//# 0 errors, 292 messages
//#

    //#JPAPingTargetManagerImpl.java:1:1: class: org.apache.roller.weblogger.business.jpa.JPAPingTargetManagerImpl
/*
 * Licensed to the Apache Software Foundation (ASF) under one or more
 *  contributor license agreements.  The ASF licenses this file to You
 * under the Apache License, Version 2.0 (the "License"); you may not
 * use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.  For additional information regarding
 * copyright in this work, please see the NOTICE file in the top level
 * directory of this distribution.
 */
package org.apache.roller.weblogger.business.jpa;

import java.net.InetAddress;
import java.net.MalformedURLException;
import java.net.URL;
import java.net.UnknownHostException;
import java.util.List;
import java.util.Iterator;
import javax.persistence.Query;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.roller.weblogger.business.jpa.JPAPersistenceStrategy;

import org.apache.roller.weblogger.WebloggerException;
import org.apache.roller.weblogger.business.Weblogger;

import org.apache.roller.weblogger.business.pings.PingTargetManager;
import org.apache.roller.weblogger.pojos.PingTarget;
import org.apache.roller.weblogger.pojos.Weblog;

/*
 * JPAPingTargetManagerImpl.java
 *
 * Created on May 29, 2006, 2:24 PM
 *
 */
@com.google.inject.Singleton
public class JPAPingTargetManagerImpl implements PingTargetManager {
    
    /** The logger instance for this class. */
    private static Log log = LogFactory.getLog(
    //#JPAPingTargetManagerImpl.java:50: method: org.apache.roller.weblogger.business.jpa.JPAPingTargetManagerImpl.org.apache.roller.weblogger.business.jpa.JPAPingTargetManagerImpl__static_init
    //#JPAPingTargetManagerImpl.java:50: Warning: method not available
    //#    -- call on Log org.apache.commons.logging.LogFactory:getLog(Class)
    //#    severity: INFORMATIONAL
    //#    class: org.apache.roller.weblogger.business.jpa.JPAPingTargetManagerImpl
    //#    method: org.apache.roller.weblogger.business.jpa.JPAPingTargetManagerImpl__static_init
    //#    unanalyzed callee: Log org.apache.commons.logging.LogFactory:getLog(Class)
    //#output(org.apache.roller.weblogger.business.jpa.JPAPingTargetManagerImpl__static_init): __Descendant_Table[org/apache/roller/weblogger/business/jpa/JPAPingTargetManagerImpl]
    //#output(org.apache.roller.weblogger.business.jpa.JPAPingTargetManagerImpl__static_init): __Dispatch_Table.getCommonPingTargets()Ljava/util/List;
    //#output(org.apache.roller.weblogger.business.jpa.JPAPingTargetManagerImpl__static_init): __Dispatch_Table.getCustomPingTargets(Lorg/apache/roller/weblogger/pojos/Weblog;)Ljava/util/List;
    //#output(org.apache.roller.weblogger.business.jpa.JPAPingTargetManagerImpl__static_init): __Dispatch_Table.getPingTarget(Ljava/lang/String;)Lorg/apache/roller/weblogger/pojos/PingTarget;
    //#output(org.apache.roller.weblogger.business.jpa.JPAPingTargetManagerImpl__static_init): __Dispatch_Table.isHostnameKnown(Lorg/apache/roller/weblogger/pojos/PingTarget;)Z
    //#output(org.apache.roller.weblogger.business.jpa.JPAPingTargetManagerImpl__static_init): __Dispatch_Table.isNameUnique(Lorg/apache/roller/weblogger/pojos/PingTarget;)Z
    //#output(org.apache.roller.weblogger.business.jpa.JPAPingTargetManagerImpl__static_init): __Dispatch_Table.isUrlWellFormed(Lorg/apache/roller/weblogger/pojos/PingTarget;)Z
    //#output(org.apache.roller.weblogger.business.jpa.JPAPingTargetManagerImpl__static_init): __Dispatch_Table.release()V
    //#output(org.apache.roller.weblogger.business.jpa.JPAPingTargetManagerImpl__static_init): __Dispatch_Table.removeAllCustomPingTargets()V
    //#output(org.apache.roller.weblogger.business.jpa.JPAPingTargetManagerImpl__static_init): __Dispatch_Table.removePingTarget(Lorg/apache/roller/weblogger/pojos/PingTarget;)V
    //#output(org.apache.roller.weblogger.business.jpa.JPAPingTargetManagerImpl__static_init): __Dispatch_Table.removePingTargetContents(Lorg/apache/roller/weblogger/pojos/PingTarget;)V
    //#output(org.apache.roller.weblogger.business.jpa.JPAPingTargetManagerImpl__static_init): __Dispatch_Table.savePingTarget(Lorg/apache/roller/weblogger/pojos/PingTarget;)V
    //#output(org.apache.roller.weblogger.business.jpa.JPAPingTargetManagerImpl__static_init): log
    //#output(org.apache.roller.weblogger.business.jpa.JPAPingTargetManagerImpl__static_init): org/apache/roller/weblogger/business/pings/PingTargetManager.__Descendant_Table[org/apache/roller/weblogger/business/jpa/JPAPingTargetManagerImpl]
    //#post(org.apache.roller.weblogger.business.jpa.JPAPingTargetManagerImpl__static_init): __Descendant_Table[org/apache/roller/weblogger/business/jpa/JPAPingTargetManagerImpl] == &__Dispatch_Table
    //#post(org.apache.roller.weblogger.business.jpa.JPAPingTargetManagerImpl__static_init): org/apache/roller/weblogger/business/pings/PingTargetManager.__Descendant_Table[org/apache/roller/weblogger/business/jpa/JPAPingTargetManagerImpl] == &__Dispatch_Table
    //#post(org.apache.roller.weblogger.business.jpa.JPAPingTargetManagerImpl__static_init): __Dispatch_Table.getCommonPingTargets()Ljava/util/List; == &getCommonPingTargets
    //#post(org.apache.roller.weblogger.business.jpa.JPAPingTargetManagerImpl__static_init): __Dispatch_Table.getCustomPingTargets(Lorg/apache/roller/weblogger/pojos/Weblog;)Ljava/util/List; == &getCustomPingTargets
    //#post(org.apache.roller.weblogger.business.jpa.JPAPingTargetManagerImpl__static_init): __Dispatch_Table.getPingTarget(Ljava/lang/String;)Lorg/apache/roller/weblogger/pojos/PingTarget; == &getPingTarget
    //#post(org.apache.roller.weblogger.business.jpa.JPAPingTargetManagerImpl__static_init): __Dispatch_Table.isHostnameKnown(Lorg/apache/roller/weblogger/pojos/PingTarget;)Z == &isHostnameKnown
    //#post(org.apache.roller.weblogger.business.jpa.JPAPingTargetManagerImpl__static_init): __Dispatch_Table.isNameUnique(Lorg/apache/roller/weblogger/pojos/PingTarget;)Z == &isNameUnique
    //#post(org.apache.roller.weblogger.business.jpa.JPAPingTargetManagerImpl__static_init): __Dispatch_Table.isUrlWellFormed(Lorg/apache/roller/weblogger/pojos/PingTarget;)Z == &isUrlWellFormed
    //#post(org.apache.roller.weblogger.business.jpa.JPAPingTargetManagerImpl__static_init): __Dispatch_Table.release()V == &release
    //#post(org.apache.roller.weblogger.business.jpa.JPAPingTargetManagerImpl__static_init): __Dispatch_Table.removeAllCustomPingTargets()V == &removeAllCustomPingTargets
    //#post(org.apache.roller.weblogger.business.jpa.JPAPingTargetManagerImpl__static_init): __Dispatch_Table.removePingTarget(Lorg/apache/roller/weblogger/pojos/PingTarget;)V == &removePingTarget
    //#post(org.apache.roller.weblogger.business.jpa.JPAPingTargetManagerImpl__static_init): __Dispatch_Table.removePingTargetContents(Lorg/apache/roller/weblogger/pojos/PingTarget;)V == &removePingTargetContents
    //#post(org.apache.roller.weblogger.business.jpa.JPAPingTargetManagerImpl__static_init): __Dispatch_Table.savePingTarget(Lorg/apache/roller/weblogger/pojos/PingTarget;)V == &savePingTarget
    //#post(org.apache.roller.weblogger.business.jpa.JPAPingTargetManagerImpl__static_init): init'ed(log)
    //#JPAPingTargetManagerImpl.java:50: end of method: org.apache.roller.weblogger.business.jpa.JPAPingTargetManagerImpl.org.apache.roller.weblogger.business.jpa.JPAPingTargetManagerImpl__static_init
        JPAPingTargetManagerImpl.class);

