Package org.apache.roller.model

Examples of org.apache.roller.model.Roller


    }
   
    public Date getWeblogLastPublishTime(WebsiteData website, String catName)
    throws RollerException {
        WeblogCategoryData cat = null;
        Roller mRoller = RollerFactory.getRoller();
        if (catName != null && website != null) {
            cat = getWeblogCategoryByPath(website, null, catName);
            if (cat == null) catName = null;
        }
        if (catName != null && catName.trim().equals("/")) {
View Full Code Here


                        && !refurl.startsWith("http://www.teoma")
                        ) {
                    // Launch thread to extract referer linkback
                   
                    try {
                        Roller mRoller = RollerFactory.getRoller();
                        mRoller.getThreadManager().executeInBackground(
                                new LinkbackExtractorRunnable(ref));
                    } catch (InterruptedException e) {
                        log.warn("Interrupted during linkback extraction",e);
                    }
                } else {
View Full Code Here

       
        public YourWebsitesPageModel(HttpServletRequest request,
          HttpServletResponse response, ActionMapping mapping) throws RollerException
        {
            super("yourWebsites.title", request, response, mapping);
            Roller roller = RollerFactory.getRoller();
            RollerSession rollerSession = RollerSession.getRollerSession(request);
            UserData user = rollerSession.getAuthenticatedUser();
            permissions = roller.getUserManager().getAllPermissions(user);
            userWeblogCount = permissions.size();
            pendings = roller.getUserManager().getPendingPermissions(user);
            groupBloggingEnabled =
                RollerConfig.getBooleanProperty("groupblogging.enabled");
            setPlanetAggregatorEnabled(RollerConfig.getBooleanProperty("planet.aggregator.enabled"));
        }
View Full Code Here

                CommentManagementForm queryFormthrows RollerException {
           
            super(titleKey, request, response, mapping);
            this.queryForm = queryForm;
           
            Roller roller = RollerFactory.getRoller();
            RollerRequest rreq = RollerRequest.getRollerRequest(request);
            if (rreq.getWeblogEntry() != null) {
                website = rreq.getWeblogEntry().getWebsite();
                weblogEntry = rreq.getWeblogEntry();
            }
            else if (rreq.getWebsite() != null) {
                website = rreq.getWebsite();
            }
            WeblogManager blogmgr = roller.getWeblogManager();

            int offset = queryForm.getOffset();
            comments = blogmgr.getComments(
                website,
                weblogEntry,
View Full Code Here

        WebsiteData website = rreq.getWebsite();
        if (website != null) {
            request.getSession().setAttribute(HANDLE, website.getHandle());
        } else {
            String handle = (String)request.getSession().getAttribute(HANDLE);
            Roller roller = RollerFactory.getRoller();
            website = roller.getUserManager().getWebsiteByHandle(handle);
        }
        return website;
    }
View Full Code Here

        {
            endDeleting();
        }
       
        IndexWriter writer = beginWriting();
        Roller roller = RollerFactory.getRoller();
        try
        {
            if (writer != null)
            {
                writer.addDocument(getDocument(data));
            }
        }
        catch (IOException e)
        {
            mLogger.error("Problems adding doc to index", e);
        }
        finally
        {
            if (roller != null) roller.release();
            endWriting();
        }     
    }   
View Full Code Here

     * @see java.lang.Runnable#run()
     */
    public void doRun()
    {     
        IndexWriter writer = beginWriting();
        Roller roller = RollerFactory.getRoller();
        try
        {
            if (writer != null)
            {
                writer.addDocument(getDocument(data));
            }
        }
        catch (IOException e)
        {
            mLogger.error("Problems adding doc to index", e);
        }
        finally
        {
            if (roller != null) roller.release();
            endWriting();
        }     
    }
View Full Code Here

    }
   
   
    public void refreshEntries() throws RollerException {
       
        Roller roller = RollerFactory.getRoller();
       
        Date now = new Date();
        long startTime = System.currentTimeMillis();
        PlanetConfigData config = getConfiguration();
       
        // can't continue without cache dir
        if (config == null || config.getCacheDir() == null) {
            log.warn("Planet cache directory not set, aborting refresh");
            return;
        }
       
        // allow ${user.home} in cache dir property
        String cacheDirName = config.getCacheDir().replaceFirst(
                "\\$\\{user.home}",System.getProperty("user.home"));
       
        // allow ${catalina.home} in cache dir property
        cacheDirName = cacheDirName.replaceFirst(
                "\\$\\{catalina.home}",System.getProperty("catalina.home"));
       
        // create cache  dir if it does not exist
        File cacheDir = null;
        try {
            cacheDir = new File(cacheDirName);
            if (!cacheDir.exists()) cacheDir.mkdirs();
        } catch (Exception e) {
            log.error("Unable to create planet cache directory");
            return;
        }
       
        // abort if cache dir is not writable
        if (!cacheDir.canWrite()) {
            log.error("Planet cache directory is not writable");
            return;
        }
       
        FeedFetcherCache feedInfoCache =
                new DiskFeedInfoCache(cacheDirName);
       
        if (config.getProxyHost()!=null && config.getProxyPort() > 0) {
            System.setProperty("proxySet", "true");
            System.setProperty("http.proxyHost", config.getProxyHost());
            System.setProperty("http.proxyPort",
                    Integer.toString(config.getProxyPort()));
        }
        /** a hack to set 15 sec timeouts for java.net.HttpURLConnection */
        System.setProperty("sun.net.client.defaultConnectTimeout", "15000");
        System.setProperty("sun.net.client.defaultReadTimeout", "15000");
       
        FeedFetcher feedFetcher = new HttpURLFeedFetcher(feedInfoCache);
        //FeedFetcher feedFetcher = new HttpClientFeedFetcher(feedInfoCache);
        feedFetcher.setUsingDeltaEncoding(false);
        feedFetcher.setUserAgent("RollerPlanetAggregator");
       
        // Loop through all subscriptions in the system
        Iterator subs = getAllSubscriptions();
        while (subs.hasNext()) {
           
            long subStartTime = System.currentTimeMillis();
           
            PlanetSubscriptionData sub = (PlanetSubscriptionData)subs.next();
           
            // reattach sub.  sub gets detached as we iterate
            sub = this.getSubscriptionById(sub.getId());
           
            // Fetch latest entries for each subscription
//            Set newEntries = null;
//            int count = 0;
//            if (!StringUtils.isEmpty(localURL) && sub.getFeedUrl().startsWith(localURL)) {
//                newEntries = getNewEntriesLocal(sub, feedFetcher, feedInfoCache);
//            } else {
//                newEntries = getNewEntriesRemote(sub, feedFetcher, feedInfoCache);
//            }
            Set newEntries = this.getNewEntries(sub, feedFetcher, feedInfoCache);
            int count = newEntries.size();
           
            log.debug("   Entry count: " + count);
            if (count > 0) {
                sub.purgeEntries();
                sub.addEntries(newEntries);
                this.saveSubscription(sub);
                if(roller != null) roller.flush();
            }
            long subEndTime = System.currentTimeMillis();
            log.info("   " + count + " - "
                    + ((subEndTime-subStartTime)/1000.0)
                    + " seconds to process (" + count + ") entries of "
View Full Code Here

     * Determine if file can be saved given current RollerConfig settings.
     */
    public boolean canSave(
            String weblogHandle, String name, long size, RollerMessages messages)
            throws RollerException {
        Roller mRoller = RollerFactory.getRoller();
        Map config = mRoller.getPropertiesManager().getProperties();
       
        if (!((RollerPropertyData)config.get("uploads.enabled")).getValue().equalsIgnoreCase("true")) {
            messages.addError("error.upload.disabled");
            return false;
        }
View Full Code Here

            endDeleting();
        }

        IndexWriter writer = beginWriting();

        Roller roller = RollerFactory.getRoller();
        try
        {
            if (writer != null)
            {
                WeblogManager weblogManager = roller.getWeblogManager();

                List entries = weblogManager .getWeblogEntries(
                    website,                   // userName
                    null,                      // startDate
                    new Date(),                // endDate (don't index 'future' entries)
                    null,                      // catName
                    WeblogEntryData.PUBLISHED, // status
                    null,                      // sortby (null mean pubTime)
                    null);                     // maxEntries (null to get 'em all)

                for (Iterator wbItr = entries.iterator(); wbItr.hasNext();)
                {
                    WeblogEntryData entry = (WeblogEntryData) wbItr.next();
                    writer.addDocument(getDocument(entry));
                    mLogger.debug(
                       MessageFormat.format("Indexed entry {0}: {1}",
                       new Object[] {entry.getPubTime(), entry.getAnchor()}));
                }
                // release the database connection
                roller.release();
            }
        }
        catch (Exception e)
        {
            mLogger.error("ERROR adding doc to index", e);
        }
        finally
        {
            endWriting();
            if (roller != null) roller.release();
        }

        Date end = new Date();
        double length = (end.getTime() - start.getTime()) / (double) 1000;
View Full Code Here

TOP

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

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.