You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@roller.apache.org by sn...@apache.org on 2007/02/13 18:07:40 UTC

svn commit: r507104 - in /incubator/roller/branches/roller_4.0/src/org/apache/roller: business/datamapper/ planet/ui/admin/struts/actions/ planet/ui/admin/struts/forms/

Author: snoopdave
Date: Tue Feb 13 09:07:39 2007
New Revision: 507104

URL: http://svn.apache.org/viewvc?view=rev&rev=507104
Log:
Next step: fix Roller UI to use Planet config correctly

Removed:
    incubator/roller/branches/roller_4.0/src/org/apache/roller/planet/ui/admin/struts/forms/PlanetConfigForm.java
Modified:
    incubator/roller/branches/roller_4.0/src/org/apache/roller/business/datamapper/DatamapperPropertiesManagerImpl.java
    incubator/roller/branches/roller_4.0/src/org/apache/roller/planet/ui/admin/struts/actions/PlanetConfigAction.java
    incubator/roller/branches/roller_4.0/src/org/apache/roller/planet/ui/admin/struts/actions/PlanetSubscriptionsAction.java

Modified: incubator/roller/branches/roller_4.0/src/org/apache/roller/business/datamapper/DatamapperPropertiesManagerImpl.java
URL: http://svn.apache.org/viewvc/incubator/roller/branches/roller_4.0/src/org/apache/roller/business/datamapper/DatamapperPropertiesManagerImpl.java?view=diff&rev=507104&r1=507103&r2=507104
==============================================================================
--- incubator/roller/branches/roller_4.0/src/org/apache/roller/business/datamapper/DatamapperPropertiesManagerImpl.java (original)
+++ incubator/roller/branches/roller_4.0/src/org/apache/roller/business/datamapper/DatamapperPropertiesManagerImpl.java Tue Feb 13 09:07:39 2007
@@ -58,7 +58,7 @@
     /** Creates a new instance of DatamapperPropertiesManagerImpl */
     public DatamapperPropertiesManagerImpl (
             DatamapperPersistenceStrategy strategy) {
-        log.debug("Instantiating Hibernate Properties Manager");
+        log.debug("Instantiating Datamapper Properties Manager");
 
         this.strategy = strategy;
 

Modified: incubator/roller/branches/roller_4.0/src/org/apache/roller/planet/ui/admin/struts/actions/PlanetConfigAction.java
URL: http://svn.apache.org/viewvc/incubator/roller/branches/roller_4.0/src/org/apache/roller/planet/ui/admin/struts/actions/PlanetConfigAction.java?view=diff&rev=507104&r1=507103&r2=507104
==============================================================================
--- incubator/roller/branches/roller_4.0/src/org/apache/roller/planet/ui/admin/struts/actions/PlanetConfigAction.java (original)
+++ incubator/roller/branches/roller_4.0/src/org/apache/roller/planet/ui/admin/struts/actions/PlanetConfigAction.java Tue Feb 13 09:07:39 2007
@@ -39,9 +39,7 @@
 import org.apache.roller.planet.business.PlanetManager;
 import org.apache.roller.business.Roller;
 import org.apache.roller.business.RollerFactory;
-import org.apache.roller.planet.pojos.PlanetConfigData;
 import org.apache.roller.planet.pojos.PlanetGroupData;
-import org.apache.roller.planet.ui.admin.struts.forms.PlanetConfigForm;
 import org.apache.roller.ui.core.BasePageModel;
 import org.apache.roller.ui.core.RollerRequest;
 import org.apache.roller.ui.core.RollerSession;
@@ -61,111 +59,111 @@
     private static Log logger = 
         LogFactory.getFactory().getInstance(PlanetConfigAction.class);
 
-    /** Populate config form and forward to config page */
-    public ActionForward getConfig(ActionMapping mapping,
-            ActionForm actionForm, HttpServletRequest request,
-            HttpServletResponse response) throws IOException, ServletException
-    {
-        ActionForward forward = mapping.findForward("planetConfig.page");
-        try
-        {
-            RollerRequest rreq = RollerRequest.getRollerRequest(request);
-            if (RollerSession.getRollerSession(request).isGlobalAdminUser())
-            {
-                BasePageModel pageModel = new BasePageModel(
-                    "planetConfig.pageTitle", request, response, mapping);
-                request.setAttribute("model",pageModel);                
-                PlanetManager planet = PlanetFactory.getPlanet().getPlanetManager();
-                PlanetConfigData config = planet.getConfiguration();
-                PlanetConfigForm form = (PlanetConfigForm)actionForm;
-                if (config != null)
-                {
-                    form.copyFrom(config, request.getLocale());
-                }
-                else 
-                {
-                    form.setTitle("Planet Roller");
-                    form.setAdminEmail(RollerRuntimeConfig.getProperty("site.adminemail"));
-                    form.setSiteURL(RollerRuntimeConfig.getProperty("site.absoluteurl"));
-                    form.setCacheDir("/tmp");
-                }
-            }
-            else
-            {
-                forward = mapping.findForward("access-denied");
-            }
-        }
-        catch (Exception e)
-        {
-            request.getSession().getServletContext().log("ERROR", e);
-            throw new ServletException(e);
-        }
-        return forward;
-    }
+//    /** Populate config form and forward to config page */
+//    public ActionForward getConfig(ActionMapping mapping,
+//            ActionForm actionForm, HttpServletRequest request,
+//            HttpServletResponse response) throws IOException, ServletException
+//    {
+//        ActionForward forward = mapping.findForward("planetConfig.page");
+//        try
+//        {
+//            RollerRequest rreq = RollerRequest.getRollerRequest(request);
+//            if (RollerSession.getRollerSession(request).isGlobalAdminUser())
+//            {
+//                BasePageModel pageModel = new BasePageModel(
+//                    "planetConfig.pageTitle", request, response, mapping);
+//                request.setAttribute("model",pageModel);                
+//                PlanetManager planet = PlanetFactory.getPlanet().getPlanetManager();
+//                // TODO 4.0 PlanetConfigData config = planet.getConfiguration();
+//                PlanetConfigForm form = (PlanetConfigForm)actionForm;
+//                // TODO 4.0 if (config != null)
+//                //{
+//                    //form.copyFrom(config, request.getLocale());
+//                //}
+//                //else 
+//                {
+//                    form.setTitle("Planet Roller");
+//                    form.setAdminEmail(RollerRuntimeConfig.getProperty("site.adminemail"));
+//                    form.setSiteURL(RollerRuntimeConfig.getProperty("site.absoluteurl"));
+//                    form.setCacheDir("/tmp");
+//                }
+//            }
+//            else
+//            {
+//                forward = mapping.findForward("access-denied");
+//            }
+//        }
+//        catch (Exception e)
+//        {
+//            request.getSession().getServletContext().log("ERROR", e);
+//            throw new ServletException(e);
+//        }
+//        return forward;
+//    }
 
-    /** Save posted config form data */
-    public ActionForward saveConfig(ActionMapping mapping,
-            ActionForm actionForm, HttpServletRequest request,
-            HttpServletResponse response) throws IOException, ServletException
-    {
-        ActionForward forward = mapping.findForward("planetConfig.page");
-        try
-        {
-            RollerRequest rreq = RollerRequest.getRollerRequest(request);
-            if (RollerSession.getRollerSession(request).isGlobalAdminUser())
-            {
-                BasePageModel pageModel = new BasePageModel(
-                    "planetConfig.pageTitle", request, response, mapping);
-                request.setAttribute("model",pageModel);                
-                PlanetManager planet = PlanetFactory.getPlanet().getPlanetManager();
-                PlanetConfigData config = planet.getConfiguration();
-                if (config == null)
-                {
-                    config = new PlanetConfigData();
-                }
-                PlanetConfigForm form = (PlanetConfigForm) actionForm;
-                ActionErrors errors = validate(form);
-                if (errors.isEmpty())
-                {
-                    form.copyTo(config, request.getLocale());
-                    
-                    // the form copy is a little dumb and will set the id value
-                    // to empty string if it didn't have a value before, which means
-                    // that this object would not be considered new
-                    if(config.getId() != null && config.getId().trim().equals("")) {
-                        config.setId(null);
-                    }
-                    
-                    planet.saveConfiguration(config);
-                    if (planet.getGroup("external") == null) 
-                    {
-                        PlanetGroupData group = new PlanetGroupData();
-                        group.setHandle("external");
-                        group.setTitle("external");
-                        planet.saveGroup(group);
-                    }
-                    PlanetFactory.getPlanet().flush();
-                    ActionMessages messages = new ActionMessages();
-                    messages.add(null, new ActionMessage("planetConfig.success.saved"));
-                    saveMessages(request, messages);
-                }                
-                else
-                {
-                    saveErrors(request, errors);
-                }
-            }
-            else
-            {
-                forward = mapping.findForward("access-denied");
-            }
-        }
-        catch (Exception e)
-        {
-            request.getSession().getServletContext().log("ERROR", e);
-            throw new ServletException(e);
-        }
-        return forward;
-    }
+//    /** Save posted config form data */
+//    public ActionForward saveConfig(ActionMapping mapping,
+//            ActionForm actionForm, HttpServletRequest request,
+//            HttpServletResponse response) throws IOException, ServletException
+//    {
+//        ActionForward forward = mapping.findForward("planetConfig.page");
+//        try
+//        {
+//            RollerRequest rreq = RollerRequest.getRollerRequest(request);
+//            if (RollerSession.getRollerSession(request).isGlobalAdminUser())
+//            {
+//                BasePageModel pageModel = new BasePageModel(
+//                    "planetConfig.pageTitle", request, response, mapping);
+//                request.setAttribute("model",pageModel);                
+//                PlanetManager planet = PlanetFactory.getPlanet().getPlanetManager();
+//                // TODO 4.0 PlanetConfigData config = planet.getConfiguration();
+//                //if (config == null)
+//                //{
+//                    //config = new PlanetConfigData();
+//                //}
+//                PlanetConfigForm form = (PlanetConfigForm) actionForm;
+//                ActionErrors errors = validate(form);
+//                if (errors.isEmpty())
+//                {
+//                    // TODO 4.0 form.copyTo(config, request.getLocale());
+//                    
+//                    // the form copy is a little dumb and will set the id value
+//                    // to empty string if it didn't have a value before, which means
+//                    // that this object would not be considered new
+//                    // TODO 4.0 if(config.getId() != null && config.getId().trim().equals("")) {
+//                        //config.setId(null);
+//                    //}
+//                    
+//                    //planet.saveConfiguration(config);
+//                    if (planet.getGroup("external") == null) 
+//                    {
+//                        PlanetGroupData group = new PlanetGroupData();
+//                        group.setHandle("external");
+//                        group.setTitle("external");
+//                        planet.saveGroup(group);
+//                    }
+//                    PlanetFactory.getPlanet().flush();
+//                    ActionMessages messages = new ActionMessages();
+//                    messages.add(null, new ActionMessage("planetConfig.success.saved"));
+//                    saveMessages(request, messages);
+//                }                
+//                else
+//                {
+//                    saveErrors(request, errors);
+//                }
+//            }
+//            else
+//            {
+//                forward = mapping.findForward("access-denied");
+//            }
+//        }
+//        catch (Exception e)
+//        {
+//            request.getSession().getServletContext().log("ERROR", e);
+//            throw new ServletException(e);
+//        }
+//        return forward;
+//    }
 
     /** Refresh entries in backgrounded thread (for testing) */
     public ActionForward refreshEntries(ActionMapping mapping,
@@ -239,19 +237,19 @@
         return forward;
     }
     
-    /** Validate config form, returns empty collection if all OK */
-    public ActionErrors validate(PlanetConfigForm form)
-    {
-        ActionErrors errors = new ActionErrors();
-        if (form.getProxyHost()!=null && form.getProxyHost().trim().length()>0)
-        {
-            if (form.getProxyPort()<1)
-            {
-                errors.add(null, new ActionError(
-                        "planetConfig.error.badProxyPort"));
-            }
-        }
-        return errors;
-    }
+//    /** Validate config form, returns empty collection if all OK */
+//    public ActionErrors validate(PlanetConfigForm form)
+//    {
+//        ActionErrors errors = new ActionErrors();
+//        if (form.getProxyHost()!=null && form.getProxyHost().trim().length()>0)
+//        {
+//            if (form.getProxyPort()<1)
+//            {
+//                errors.add(null, new ActionError(
+//                        "planetConfig.error.badProxyPort"));
+//            }
+//        }
+//        return errors;
+//    }
 }
 

