Examples of PingTargetManager


Examples of org.apache.roller.weblogger.business.pings.PingTargetManager

     * Test lookup mechanisms ... id, ping target, weblog
     */
    public void testAutoPingLookups() throws Exception {
       
        AutoPingManager mgr = WebloggerFactory.getWeblogger().getAutopingManager();
        PingTargetManager ptmgr = WebloggerFactory.getWeblogger().getPingTargetManager();
        AutoPing autoPing = null;
       
        // create autoPing target to use for tests
        PingTarget pingTarget = TestUtils.setupPingTarget("fooPing", "http://foo/null");
        TestUtils.endSession(true);
       
        // create autoPing
        testWeblog = TestUtils.getManagedWebsite(testWeblog);
        pingTarget = ptmgr.getPingTarget(pingTarget.getId());
        autoPing = new AutoPing(null, pingTarget, testWeblog);
        mgr.saveAutoPing(autoPing);
        String id = autoPing.getId();
        TestUtils.endSession(true);
       
        // lookup by id
        autoPing = null;
        autoPing = mgr.getAutoPing(id);
        assertNotNull(autoPing);
        assertEquals(pingTarget, autoPing.getPingTarget());
       
        // lookup by ping target
        pingTarget = ptmgr.getPingTarget(pingTarget.getId());
        List autoPings = mgr.getAutoPingsByTarget(pingTarget);
        assertNotNull(autoPings);
        assertEquals(1, autoPings.size());
       
        // lookup by weblog
View Full Code Here

Examples of org.apache.roller.weblogger.business.pings.PingTargetManager

    }
   
   
    public void myPrepare() {
       
        PingTargetManager pingTargetMgr = WebloggerFactory.getWeblogger().getPingTargetManager();
       
        // load selected ping target, if possible
        if(getPingTargetId() != null) try {
            setPingTarget(pingTargetMgr.getPingTarget(getPingTargetId()));
        } catch (WebloggerException ex) {
            log.error("Error looking up ping target - "+getPingTargetId(), ex);
        }
       
        try {
            // load common ping targets list
            setCommonPingTargets(pingTargetMgr.getCommonPingTargets());
           
            // load custom ping targets list for weblog, if applicable
            if(!PingConfig.getDisallowCustomTargets()) {
                setCustomPingTargets(pingTargetMgr.getCustomPingTargets(getActionWeblog()));
            }
           
        } catch (WebloggerException ex) {
            log.error("Error loading ping target lists for weblog - "+getActionWeblog().getHandle(), ex);
            // TODO: i18n
View Full Code Here

Examples of org.apache.roller.weblogger.business.pings.PingTargetManager

        while(it.hasNext()) {
            this.strategy.remove((AutoPing) it.next());
        }
       
        // Remove the website's custom ping targets
        PingTargetManager pingTargetMgr = roller.getPingTargetManager();
        List pingtargets = pingTargetMgr.getCustomPingTargets(website);
        it = pingtargets.iterator();
        while(it.hasNext()) {
            this.strategy.remove((PingTarget) it.next());
        }
       
View Full Code Here

Examples of org.apache.roller.weblogger.business.pings.PingTargetManager

                }
            }
        }
       
        // add any auto enabled ping targets
        PingTargetManager pingTargetMgr = roller.getPingTargetManager();
        AutoPingManager autoPingMgr = roller.getAutopingManager();
       
        Iterator pingTargets = pingTargetMgr.getCommonPingTargets().iterator();
        PingTarget pingTarget = null;
        while(pingTargets.hasNext()) {
            pingTarget = (PingTarget) pingTargets.next();
           
            if(pingTarget.isAutoEnabled()) {
View Full Code Here

Examples of org.apache.roller.weblogger.business.pings.PingTargetManager

   
   
    public void loadPingTargets() {
       
        if(!PingConfig.getDisallowCustomTargets()) try {
            PingTargetManager pingTargetMgr = WebloggerFactory.getWeblogger().getPingTargetManager();
            setPingTargets(pingTargetMgr.getCustomPingTargets(getActionWeblog()));
        } catch (WebloggerException ex) {
            log.error("Error loading common ping targets", ex);
            // TODO: i18n
            addError("Error loading common ping targets");
        }
View Full Code Here

Examples of org.apache.roller.weblogger.business.pings.PingTargetManager

    /**
     * Prepare action by loading ping target to work on.
     */
    public void myPrepare() {
       
        PingTargetManager pingTargetMgr = WebloggerFactory.getWeblogger().getPingTargetManager();
        if(!StringUtils.isEmpty(getBean().getId())) {
           
            try {
                setPingTarget(pingTargetMgr.getPingTarget(getBean().getId()));
            } catch (WebloggerException ex) {
                getLogger().error("Error looking up ping target - "+getBean().getId());
            }
           
            if(getPingTarget() == null) {
View Full Code Here

Examples of org.apache.roller.weblogger.business.pings.PingTargetManager

        // If there are errors, go back to the target edit page.
        myValidate(getPingTarget());
       
        if(!hasActionErrors()) try {
            // Appears to be ok.  Save it and flush.
            PingTargetManager pingTargetMgr = WebloggerFactory.getWeblogger().getPingTargetManager();
            pingTargetMgr.savePingTarget(getPingTarget());
            WebloggerFactory.getWeblogger().flush();
           
            addMessage("pingTarget.saved");
           
        } catch (WebloggerException ex) {
View Full Code Here

Examples of org.apache.roller.weblogger.business.pings.PingTargetManager

     * Private helper to validate a ping target.
     */
    protected void myValidate(PingTarget pingTarget) {
       
        try {
            PingTargetManager pingTargetMgr = WebloggerFactory.getWeblogger().getPingTargetManager();
            if (!pingTargetMgr.isNameUnique(pingTarget)) {
                addError("pingTarget.nameNotUnique");
            }
           
            if (!pingTargetMgr.isUrlWellFormed(pingTarget)) {
                addError("pingTarget.malformedUrl");
            } else if (!pingTargetMgr.isHostnameKnown(pingTarget)) {
                addError("pingTarget.unknownHost");
            }
        } catch (WebloggerException ex) {
            getLogger().error("Error validating ping target", ex);
            // TODO: i18n
View Full Code Here

Examples of org.apache.roller.weblogger.business.pings.PingTargetManager

        // If there are errors, go back to the target edit page.
        myValidate(pingTarget);
       
        if(!hasActionErrors()) try {
            // Appears to be ok.  Save it and flush.
            PingTargetManager pingTargetMgr = WebloggerFactory.getWeblogger().getPingTargetManager();
            pingTargetMgr.savePingTarget(pingTarget);
            WebloggerFactory.getWeblogger().flush();
           
            addMessage("pingTarget.saved");
           
            return SUCCESS;
View Full Code Here

Examples of org.apache.roller.weblogger.business.pings.PingTargetManager

     * Private helper to validate a ping target.
     */
    protected void myValidate(PingTarget pingTarget) {
       
        try {
            PingTargetManager pingTargetMgr = WebloggerFactory.getWeblogger().getPingTargetManager();
            if (!pingTargetMgr.isNameUnique(pingTarget)) {
                addError("pingTarget.nameNotUnique");
            }
           
            if (!pingTargetMgr.isUrlWellFormed(pingTarget)) {
                addError("pingTarget.malformedUrl");
            } else if (!pingTargetMgr.isHostnameKnown(pingTarget)) {
                addError("pingTarget.unknownHost");
            }
        } catch (WebloggerException ex) {
            getLogger().error("Error validating ping target", ex);
            // TODO: i18n
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.