You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jetspeed-dev@portals.apache.org by ta...@apache.org on 2005/12/06 09:55:36 UTC

svn commit: r354372 - in /portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/decoration: DecorationFactoryImpl.java LayoutDecorationImpl.java LayoutInfoImpl.java validators/WebApplicationResourceValidator.java

Author: taylor
Date: Tue Dec  6 00:55:34 2005
New Revision: 354372

URL: http://svn.apache.org/viewcvs?rev=354372&view=rev
Log:
enhance customizer to support
* select portlet decoration
* select page decoration
* select layout (this is experimental, may come out tomorrow before code freeze)

Added:
    portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/decoration/LayoutInfoImpl.java
Modified:
    portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/decoration/DecorationFactoryImpl.java
    portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/decoration/LayoutDecorationImpl.java
    portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/decoration/validators/WebApplicationResourceValidator.java

Modified: portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/decoration/DecorationFactoryImpl.java
URL: http://svn.apache.org/viewcvs/portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/decoration/DecorationFactoryImpl.java?rev=354372&r1=354371&r2=354372&view=diff
==============================================================================
--- portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/decoration/DecorationFactoryImpl.java (original)
+++ portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/decoration/DecorationFactoryImpl.java Tue Dec  6 00:55:34 2005
@@ -17,6 +17,9 @@
 
 import java.io.IOException;
 import java.io.InputStream;
+import java.util.Iterator;
+import java.util.LinkedList;
+import java.util.List;
 import java.util.Locale;
 import java.util.Properties;
 
@@ -24,10 +27,15 @@
 
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
+import org.apache.jetspeed.components.portletregistry.PortletRegistry;
 import org.apache.jetspeed.decoration.caches.SessionPathResolverCache;
+import org.apache.jetspeed.om.common.SecuredResource;
+import org.apache.jetspeed.om.common.portlet.MutablePortletApplication;
+import org.apache.jetspeed.om.common.portlet.PortletDefinitionComposite;
 import org.apache.jetspeed.om.page.Fragment;
 import org.apache.jetspeed.om.page.Page;
 import org.apache.jetspeed.request.RequestContext;
+import org.apache.jetspeed.security.PortletPermission;
 import org.apache.jetspeed.util.Path;
 import org.springframework.web.context.ServletContextAware;
 
@@ -44,11 +52,26 @@
     private final ResourceValidator validator;
     private final String defaultLayoutDecorator;    
     private final String defaultPortletDecorator;
+    private final PortletRegistry registry;
     
     private ServletContext servletContext;    
 
     public DecorationFactoryImpl(String decorationsPath, ResourceValidator validator, String defaultLayoutDecorator, String defaultPortletDecorator)
     {
+        this.registry = null;
+        this.decorationsPath = new Path(decorationsPath);
+        this.validator = validator;
+        this.defaultLayoutDecorator = defaultLayoutDecorator;
+        this.defaultPortletDecorator = defaultPortletDecorator;
+    }
+
+    public DecorationFactoryImpl(PortletRegistry registry,
+                                 String decorationsPath, 
+                                 ResourceValidator validator, 
+                                 String defaultLayoutDecorator, 
+                                 String defaultPortletDecorator)
+    {
+        this.registry =  registry;
         this.decorationsPath = new Path(decorationsPath);
         this.validator = validator;
         this.defaultLayoutDecorator = defaultLayoutDecorator;
@@ -172,4 +195,72 @@
         return decoration;
     }
 
