Package org.apache.roller.model

Examples of org.apache.roller.model.PingTargetManager


    /*
    * Get the ping targets for the view.  Here we return the common ping targets for the
    * entire site.
    */
    protected List getPingTargets(RollerRequest rreq) throws RollerException {
        PingTargetManager pingTargetMgr = RollerFactory.getRoller().getPingTargetManager();
        return pingTargetMgr.getCommonPingTargets();
    }
View Full Code Here


     * website and  set the value of attribute <code>allowCustomTargets</code> in the request.
     * If custom ping targets have been disallowed, we just return the empty list.
     */
    protected List getPingTargets(RollerRequest rreq) throws RollerException {
        HttpServletRequest req = rreq.getRequest();
        PingTargetManager pingTargetMgr = RollerFactory.getRoller().getPingTargetManager();

        Boolean allowCustomTargets = new Boolean(!PingConfig.getDisallowCustomTargets());
        req.setAttribute("allowCustomTargets", allowCustomTargets);

        List customPingTargets = allowCustomTargets.booleanValue() ? pingTargetMgr.getCustomPingTargets(rreq.getWebsite()) : Collections.EMPTY_LIST;

        return customPingTargets;
    }
View Full Code Here

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

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

     * Display the common ping targets with page
     */
    public ActionForward view(ActionMapping mapping, ActionForm form, HttpServletRequest req, HttpServletResponse res) throws Exception {
        ActionForward forward = mapping.findForward(PING_SETUP_PAGE);
        RollerRequest rreq = RollerRequest.getRollerRequest(req);
        PingTargetManager pingTargetMgr = RollerFactory.getRoller().getPingTargetManager();
        WebsiteData website = rreq.getWebsite();
        try {
            if (!isAuthorized(rreq, website)) {
                return mapping.findForward("access-denied");
            }

            BasePageModel pageModel = new BasePageModel("pings.title", req, res, mapping);
            req.setAttribute("model", pageModel);

            List commonPingTargets = pingTargetMgr.getCommonPingTargets();
            req.setAttribute("commonPingTargets", commonPingTargets);

            Boolean allowCustomTargets = new Boolean(!PingConfig.getDisallowCustomTargets());
            req.setAttribute("allowCustomTargets", allowCustomTargets);

            List customPingTargets = allowCustomTargets.booleanValue() ? pingTargetMgr.getCustomPingTargets(website) : Collections.EMPTY_LIST;
            req.setAttribute("customPingTargets", customPingTargets);

            // Build isEnabled map (keyed by ping target id and values Boolean.TRUE/Boolean.FALSE)
            Map isEnabled = buildIsEnabledMap(rreq, commonPingTargets, customPingTargets);
            req.setAttribute("isEnabled", isEnabled);
View Full Code Here

    // TODO: Consider unifying with other RollerRequest methods
    // Private helper to get ping target specified by request
    private PingTargetData select(RollerRequest rreq) throws RollerException {
        String pingTargetId = rreq.getRequest().getParameter(RequestConstants.PINGTARGET_ID);
        PingTargetManager pingTargetMgr = RollerFactory.getRoller().getPingTargetManager();
        if (pingTargetId == null || pingTargetId.length() == 0) {
            throw new RollerException("Missing ping target id: " + pingTargetId);
        }

        PingTargetData pingTarget = pingTargetMgr.getPingTarget(pingTargetId);
        if (pingTarget == null) {
            throw new RollerException("No such ping target id: " + pingTargetId);
        }
        return pingTarget;
    }
View Full Code Here

            if (logger.isDebugEnabled()) {
                logger.debug("No (or empty) value of " + PINGS_INITIAL_COMMON_TARGETS_PROP + " present in the configuration.  Skipping initialization of commmon targets.");
            }
            return;
        }
        PingTargetManager pingTargetMgr = RollerFactory.getRoller().getPingTargetManager();
        if (!pingTargetMgr.getCommonPingTargets().isEmpty()) {
            if (logger.isDebugEnabled()) {
                logger.debug("Some common ping targets are present in the database already.  Skipping initialization.");
            }
            return;
        }

        String[] configuredTargets = configuredVal.trim().split(",");
        for (int i = 0; i < configuredTargets.length; i++) {
            // Trim space around the target spec
            String thisTarget = configuredTargets[i].trim();
            // skip empty ones
            if (thisTarget.length() == 0) continue;
            // parse the ith target and store it
            Matcher m = NESTED_BRACE_PAIR.matcher(thisTarget);
            if (m.matches() && m.groupCount() == 2) {
                String name = m.group(1).trim();
                String url = m.group(2).trim();
                logger.info("Creating common ping target '" + name + "' from configuration properties.");
                PingTargetData pingTarget = new PingTargetData(null, name, url, null, false);
                pingTargetMgr.savePingTarget(pingTarget);
            } else {
                logger.error("Unable to parse configured initial ping target '" + thisTarget + "'. Skipping this target. Check your setting of the property " + PINGS_INITIAL_COMMON_TARGETS_PROP);
            }
        }
    }
View Full Code Here

TOP

Related Classes of org.apache.roller.model.PingTargetManager

Copyright © 2018 www.massapicom. 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.