You are viewing a plain text version of this content. The canonical link for it is here.
Posted to pluto-scm@portals.apache.org by dd...@apache.org on 2007/02/04 04:53:47 UTC

svn commit: r503352 - in /portals/pluto/trunk: pluto-descriptor-api/src/main/java/org/apache/pluto/descriptors/portlet/ pluto-descriptor-impl/src/main/resources/org/apache/pluto/descriptors/services/castor/ pluto-descriptor-impl/src/test/java/org/apach...

Author: ddewolf
Date: Sat Feb  3 19:53:46 2007
New Revision: 503352

URL: http://svn.apache.org/viewvc?view=rev&rev=503352
Log:
More descriptor updates;PLUTO-293 

Added:
    portals/pluto/trunk/pluto-descriptor-api/src/main/java/org/apache/pluto/descriptors/portlet/DescriptionDD.java   (with props)
    portals/pluto/trunk/pluto-descriptor-api/src/main/java/org/apache/pluto/descriptors/portlet/DisplayNameDD.java   (with props)
Modified:
    portals/pluto/trunk/pluto-descriptor-api/src/main/java/org/apache/pluto/descriptors/portlet/PortletDD.java
    portals/pluto/trunk/pluto-descriptor-api/src/main/java/org/apache/pluto/descriptors/portlet/SecurityConstraintDD.java
    portals/pluto/trunk/pluto-descriptor-impl/src/main/resources/org/apache/pluto/descriptors/services/castor/castor-portlet-xml-mapping.xml
    portals/pluto/trunk/pluto-descriptor-impl/src/test/java/org/apache/pluto/descriptors/services/castor/PortletAppDescriptorServiceImplTest.java

Added: portals/pluto/trunk/pluto-descriptor-api/src/main/java/org/apache/pluto/descriptors/portlet/DescriptionDD.java
URL: http://svn.apache.org/viewvc/portals/pluto/trunk/pluto-descriptor-api/src/main/java/org/apache/pluto/descriptors/portlet/DescriptionDD.java?view=auto&rev=503352
==============================================================================
--- portals/pluto/trunk/pluto-descriptor-api/src/main/java/org/apache/pluto/descriptors/portlet/DescriptionDD.java (added)
+++ portals/pluto/trunk/pluto-descriptor-api/src/main/java/org/apache/pluto/descriptors/portlet/DescriptionDD.java Sat Feb  3 19:53:46 2007
@@ -0,0 +1,41 @@
+/*
+ * Copyright 2005 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.pluto.descriptors.portlet;
+
+import java.util.Locale;
+
+public class DescriptionDD {
+
+    private String description;
+
+    private String lang = Locale.ENGLISH.toString();
+
+    public String getDescription() {
+        return description;
+    }
+
+    public void setDescription(String description) {
+        this.description = description;
+    }
+
+    public String getLang() {
+        return lang;
+    }
+
+    public void setLang(String lang) {
+        this.lang = lang;
+    }
+}

Propchange: portals/pluto/trunk/pluto-descriptor-api/src/main/java/org/apache/pluto/descriptors/portlet/DescriptionDD.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: portals/pluto/trunk/pluto-descriptor-api/src/main/java/org/apache/pluto/descriptors/portlet/DescriptionDD.java
------------------------------------------------------------------------------
    svn:keywords = Id Author Date Rev

Added: portals/pluto/trunk/pluto-descriptor-api/src/main/java/org/apache/pluto/descriptors/portlet/DisplayNameDD.java
URL: http://svn.apache.org/viewvc/portals/pluto/trunk/pluto-descriptor-api/src/main/java/org/apache/pluto/descriptors/portlet/DisplayNameDD.java?view=auto&rev=503352
==============================================================================
--- portals/pluto/trunk/pluto-descriptor-api/src/main/java/org/apache/pluto/descriptors/portlet/DisplayNameDD.java (added)
+++ portals/pluto/trunk/pluto-descriptor-api/src/main/java/org/apache/pluto/descriptors/portlet/DisplayNameDD.java Sat Feb  3 19:53:46 2007
@@ -0,0 +1,45 @@
+/*
+ * Copyright 2007 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.pluto.descriptors.portlet;
+
+import java.util.Locale;
+
+/**
+ *
+ * @author David H. DeWolf
+ * @since 1.1.0
+ */
+public class DisplayNameDD {
+
+    private String displayName;
+    private String lang = Locale.ENGLISH.toString();
+
+    public String getDisplayName() {
+        return displayName;
+    }
+
+    public void setDisplayName(String displayName) {
+        this.displayName = displayName;
+    }
+
+    public String getLang() {
+        return lang;
+    }
+
+    public void setLang(String lang) {
+        this.lang = lang;
+    }
+}