+    /**
+     * Get the portal-wide list of page decorations.
+     * 
+     * @return A list of page decorations of type <code>Decoration</code>
+     */
+    public List getPageDecorations(RequestContext request)
+    {
+        List list = new LinkedList();
+        /// TODO: hard code until Scotts commits arrive with new directory format
+        list.add("clear");
+        list.add("jetspeed");
+        list.add("jscookmenu");
+        list.add("metal");
+        list.add("minty-blue");
+        list.add("simple");
+        list.add("tigris");
+        return list;
+    }
+
+    /**
+     * Get the portal-wide list of portlet decorations.
+     * 
+     * @return A list of portlet decorations of type <code>String</code>
+     */    
+    public List getPortletDecorations(RequestContext request)
+    {
+        List list = new LinkedList();
+        /// TODO: hard code until Scotts commits arrive with new directory format        
+        list.add("blue-gradient");
+        list.add("clear");
+        list.add("gray-gradient");
+        list.add("gray-gradient-noborder");
+        list.add("jetspeed");
+        list.add("metal");
+        list.add("minty-blue");
+        list.add("pretty-single-portlet");
+        list.add("tigris");        
+        return list;
+    }
+    
+    /**
+     * Get the portal-wide list of available layouts.
+     * 
+     * @return A list of layout portlets of type <code>PortletDefinitionComposite</code>
+     */    
+    public List getLayouts(RequestContext request)
+    {
+        List list = new LinkedList();
+        Iterator portlets = registry.getAllPortletDefinitions().iterator();
+        while (portlets.hasNext())
+        {
+            PortletDefinitionComposite portlet = (PortletDefinitionComposite)portlets.next();
+            MutablePortletApplication muta = (MutablePortletApplication)portlet.getPortletApplicationDefinition();
+            String appName = muta.getName();
+            if (appName == null)
+                continue;       
+            if (!appName.equals("jetspeed-layouts"))
+                continue;
+            
+            String uniqueName = appName + "::" + portlet.getName();
+            list.add(new LayoutInfoImpl(uniqueName, 
+                     portlet.getDisplayNameText(request.getLocale()), 
+                     portlet.getDescriptionText(request.getLocale())));
+            
+        }
+        return list;
+    }
+    
 }

Modified: portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/decoration/LayoutDecorationImpl.java
URL: http://svn.apache.org/viewcvs/portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/decoration/LayoutDecorationImpl.java?rev=354372&r1=354371&r2=354372&view=diff
==============================================================================
--- portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/decoration/LayoutDecorationImpl.java (original)
+++ portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/decoration/LayoutDecorationImpl.java Tue Dec  6 00:55:34 2005
@@ -15,9 +15,7 @@
  */
 package org.apache.jetspeed.decoration;
 
-import java.util.LinkedHashSet;
 import java.util.Properties;
-import java.util.Set;
 
 import org.apache.jetspeed.util.Path;
 

Added: portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/decoration/LayoutInfoImpl.java
URL: http://svn.apache.org/viewcvs/portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/decoration/LayoutInfoImpl.java?rev=354372&view=auto
==============================================================================
--- portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/decoration/LayoutInfoImpl.java (added)
+++ portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/decoration/LayoutInfoImpl.java Tue Dec  6 00:55:34 2005
@@ -0,0 +1,50 @@
+/*
+ * Copyright 2000-2001,2004 The Apache Software Foundation.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.apache.jetspeed.decoration;
+
+/**
+ * 
+ * @author <href a="mailto:weaver@apache.org">Scott T. Weaver</a>
+ *
+ */
+public class LayoutInfoImpl implements LayoutInfo
+{
+    private String name;
+    private String displayName;
+    private String description;
+    
+    public LayoutInfoImpl(String name, String displayName, String description)
+    {
+        this.name = name;
+        this.displayName = displayName;
+        this.description = description;
+    }
+    
+    public String getName()
+    {
+        return this.name;
+    }
+    
+    public String getDescription()
+    {
+        return this.description;
+    }
+    
+    public String getDisplayName()
+    {
+        return this.displayName;
+    }        
+}

Modified: portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/decoration/validators/WebApplicationResourceValidator.java
URL: http://svn.apache.org/viewcvs/portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/decoration/validators/WebApplicationResourceValidator.java?rev=354372&r1=354371&r2=354372&view=diff
==============================================================================
--- portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/decoration/validators/WebApplicationResourceValidator.java (original)
+++ portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/decoration/validators/WebApplicationResourceValidator.java Tue Dec  6 00:55:34 2005
@@ -30,11 +30,11 @@
  */
 public class WebApplicationResourceValidator implements ResourceValidator
 {
-    private final ServletContext servletContext;
+    private ServletContext servletContext;
     
-    public WebApplicationResourceValidator(ServletContext servletContext)
+    public void setServletContext(ServletContext servletContext)
     {
-        this.servletContext = servletContext;
+        this.servletContext = servletContext;        
     }
 
     public boolean resourceExists(String path)



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