    private final Weblogger roller;
    private final JPAPersistenceStrategy strategy;
    
    
    @com.google.inject.Inject
    protected JPAPingTargetManagerImpl(Weblogger roller, JPAPersistenceStrategy strategy) {
    //#JPAPingTargetManagerImpl.java:58: method: void org.apache.roller.weblogger.business.jpa.JPAPingTargetManagerImpl.org.apache.roller.weblogger.business.jpa.JPAPingTargetManagerImpl(Weblogger, JPAPersistenceStrategy)
    //#input(void org.apache.roller.weblogger.business.jpa.JPAPingTargetManagerImpl(Weblogger, JPAPersistenceStrategy)): roller
    //#input(void org.apache.roller.weblogger.business.jpa.JPAPingTargetManagerImpl(Weblogger, JPAPersistenceStrategy)): strategy
    //#input(void org.apache.roller.weblogger.business.jpa.JPAPingTargetManagerImpl(Weblogger, JPAPersistenceStrategy)): this
    //#output(void org.apache.roller.weblogger.business.jpa.JPAPingTargetManagerImpl(Weblogger, JPAPersistenceStrategy)): this.roller
    //#output(void org.apache.roller.weblogger.business.jpa.JPAPingTargetManagerImpl(Weblogger, JPAPersistenceStrategy)): this.strategy
    //#post(void org.apache.roller.weblogger.business.jpa.JPAPingTargetManagerImpl(Weblogger, JPAPersistenceStrategy)): this.roller == roller
    //#post(void org.apache.roller.weblogger.business.jpa.JPAPingTargetManagerImpl(Weblogger, JPAPersistenceStrategy)): init'ed(this.roller)
    //#post(void org.apache.roller.weblogger.business.jpa.JPAPingTargetManagerImpl(Weblogger, JPAPersistenceStrategy)): this.strategy == strategy
    //#post(void org.apache.roller.weblogger.business.jpa.JPAPingTargetManagerImpl(Weblogger, JPAPersistenceStrategy)): init'ed(this.strategy)
        this.roller = roller;
        this.strategy = strategy;
    }
    //#JPAPingTargetManagerImpl.java:61: end of method: void org.apache.roller.weblogger.business.jpa.JPAPingTargetManagerImpl.org.apache.roller.weblogger.business.jpa.JPAPingTargetManagerImpl(Weblogger, JPAPersistenceStrategy)

    
    public void removePingTarget(PingTarget pingTarget) 
            throws WebloggerException {
        // remove contents and then target
        this.removePingTargetContents(pingTarget);
    //#JPAPingTargetManagerImpl.java:67: method: void org.apache.roller.weblogger.business.jpa.JPAPingTargetManagerImpl.removePingTarget(PingTarget)
    //#input(void removePingTarget(PingTarget)): org/apache/roller/weblogger/business/jpa/JPAPersistenceStrategy.__Descendant_Table[org/apache/roller/weblogger/business/jpa/JPAPersistenceStrategy]
    //#input(void removePingTarget(PingTarget)): org/apache/roller/weblogger/business/jpa/JPAPersistenceStrategy.__Descendant_Table[others]
    //#input(void removePingTarget(PingTarget)): org/apache/roller/weblogger/business/jpa/JPAPersistenceStrategy.__Dispatch_Table.getNamedUpdate(Ljava/lang/String;)Ljavax/persistence/Query;
    //#input(void removePingTarget(PingTarget)): org/apache/roller/weblogger/business/jpa/JPAPersistenceStrategy.__Dispatch_Table.remove(Ljava/lang/Object;)V
    //#input(void removePingTarget(PingTarget)): pingTarget
    //#input(void removePingTarget(PingTarget)): this
    //#input(void removePingTarget(PingTarget)): this.strategy
    //#input(void removePingTarget(PingTarget)): this.strategy.__Tag
    //#input(void removePingTarget(PingTarget)): this.strategy.emf
    //#input(void removePingTarget(PingTarget)): this.strategy.threadLocalEntityManager
    //#pre[3] (void removePingTarget(PingTarget)): this.strategy != null
    //#pre[4] (void removePingTarget(PingTarget)): this.strategy.__Tag == org/apache/roller/weblogger/business/jpa/JPAPersistenceStrategy
    //#pre[6] (void removePingTarget(PingTarget)): this.strategy.threadLocalEntityManager != null
    //#pre[5] (void removePingTarget(PingTarget)): (soft) this.strategy.emf != null
    //#unanalyzed(void removePingTarget(PingTarget)): Effects-of-calling:java.lang.ThreadLocal:get
    //#unanalyzed(void removePingTarget(PingTarget)): Effects-of-calling:javax.persistence.EntityManagerFactory:createEntityManager
    //#unanalyzed(void removePingTarget(PingTarget)): Effects-of-calling:java.lang.ThreadLocal:set
    //#unanalyzed(void removePingTarget(PingTarget)): Effects-of-calling:javax.persistence.EntityManager:getTransaction
    //#unanalyzed(void removePingTarget(PingTarget)): Effects-of-calling:javax.persistence.EntityTransaction:isActive
    //#unanalyzed(void removePingTarget(PingTarget)): Effects-of-calling:javax.persistence.EntityTransaction:begin
    //#unanalyzed(void removePingTarget(PingTarget)): Effects-of-calling:javax.persistence.EntityManager:createNamedQuery
    //#unanalyzed(void removePingTarget(PingTarget)): Effects-of-calling:javax.persistence.Query:setParameter
    //#unanalyzed(void removePingTarget(PingTarget)): Effects-of-calling:javax.persistence.Query:executeUpdate
    //#unanalyzed(void removePingTarget(PingTarget)): Effects-of-calling:javax.persistence.EntityManager:remove
        this.strategy.remove(pingTarget);
    }
    //#JPAPingTargetManagerImpl.java:69: end of method: void org.apache.roller.weblogger.business.jpa.JPAPingTargetManagerImpl.removePingTarget(PingTarget)

