portals-jetspeed-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rwat...@apache.org
Subject svn commit: r314917 - in /portals/jetspeed-2/trunk/components/page-manager/src/java/org/apache/jetspeed/page: impl/AbstractPageManager.java impl/DatabasePageManager.java impl/DelegatingPageManager.java psml/CastorXmlPageManager.java
Date Wed, 12 Oct 2005 14:15:05 GMT
Author: rwatler
Date: Wed Oct 12 07:15:00 2005
New Revision: 314917

URL: http://svn.apache.org/viewcvs?rev=314917&view=rev
Log:
configure model class for AbstractPageManager

Modified:
    portals/jetspeed-2/trunk/components/page-manager/src/java/org/apache/jetspeed/page/impl/AbstractPageManager.java
    portals/jetspeed-2/trunk/components/page-manager/src/java/org/apache/jetspeed/page/impl/DatabasePageManager.java
    portals/jetspeed-2/trunk/components/page-manager/src/java/org/apache/jetspeed/page/impl/DelegatingPageManager.java
    portals/jetspeed-2/trunk/components/page-manager/src/java/org/apache/jetspeed/page/psml/CastorXmlPageManager.java

Modified: portals/jetspeed-2/trunk/components/page-manager/src/java/org/apache/jetspeed/page/impl/AbstractPageManager.java
URL: http://svn.apache.org/viewcvs/portals/jetspeed-2/trunk/components/page-manager/src/java/org/apache/jetspeed/page/impl/AbstractPageManager.java?rev=314917&r1=314916&r2=314917&view=diff
==============================================================================
--- portals/jetspeed-2/trunk/components/page-manager/src/java/org/apache/jetspeed/page/impl/AbstractPageManager.java
(original)
+++ portals/jetspeed-2/trunk/components/page-manager/src/java/org/apache/jetspeed/page/impl/AbstractPageManager.java
Wed Oct 12 07:15:00 2005
@@ -20,6 +20,7 @@
 import java.util.Iterator;
 import java.util.List;
 import java.util.LinkedList;
+import java.util.Map;
 
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
@@ -33,22 +34,10 @@
 import org.apache.jetspeed.om.folder.MenuIncludeDefinition;
 import org.apache.jetspeed.om.folder.MenuOptionsDefinition;
 import org.apache.jetspeed.om.folder.MenuSeparatorDefinition;
-import org.apache.jetspeed.om.folder.psml.FolderImpl;
-import org.apache.jetspeed.om.folder.psml.MenuDefinitionImpl;
-import org.apache.jetspeed.om.folder.psml.MenuExcludeDefinitionImpl;
-import org.apache.jetspeed.om.folder.psml.MenuIncludeDefinitionImpl;
-import org.apache.jetspeed.om.folder.psml.MenuOptionsDefinitionImpl;
-import org.apache.jetspeed.om.folder.psml.MenuSeparatorDefinitionImpl;
 import org.apache.jetspeed.om.page.Fragment;
 import org.apache.jetspeed.om.page.Link;
 import org.apache.jetspeed.om.page.Page;
 import org.apache.jetspeed.om.page.Property;
-import org.apache.jetspeed.om.page.psml.FragmentImpl;
-import org.apache.jetspeed.om.page.psml.LinkImpl;
-import org.apache.jetspeed.om.page.psml.PageImpl;
-import org.apache.jetspeed.om.page.psml.PropertyImpl;
-import org.apache.jetspeed.om.page.psml.SecurityConstraintImpl;
-import org.apache.jetspeed.om.page.psml.SecurityConstraintsImpl;
 import org.apache.jetspeed.page.PageManager;
 import org.apache.jetspeed.page.PageManagerEventListener;
 import org.apache.jetspeed.page.PageNotUpdatedException;
@@ -66,18 +55,18 @@
 {
     private final static Log log = LogFactory.getLog(AbstractPageManager.class);
     
-    protected Class fragmentClass = FragmentImpl.class;
-    protected Class pageClass = PageImpl.class;
-    protected Class folderClass = FolderImpl.class;
-    protected Class linkClass = LinkImpl.class;
-    protected Class propertyClass = PropertyImpl.class;
-    protected Class menuDefinitionClass = MenuDefinitionImpl.class;
-    protected Class menuExcludeDefinitionClass = MenuExcludeDefinitionImpl.class;
-    protected Class menuIncludeDefinitionClass = MenuIncludeDefinitionImpl.class;
-    protected Class menuOptionsDefinitionClass = MenuOptionsDefinitionImpl.class;
-    protected Class menuSeparatorDefinitionClass = MenuSeparatorDefinitionImpl.class;
-    protected Class securityConstraintsClass = SecurityConstraintsImpl.class;
-    protected Class securityConstraintClass = SecurityConstraintImpl.class;
+    protected Class fragmentClass;
+    protected Class pageClass;
+    protected Class folderClass;
+    protected Class linkClass;
+    protected Class propertyClass;
+    protected Class menuDefinitionClass;
+    protected Class menuExcludeDefinitionClass;
+    protected Class menuIncludeDefinitionClass;
+    protected Class menuOptionsDefinitionClass;
+    protected Class menuSeparatorDefinitionClass;
+    protected Class securityConstraintsClass;
+    protected Class securityConstraintClass;
 
     protected IdGenerator generator = null;
 
@@ -94,23 +83,22 @@
         this.constraintsEnabled = constraintsEnabled;
     }
     