Modified: incubator/roller/branches/roller_4.0/src/org/apache/roller/planet/ui/admin/struts/actions/PlanetSubscriptionsAction.java
URL: http://svn.apache.org/viewvc/incubator/roller/branches/roller_4.0/src/org/apache/roller/planet/ui/admin/struts/actions/PlanetSubscriptionsAction.java?view=diff&rev=507104&r1=507103&r2=507104
==============================================================================
--- incubator/roller/branches/roller_4.0/src/org/apache/roller/planet/ui/admin/struts/actions/PlanetSubscriptionsAction.java (original)
+++ incubator/roller/branches/roller_4.0/src/org/apache/roller/planet/ui/admin/struts/actions/PlanetSubscriptionsAction.java Tue Feb 13 09:07:39 2007
@@ -43,7 +43,7 @@
 import org.apache.roller.planet.util.Technorati;
 import org.apache.roller.business.Roller;
 import org.apache.roller.business.RollerFactory;
-import org.apache.roller.planet.pojos.PlanetConfigData;
+// TODO 4.0 import org.apache.roller.planet.pojos.PlanetConfigData;
 import org.apache.roller.planet.pojos.PlanetGroupData;
 import org.apache.roller.planet.pojos.PlanetSubscriptionData;
 import org.apache.roller.ui.core.BasePageModel;
@@ -270,14 +270,14 @@
         int inboundblogs = -1;
         if (form.getSiteURL()!=null && form.getSiteURL().trim().length() > 0) {
             try {
-                PlanetConfigData config = planet.getConfiguration();
+                // TODO 4.0 PlanetConfigData config = planet.getConfiguration();
                 Technorati technorati = null;
-                if (config.getProxyHost()!=null && config.getProxyPort() > 0) {
-                    technorati = new Technorati(
-                            config.getProxyHost(), config.getProxyPort());
-                } else {
+                //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());
                 technoratiTitle = result.getWeblog().getName();