portals-jetspeed-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tay...@apache.org
Subject cvs commit: jakarta-jetspeed-2/portal/src/webapp/WEB-INF/psml/user/anon/html default.psml
Date Tue, 07 Oct 2003 21:38:17 GMT
taylor      2003/10/07 14:38:17

  Modified:    commons/src/java/org/apache/jetspeed/om/common/portlet
                        ContentTypeComposite.java ContentTypeImpl.java
               commons/src/java/org/apache/jetspeed/tools/castor/om/common/portlet
                        ContentTypeDescriptor.java
                        PortletDefinitionDescriptor.java
               portal   maven.xml
               portal/src/java/org/apache/jetspeed/util/ojb
                        CSVtoCollectionFieldConversion.java
               portal/src/test/org/apache/jetspeed/services/registry
                        TestRegistry.java
               portal/src/test/org/apache/jetspeed/tools/pamanager
                        TestPortletDescriptor.java
               portal/src/webapp/WEB-INF/conf/ojb repository_jetspeed.xml
               portal/src/webapp/WEB-INF/psml/user/anon/html default.psml
  Added:       portal/src/java/org/apache/jetspeed/util/ojb
                        CSVtoPortletModeFieldConversion.java
  Log:
  1. Modified ContentType to keep a list of PortletMode objects, not Strings per latest Portlet
API
  	- OJB mapping for registry
  	- Castor mapping for deployment descriptors
  2. Commented out PreferencePortlet from the PSML as it has identified a infinite loop in
