Package org.apache.roller.model

Examples of org.apache.roller.model.AutoPingManager


     * Convenience method for creating an auto ping.
     */
    public static AutoPingData setupAutoPing(PingTargetData ping, WebsiteData weblog)
            throws Exception {
       
        AutoPingManager mgr = RollerFactory.getRoller().getAutopingManager();
       
        // store auto ping
        AutoPingData autoPing = new AutoPingData(null, ping, weblog);
        mgr.saveAutoPing(autoPing);
       
        // query for it
        autoPing = mgr.getAutoPing(autoPing.getId());
       
        if(autoPing == null)
            throw new RollerException("error setting up auto ping");
       
        return autoPing;
View Full Code Here


     * Convenience method for removing an auto ping.
     */
    public static void teardownAutoPing(String id) throws Exception {
       
        // query for it
        AutoPingManager mgr = RollerFactory.getRoller().getAutopingManager();
        AutoPingData autoPing = mgr.getAutoPing(id);
       
        // remove the auto ping
        mgr.removeAutoPing(autoPing);
    }
View Full Code Here

        Criteria criteria = session.createCriteria(PingQueueEntryData.class);
        criteria.add(Expression.eq("website", website));
        List queueEntries = criteria.list();
       
        // Remove the website's auto ping configurations
        AutoPingManager autoPingMgr = RollerFactory.getRoller().getAutopingManager();
        List autopings = autoPingMgr.getAutoPingsByWebsite(website);
        Iterator it = autopings.iterator();
        while(it.hasNext()) {
            this.strategy.remove((AutoPingData) 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()) {
                AutoPingData autoPing = new AutoPingData(null, pingTarget, newWeblog);
                autoPingMgr.saveAutoPing(autoPing);
            }
        }
    }
View Full Code Here

        while(qIT.hasNext()) {
            this.strategy.remove((PingQueueEntryData) qIT.next());
        }
       
        // Remove the website's auto ping configurations
        AutoPingManager autoPingMgr = RollerFactory.getRoller().getAutopingManager();
        List autopings = autoPingMgr.getAutoPingsByTarget(ping);
        Iterator it = autopings.iterator();
        while(it.hasNext()) {
            this.strategy.remove((AutoPingData) it.next());
        }
    }
View Full Code Here

    /*
     * Private helper to build a map indexed by ping target id with values Boolean.TRUE and Boolean.FALSE
     * based on whether the ping target is enabled (has a corresponding auto ping configuration).
     */
    private Map buildIsEnabledMap(RollerRequest rreq, List commonPingTargets, List customPingTargets) throws RollerException {
        AutoPingManager autoPingMgr = RollerFactory.getRoller().getAutopingManager();
        WebsiteData website = rreq.getWebsite();

        // Build isEnabled map (keyed by ping target id and values Boolean.TRUE/Boolean.FALSE)
        Map isEnabled = new HashMap();
        List autopings = autoPingMgr.getAutoPingsByWebsite(website);
        // Add the enabled auto ping configs with TRUE
        for (Iterator i = autopings.iterator(); i.hasNext();) {
            AutoPingData autoPing = (AutoPingData) i.next();
            isEnabled.put(autoPing.getPingTarget().getId(), Boolean.TRUE);
        }
View Full Code Here

    /*
     * Enable a ping target.
     */
    public ActionForward enableSelected(ActionMapping mapping, ActionForm form, HttpServletRequest req, HttpServletResponse res) throws Exception {
        RollerRequest rreq = RollerRequest.getRollerRequest(req);
        AutoPingManager autoPingMgr = RollerFactory.getRoller().getAutopingManager();
        PingTargetData pingTarget = select(rreq);
        try {
            if (!isAuthorized(rreq, rreq.getWebsite())) {
                return mapping.findForward("access-denied");
            }
            AutoPingData autoPing = new AutoPingData(null, pingTarget, rreq.getWebsite());
            autoPingMgr.saveAutoPing(autoPing);
            RollerFactory.getRoller().flush();

            return view(mapping, form, req, res);
        } catch (Exception e) {
            mLogger.error("ERROR in action", e);
View Full Code Here

    /*
     * Load delete confirmation view.
     */
    public ActionForward disableSelected(ActionMapping mapping, ActionForm form, HttpServletRequest req, HttpServletResponse res) throws Exception {
        RollerRequest rreq = RollerRequest.getRollerRequest(req);
        AutoPingManager autoPingMgr = RollerFactory.getRoller().getAutopingManager();
        PingTargetData pingTarget = select(rreq);
        try {
            if (!isAuthorized(rreq, rreq.getWebsite())) {
                return mapping.findForward("access-denied");
            }
            autoPingMgr.removeAutoPing(pingTarget, rreq.getWebsite());
            RollerFactory.getRoller().flush();

            return view(mapping, form, req, res);
        } catch (Exception e) {
            mLogger.error("ERROR in action", e);
View Full Code Here

TOP

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

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.