    /**
     * Convenience method which removes any queued pings or auto pings that
     * reference the given ping target.
     */
    private void removePingTargetContents(PingTarget ping) 
            throws WebloggerException {
        // Remove the website's ping queue entries
        Query q = strategy.getNamedUpdate("PingQueueEntry.removeByPingTarget");
    //#JPAPingTargetManagerImpl.java:78: method: void org.apache.roller.weblogger.business.jpa.JPAPingTargetManagerImpl.removePingTargetContents(PingTarget)
    //#input(void removePingTargetContents(PingTarget)): org/apache/roller/weblogger/business/jpa/JPAPersistenceStrategy.__Descendant_Table[org/apache/roller/weblogger/business/jpa/JPAPersistenceStrategy]
    //#input(void removePingTargetContents(PingTarget)): org/apache/roller/weblogger/business/jpa/JPAPersistenceStrategy.__Descendant_Table[others]
    //#input(void removePingTargetContents(PingTarget)): org/apache/roller/weblogger/business/jpa/JPAPersistenceStrategy.__Dispatch_Table.getNamedUpdate(Ljava/lang/String;)Ljavax/persistence/Query;
    //#input(void removePingTargetContents(PingTarget)): ping
    //#input(void removePingTargetContents(PingTarget)): this
    //#input(void removePingTargetContents(PingTarget)): this.strategy
    //#input(void removePingTargetContents(PingTarget)): this.strategy.__Tag
    //#input(void removePingTargetContents(PingTarget)): this.strategy.emf
    //#input(void removePingTargetContents(PingTarget)): this.strategy.threadLocalEntityManager
    //#pre[3] (void removePingTargetContents(PingTarget)): this.strategy != null
    //#pre[4] (void removePingTargetContents(PingTarget)): this.strategy.__Tag == org/apache/roller/weblogger/business/jpa/JPAPersistenceStrategy
    //#pre[6] (void removePingTargetContents(PingTarget)): this.strategy.threadLocalEntityManager != null
    //#pre[5] (void removePingTargetContents(PingTarget)): (soft) this.strategy.emf != null
    //#presumption(void removePingTargetContents(PingTarget)): javax.persistence.EntityManager:createNamedQuery(...)@301 != null
    //#presumption(void removePingTargetContents(PingTarget)): javax.persistence.EntityManager:createNamedQuery(...)@301 != null
    //#unanalyzed(void removePingTargetContents(PingTarget)): Effects-of-calling:java.lang.ThreadLocal:get
    //#unanalyzed(void removePingTargetContents(PingTarget)): Effects-of-calling:javax.persistence.EntityManagerFactory:createEntityManager
    //#unanalyzed(void removePingTargetContents(PingTarget)): Effects-of-calling:java.lang.ThreadLocal:set
    //#unanalyzed(void removePingTargetContents(PingTarget)): Effects-of-calling:javax.persistence.EntityManager:getTransaction
    //#unanalyzed(void removePingTargetContents(PingTarget)): Effects-of-calling:javax.persistence.EntityTransaction:isActive
    //#unanalyzed(void removePingTargetContents(PingTarget)): Effects-of-calling:javax.persistence.EntityTransaction:begin
    //#unanalyzed(void removePingTargetContents(PingTarget)): Effects-of-calling:javax.persistence.EntityManager:createNamedQuery
        q.setParameter(1, ping);
        q.executeUpdate();
        
        // Remove the website's auto ping configurations
        q = strategy.getNamedUpdate("AutoPing.removeByPingTarget");
        q.setParameter(1, ping);
        q.executeUpdate();
    }
    //#JPAPingTargetManagerImpl.java:86: end of method: void org.apache.roller.weblogger.business.jpa.JPAPingTargetManagerImpl.removePingTargetContents(PingTarget)