the implementation
     Need to debug this one later
  
  3. Updated Unit Tests for PortletMode change
  
  Revision  Changes    Path
  1.2       +5 -3      jakarta-jetspeed-2/commons/src/java/org/apache/jetspeed/om/common/portlet/ContentTypeComposite.java
  
  Index: ContentTypeComposite.java
  ===================================================================
  RCS file: /home/cvs/jakarta-jetspeed-2/commons/src/java/org/apache/jetspeed/om/common/portlet/ContentTypeComposite.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- ContentTypeComposite.java	28 Jul 2003 23:46:40 -0000	1.1
  +++ ContentTypeComposite.java	7 Oct 2003 21:38:16 -0000	1.2
  @@ -56,6 +56,8 @@
   import java.io.Serializable;
   import java.util.Collection;
   
  +import javax.portlet.PortletMode;
  +
   import org.apache.pluto.om.portlet.ContentType;
   /**
    * 
  @@ -79,7 +81,7 @@
        * already exists, the same mode is NOT added again.
        * @param mode portlet mode to add.
        */
  -    void addPortletMode(String mode);
  +    void addPortletMode(PortletMode mode);
   
       /**
        * Checks whether or not the <code>mode</code>
  @@ -88,7 +90,7 @@
        * @return <code>true</code> if the <code>mode</code> is
        * supported, otherwise <code>false</code>.
        */
  -    boolean supportsPortletMode(String mode);
  +    boolean supportsPortletMode(PortletMode mode);
   
       /**
        * 
  
  
  
  1.2       +9 -7      jakarta-jetspeed-2/commons/src/java/org/apache/jetspeed/om/common/portlet/ContentTypeImpl.java
  
  Index: ContentTypeImpl.java
  ===================================================================
  RCS file: /home/cvs/jakarta-jetspeed-2/commons/src/java/org/apache/jetspeed/om/common/portlet/ContentTypeImpl.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- ContentTypeImpl.java	30 Jul 2003 18:30:15 -0000	1.1
  +++ ContentTypeImpl.java	7 Oct 2003 21:38:16 -0000	1.2
  @@ -58,6 +58,8 @@
   import java.util.HashSet;
   import java.util.Iterator;
   
  +import javax.portlet.PortletMode;
  +
   import org.apache.jetspeed.util.HashCodeBuilder;
   import org.apache.pluto.om.portlet.ContentType;
   
  @@ -135,10 +137,10 @@
           return hasher.toHashCode();
       }
   
  -    /**
  -     * @see org.apache.jetspeed.om.common.portlet.ContentTypeComposite#addMode(java.lang.String)
  +    /* (non-Javadoc)
  +     * @see org.apache.jetspeed.om.common.portlet.ContentTypeComposite#addPortletMode(javax.portlet.PortletMode)
        */
  -    public void addPortletMode(String mode)
  +    public void addPortletMode(PortletMode mode)
       {
           portletModes.add(mode);
   
  @@ -152,10 +154,10 @@
           portletModes = modes;
       }
   
  -    /**
  -     * @see org.apache.jetspeed.om.common.portlet.ContentTypeComposite#supportsPortletMode(java.lang.String)
  +    /* (non-Javadoc)
  +     * @see org.apache.jetspeed.om.common.portlet.ContentTypeComposite#supportsPortletMode(javax.portlet.PortletMode)
        */
  -    public boolean supportsPortletMode(String mode)
  +    public boolean supportsPortletMode(PortletMode mode)
       {
           return portletModes.contains(mode);
       }
  
  
  
  1.3       +5 -3      jakarta-jetspeed-2/commons/src/java/org/apache/jetspeed/tools/castor/om/common/portlet/ContentTypeDescriptor.java
  
  Index: ContentTypeDescriptor.java
  ===================================================================
  RCS file: /home/cvs/jakarta-jetspeed-2/commons/src/java/org/apache/jetspeed/tools/castor/om/common/portlet/ContentTypeDescriptor.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- ContentTypeDescriptor.java	30 Jul 2003 18:30:15 -0000	1.2
  +++ ContentTypeDescriptor.java	7 Oct 2003 21:38:16 -0000	1.3
  @@ -65,14 +65,16 @@
    */
   public class ContentTypeDescriptor extends ContentTypeImpl
   {
  +    protected Collection castorPortletModes; 
  +    
       public Collection getCastorPortletModes() 
       {
  -        return this.portletModes;    
  +        return this.castorPortletModes;    
       }
   
       public void setCastorPortletModes(Collection modes) 
       {
  -        this.setPortletModes(modes);
  +        castorPortletModes = modes;
       }
       
   }
  
  
  
  1.5       +19 -1     jakarta-jetspeed-2/commons/src/java/org/apache/jetspeed/tools/castor/om/common/portlet/PortletDefinitionDescriptor.java
  
  Index: PortletDefinitionDescriptor.java
  ===================================================================
  RCS file: /home/cvs/jakarta-jetspeed-2/commons/src/java/org/apache/jetspeed/tools/castor/om/common/portlet/PortletDefinitionDescriptor.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- PortletDefinitionDescriptor.java	5 Aug 2003 18:45:43 -0000	1.4
  +++ PortletDefinitionDescriptor.java	7 Oct 2003 21:38:16 -0000	1.5
  @@ -57,12 +57,15 @@
   import java.util.ArrayList;
   import java.util.Iterator;
   
  +import javax.portlet.PortletMode;
  +
   import org.apache.jetspeed.om.common.portlet.PortletDefinitionImpl;
   import org.apache.jetspeed.om.common.preference.PreferenceSetImpl;
   import org.apache.jetspeed.tools.castor.om.common.LanguageSetDescriptor;
   import org.apache.jetspeed.tools.castor.om.common.PreferenceDescriptor;
   import org.apache.jetspeed.tools.castor.om.common.PreferenceSetDescriptor;
   import org.apache.jetspeed.om.common.LanguageSetImpl;
  +import org.apache.pluto.om.portlet.ContentTypeSet;
   
   /**
    * Used to help Castor in mapping XML portlet types to Java objects 
  @@ -149,5 +152,20 @@
               PreferenceDescriptor pd  = (PreferenceDescriptor)prefs.next();
               pd.setCastorValues(pd.getCastorValues());
           }
  +        
  +        // convert string collection representation to portlet mode collection
  +        ContentTypeSet contentSet = this.getContentTypeSet();
  +        Iterator contents = contentSet.iterator();
  +        while (contents.hasNext())
  +        {
  +            ContentTypeDescriptor type = (ContentTypeDescriptor)contents.next();
  +            Iterator modes = type.getCastorPortletModes().iterator();
  +            while (modes.hasNext())
  +            {
  +                String mode = (String)modes.next();
  +                type.addPortletMode(new PortletMode(mode));        
  +            }
  +        }
  +        
       }
   }
  
  
  
  1.4       +2 -1      jakarta-jetspeed-2/portal/maven.xml
  
  Index: maven.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-jetspeed-2/portal/maven.xml,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- maven.xml	8 Aug 2003 21:59:53 -0000	1.3
  +++ maven.xml	7 Oct 2003 21:38:16 -0000	1.4
  @@ -4,7 +4,8 @@
            xmlns:reactor="reactor">
   
     <!-- Target of maven test:single test -->
  -  <property name='testcase' value='org.apache.jetspeed.tools.pamanager.TestPortletDescriptor'/>
 
  +  <property name='testcase' value='org.apache.jetspeed.services.registry.TestRegistry'/>
 
  +<!--  <property name='testcase' value='org.apache.jetspeed.tools.pamanager.TestPortletDescriptor'/>
 -->
   
    
   <!--
  
  
  
  1.2       +27 -3     jakarta-jetspeed-2/portal/src/java/org/apache/jetspeed/util/ojb/CSVtoCollectionFieldConversion.java
  
  Index: CSVtoCollectionFieldConversion.java
  ===================================================================
  RCS file: /home/cvs/jakarta-jetspeed-2/portal/src/java/org/apache/jetspeed/util/ojb/CSVtoCollectionFieldConversion.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- CSVtoCollectionFieldConversion.java	28 Jul 2003 23:47:53 -0000	1.1
  +++ CSVtoCollectionFieldConversion.java	7 Oct 2003 21:38:16 -0000	1.2
  @@ -75,7 +75,7 @@
   {
       private static final String DELIM = ",";
       private static final String QUOTE = "\"";
  -
  +    
       /**
        * @see org.apache.ojb.broker.accesslayer.conversions.FieldConversion#javaToSql(java.lang.Object)
        * @task Fix JDK 1.3 complient problem described in the FIXME
  @@ -96,7 +96,7 @@
               while (itr.hasNext())
               {
                   buffer.append(QUOTE);
  -                String value = (String) itr.next();
  +                String value = getNext(itr);
   
                   // FIXME: The following is not JDK1.3 complient. So I implement a warning

                   //        message as a workaround until this field conversion is no longer
  @@ -146,7 +146,7 @@
               {
                   while (st.nextToken() != StreamTokenizer.TT_EOF)
                   {
  -                    list.add(st.sval);
  +                    list.add(createObject(st.sval));
                       System.out.println("Parsed token value: "+st.sval);
                   }
               }
  @@ -161,6 +161,30 @@
           }
   
           return arg0;
  +    }
  +
  +    /**
  +     * Makes creation of objects created via csv fields extensible
  +     * By default simply return the string value.
  +     * 
  +     * @param name The string value
  +     * @return The string value
  +     */
  +    protected Object createObject(String name)
  +    {
  +        return name;
  +    }
  +
  +    /**
  +     * Makes getting objects via csv fields extensible
  +     * By default simply return the string value.
  +     * 
  +     * @param name The string value
  +     * @return The string value
  +     */
  +    protected String getNext(Iterator iterator)
  +    {
  +        return (String) iterator.next();
       }
   
   }
  
  
  
  1.1                  jakarta-jetspeed-2/portal/src/java/org/apache/jetspeed/util/ojb/CSVtoPortletModeFieldConversion.java
  
  Index: CSVtoPortletModeFieldConversion.java
  ===================================================================
  /* ====================================================================
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 2000-2003 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution,
   *    if any, must include the following acknowledgment:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowledgment may appear in the software itself,
   *    if and wherever such third-party acknowledgments normally appear.
   *
   * 4. The names "Apache" and "Apache Software Foundation" and
   *    "Apache Jetspeed" must not be used to endorse or promote products
   *    derived from this software without prior written permission. For
   *    written permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache",
   *    "Apache Jetspeed", nor may "Apache" appear in their name, without
   *    prior written permission of the Apache Software Foundation.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   */
  package org.apache.jetspeed.util.ojb;
  
  import java.util.Iterator;
  
  import javax.portlet.PortletMode;
  
  import org.apache.ojb.broker.accesslayer.conversions.FieldConversion;
  
  /**
   * CSVtoPortletModeFieldConversion
   *
   * @author <a href="mailto:taylor@apache.org">David Sean Taylor</a>
   * @version $Id: CSVtoPortletModeFieldConversion.java,v 1.1 2003/10/07 21:38:16 taylor Exp
$
   */
  public class CSVtoPortletModeFieldConversion extends CSVtoCollectionFieldConversion implements