Propchange: portals/pluto/trunk/pluto-descriptor-api/src/main/java/org/apache/pluto/descriptors/portlet/DisplayNameDD.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: portals/pluto/trunk/pluto-descriptor-api/src/main/java/org/apache/pluto/descriptors/portlet/DisplayNameDD.java
------------------------------------------------------------------------------
    svn:keywords = Id Author Date Rev

Modified: portals/pluto/trunk/pluto-descriptor-api/src/main/java/org/apache/pluto/descriptors/portlet/PortletDD.java
URL: http://svn.apache.org/viewvc/portals/pluto/trunk/pluto-descriptor-api/src/main/java/org/apache/pluto/descriptors/portlet/PortletDD.java?view=diff&rev=503352&r1=503351&r2=503352
==============================================================================
--- portals/pluto/trunk/pluto-descriptor-api/src/main/java/org/apache/pluto/descriptors/portlet/PortletDD.java (original)
+++ portals/pluto/trunk/pluto-descriptor-api/src/main/java/org/apache/pluto/descriptors/portlet/PortletDD.java Sat Feb  3 19:53:46 2007
@@ -37,6 +37,11 @@
     /** The unique name of the portlet. */
     private String portletName = null;
 
+    /** The display name of the portlet. */
+    private List displayNames = new ArrayList();
+
+    private int expirationCache = 0;
+
     /** The class which implements the portlet interface. */
     private String portletClass = null;
 
@@ -50,6 +55,8 @@
 
     private List supports = new ArrayList();
 
+    private List supportedLocales = new ArrayList();
+
     /** All security role references. */
     private List securityRoleRefs = new ArrayList();
     
@@ -88,6 +95,22 @@
         this.portletName = portletName;
     }
 