-    public AbstractPageManager(IdGenerator generator, boolean permissionsEnabled, boolean
constraintsEnabled, List modelClasses)
+    public AbstractPageManager(IdGenerator generator, boolean permissionsEnabled, boolean
constraintsEnabled, Map modelClasses)
     {
-        this.generator = generator;     
-        if (modelClasses.size() > 0)
-        {
-            this.fragmentClass = (Class)modelClasses.get(0);
-            if (modelClasses.size() > 1)
-            {
-                this.pageClass  = (Class)modelClasses.get(1);
-                if (modelClasses.size() > 2)
-                {
-                    this.propertyClass  = (Class)modelClasses.get(2);
-                }                
-            }
-        }                                 
-        this.permissionsEnabled = permissionsEnabled;
-        this.constraintsEnabled = constraintsEnabled;
+        this(generator, permissionsEnabled, constraintsEnabled);     
+
+        this.fragmentClass = (Class)modelClasses.get("FragmentImpl.class");
+        this.pageClass = (Class)modelClasses.get("PageImpl.class");
+        this.folderClass = (Class)modelClasses.get("FolderImpl.class");
+        this.linkClass = (Class)modelClasses.get("LinkImpl.class");
+        this.propertyClass = (Class)modelClasses.get("PropertyImpl.class");
+        this.menuDefinitionClass = (Class)modelClasses.get("MenuDefinitionImpl.class");
+        this.menuExcludeDefinitionClass = (Class)modelClasses.get("MenuExcludeDefinitionImpl.class");
+        this.menuIncludeDefinitionClass = (Class)modelClasses.get("MenuIncludeDefinitionImpl.class");
+        this.menuOptionsDefinitionClass = (Class)modelClasses.get("MenuOptionsDefinitionImpl.class");
+        this.menuSeparatorDefinitionClass = (Class)modelClasses.get("MenuSeparatorDefinitionImpl.class");
+        this.securityConstraintsClass = (Class)modelClasses.get("SecurityConstraintsImpl.class");
+        this.securityConstraintClass = (Class)modelClasses.get("SecurityConstraintImpl.class");
     }
     
     /**

Modified: portals/jetspeed-2/trunk/components/page-manager/src/java/org/apache/jetspeed/page/impl/DatabasePageManager.java
URL: http://svn.apache.org/viewcvs/portals/jetspeed-2/trunk/components/page-manager/src/java/org/apache/jetspeed/page/impl/DatabasePageManager.java?rev=314917&r1=314916&r2=314917&view=diff
==============================================================================
--- portals/jetspeed-2/trunk/components/page-manager/src/java/org/apache/jetspeed/page/impl/DatabasePageManager.java
(original)
+++ portals/jetspeed-2/trunk/components/page-manager/src/java/org/apache/jetspeed/page/impl/DatabasePageManager.java
Wed Oct 12 07:15:00 2005
@@ -1,5 +1,8 @@
 package org.apache.jetspeed.page.impl;
 
+import java.util.HashMap;
+import java.util.Map;
+
 import org.apache.jetspeed.components.dao.InitablePersistenceBrokerDaoSupport;
 import org.apache.jetspeed.exception.JetspeedException;
 import org.apache.jetspeed.idgenerator.IdGenerator;
@@ -13,13 +16,15 @@
 import org.apache.jetspeed.om.folder.MenuIncludeDefinition;
 import org.apache.jetspeed.om.folder.MenuOptionsDefinition;
 import org.apache.jetspeed.om.folder.MenuSeparatorDefinition;
+import org.apache.jetspeed.om.folder.impl.FolderImpl;
 import org.apache.jetspeed.om.page.ContentPage;
 import org.apache.jetspeed.om.page.Fragment;
 import org.apache.jetspeed.om.page.Link;
 import org.apache.jetspeed.om.page.Page;
 import org.apache.jetspeed.om.page.PageSecurity;
 import org.apache.jetspeed.om.page.Property;
-import org.apache.jetspeed.om.page.psml.PageImpl;
+import org.apache.jetspeed.om.page.impl.FragmentImpl;
+import org.apache.jetspeed.om.page.impl.PageImpl;
 import org.apache.jetspeed.page.FolderNotRemovedException;
 import org.apache.jetspeed.page.FolderNotUpdatedException;
 import org.apache.jetspeed.page.LinkNotRemovedException;
@@ -36,7 +41,6 @@
 import org.apache.ojb.broker.query.QueryByCriteria;
 import org.apache.ojb.broker.query.QueryFactory;
 
-
 /**
  * DatabasePageManager
  * 
@@ -47,6 +51,23 @@
 public class DatabasePageManager extends InitablePersistenceBrokerDaoSupport
         implements PageManager
 {
+    private static Map modelClasses = new HashMap();
+    static
+    {
+        modelClasses.put("FragmentImpl.class", FragmentImpl.class);
+        modelClasses.put("PageImpl.class", PageImpl.class);
+        modelClasses.put("FolderImpl.class", FolderImpl.class);
+        //modelClasses.put("LinkImpl.class", LinkImpl.class);
+        //modelClasses.put("PropertyImpl.class", PropertyImpl.class);
+        //modelClasses.put("MenuDefinitionImpl.class", MenuDefinitionImpl.class);
+        //modelClasses.put("MenuExcludeDefinitionImpl.class", MenuExcludeDefinitionImpl.class);
+        //modelClasses.put("MenuIncludeDefinitionImpl.class", MenuIncludeDefinitionImpl.class);
+        //modelClasses.put("MenuOptionsDefinitionImpl.class", MenuOptionsDefinitionImpl.class);
+        //modelClasses.put("MenuSeparatorDefinitionImpl.class", MenuSeparatorDefinitionImpl.class);
+        //modelClasses.put("SecurityConstraintsImpl.class", SecurityConstraintsImpl.class);
+        //modelClasses.put("SecurityConstraintImpl.class", SecurityConstraintImpl.class);
+    }
+
     private DelegatingPageManager delegator;
     
     public DatabasePageManager(
@@ -58,7 +79,7 @@
     {
         super(repositoryPath);
         System.out.println("Page Manager repo = " + repositoryPath);
-        delegator = new DelegatingPageManager(generator, isPermissionsSecurity, isConstraintsSecurity);
+        delegator = new DelegatingPageManager(generator, isPermissionsSecurity, isConstraintsSecurity,
modelClasses);
     }
 
     /* (non-Javadoc)

Modified: portals/jetspeed-2/trunk/components/page-manager/src/java/org/apache/jetspeed/page/impl/DelegatingPageManager.java
URL: http://svn.apache.org/viewcvs/portals/jetspeed-2/trunk/components/page-manager/src/java/org/apache/jetspeed/page/impl/DelegatingPageManager.java?rev=314917&r1=314916&r2=314917&view=diff
==============================================================================
--- portals/jetspeed-2/trunk/components/page-manager/src/java/org/apache/jetspeed/page/impl/DelegatingPageManager.java
(original)
+++ portals/jetspeed-2/trunk/components/page-manager/src/java/org/apache/jetspeed/page/impl/DelegatingPageManager.java
Wed Oct 12 07:15:00 2005
@@ -1,5 +1,7 @@
 package org.apache.jetspeed.page.impl;
 
+import java.util.Map;
+
 import org.apache.jetspeed.exception.JetspeedException;
 import org.apache.jetspeed.idgenerator.IdGenerator;
 import org.apache.jetspeed.om.folder.Folder;
@@ -34,9 +36,10 @@
     DelegatingPageManager(
             IdGenerator generator, 
             boolean isPermissionsSecurity, 
-            boolean isConstraintsSecurity)
+            boolean isConstraintsSecurity,
+            Map modelClasses)
     {
-        super(generator, isPermissionsSecurity, isConstraintsSecurity);
+        super(generator, isPermissionsSecurity, isConstraintsSecurity, modelClasses);
     }
     /* (non-Javadoc)
      * @see org.apache.jetspeed.page.PageManager#getPage(java.lang.String)

Modified: portals/jetspeed-2/trunk/components/page-manager/src/java/org/apache/jetspeed/page/psml/CastorXmlPageManager.java
URL: http://svn.apache.org/viewcvs/portals/jetspeed-2/trunk/components/page-manager/src/java/org/apache/jetspeed/page/psml/CastorXmlPageManager.java?rev=314917&r1=314916&r2=314917&view=diff
==============================================================================
--- portals/jetspeed-2/trunk/components/page-manager/src/java/org/apache/jetspeed/page/psml/CastorXmlPageManager.java
(original)
+++ portals/jetspeed-2/trunk/components/page-manager/src/java/org/apache/jetspeed/page/psml/CastorXmlPageManager.java
Wed Oct 12 07:15:00 2005
@@ -17,7 +17,9 @@
 package org.apache.jetspeed.page.psml;
 
 import java.io.FileNotFoundException;
+import java.util.HashMap;
 import java.util.List;
+import java.util.Map;
 
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
@@ -31,13 +33,22 @@
 import org.apache.jetspeed.om.folder.FolderNotFoundException;
 import org.apache.jetspeed.om.folder.InvalidFolderException;
 import org.apache.jetspeed.om.folder.psml.FolderImpl;
+import org.apache.jetspeed.om.folder.psml.MenuDefinitionImpl;
+import org.apache.jetspeed.om.folder.psml.MenuExcludeDefinitionImpl;
+import org.apache.jetspeed.om.folder.psml.MenuIncludeDefinitionImpl;
+import org.apache.jetspeed.om.folder.psml.MenuOptionsDefinitionImpl;
+import org.apache.jetspeed.om.folder.psml.MenuSeparatorDefinitionImpl;
 import org.apache.jetspeed.om.page.ContentPage;
 import org.apache.jetspeed.om.page.Link;
 import org.apache.jetspeed.om.page.Page;
 import org.apache.jetspeed.om.page.PageSecurity;
 import org.apache.jetspeed.om.page.psml.ContentPageImpl;
+import org.apache.jetspeed.om.page.psml.FragmentImpl;
 import org.apache.jetspeed.om.page.psml.LinkImpl;
 import org.apache.jetspeed.om.page.psml.PageImpl;
+import org.apache.jetspeed.om.page.psml.PropertyImpl;
+import org.apache.jetspeed.om.page.psml.SecurityConstraintImpl;
+import org.apache.jetspeed.om.page.psml.SecurityConstraintsImpl;
 import org.apache.jetspeed.page.PageManager;
 import org.apache.jetspeed.page.PageNotFoundException;
 import org.apache.jetspeed.page.document.DocumentHandlerFactory;
@@ -64,31 +75,30 @@
     protected final static String PROFILE_PROPERTY_FOLDER_PREFIX = "_";
     protected final static String PROFILE_NAVIGATION_PROPERTY_FOLDER_PREFIX = "__";
 
-    private DocumentHandlerFactory handlerFactory;
+    private static Map modelClasses = new HashMap();
+    static
+    {
+        modelClasses.put("FragmentImpl.class", FragmentImpl.class);
+        modelClasses.put("PageImpl.class", PageImpl.class);
+        modelClasses.put("FolderImpl.class", FolderImpl.class);
+        modelClasses.put("LinkImpl.class", LinkImpl.class);
+        modelClasses.put("PropertyImpl.class", PropertyImpl.class);
+        modelClasses.put("MenuDefinitionImpl.class", MenuDefinitionImpl.class);
+        modelClasses.put("MenuExcludeDefinitionImpl.class", MenuExcludeDefinitionImpl.class);
+        modelClasses.put("MenuIncludeDefinitionImpl.class", MenuIncludeDefinitionImpl.class);
+        modelClasses.put("MenuOptionsDefinitionImpl.class", MenuOptionsDefinitionImpl.class);
+        modelClasses.put("MenuSeparatorDefinitionImpl.class", MenuSeparatorDefinitionImpl.class);
+        modelClasses.put("SecurityConstraintsImpl.class", SecurityConstraintsImpl.class);
+        modelClasses.put("SecurityConstraintImpl.class", SecurityConstraintImpl.class);
+    }
 
+    private DocumentHandlerFactory handlerFactory;
     private FolderHandler folderHandler;
-
     private FileCache fileCache;
 
-    // default configuration values
-
     public CastorXmlPageManager( IdGenerator generator, DocumentHandlerFactory handlerFactory,
                                  FolderHandler folderHandler, FileCache fileCache,
                                  boolean permissionsEnabled, boolean constraintsEnabled )
throws FileNotFoundException
-    {
-        super(generator, permissionsEnabled, constraintsEnabled);
-        handlerFactory.setPermissionsEnabled(permissionsEnabled);
-        handlerFactory.setConstraintsEnabled(constraintsEnabled);
-        this.handlerFactory = handlerFactory;
-        this.folderHandler = folderHandler;
-        this.fileCache = fileCache;
-        this.fileCache.addListener(this);
-    }
-
-    public CastorXmlPageManager( IdGenerator generator, DocumentHandlerFactory handlerFactory,
-                                 FolderHandler folderHandler, FileCache fileCache,
-                                 boolean permissionsEnabled, boolean constraintsEnabled,
-                                 List modelClasses ) throws FileNotFoundException
     {
         super(generator, permissionsEnabled, constraintsEnabled, modelClasses);
         handlerFactory.setPermissionsEnabled(permissionsEnabled);



---------------------------------------------------------------------
To unsubscribe, e-mail: jetspeed-dev-unsubscribe@portals.apache.org
For additional commands, e-mail: jetspeed-dev-help@portals.apache.org


Mime
View raw message