FieldConversion
  {
      /* (non-Javadoc)
       * @see org.apache.jetspeed.util.ojb.CSVtoCollectionFieldConversion#getNext(java.util.Iterator)
       */
      protected String getNext(Iterator iterator)
      {
          PortletMode mode = (PortletMode)iterator.next();
          return mode.toString();
      }
      
      /* (non-Javadoc)
       * @see org.apache.jetspeed.util.ojb.CSVtoCollectionFieldConversion#createObject(java.lang.String)
       */
      protected Object createObject(String name)
      {
          return new PortletMode(name);
      }
      
      
  }
  
  
  
  1.4       +11 -8     jakarta-jetspeed-2/portal/src/test/org/apache/jetspeed/services/registry/TestRegistry.java
  
  Index: TestRegistry.java
  ===================================================================
  RCS file: /home/cvs/jakarta-jetspeed-2/portal/src/test/org/apache/jetspeed/services/registry/TestRegistry.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- TestRegistry.java	6 Aug 2003 19:37:05 -0000	1.3
  +++ TestRegistry.java	7 Oct 2003 21:38:17 -0000	1.4
  @@ -58,6 +58,8 @@
   import java.util.Iterator;
   import java.util.Locale;
   
  +import javax.portlet.PortletMode;
  +
   import junit.framework.AssertionFailedError;
   import junit.framework.Test;
   
  @@ -232,12 +234,12 @@
           ContentTypeComposite html = JetspeedPortletRegistry.newContentType();
           html.setContentType("html/text");
           ContentTypeComposite wml = JetspeedPortletRegistry.newContentType();
  -        html.addPortletMode("EDIT");
  -        html.addPortletMode("VIEW");
  -        html.addPortletMode("HELP");
  +        html.addPortletMode(new PortletMode("EDIT"));
  +        html.addPortletMode(new PortletMode("VIEW"));
  +        html.addPortletMode(new PortletMode("HELP"));
           wml.setContentType("wml");
  -        wml.addPortletMode("HELP");
  -        wml.addPortletMode("VIEW");
  +        wml.addPortletMode(new PortletMode("HELP"));
  +        wml.addPortletMode(new PortletMode("VIEW"));
           pdc.addContentType(html);
           pdc.addContentType(wml);
   
  @@ -266,7 +268,8 @@
           Iterator modes = html.getPortletModes();
           while (modes.hasNext())
           {
  -            System.out.println("   - Available Mode: " + modes.next());
  +            PortletMode mode = (PortletMode)modes.next();
  +            System.out.println("   - Available Mode: " + mode);
           }
       }
   
  @@ -320,7 +323,7 @@
           while (valItr.hasNext())
           {
               valueCount++;
  -			valItr.next();
  +            valItr.next();
           }
   
           assertTrue("\"preference 1\" should have 2 values not " + valueCount, valueCount
== 2);
  
  
  
  1.5       +6 -3      jakarta-jetspeed-2/portal/src/test/org/apache/jetspeed/tools/pamanager/TestPortletDescriptor.java
  
  Index: TestPortletDescriptor.java
  ===================================================================
  RCS file: /home/cvs/jakarta-jetspeed-2/portal/src/test/org/apache/jetspeed/tools/pamanager/TestPortletDescriptor.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- TestPortletDescriptor.java	6 Oct 2003 00:37:19 -0000	1.4
  +++ TestPortletDescriptor.java	7 Oct 2003 21:38:17 -0000	1.5
  @@ -55,6 +55,8 @@
   
   import java.util.Iterator;
   
  +import javax.portlet.PortletMode;
  +
   import junit.framework.Test;
   import junit.framework.TestSuite;
   import junit.textui.TestRunner;
  @@ -176,7 +178,8 @@
           // Display Name                
           DisplayName displayName = portlet.getDisplayName(Jetspeed.getDefaultLocale());
           assertNotNull("Display Name is null", displayName);
  -        assertTrue("Portlet.DisplayName invalid: " + displayName.getDisplayName(), displayName.getDisplayName().equals("HelloWorld
Portlet Wrapper"));
  +        assertTrue("Portlet.DisplayName invalid: " + displayName.getDisplayName(), 
  +                    displayName.getDisplayName().equals("HelloWorld Portlet Wrapper"));
   
           // Init Parameters
           ParameterSet paramsList = portlet.getInitParameterSet();
  @@ -208,7 +211,7 @@
               int modesCount = 0;
               while (modesIterator.hasNext())
               {
  -                String mode = (String) modesIterator.next();
  +                PortletMode mode = (PortletMode) modesIterator.next();
                   // System.out.println("mode = " + mode);
                   modesCount++;
               }
  
  
  
  1.9       +1 -1      jakarta-jetspeed-2/portal/src/webapp/WEB-INF/conf/ojb/repository_jetspeed.xml
  
  Index: repository_jetspeed.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-jetspeed-2/portal/src/webapp/WEB-INF/conf/ojb/repository_jetspeed.xml,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- repository_jetspeed.xml	7 Oct 2003 00:16:49 -0000	1.8
  +++ repository_jetspeed.xml	7 Oct 2003 21:38:17 -0000	1.9
  @@ -385,7 +385,7 @@
            name="portletModes"
            column="MODES"
            jdbc-type="VARCHAR"
  -         conversion="org.apache.jetspeed.util.ojb.CSVtoCollectionFieldConversion"
  +         conversion="org.apache.jetspeed.util.ojb.CSVtoPortletModeFieldConversion"
         />  
      </class-descriptor>
      
  
  
  
  1.4       +1 -1      jakarta-jetspeed-2/portal/src/webapp/WEB-INF/psml/user/anon/html/default.psml
  
  Index: default.psml
  ===================================================================
  RCS file: /home/cvs/jakarta-jetspeed-2/portal/src/webapp/WEB-INF/psml/user/anon/html/default.psml,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- default.psml	10 Aug 2003 11:25:45 -0000	1.3
  +++ default.psml	7 Oct 2003 21:38:17 -0000	1.4
  @@ -12,6 +12,6 @@
       <entry type="ref" name="CustomerInfo" parent="CustomerInfo"/>
       <entry type="ref" name="CustomerDetail" parent="CustomerDetail"/>
       <entry type="ref" name="JMXPortlet" parent="JMXPortlet"/>
  -    <entry type="ref" name="PreferencePortlet" parent="PreferencePortlet"/>
  +<!--    <entry type="ref" name="PreferencePortlet" parent="PreferencePortlet"/>
-->
       
   </portlets>
  
  
  

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


Mime
View raw message