+    public List getDisplayNames() {
+        return displayNames;
+    }
+
+    public void setDisplayNames(List displayNames) {
+        this.displayNames = displayNames;
+    }
+
+    public int getExpirationCache() {
+        return expirationCache;
+    }
+
+    public void setExpirationCache(int expirationCache) {
+        this.expirationCache = expirationCache;
+    }
+
     /**
      * Retrieve the name of the portlet class.
      * @return the fully qualified portlet class name.
@@ -126,6 +149,14 @@
 
     public void setSupports(List supports) {
         this.supports = supports;
+    }
+
+    public List getSupportedLocales() {
+        return supportedLocales;
+    }
+
+    public void setSupportedLocales(List supportedLocales) {
+        this.supportedLocales = supportedLocales;
     }
 
     public List getInitParams() {

Modified: portals/pluto/trunk/pluto-descriptor-api/src/main/java/org/apache/pluto/descriptors/portlet/SecurityConstraintDD.java
URL: http://svn.apache.org/viewvc/portals/pluto/trunk/pluto-descriptor-api/src/main/java/org/apache/pluto/descriptors/portlet/SecurityConstraintDD.java?view=diff&rev=503352&r1=503351&r2=503352
==============================================================================
--- portals/pluto/trunk/pluto-descriptor-api/src/main/java/org/apache/pluto/descriptors/portlet/SecurityConstraintDD.java (original)
+++ portals/pluto/trunk/pluto-descriptor-api/src/main/java/org/apache/pluto/descriptors/portlet/SecurityConstraintDD.java Sat Feb  3 19:53:46 2007
@@ -17,19 +17,21 @@
 
 import org.apache.pluto.descriptors.common.UserDataConstraintDD;
 
+import java.util.List;
+
 
 public class SecurityConstraintDD {
 
-    private String displayName;
+    private List displayNames;
     private PortletCollectionDD portletCollection;
     private UserDataConstraintDD userDataConstraint;
 
-    public String getDisplayName() {
-        return displayName;
+    public List getDisplayNames() {
+        return displayNames;
     }
 
-    public void setDisplayName(String displayName) {
-        this.displayName = displayName;
+    public void setDisplayNames(List displayNames) {
+        this.displayNames = displayNames;
     }
 
     public PortletCollectionDD getPortletCollection() {

Modified: portals/pluto/trunk/pluto-descriptor-impl/src/main/resources/org/apache/pluto/descriptors/services/castor/castor-portlet-xml-mapping.xml
URL: http://svn.apache.org/viewvc/portals/pluto/trunk/pluto-descriptor-impl/src/main/resources/org/apache/pluto/descriptors/services/castor/castor-portlet-xml-mapping.xml?view=diff&rev=503352&r1=503351&r2=503352
==============================================================================
--- portals/pluto/trunk/pluto-descriptor-impl/src/main/resources/org/apache/pluto/descriptors/services/castor/castor-portlet-xml-mapping.xml (original)
+++ portals/pluto/trunk/pluto-descriptor-impl/src/main/resources/org/apache/pluto/descriptors/services/castor/castor-portlet-xml-mapping.xml Sat Feb  3 19:53:46 2007
@@ -64,6 +64,15 @@
             <bind-xml name="portlet-name" node="element"/>
         </field>
 
+        <field name="DisplayNames" type="org.apache.pluto.descriptors.portlet.DisplayNameDD"
+            collection="arraylist">
+            <bind-xml name="display-name" node="element"/>
+        </field>
+
+        <field name="ExpirationCache">
+            <bind-xml name="expiration-cache" node="element"/>
+        </field>
+
         <field name="PortletClass">
             <bind-xml name="portlet-class" node="element"/>
         </field>
@@ -91,6 +100,11 @@
             <bind-xml name="supports" node="element"/>
         </field>
 
+        <field name="SupportedLocales" type="java.lang.String"
+               collection="arraylist">
+            <bind-xml name="supported-locale" node="element"/>
+        </field>
+
         <field name="PortletPreferences" type="org.apache.pluto.descriptors.portlet.PortletPreferencesDD">
             <bind-xml name="portlet-preferences" node="element"/>
         </field>
@@ -184,7 +198,8 @@
     </class>
 
     <class name="org.apache.pluto.descriptors.portlet.SecurityConstraintDD">
-        <field name="DisplayName">
+        <field name="DisplayNames" type="org.apache.pluto.descriptors.portlet.DisplayNameDD"
+            collection="arraylist">
             <bind-xml name="display-name" node="element"/>
         </field>
 
@@ -210,6 +225,16 @@
 
         <field name="TransportGuarantee">
             <bind-xml name="transport-guarantee" node="element"/>
+        </field>
+    </class>
+
+    <class name="org.apache.pluto.descriptors.portlet.DisplayNameDD">
+        <field name="Lang">
+            <bind-xml name="lang" node="attribute"/>
+        </field>
+
+        <field name="DisplayName">
+            <bind-xml name="display-name" node="text"/>
         </field>
     </class>
 

Modified: portals/pluto/trunk/pluto-descriptor-impl/src/test/java/org/apache/pluto/descriptors/services/castor/PortletAppDescriptorServiceImplTest.java
URL: http://svn.apache.org/viewvc/portals/pluto/trunk/pluto-descriptor-impl/src/test/java/org/apache/pluto/descriptors/services/castor/PortletAppDescriptorServiceImplTest.java?view=diff&rev=503352&r1=503351&r2=503352
==============================================================================
--- portals/pluto/trunk/pluto-descriptor-impl/src/test/java/org/apache/pluto/descriptors/services/castor/PortletAppDescriptorServiceImplTest.java (original)
+++ portals/pluto/trunk/pluto-descriptor-impl/src/test/java/org/apache/pluto/descriptors/services/castor/PortletAppDescriptorServiceImplTest.java Sat Feb  3 19:53:46 2007
@@ -23,6 +23,8 @@
 
 import org.apache.pluto.descriptors.portlet.PortletAppDD;
 import org.apache.pluto.descriptors.portlet.SecurityConstraintDD;
+import org.apache.pluto.descriptors.portlet.PortletDD;
+import org.apache.pluto.descriptors.portlet.DisplayNameDD;
 
 /**
  *
@@ -43,7 +45,17 @@
 
         PortletAppDD dd = service.read(in);
         assertEquals("1.0", dd.getVersion());
-        assertEquals(0, dd.getPortlets().size());
+        assertEquals(1, dd.getPortlets().size());
+
+        PortletDD pd = (PortletDD)dd.getPortlets().get(0);
+        assertEquals(2, pd.getDisplayNames().size());
+        assertEquals("About Portlet", ((DisplayNameDD)pd.getDisplayNames().get(0)).getDisplayName());
+        assertEquals("en", ((DisplayNameDD)pd.getDisplayNames().get(0)).getLang());
+        assertEquals("fr", ((DisplayNameDD)pd.getDisplayNames().get(1)).getLang());
+        assertEquals(30, pd.getExpirationCache());
+        assertEquals(1, pd.getSupportedLocales().size());
+        assertEquals("en", pd.getSupportedLocales().get(0));
+
         assertEquals(2, dd.getCustomPortletModes().size());
         assertEquals(2, dd.getCustomWindowStates().size());
         assertEquals(1, dd.getUserAttributes().size());
@@ -51,7 +63,7 @@
 
         SecurityConstraintDD sc = (SecurityConstraintDD)dd.getSecurityConstraints().get(0);
         assertNotNull(sc.getPortletCollection());
-        assertEquals("description", sc.getDisplayName());
+        assertEquals(1, sc.getDisplayNames().size());
         assertEquals(3, sc.getPortletCollection().getPortletNames().size());
         assertEquals("a", sc.getPortletCollection().getPortletNames().get(0));
         assertEquals("b", sc.getPortletCollection().getPortletNames().get(1));
@@ -71,6 +83,24 @@
         "    xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n" +
         "    xsi:schemaLocation=\"http://java.sun.com/xml/ns/portlet/portlet-app_1_0.xsd\n" +
         "                        http://java.sun.com/xml/ns/portlet/portlet-app_1_0.xsd\">" +
+        "<portlet>"+
+        "<description>AboutPortletDescription</description>"+
+        "<portlet-name>AboutPortlet</portlet-name>"+
+        "<display-name>About Portlet</display-name>"+
+        "<display-name xml:lang=\"fr\">About Portlet</display-name>"+
+        "<portlet-class>org.apache.pluto.driver.portlets.AboutPortlet</portlet-class>"+
+        "<expiration-cache>30</expiration-cache>"+
+        "<supports>"+
+        "<mime-type>text/html</mime-type>"+
+        "<portlet-mode>VIEW</portlet-mode>"+
+        "<portlet-mode>EDIT</portlet-mode>"+
+        "<portlet-mode>HELP</portlet-mode>"+
+        "</supports>"+
+        "<supported-locale>en</supported-locale>"+
+        "<portlet-info>"+
+        "<title>About Apache Pluto</title>"+
+        "</portlet-info>"+
+        "</portlet>"+
         " <custom-portlet-mode><description>Test</description><portlet-mode>customMode</portlet-mode></custom-portlet-mode>" +
         " <custom-portlet-mode><description>Test2</description><portlet-mode>customMode2</portlet-mode></custom-portlet-mode>" +
         " <custom-window-state><description>Test</description><window-state>customWindow</window-state></custom-window-state>" +