    public void removeAllCustomPingTargets()
            throws WebloggerException {
        Query q = strategy.getNamedUpdate(
    //#JPAPingTargetManagerImpl.java:90: method: void org.apache.roller.weblogger.business.jpa.JPAPingTargetManagerImpl.removeAllCustomPingTargets()
    //#input(void removeAllCustomPingTargets()): org/apache/roller/weblogger/business/jpa/JPAPersistenceStrategy.__Descendant_Table[org/apache/roller/weblogger/business/jpa/JPAPersistenceStrategy]
    //#input(void removeAllCustomPingTargets()): org/apache/roller/weblogger/business/jpa/JPAPersistenceStrategy.__Descendant_Table[others]
    //#input(void removeAllCustomPingTargets()): org/apache/roller/weblogger/business/jpa/JPAPersistenceStrategy.__Dispatch_Table.getNamedUpdate(Ljava/lang/String;)Ljavax/persistence/Query;
    //#input(void removeAllCustomPingTargets()): this
    //#input(void removeAllCustomPingTargets()): this.strategy
    //#input(void removeAllCustomPingTargets()): this.strategy.__Tag
    //#input(void removeAllCustomPingTargets()): this.strategy.emf
    //#input(void removeAllCustomPingTargets()): this.strategy.threadLocalEntityManager
    //#pre[2] (void removeAllCustomPingTargets()): this.strategy != null
    //#pre[3] (void removeAllCustomPingTargets()): this.strategy.__Tag == org/apache/roller/weblogger/business/jpa/JPAPersistenceStrategy
    //#pre[5] (void removeAllCustomPingTargets()): this.strategy.threadLocalEntityManager != null
    //#pre[4] (void removeAllCustomPingTargets()): (soft) this.strategy.emf != null
    //#presumption(void removeAllCustomPingTargets()): javax.persistence.EntityManager:createNamedQuery(...)@301 != null
    //#unanalyzed(void removeAllCustomPingTargets()): Effects-of-calling:java.lang.ThreadLocal:get
    //#unanalyzed(void removeAllCustomPingTargets()): Effects-of-calling:javax.persistence.EntityManagerFactory:createEntityManager
    //#unanalyzed(void removeAllCustomPingTargets()): Effects-of-calling:java.lang.ThreadLocal:set
    //#unanalyzed(void removeAllCustomPingTargets()): Effects-of-calling:javax.persistence.EntityManager:getTransaction
    //#unanalyzed(void removeAllCustomPingTargets()): Effects-of-calling:javax.persistence.EntityTransaction:isActive
    //#unanalyzed(void removeAllCustomPingTargets()): Effects-of-calling:javax.persistence.EntityTransaction:begin
    //#unanalyzed(void removeAllCustomPingTargets()): Effects-of-calling:javax.persistence.EntityManager:createNamedQuery
            "PingTarget.removeByWebsiteNotNull");
        q.executeUpdate();
    }
    //#JPAPingTargetManagerImpl.java:93: end of method: void org.apache.roller.weblogger.business.jpa.JPAPingTargetManagerImpl.removeAllCustomPingTargets()

    public void savePingTarget(PingTarget pingTarget)
            throws WebloggerException {
        strategy.store(pingTarget);
    //#JPAPingTargetManagerImpl.java:97: method: void org.apache.roller.weblogger.business.jpa.JPAPingTargetManagerImpl.savePingTarget(PingTarget)
    //#input(void savePingTarget(PingTarget)): org/apache/roller/weblogger/business/jpa/JPAPersistenceStrategy.__Descendant_Table[org/apache/roller/weblogger/business/jpa/JPAPersistenceStrategy]
    //#input(void savePingTarget(PingTarget)): org/apache/roller/weblogger/business/jpa/JPAPersistenceStrategy.__Descendant_Table[others]
    //#input(void savePingTarget(PingTarget)): org/apache/roller/weblogger/business/jpa/JPAPersistenceStrategy.__Dispatch_Table.store(Ljava/lang/Object;)Ljava/lang/Object;
    //#input(void savePingTarget(PingTarget)): pingTarget
    //#input(void savePingTarget(PingTarget)): this
    //#input(void savePingTarget(PingTarget)): this.strategy
    //#input(void savePingTarget(PingTarget)): this.strategy.__Tag
    //#input(void savePingTarget(PingTarget)): this.strategy.emf
    //#input(void savePingTarget(PingTarget)): this.strategy.threadLocalEntityManager
    //#pre[3] (void savePingTarget(PingTarget)): this.strategy != null
    //#pre[4] (void savePingTarget(PingTarget)): this.strategy.__Tag == org/apache/roller/weblogger/business/jpa/JPAPersistenceStrategy
    //#pre[6] (void savePingTarget(PingTarget)): this.strategy.threadLocalEntityManager != null
    //#pre[5] (void savePingTarget(PingTarget)): (soft) this.strategy.emf != null
    //#unanalyzed(void savePingTarget(PingTarget)): Effects-of-calling:java.lang.ThreadLocal:get
    //#unanalyzed(void savePingTarget(PingTarget)): Effects-of-calling:javax.persistence.EntityManagerFactory:createEntityManager
    //#unanalyzed(void savePingTarget(PingTarget)): Effects-of-calling:java.lang.ThreadLocal:set
    //#unanalyzed(void savePingTarget(PingTarget)): Effects-of-calling:javax.persistence.EntityManager:getTransaction
    //#unanalyzed(void savePingTarget(PingTarget)): Effects-of-calling:javax.persistence.EntityTransaction:isActive
    //#unanalyzed(void savePingTarget(PingTarget)): Effects-of-calling:javax.persistence.EntityTransaction:begin
    //#unanalyzed(void savePingTarget(PingTarget)): Effects-of-calling:javax.persistence.EntityManager:contains
    //#unanalyzed(void savePingTarget(PingTarget)): Effects-of-calling:javax.persistence.EntityManager:persist
    }
    //#JPAPingTargetManagerImpl.java:98: end of method: void org.apache.roller.weblogger.business.jpa.JPAPingTargetManagerImpl.savePingTarget(PingTarget)

