Package org.apache.roller.pojos

Examples of org.apache.roller.pojos.PlanetConfigData


        strategy.remove(sub);
    }
   
   
    public PlanetConfigData getConfiguration() throws RollerException {
        PlanetConfigData config = null;
        try {
            Session session = ((HibernatePersistenceStrategy)strategy).getSession();
            Criteria criteria = session.createCriteria(PlanetConfigData.class);
            criteria.setMaxResults(1);
            List list = criteria.list();
            config = list.size()!=0 ? (PlanetConfigData)list.get(0) : null;
           
            // We inject the cache dir into the config object here to maintain
            // compatibility with the standaline version of the aggregator.
            if (config != null) {
                config.setCacheDir(
                        RollerConfig.getProperty("planet.aggregator.cache.dir"));
            }
        } catch (HibernateException e) {
            throw new RollerException(e);
        }
View Full Code Here


       
        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");
       
View Full Code Here

    public void testConfigurationStorage() throws Exception {
       
        PlanetManager planet = RollerFactory.getRoller().getPlanetManager();
       
        {   // retrieve config
            PlanetConfigData config = planet.getConfiguration();
            assertNotNull(config);
            assertEquals("test_title", config.getTitle());
            assertEquals("test_admin_email", config.getAdminEmail());
            assertNull(config.getSiteUrl());
        }
        {   // save config
            PlanetConfigData config = planet.getConfiguration();
            config.setSiteUrl("http://footest/lskdf/null");
            planet.saveConfiguration(config);
            TestUtils.endSession(true);
        }
        {
            // make sure config was saved
            PlanetConfigData config = planet.getConfiguration();
            assertNotNull(config);
            assertEquals("http://footest/lskdf/null", config.getSiteUrl());
        }
    }
View Full Code Here

                (RollerPropertyData)props.get("site.absoluteurl");
        prop.setValue("http://localhost:8080/roller");
        propmgr.saveProperties(props);
       
        PlanetManager planet = getRoller().getPlanetManager();
        PlanetConfigData config = config = new PlanetConfigData();
        config.setCacheDir("");
        config.setTitle("Test");
        config.setAdminEmail("admin@example.com");
        planet.saveConfiguration(config);
       
        PlanetGroupData group = new PlanetGroupData();
        group.setHandle("external");
        group.setTitle("external");
View Full Code Here

     * @see TestCase#tearDown()
     */
    public void tearDown() throws Exception {
        try {
            PlanetManager planet = getRoller().getPlanetManager();
            PlanetConfigData config = planet.getConfiguration();
            PlanetGroupData group = planet.getGroup("external");
            planet.deleteGroup(group);
           
            deleteWebsite(testUsername);
        } catch (RollerException e) {
View Full Code Here

        String technoratiFeedUrl = null;
        int inboundlinks = -1;
        int inboundblogs = -1;
        if (form.getSiteUrl()!=null && form.getSiteUrl().trim().length() > 0) {
            try {
                PlanetConfigData config = planet.getConfiguration();
                Technorati technorati = null;
                if (config.getProxyHost()!=null && config.getProxyPort() > 0) {
                    technorati = new Technorati(
                            config.getProxyHost(), config.getProxyPort());
                } else {
                    technorati = new Technorati();
                }
                Technorati.Result result =
                        technorati.getBloginfo(form.getSiteUrl());
View Full Code Here

       
        public PlanetPageData(HttpServletRequest req) throws RollerException
        {
           mRequest = req;
           Roller roller = RollerFactory.getRoller();
           PlanetConfigData cfg = roller.getPlanetManager().getConfiguration();
           if (cfg != null)
           {
               mTitle = cfg.getTitle();
               mDescription = cfg.getDescription();
           }
        }
View Full Code Here

                BasePageModel pageModel = new BasePageModel(
                    "planetConfig.pageTitle", request, response, mapping);
                request.setAttribute("model",pageModel);               
                Roller roller = RollerFactory.getRoller();
                PlanetManager planet = roller.getPlanetManager();
                PlanetConfigData config = planet.getConfiguration();
                PlanetConfigForm form = (PlanetConfigForm)actionForm;
                if (config != null)
                {
                    form.copyFrom(config, request.getLocale());
                }
View Full Code Here

                BasePageModel pageModel = new BasePageModel(
                    "planetConfig.pageTitle", request, response, mapping);
                request.setAttribute("model",pageModel);               
                Roller roller = RollerFactory.getRoller();
                PlanetManager planet = roller.getPlanetManager();
                PlanetConfigData config = planet.getConfiguration();
                if (config == null)
                {
                    config = new PlanetConfigData();
                }
                PlanetConfigForm form = (PlanetConfigForm) actionForm;
                ActionErrors errors = validate(form);
                if (errors.isEmpty())
                {
View Full Code Here

    private void rankSubscriptions() {
        int count = 0;
        int errorCount = 0;
        try {
            PlanetManager planet = roller.getPlanetManager();
            PlanetConfigData config = planet.getConfiguration();
            Technorati technorati = null;
            try {
                if (config.getProxyHost()!=null && config.getProxyPort() != -1) {
                    technorati = new Technorati(
                            config.getProxyHost(), config.getProxyPort());
                } else {
                    technorati = new Technorati();
                }
            } catch (IOException e) {
                logger.error("Aborting collection of Technorati rankings.\n"
View Full Code Here

TOP

Related Classes of org.apache.roller.pojos.PlanetConfigData

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.