    public PingTarget getPingTarget(String id)
            throws WebloggerException {
        return (PingTarget)strategy.load(PingTarget.class, id);
    //#JPAPingTargetManagerImpl.java:102: method: PingTarget org.apache.roller.weblogger.business.jpa.JPAPingTargetManagerImpl.getPingTarget(String)
    //#input(PingTarget getPingTarget(String)): id
    //#input(PingTarget getPingTarget(String)): org/apache/roller/weblogger/business/jpa/JPAPersistenceStrategy.__Descendant_Table[org/apache/roller/weblogger/business/jpa/JPAPersistenceStrategy]
    //#input(PingTarget getPingTarget(String)): org/apache/roller/weblogger/business/jpa/JPAPersistenceStrategy.__Descendant_Table[others]
    //#input(PingTarget getPingTarget(String)): org/apache/roller/weblogger/business/jpa/JPAPersistenceStrategy.__Dispatch_Table.load(Ljava/lang/Class;Ljava/lang/String;)Ljava/lang/Object;
    //#input(PingTarget getPingTarget(String)): this
    //#input(PingTarget getPingTarget(String)): this.strategy
    //#input(PingTarget getPingTarget(String)): this.strategy.__Tag
    //#input(PingTarget getPingTarget(String)): this.strategy.emf
    //#input(PingTarget getPingTarget(String)): this.strategy.threadLocalEntityManager
    //#output(PingTarget getPingTarget(String)): return_value
    //#pre[3] (PingTarget getPingTarget(String)): this.strategy != null
    //#pre[4] (PingTarget getPingTarget(String)): this.strategy.__Tag == org/apache/roller/weblogger/business/jpa/JPAPersistenceStrategy
    //#pre[6] (PingTarget getPingTarget(String)): this.strategy.threadLocalEntityManager != null
    //#pre[5] (PingTarget getPingTarget(String)): (soft) this.strategy.emf != null
    //#post(PingTarget getPingTarget(String)): init'ed(return_value)
    //#unanalyzed(PingTarget getPingTarget(String)): Effects-of-calling:java.lang.ThreadLocal:get
    //#unanalyzed(PingTarget getPingTarget(String)): Effects-of-calling:javax.persistence.EntityManagerFactory:createEntityManager
    //#unanalyzed(PingTarget getPingTarget(String)): Effects-of-calling:java.lang.ThreadLocal:set
    //#unanalyzed(PingTarget getPingTarget(String)): Effects-of-calling:javax.persistence.EntityManager:getTransaction
    //#unanalyzed(PingTarget getPingTarget(String)): Effects-of-calling:javax.persistence.EntityTransaction:isActive
    //#unanalyzed(PingTarget getPingTarget(String)): Effects-of-calling:javax.persistence.EntityTransaction:begin
    //#unanalyzed(PingTarget getPingTarget(String)): Effects-of-calling:javax.persistence.EntityManager:find
    //#JPAPingTargetManagerImpl.java:102: end of method: PingTarget org.apache.roller.weblogger.business.jpa.JPAPingTargetManagerImpl.getPingTarget(String)
    }

    public boolean isNameUnique(PingTarget pingTarget) 
            throws WebloggerException {
        String name = pingTarget.getName();
    //#JPAPingTargetManagerImpl.java:107: method: bool org.apache.roller.weblogger.business.jpa.JPAPingTargetManagerImpl.isNameUnique(PingTarget)
    //#JPAPingTargetManagerImpl.java:107: Warning: method not available
    //#    -- call on String org.apache.roller.weblogger.pojos.PingTarget:getName()
    //#    severity: INFORMATIONAL
    //#    class: org.apache.roller.weblogger.business.jpa.JPAPingTargetManagerImpl
    //#    method: bool isNameUnique(PingTarget)
    //#    unanalyzed callee: String org.apache.roller.weblogger.pojos.PingTarget:getName()
    //#input(bool isNameUnique(PingTarget)): __Descendant_Table[org/apache/roller/weblogger/business/jpa/JPAPingTargetManagerImpl]
    //#input(bool isNameUnique(PingTarget)): __Descendant_Table[others]
    //#input(bool isNameUnique(PingTarget)): __Dispatch_Table.getCommonPingTargets()Ljava/util/List;
    //#input(bool isNameUnique(PingTarget)): __Dispatch_Table.getCustomPingTargets(Lorg/apache/roller/weblogger/pojos/Weblog;)Ljava/util/List;
    //#input(bool isNameUnique(PingTarget)): org/apache/roller/weblogger/business/jpa/JPAPersistenceStrategy.__Descendant_Table[org/apache/roller/weblogger/business/jpa/JPAPersistenceStrategy]
    //#input(bool isNameUnique(PingTarget)): org/apache/roller/weblogger/business/jpa/JPAPersistenceStrategy.__Descendant_Table[others]
    //#input(bool isNameUnique(PingTarget)): org/apache/roller/weblogger/business/jpa/JPAPersistenceStrategy.__Dispatch_Table.getNamedQuery(Ljava/lang/String;)Ljavax/persistence/Query;
    //#input(bool isNameUnique(PingTarget)): org/apache/roller/weblogger/business/jpa/JPAPersistenceStrategy.javax.persistence.FlushModeType.COMMIT
    //#input(bool isNameUnique(PingTarget)): pingTarget
    //#input(bool isNameUnique(PingTarget)): this
    //#input(bool isNameUnique(PingTarget)): this.__Tag
    //#input(bool isNameUnique(PingTarget)): this.strategy
    //#input(bool isNameUnique(PingTarget)): this.strategy.__Tag
    //#input(bool isNameUnique(PingTarget)): this.strategy.emf
    //#input(bool isNameUnique(PingTarget)): this.strategy.threadLocalEntityManager
    //#output(bool isNameUnique(PingTarget)): return_value
    //#pre[1] (bool isNameUnique(PingTarget)): pingTarget != null
    //#pre[3] (bool isNameUnique(PingTarget)): (soft) this.__Tag == org/apache/roller/weblogger/business/jpa/JPAPingTargetManagerImpl
    //#pre[4] (bool isNameUnique(PingTarget)): (soft) this.strategy != null
    //#pre[5] (bool isNameUnique(PingTarget)): (soft) this.strategy.__Tag == org/apache/roller/weblogger/business/jpa/JPAPersistenceStrategy
    //#pre[6] (bool isNameUnique(PingTarget)): (soft) this.strategy.emf != null
    //#pre[7] (bool isNameUnique(PingTarget)): (soft) this.strategy.threadLocalEntityManager != null
    //#presumption(bool isNameUnique(PingTarget)): java.util.Iterator:next(...)@126 != null
    //#presumption(bool isNameUnique(PingTarget)): javax.persistence.Query:getResultList(...)@177 != null
    //#presumption(bool isNameUnique(PingTarget)): javax.persistence.Query:getResultList(...)@185 != null
    //#presumption(bool isNameUnique(PingTarget)): org.apache.roller.weblogger.pojos.PingTarget:getId(...)@128 != null
    //#presumption(bool isNameUnique(PingTarget)): org.apache.roller.weblogger.pojos.PingTarget:getName(...)@128 != null
    //#post(bool isNameUnique(PingTarget)): init'ed(return_value)
    //#unanalyzed(bool isNameUnique(PingTarget)): Effects-of-calling:java.lang.ThreadLocal:get
    //#unanalyzed(bool isNameUnique(PingTarget)): Effects-of-calling:javax.persistence.EntityManagerFactory:createEntityManager
    //#unanalyzed(bool isNameUnique(PingTarget)): Effects-of-calling:java.lang.ThreadLocal:set
    //#unanalyzed(bool isNameUnique(PingTarget)): Effects-of-calling:javax.persistence.EntityManager:getTransaction
    //#unanalyzed(bool isNameUnique(PingTarget)): Effects-of-calling:javax.persistence.EntityTransaction:isActive
    //#unanalyzed(bool isNameUnique(PingTarget)): Effects-of-calling:javax.persistence.EntityTransaction:begin
    //#unanalyzed(bool isNameUnique(PingTarget)): Effects-of-calling:javax.persistence.EntityManager:createNamedQuery
    //#unanalyzed(bool isNameUnique(PingTarget)): Effects-of-calling:javax.persistence.Query:setFlushMode
    //#unanalyzed(bool isNameUnique(PingTarget)): Effects-of-calling:javax.persistence.Query:setParameter
    //#unanalyzed(bool isNameUnique(PingTarget)): Effects-of-calling:javax.persistence.Query:getResultList
    //#test_vector(bool isNameUnique(PingTarget)): java.lang.String:equals(...)@128: {0}, {1}
    //#test_vector(bool isNameUnique(PingTarget)): java.lang.String:equals(...)@128: {1}, {0}
    //#test_vector(bool isNameUnique(PingTarget)): java.lang.String:length(...)@108: {1..4_294_967_295}, {0}
    //#test_vector(bool isNameUnique(PingTarget)): java.util.Iterator:hasNext(...)@125: {0}, {1}
    //#test_vector(bool isNameUnique(PingTarget)): org.apache.roller.weblogger.pojos.PingTarget:getId(...)@110: Addr_Set{null}, Inverse{null}
    //#test_vector(bool isNameUnique(PingTarget)): org.apache.roller.weblogger.pojos.PingTarget:getName(...)@107: Addr_Set{null}, Inverse{null}
    //#test_vector(bool isNameUnique(PingTarget)): org.apache.roller.weblogger.pojos.PingTarget:getWebsite(...)@115: Inverse{null}, Addr_Set{null}
        if (name == null || name.trim().length() == 0) return false;
        
        String id = pingTarget.getId();
    //#JPAPingTargetManagerImpl.java:110: Warning: method not available
    //#    -- call on String org.apache.roller.weblogger.pojos.PingTarget:getId()
    //#    severity: INFORMATIONAL
    //#    class: org.apache.roller.weblogger.business.jpa.JPAPingTargetManagerImpl
    //#    method: bool isNameUnique(PingTarget)
    //#    unanalyzed callee: String org.apache.roller.weblogger.pojos.PingTarget:getId()
        
        // Determine the set of "brother" targets (custom or common) 
        // among which this name should be unique.
        List brotherTargets = null;
    //#JPAPingTargetManagerImpl.java:114: Warning: unused assignment
    //#    unused assignment into brotherTargets
    //#    severity: SUPPRESSED
    //#    class: org.apache.roller.weblogger.business.jpa.JPAPingTargetManagerImpl
    //#    method: bool isNameUnique(PingTarget)
    //#    Attribs:  Uncertain
        Weblog website = pingTarget.getWebsite();
    //#JPAPingTargetManagerImpl.java:115: Warning: method not available
    //#    -- call on Weblog org.apache.roller.weblogger.pojos.PingTarget:getWebsite()
    //#    severity: INFORMATIONAL
    //#    class: org.apache.roller.weblogger.business.jpa.JPAPingTargetManagerImpl
    //#    method: bool isNameUnique(PingTarget)
    //#    unanalyzed callee: Weblog org.apache.roller.weblogger.pojos.PingTarget:getWebsite()
        if (website == null) {
            brotherTargets = getCommonPingTargets();
        } else {
            brotherTargets = getCustomPingTargets(website);
        }
        
        // Within that set of targets, fail if there is a target 
        // with the same name and that target doesn't
        // have the same id.
        for (Iterator i = brotherTargets.iterator(); i.hasNext();) {
            PingTarget brother = (PingTarget) i.next();
            // Fail if it has the same name but not the same id.
            if (brother.getName().equals(name) && 
    //#JPAPingTargetManagerImpl.java:128: Warning: method not available
    //#    -- call on String org.apache.roller.weblogger.pojos.PingTarget:getName()
    //#    severity: INFORMATIONAL
    //#    class: org.apache.roller.weblogger.business.jpa.JPAPingTargetManagerImpl
    //#    method: bool isNameUnique(PingTarget)
    //#    unanalyzed callee: String org.apache.roller.weblogger.pojos.PingTarget:getName()
    //#JPAPingTargetManagerImpl.java:128: Warning: method not available
    //#    -- call on String org.apache.roller.weblogger.pojos.PingTarget:getId()
    //#    severity: INFORMATIONAL
    //#    class: org.apache.roller.weblogger.business.jpa.JPAPingTargetManagerImpl
    //#    method: bool isNameUnique(PingTarget)
    //#    unanalyzed callee: String org.apache.roller.weblogger.pojos.PingTarget:getId()
                (id == null || !brother.getId().equals(id))) {
                return false;
            }
        }
        // No conflict found
        return true;
    //#JPAPingTargetManagerImpl.java:134: end of method: bool org.apache.roller.weblogger.business.jpa.JPAPingTargetManagerImpl.isNameUnique(PingTarget)
    }

    
    public boolean isUrlWellFormed(PingTarget pingTarget) 
            throws WebloggerException {
        String url = pingTarget.getPingUrl();
    //#JPAPingTargetManagerImpl.java:140: method: bool org.apache.roller.weblogger.business.jpa.JPAPingTargetManagerImpl.isUrlWellFormed(PingTarget)
    //#JPAPingTargetManagerImpl.java:140: Warning: method not available
    //#    -- call on String org.apache.roller.weblogger.pojos.PingTarget:getPingUrl()
    //#    severity: INFORMATIONAL
    //#    class: org.apache.roller.weblogger.business.jpa.JPAPingTargetManagerImpl
    //#    method: bool isUrlWellFormed(PingTarget)
    //#    unanalyzed callee: String org.apache.roller.weblogger.pojos.PingTarget:getPingUrl()
    //#input(bool isUrlWellFormed(PingTarget)): pingTarget
    //#output(bool isUrlWellFormed(PingTarget)): return_value
    //#pre[1] (bool isUrlWellFormed(PingTarget)): pingTarget != null
    //#presumption(bool isUrlWellFormed(PingTarget)): java.net.URL:getHost(...)@147 != null
    //#presumption(bool isUrlWellFormed(PingTarget)): java.net.URL:getProtocol(...)@146 != null
    //#post(bool isUrlWellFormed(PingTarget)): init'ed(return_value)
    //#test_vector(bool isUrlWellFormed(PingTarget)): java.lang.String:length(...)@141: {1..4_294_967_295}, {0}
    //#test_vector(bool isUrlWellFormed(PingTarget)): org.apache.roller.weblogger.pojos.PingTarget:getPingUrl(...)@140: Addr_Set{null}, Inverse{null}
        if (url == null || url.trim().length() == 0) return false;
        try {
            URL parsedUrl = new URL(url);
            // OK.  If we get here, it parses ok.  Now just check 
            // that the protocol is http and there is a host portion.
            boolean isHttp = parsedUrl.getProtocol().equals("http");
            boolean hasHost = (parsedUrl.getHost() != null) && 
                (parsedUrl.getHost().trim().length() > 0);
            return isHttp && hasHost;
        } catch (MalformedURLException e) {
            return false;
    //#JPAPingTargetManagerImpl.java:151: end of method: bool org.apache.roller.weblogger.business.jpa.JPAPingTargetManagerImpl.isUrlWellFormed(PingTarget)
        }
    }

    
    public boolean isHostnameKnown(PingTarget pingTarget) 
            throws WebloggerException {
        String url = pingTarget.getPingUrl();
    //#JPAPingTargetManagerImpl.java:158: method: bool org.apache.roller.weblogger.business.jpa.JPAPingTargetManagerImpl.isHostnameKnown(PingTarget)
    //#JPAPingTargetManagerImpl.java:158: Warning: method not available
    //#    -- call on String org.apache.roller.weblogger.pojos.PingTarget:getPingUrl()
    //#    severity: INFORMATIONAL
    //#    class: org.apache.roller.weblogger.business.jpa.JPAPingTargetManagerImpl
    //#    method: bool isHostnameKnown(PingTarget)
    //#    unanalyzed callee: String org.apache.roller.weblogger.pojos.PingTarget:getPingUrl()
    //#input(bool isHostnameKnown(PingTarget)): pingTarget
    //#output(bool isHostnameKnown(PingTarget)): return_value
    //#pre[1] (bool isHostnameKnown(PingTarget)): pingTarget != null
    //#post(bool isHostnameKnown(PingTarget)): init'ed(return_value)
    //#test_vector(bool isHostnameKnown(PingTarget)): java.lang.String:length(...)@159: {1..4_294_967_295}, {0}
    //#test_vector(bool isHostnameKnown(PingTarget)): java.lang.String:length(...)@163: {1..4_294_967_295}, {0}
    //#test_vector(bool isHostnameKnown(PingTarget)): java.net.URL:getHost(...)@162: Addr_Set{null}, Inverse{null}
    //#test_vector(bool isHostnameKnown(PingTarget)): org.apache.roller.weblogger.pojos.PingTarget:getPingUrl(...)@158: Addr_Set{null}, Inverse{null}
        if (url == null || url.trim().length() == 0) return false;
        try {
            URL parsedUrl = new URL(url);
            String host = parsedUrl.getHost();
            if (host == null || host.trim().length() == 0) return false;
            InetAddress addr = InetAddress.getByName(host);
    //#JPAPingTargetManagerImpl.java:164: Warning: unused assignment
    //#    unused assignment into addr
    //#    severity: LOW
    //#    class: org.apache.roller.weblogger.business.jpa.JPAPingTargetManagerImpl
    //#    method: bool isHostnameKnown(PingTarget)
            return true;
        } catch (MalformedURLException e) {
            return false;
        } catch (UnknownHostException e) {
            return false;
    //#JPAPingTargetManagerImpl.java:169: end of method: bool org.apache.roller.weblogger.business.jpa.JPAPingTargetManagerImpl.isHostnameKnown(PingTarget)
        }
    }

    public List getCommonPingTargets()
            throws WebloggerException {
        Query q = strategy.getNamedQuery(
    //#JPAPingTargetManagerImpl.java:175: method: List org.apache.roller.weblogger.business.jpa.JPAPingTargetManagerImpl.getCommonPingTargets()
    //#input(List getCommonPingTargets()): org/apache/roller/weblogger/business/jpa/JPAPersistenceStrategy.__Descendant_Table[org/apache/roller/weblogger/business/jpa/JPAPersistenceStrategy]
    //#input(List getCommonPingTargets()): org/apache/roller/weblogger/business/jpa/JPAPersistenceStrategy.__Descendant_Table[others]
    //#input(List getCommonPingTargets()): org/apache/roller/weblogger/business/jpa/JPAPersistenceStrategy.__Dispatch_Table.getNamedQuery(Ljava/lang/String;)Ljavax/persistence/Query;
    //#input(List getCommonPingTargets()): org/apache/roller/weblogger/business/jpa/JPAPersistenceStrategy.javax.persistence.FlushModeType.COMMIT
    //#input(List getCommonPingTargets()): this
    //#input(List getCommonPingTargets()): this.strategy
    //#input(List getCommonPingTargets()): this.strategy.__Tag
    //#input(List getCommonPingTargets()): this.strategy.emf
    //#input(List getCommonPingTargets()): this.strategy.threadLocalEntityManager
    //#output(List getCommonPingTargets()): return_value
    //#pre[2] (List getCommonPingTargets()): this.strategy != null
    //#pre[3] (List getCommonPingTargets()): this.strategy.__Tag == org/apache/roller/weblogger/business/jpa/JPAPersistenceStrategy
    //#pre[5] (List getCommonPingTargets()): this.strategy.threadLocalEntityManager != null
    //#pre[4] (List getCommonPingTargets()): (soft) this.strategy.emf != null
    //#post(List getCommonPingTargets()): init'ed(return_value)
    //#unanalyzed(List getCommonPingTargets()): Effects-of-calling:java.lang.ThreadLocal:get
    //#unanalyzed(List getCommonPingTargets()): Effects-of-calling:javax.persistence.EntityManagerFactory:createEntityManager
    //#unanalyzed(List getCommonPingTargets()): Effects-of-calling:java.lang.ThreadLocal:set
    //#unanalyzed(List getCommonPingTargets()): Effects-of-calling:javax.persistence.EntityManager:getTransaction
    //#unanalyzed(List getCommonPingTargets()): Effects-of-calling:javax.persistence.EntityTransaction:isActive
    //#unanalyzed(List getCommonPingTargets()): Effects-of-calling:javax.persistence.EntityTransaction:begin
    //#unanalyzed(List getCommonPingTargets()): Effects-of-calling:javax.persistence.EntityManager:createNamedQuery
    //#unanalyzed(List getCommonPingTargets()): Effects-of-calling:javax.persistence.Query:setFlushMode
                "PingTarget.getByWebsiteNullOrderByName");
        return q.getResultList();
    //#JPAPingTargetManagerImpl.java:177: end of method: List org.apache.roller.weblogger.business.jpa.JPAPingTargetManagerImpl.getCommonPingTargets()
    }

    public List getCustomPingTargets(Weblog website)
            throws WebloggerException {
        Query q = strategy.getNamedQuery(
    //#JPAPingTargetManagerImpl.java:182: method: List org.apache.roller.weblogger.business.jpa.JPAPingTargetManagerImpl.getCustomPingTargets(Weblog)
    //#input(List getCustomPingTargets(Weblog)): org/apache/roller/weblogger/business/jpa/JPAPersistenceStrategy.__Descendant_Table[org/apache/roller/weblogger/business/jpa/JPAPersistenceStrategy]
    //#input(List getCustomPingTargets(Weblog)): org/apache/roller/weblogger/business/jpa/JPAPersistenceStrategy.__Descendant_Table[others]
    //#input(List getCustomPingTargets(Weblog)): org/apache/roller/weblogger/business/jpa/JPAPersistenceStrategy.__Dispatch_Table.getNamedQuery(Ljava/lang/String;)Ljavax/persistence/Query;
    //#input(List getCustomPingTargets(Weblog)): org/apache/roller/weblogger/business/jpa/JPAPersistenceStrategy.javax.persistence.FlushModeType.COMMIT
    //#input(List getCustomPingTargets(Weblog)): this
    //#input(List getCustomPingTargets(Weblog)): this.strategy
    //#input(List getCustomPingTargets(Weblog)): this.strategy.__Tag
    //#input(List getCustomPingTargets(Weblog)): this.strategy.emf
    //#input(List getCustomPingTargets(Weblog)): this.strategy.threadLocalEntityManager
    //#input(List getCustomPingTargets(Weblog)): website
    //#output(List getCustomPingTargets(Weblog)): return_value
    //#pre[2] (List getCustomPingTargets(Weblog)): this.strategy != null
    //#pre[3] (List getCustomPingTargets(Weblog)): this.strategy.__Tag == org/apache/roller/weblogger/business/jpa/JPAPersistenceStrategy
    //#pre[5] (List getCustomPingTargets(Weblog)): this.strategy.threadLocalEntityManager != null
    //#pre[4] (List getCustomPingTargets(Weblog)): (soft) this.strategy.emf != null
    //#post(List getCustomPingTargets(Weblog)): init'ed(return_value)
    //#unanalyzed(List getCustomPingTargets(Weblog)): Effects-of-calling:java.lang.ThreadLocal:get
    //#unanalyzed(List getCustomPingTargets(Weblog)): Effects-of-calling:javax.persistence.EntityManagerFactory:createEntityManager
    //#unanalyzed(List getCustomPingTargets(Weblog)): Effects-of-calling:java.lang.ThreadLocal:set
    //#unanalyzed(List getCustomPingTargets(Weblog)): Effects-of-calling:javax.persistence.EntityManager:getTransaction
    //#unanalyzed(List getCustomPingTargets(Weblog)): Effects-of-calling:javax.persistence.EntityTransaction:isActive
    //#unanalyzed(List getCustomPingTargets(Weblog)): Effects-of-calling:javax.persistence.EntityTransaction:begin
    //#unanalyzed(List getCustomPingTargets(Weblog)): Effects-of-calling:javax.persistence.EntityManager:createNamedQuery
    //#unanalyzed(List getCustomPingTargets(Weblog)): Effects-of-calling:javax.persistence.Query:setFlushMode
                "PingTarget.getByWebsiteOrderByName");
        q.setParameter(1, website);
        return q.getResultList();
    //#JPAPingTargetManagerImpl.java:185: end of method: List org.apache.roller.weblogger.business.jpa.JPAPingTargetManagerImpl.getCustomPingTargets(Weblog)
    }

    public void release() {}
    //#JPAPingTargetManagerImpl.java:188: method: void org.apache.roller.weblogger.business.jpa.JPAPingTargetManagerImpl.release()
    //#JPAPingTargetManagerImpl.java:188: end of method: void org.apache.roller.weblogger.business.jpa.JPAPingTargetManagerImpl.release()
    
}
    //#JPAPingTargetManagerImpl.java:: end of class: org.apache.roller.weblogger.business.jpa.JPAPingTargetManagerImpl
