You are viewing a plain text version of this content. The canonical link for it is here.
Posted to wsrp4j-dev@portals.apache.org by es...@apache.org on 2008/05/17 02:15:52 UTC

svn commit: r657256 [2/2] - in /portals/wsrp4j/trunk: ./ commons-consumer/src/main/java/org/apache/wsrp4j/commons/consumer/driver/page/ commons-producer/ commons/src/main/java/org/apache/wsrp4j/commons/util/ commons/src/main/java/org/apache/wsrp4j/comm...

Modified: portals/wsrp4j/trunk/commons/src/main/java/org/apache/wsrp4j/commons/util/configuration/ConfigurationParametersManager.java
URL: http://svn.apache.org/viewvc/portals/wsrp4j/trunk/commons/src/main/java/org/apache/wsrp4j/commons/util/configuration/ConfigurationParametersManager.java?rev=657256&r1=657255&r2=657256&view=diff
==============================================================================
--- portals/wsrp4j/trunk/commons/src/main/java/org/apache/wsrp4j/commons/util/configuration/ConfigurationParametersManager.java (original)
+++ portals/wsrp4j/trunk/commons/src/main/java/org/apache/wsrp4j/commons/util/configuration/ConfigurationParametersManager.java Fri May 16 17:15:46 2008
@@ -27,8 +27,7 @@
  * @version $Id$
  */
 public final class ConfigurationParametersManager
-{
-
+{        
     public static Log log = LogFactory.getLog( ConfigurationParametersManager.class );
 
     private final static String CONFIGURATION_FILE = "wsrp4j-config.properties";
@@ -76,9 +75,8 @@
 
         String value = (String) parameters.get( name );
 
-        if ( value == null )
+        if ( isEmptyOrNull( value ) )
         {
-
             if ( log.isErrorEnabled() )
             {
                 log.error( "Missing configuration parameter '" + name + "' from '" + CONFIGURATION_FILE
@@ -87,14 +85,79 @@
             throw new MissingConfigurationParameterException( name );
         }
 
-        if ( log.isInfoEnabled() )
+        if ( log.isDebugEnabled() )
         {
-            log.info( "Loading configuration parameter '" + name + "' with value '" + value + "' from '"
+            log.debug( "Loading configuration parameter '" + name + "' with value '" + value + "' from '"
                     + CONFIGURATION_FILE + "' configuration file" );
         }
 
-        return value;
-
+        return value.trim();
+    }
+    
+    public static String getInitCookie() 
+    {
+        String initCookie = null;
+        try
+        {
+            initCookie = ConfigurationParametersManager.getParameter( ConfigurationParameters.PARAM_INIT_COOKIE );
+            if (! ( initCookie.equals( ConfigurationParameters.INIT_COOKIE_NONE ) || 
+                    initCookie.equals( ConfigurationParameters.INIT_COOKIE_PERGROUP ) || 
+                    initCookie.equals( ConfigurationParameters.INIT_COOKIE_PERUSER ) ) )
+            {
+                log.warn( "Invalid value [" + initCookie + "] for configuration parameter [" + ConfigurationParameters.PARAM_INIT_COOKIE + "]. " +
+                        "Setting value to [" + ConfigurationParameters.PARAM_INIT_COOKIE_DEFAULT + "]" );
+            }            
+        }
+        catch ( MissingConfigurationParameterException e )
+        {
+            log.warn( "Setting default value of [" + ConfigurationParameters.PARAM_INIT_COOKIE + "] to [" + ConfigurationParameters.PARAM_INIT_COOKIE_DEFAULT + "]" );
+            initCookie = ConfigurationParameters.PARAM_INIT_COOKIE_DEFAULT;
+        }              
+        
+        return initCookie;
+    }
+    
+    public static boolean isRegistrationRequired()
+    {
+        boolean registrationRequired = Boolean.parseBoolean( ConfigurationParameters.PARAM_REG_REQD_DEFAULT );
+        try
+        {
+            String regAsStr = ConfigurationParametersManager.getParameter( ConfigurationParameters.PARAM_REG_REQD );
+            registrationRequired = Boolean.parseBoolean( regAsStr );
+        }
+        catch ( MissingConfigurationParameterException e )
+        {
+            log.warn( "Setting default value of [" + ConfigurationParameters.PARAM_REG_REQD + "] to [" + ConfigurationParameters.PARAM_REG_REQD_DEFAULT + "]" );
+            registrationRequired = Boolean.parseBoolean( ConfigurationParameters.PARAM_REG_REQD_DEFAULT );
+        }
+        
+        return registrationRequired;
+    }
+    
+    public static boolean doesUrlTemplateProcessing()
+    {
+        boolean doesTemplateProcessing = Boolean.parseBoolean( ConfigurationParameters.PARAM_URL_TEMPLATE_PROCESSING_DEFAULT );
+        try
+        {
+            String valueAsString = ConfigurationParametersManager.getParameter( ConfigurationParameters.PARAM_REG_REQD );
+            doesTemplateProcessing = Boolean.parseBoolean( valueAsString );
+        }
+        catch ( MissingConfigurationParameterException e )
+        {
+            log.warn( "Setting default value of [" + ConfigurationParameters.PARAM_URL_TEMPLATE_PROCESSING + "] to [" + ConfigurationParameters.PARAM_URL_TEMPLATE_PROCESSING_DEFAULT + "]" );
+            doesTemplateProcessing = Boolean.parseBoolean( ConfigurationParameters.PARAM_URL_TEMPLATE_PROCESSING_DEFAULT );
+        }
+        
+        return doesTemplateProcessing;
+    }
+    
+    private static boolean isEmptyOrNull( String anyString )
+    {
+        if ( anyString == null || anyString.trim().equals( "" ) )
+        {
+            return true;
+        }
+        return false;
     }
 
 }
\ No newline at end of file

Modified: portals/wsrp4j/trunk/commons/src/main/java/org/apache/wsrp4j/commons/util/impl/HandleGeneratorImpl.java
URL: http://svn.apache.org/viewvc/portals/wsrp4j/trunk/commons/src/main/java/org/apache/wsrp4j/commons/util/impl/HandleGeneratorImpl.java?rev=657256&r1=657255&r2=657256&view=diff
==============================================================================
--- portals/wsrp4j/trunk/commons/src/main/java/org/apache/wsrp4j/commons/util/impl/HandleGeneratorImpl.java (original)
+++ portals/wsrp4j/trunk/commons/src/main/java/org/apache/wsrp4j/commons/util/impl/HandleGeneratorImpl.java Fri May 16 17:15:46 2008
@@ -18,6 +18,7 @@
 import java.net.InetAddress;
 import java.util.Random;
 
+import org.apache.wsrp4j.commons.util.Handle;
 import org.apache.wsrp4j.commons.util.HandleGenerator;
 
 /**
@@ -50,7 +51,7 @@
      *
      * @return String representing the new handle.
      */
-    synchronized public String generateHandle() {
+    synchronized public Handle generateHandle() {
 
         String host = null;
         try {
@@ -70,7 +71,7 @@
         handle.append("_");
         handle.append(Integer.toString(counter++));
 
-        return handle.toString();
+        return new HandleImpl( handle.toString() );
     }
 
 }

Modified: portals/wsrp4j/trunk/consumer-swingconsumer/src/main/java/org/apache/wsrp4j/consumer/swingconsumer/driver/PageRegistryImpl.java
URL: http://svn.apache.org/viewvc/portals/wsrp4j/trunk/consumer-swingconsumer/src/main/java/org/apache/wsrp4j/consumer/swingconsumer/driver/PageRegistryImpl.java?rev=657256&r1=657255&r2=657256&view=diff
==============================================================================
--- portals/wsrp4j/trunk/consumer-swingconsumer/src/main/java/org/apache/wsrp4j/consumer/swingconsumer/driver/PageRegistryImpl.java (original)
+++ portals/wsrp4j/trunk/consumer-swingconsumer/src/main/java/org/apache/wsrp4j/consumer/swingconsumer/driver/PageRegistryImpl.java Fri May 16 17:15:46 2008
@@ -244,7 +244,7 @@
                 while (iter.hasNext()) {
                     
                     PortletKey portletKey = (PortletKey)iter.next();
-                    String instanceKey = this.handleGenerator.generateHandle();
+                    String instanceKey = this.handleGenerator.generateHandle().toString();
                     tempTable.put(instanceKey, portletKey);
                 }
                 page.setPortlets(tempTable);

Propchange: portals/wsrp4j/trunk/persistence-producer/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Fri May 16 17:15:46 2008
@@ -0,0 +1,3 @@
+*.ipr
+*.iws
+*.iml

Propchange: portals/wsrp4j/trunk/persistence-producer/producer-persistence-common/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Fri May 16 17:15:46 2008
@@ -0,0 +1,3 @@
+*.ipr
+*.iws
+*.iml

Propchange: portals/wsrp4j/trunk/persistence-producer/producer-persistence-db/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Fri May 16 17:15:46 2008
@@ -0,0 +1,5 @@
+catalog.xml
+target
+*.ipr
+*.iws
+*.iml

Propchange: portals/wsrp4j/trunk/persistence-producer/producer-persistence-xml/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Fri May 16 17:15:46 2008
@@ -0,0 +1,5 @@
+target
+catalog.xml
+*.ipr
+*.iws
+*.iml

Modified: portals/wsrp4j/trunk/pom.xml
URL: http://svn.apache.org/viewvc/portals/wsrp4j/trunk/pom.xml?rev=657256&r1=657255&r2=657256&view=diff
==============================================================================
--- portals/wsrp4j/trunk/pom.xml (original)
+++ portals/wsrp4j/trunk/pom.xml Fri May 16 17:15:46 2008
@@ -61,34 +61,40 @@
     <modules>
         <module>commons</module>
         <module>commons-consumer</module>
-        <module>commons-producer</module>
-        <module>consumer-proxyportlet</module>
-        <module>consumer-swingconsumer</module>
-        <module>persistence-db</module>
-        <module>persistence-xml</module>
+        <!--module>consumer-proxyportlet</module-->
+        <!--module>consumer-swingconsumer</module-->
+        <module>persistence-producer</module>
+        <!--module>persistence-consumer</module-->
         <module>producer</module>
         <module>testportlet</module>
+        <module>producer-webapp</module>
     </modules>
     
     <properties>
         <!-- Dependency Version Properties -->
         <axis.version>1.4</axis.version>
-        <castor.version>0.9.6</castor.version>
+        <castor.version>1.1.2.1</castor.version>
+        <cglib.version>2.0.2</cglib.version>
         <commons-beanutils.version>1.7.0</commons-beanutils.version>
         <commons-discovery.version>0.2</commons-discovery.version>
         <commons-fileupload.version>1.1.1</commons-fileupload.version>
         <commons-lang.version>2.1</commons-lang.version>
         <commons-logging.version>1.1</commons-logging.version>
+        <dbunit.version>2.2.2</dbunit.version>
+        <ddlutils.version>1.0</ddlutils.version>
         <hibernate.version>3.2.1.ga</hibernate.version>
+        <hsqldb.version>1.8.0.7</hsqldb.version>
+        <!--hsqldb.version>trunkesm</hsqldb.version-->
         <javax-mail.version>1.4</javax-mail.version>
         <jmock.version>1.2.0</jmock.version>
         <jstl.version>1.0.6</jstl.version>
-        <junit.version>3.8.1</junit.version>
+        <junit.version>4.4</junit.version>
         <log4j.version>1.2.13</log4j.version>
         <pluto.version>1.0.1</pluto.version>
         <portlet-api.version>1.0</portlet-api.version>        
         <servlet-api.version>2.3</servlet-api.version>
-        <spring.version>2.0.6</spring.version>
+        <spring.version>2.5.4</spring.version>
+        <spring-mock.version>2.0.8</spring-mock.version>
         <taglibs.version>1.0.6</taglibs.version>
         <wsdl4j.version>1.5.1</wsdl4j.version>
         <xalan.version>2.7.0</xalan.version>
@@ -112,21 +118,31 @@
             <!-- For now, set the properties conf using a relative path
              for using with the submodules. Try to find a system property
              for the parent base dir, like ${basedir} but for the parent -->
-            <filter>../build.properties</filter>
+            <!--filter>build.properties</filter-->
         </filters>
         <plugins>
             <plugin>
                 <groupId>org.apache.maven.plugins</groupId>
                 <artifactId>maven-compiler-plugin</artifactId>
                 <configuration>
-                    <!-- Force 1.4 code -->
-                    <source>1.4</source>
-                    <target>1.4</target>
+                    <source>1.5</source>
+                    <target>1.5</target>
                 </configuration>
+                <version>2.0.2</version>
             </plugin>
         </plugins>
     </build>
     
+    <reporting>
+        <plugins>
+            <plugin>
+                <groupId>org.codehaus.mojo</groupId>
+                <artifactId>cobertura-maven-plugin</artifactId>
+                <version>2.2</version>
+            </plugin>
+        </plugins>
+    </reporting>
+    
     <scm>
         <connection>scm:svn:http://svn.apache.org/repos/asf/portals/wsrp4j/trunk</connection>
         <developerConnection>scm:svn:https://svn.apache.org/repos/asf/portals/wsrp4j/trunk</developerConnection>

Propchange: portals/wsrp4j/trunk/producer-webapp/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Fri May 16 17:15:46 2008
@@ -0,0 +1,3 @@
+*.ipr
+*.iws
+*.iml

Propchange: portals/wsrp4j/trunk/producer-webapp/src/main/webapp/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Fri May 16 17:15:46 2008
@@ -0,0 +1 @@
+""

Modified: portals/wsrp4j/trunk/producer/pom.xml
URL: http://svn.apache.org/viewvc/portals/wsrp4j/trunk/producer/pom.xml?rev=657256&r1=657255&r2=657256&view=diff
==============================================================================
--- portals/wsrp4j/trunk/producer/pom.xml (original)
+++ portals/wsrp4j/trunk/producer/pom.xml Fri May 16 17:15:46 2008
@@ -31,9 +31,8 @@
     <modelVersion>4.0.0</modelVersion>
     <groupId>org.apache.wsrp4j</groupId>
     <artifactId>wsrp4j-producer</artifactId>
-    <packaging>war</packaging>
-    <name>WSRP4J Producer</name>
-    <description>WSRP4J Producer allows JSR-168 portlets to be exposed as WSRP-compliant portlets.</description>
+    <packaging>jar</packaging>
+    <name>WSRP4J Producer</name>    
 
     <properties>
         <!-- Contains fix for PLUTO-417 -->
@@ -43,59 +42,30 @@
     <build>
 
         <finalName>${pom.artifactId}</finalName>
-
-        <resources>
-            <resource>
-                <directory>${basedir}/src/main/resources</directory>
-                <targetPath>org/apache/wsrp4j/producer/configapp/messages</targetPath>
-                <includes>
-                    <include>Messages.properties</include>
-                </includes>
-            </resource>
-        </resources>
         
         <plugins>
-            
             <plugin>
                 <groupId>org.apache.maven.plugins</groupId>
-                <artifactId>maven-war-plugin</artifactId>
-                <version>2.0</version>
+                <artifactId>maven-surefire-plugin</artifactId>
                 <configuration>
-                    <!-- This resource must be added as a webResource as it won't end up
-                       on the WEB-INF/classes dir as do the default <resources> for a
-                       war type project -->
-                    <webResources>
-                        <resource>
-                            <directory>${basedir}/src/main/webapp</directory>
-                            <filtering>true</filtering>
-                            <includes>
-                                <include>WEB-INF/server-config.wsdd</include>
-                            </includes>
-                        </resource>
-                        <resource>
-                            <directory>${basedir}/src/main/webapp</directory>
-                            <filtering>true</filtering>
-                            <includes>
-                                <include>WEB-INF/classes/log4j.properties</include>
-                                <include>WEB-INF/classes/wsrp4j-config.properties</include>
-                            </includes>
-                        </resource>
-                    </webResources>
+                    <excludes>
+                        <exclude>**/DescriptionHandlerImplTest.java</exclude>
+                    </excludes>
                 </configuration>
-            </plugin>
-            
+            </plugin>                        
         </plugins>
         
     </build>   
     
     <dependencies>
         
-        <!-- Compile ========================================== -->
+        <!-- Compile-time dependencies ============================ -->        
         
         <dependency>
-            <artifactId>wsrp4j-commons-producer</artifactId>
+            <artifactId>wsrp4j-commons</artifactId>
             <groupId>org.apache.wsrp4j</groupId>
             <version>${pom.version}</version>
+            <scope>compile</scope>
         </dependency>
         
         <dependency>
@@ -122,7 +92,14 @@
             </exclusions>
         </dependency>
         
-        <!-- Runtime ============================================ -->
+        <!-- Runtime dependencies ================================= -->
+        
+        <dependency>
+            <groupId>cglib</groupId>
+            <artifactId>cglib-full</artifactId>
+            <version>${cglib.version}</version>
+            <scope>runtime</scope>
+        </dependency>
         
         <dependency>
             <groupId>org.springframework</groupId>
@@ -174,16 +151,7 @@
                     <artifactId>commons-logging</artifactId>
                 </exclusion>
             </exclusions>
-        </dependency>        
-        
-        <!-- Runtime dependencies ================================= -->
-        
-        <dependency>
-            <artifactId>wsrp4j-persistence-xml</artifactId>
-            <groupId>org.apache.wsrp4j</groupId>
-            <version>${pom.version}</version>
-            <scope>runtime</scope>
-        </dependency>        
+        </dependency>    
 
         <dependency>
             <artifactId>standard</artifactId>
@@ -213,7 +181,7 @@
             <scope>runtime</scope>
         </dependency>
 
-        <!-- Provided ========================================= -->
+        <!-- Provided dependencies ================================ -->
         
         <dependency>
             <artifactId>portlet-api</artifactId>
@@ -235,6 +203,36 @@
             <version>${pluto.version}</version>
             <scope>provided</scope>
         </dependency>        
+
+        <!-- Test dependencies ==================================== -->
+        
+        <dependency>
+            <groupId>jmock</groupId>
+            <artifactId>jmock</artifactId>
+            <version>${jmock.version}</version>
+            <scope>test</scope>
+        </dependency>
+        
+        <dependency>
+            <groupId>jmock</groupId>
+            <artifactId>jmock-cglib</artifactId>
+            <version>${jmock.version}</version>
+            <scope>test</scope>
+        </dependency>
+        
+        <dependency>
+            <groupId>org.springframework</groupId>
+            <artifactId>spring-mock</artifactId>
+            <version>${spring-mock.version}</version>
+            <scope>test</scope>
+        </dependency>
+        
+        <dependency>
+            <groupId>org.springframework</groupId>
+            <artifactId>spring-core</artifactId>
+            <version>${spring.version}</version>
+            <scope>test</scope>
+        </dependency>
         
     </dependencies>
     

Modified: portals/wsrp4j/trunk/producer/src/main/java/org/apache/wsrp4j/producer/provider/pluto/driver/DescriptionHandlerImpl.java
URL: http://svn.apache.org/viewvc/portals/wsrp4j/trunk/producer/src/main/java/org/apache/wsrp4j/producer/provider/pluto/driver/DescriptionHandlerImpl.java?rev=657256&r1=657255&r2=657256&view=diff
==============================================================================
--- portals/wsrp4j/trunk/producer/src/main/java/org/apache/wsrp4j/producer/provider/pluto/driver/DescriptionHandlerImpl.java (original)
+++ portals/wsrp4j/trunk/producer/src/main/java/org/apache/wsrp4j/producer/provider/pluto/driver/DescriptionHandlerImpl.java Fri May 16 17:15:46 2008
@@ -47,16 +47,12 @@
 import org.apache.wsrp4j.commons.exception.ErrorCodes;
 import org.apache.wsrp4j.commons.exception.WSRPException;
 import org.apache.wsrp4j.commons.exception.WSRPXHelper;
-import org.apache.wsrp4j.commons.persistence.PersistentDataObject;
-import org.apache.wsrp4j.commons.persistence.PersistentHandler;
-import org.apache.wsrp4j.commons.persistence.ProducerPersistentFactory;
-import org.apache.wsrp4j.commons.persistence.driver.WSRPServiceDescription;
 import org.apache.wsrp4j.commons.producer.provider.interfaces.ConsumerConfiguredPortlet;
 import org.apache.wsrp4j.commons.producer.provider.interfaces.DescriptionHandler;
 import org.apache.wsrp4j.commons.producer.provider.interfaces.Portlet;
 import org.apache.wsrp4j.commons.producer.provider.interfaces.PortletPool;
 import org.apache.wsrp4j.commons.util.WindowStates;
-import org.apache.wsrp4j.commons.util.configuration.ConfigurationParametersManager;
+import org.apache.wsrp4j.commons.util.configuration.ProducerConfiguration;
 
 /**
  * @see DescriptionHandler
@@ -70,7 +66,6 @@
     private static final Log LOG = LogFactory.getLog( DescriptionHandlerImpl.class );
     private static final Log LOG_PORTLETXML = LogFactory.getLog( DescriptionHandlerImpl.class.getName() + "_portletxml" );    
     private static final Locale DEFAULT_LOCALE = Locale.US;    
-
     
     /**
      * The portlet pool
@@ -81,27 +76,11 @@
      * Portlet registry service
      */
     private PortletRegistryService portletRegistrySvc = null;
-
-    /**
-     * Persistence
-     */
-    private PersistentDataObject persistentDataObject;
-    private PersistentHandler persistentHandler;
-
+    
     /**
-     * The service description
+     * Producer configuration object (HTTP request-scoped object)
      */
-    private ServiceDescription serviceDescription;
-
-    // name of the properties which is read
-    // private static final String WSRP_SERVICE_PROP =
-    // "wsrp4j-config.properties";
-
-    // defines an internal property name/key
-    private static final String URL_TEMPLATE_PROCESSING = "wsrp4j.producer.provider.doesurltemplateprocessing";
-
-    // indicates if a producer supports URL template processing
-    private Boolean doesUrlTemplateProcessing = Boolean.FALSE;
+    private ProducerConfiguration config = null;
 
     // holds all portlet descriptions
     private Map portletDescs = new HashMap();
@@ -111,8 +90,7 @@
      * 
      * @see DescriptionHandler
      */
-    DescriptionHandlerImpl( PortletPool portletPool, PortletRegistryService portletRegistrySvc, 
-            ProducerPersistentFactory persistenceFactory )
+    DescriptionHandlerImpl( PortletPool portletPool, PortletRegistryService portletRegistrySvc )
     {
         if ( portletPool == null )
         {
@@ -127,43 +105,11 @@
             LOG.error( msg );
             throw new IllegalArgumentException( msg );
         }
-        
-        if ( persistenceFactory == null )
-        {
-            final String msg = "Producer persistence factory must not be null";
-            LOG.error( msg );
-            throw new IllegalArgumentException( msg );
-        }
 
         this.portletPool = portletPool;
         this.portletRegistrySvc = portletRegistrySvc;
         
         portletRegistrySvc.addPortletRegistryListener( new PortletRegistryListenerImpl() );
-
-        try
-        {
-            persistentHandler = persistenceFactory.getPersistentHandler();
-            persistentDataObject = persistenceFactory.getServiceDescriptionList();
-
-            // restore the service description from persistent store
-            restore();
-        }
-        catch ( WSRPException e )
-        {
-            LOG.warn( "Restore ServiceDescription failed.  Check persistent XML file and content: "
-                    + e.getMessage(), e );
-        }
-
-        try
-        {
-            String urlTemplProcStr = ConfigurationParametersManager.getParameter( URL_TEMPLATE_PROCESSING );
-            this.doesUrlTemplateProcessing = Boolean.valueOf( urlTemplProcStr );
-        }
-        catch ( Exception e )
-        {
-            LOG.error( "Error setting url template processing: " + e.getMessage(), e );
-        }
-
     }
 
     /**
@@ -179,30 +125,42 @@
             throws WSRPException
     {
         LOG.debug( "Obtaining service description for registration context [" + regContext + "] (reg required: [" + isRegistrationRequired() + "]), locales [" + desiredLocales + "]" );
-        if ( serviceDescription != null )
+        
+        ServiceDescription sd = new ServiceDescription();
+        // set the registration flag
+        sd.setRequiresRegistration( isRegistrationRequired() );
+        
+        CookieProtocol initCookie = CookieProtocol.fromString( config.getInitCookie() );
+
+        // set the cookie protocol
+        if ( CookieProtocol.none.equals( initCookie ) )
+        {               
+            sd.setRequiresInitCookie( CookieProtocol.none );
+        }
+        else if ( CookieProtocol.perUser.equals( initCookie ) ) 
         {
-            // check if full description is required
-            if ( regContext != null || !isRegistrationRequired() )
-            {
-                // get all portlet descriptions from portlet pool
-                serviceDescription.setOfferedPortlets( getProducerOfferedPortletDescriptions( regContext,
-                        desiredLocales ) );
-                // TODO: make the cookie protocol configurable
-                serviceDescription.setRequiresInitCookie( CookieProtocol.none );
-            }
-            else
-            {
-                LOG.debug( "Can't obtain service descriptions." );
-            }
+            sd.setRequiresInitCookie( CookieProtocol.perUser );
+        }
+        else if ( CookieProtocol.perGroup.equals( initCookie ) )
+        {
+            sd.setRequiresInitCookie( CookieProtocol.perGroup );
         }
         else
         {
-            // serviceDescription not available
-            WSRPXHelper.throwX( LOG, ErrorCodes.LOAD_SERVICEDESCRIPTION_FAILED );
+            // this shouldn't happen as the ConfigurationParametersManager 
+            // should return a valid value
+            LOG.error( "Unrecognized value for cookie protocol.  Defaulting to 'none'" );
+            sd.setRequiresInitCookie( CookieProtocol.none );
         }
-        return serviceDescription;
-
-        // TODO: return descriptions according to configuration
+                
+        // check if full description is required
+        if ( regContext != null || !isRegistrationRequired() )
+        {
+            // get all portlet descriptions from portlet pool
+            sd.setOfferedPortlets( getProducerOfferedPortletDescriptions( regContext,
+                    desiredLocales ) );                                    
+        }
+        return sd;
     }
 
     /**
@@ -214,43 +172,7 @@
      */
     public boolean isRegistrationRequired( ) throws WSRPException
     {
-        boolean bRetVal = true;
-
-        if ( serviceDescription != null )
-        {
-            bRetVal = serviceDescription.isRequiresRegistration();
-        }
-        else
-        {
-            WSRPXHelper.throwX( LOG, ErrorCodes.LOAD_SERVICEDESCRIPTION_FAILED );
-        }
-
-        return bRetVal;
-    }
-
-    /**
-     * Adds/replaces the ServiceDescription object in the DescriptionHandler and
-     * stores the object for persistency.
-     * 
-     * @param newServiceDescription
-     *            ServiceDescription
-     */
-    public void put( ServiceDescription newServiceDescription ) throws WSRPException
-    {
-        serviceDescription = newServiceDescription;
-        WSRPServiceDescription wsrpServDesc = new WSRPServiceDescription( newServiceDescription );
-        persistentDataObject.clear();
-        persistentDataObject.addObject( wsrpServDesc );
-
-        try
-        {
-            store( persistentDataObject );
-        }
-        catch ( WSRPException e )
-        {
-            serviceDescription = null;
-            WSRPXHelper.throwX( LOG, ErrorCodes.SAVE_SERVICEDESCRIPTION_FAILED, e );
-        }
+        return config.isRegistrationRequired();
     }
 
     /**
@@ -276,7 +198,7 @@
 
         while ( portlets.hasNext() )
         {
-            String id = ( (Portlet)portlets.next() ).getPortletHandle();
+            String id = ( (Portlet)portlets.next() ).getPortletHandle().toString();
             PortletDescription desc = (PortletDescription) portletDescs.get( id );
 
             // if the description is not in the map, create it
@@ -332,7 +254,7 @@
             if ( ccp.getPortletHandle().equals( portletHandle ) )
             {
                 LOG.debug( "Retrieved the parent portlet handle [" + ccp.getParentHandle() + "] for consumer configured portlet [" + portletHandle + "]" );
-                portletHandle = ccp.getParentHandle();                
+                portletHandle = ccp.getParentHandle().toString();                
             }
         }
         
@@ -415,7 +337,7 @@
         portletDescription.setUserContextStoredInSession( Boolean.FALSE );
         portletDescription.setTemplatesStoredInSession( Boolean.FALSE );
         portletDescription.setHasUserSpecificState( Boolean.TRUE );
-        portletDescription.setDoesUrlTemplateProcessing( doesUrlTemplateProcessing );
+        portletDescription.setDoesUrlTemplateProcessing( Boolean.valueOf( config.isUrlTemplateProcessing() ) );
 
         return portletDescription;
     }
@@ -438,71 +360,6 @@
         LOG.debug( "Retrieving portlet description for handle [" + portletHandle + "]." );
         return getPortletDescription( portletHandle, null, null, null );
     }
-
-    /**
-     * Stores the ServiceDescription to persistent store
-     * 
-     * @param persistentDataObject
-     * @throws WSRPException
-     */
-    private void store( PersistentDataObject persistentDataObject ) throws WSRPException
-    {
-
-        persistentHandler.store( persistentDataObject );
-
-    }
-
-    /**
-     * Restores a single ServiceDescritpion
-     * 
-     * @throws WSRPException
-     */
-    private void restore( ) throws WSRPException
-    {
-
-        persistentDataObject = persistentHandler.restoreMultiple( persistentDataObject );
-
-        /* Use the last description found */
-        WSRPServiceDescription tempServiceDescription = (WSRPServiceDescription) persistentDataObject.getLastElement();
-        if ( tempServiceDescription == null )
-        {
-            WSRPXHelper.throwX( ErrorCodes.MISSING_SERVICE_DESCRIPTION );
-        }
-        this.serviceDescription = tempServiceDescription.toServiceDescription();
-
-    }
-
-    /**
-     * Trace input arguments for getPortletDescription method
-     * 
-     * @param portletHandle
-     *            as String
-     * @param desiredLocales
-     *            as String[]
-     * 
-     */
-    private void trace_getPortletDescription_args( String portletHandle, String[] desiredLocales )
-    {
-
-        if ( LOG.isDebugEnabled() )
-        {
-
-            LOG.debug( "INPUT:STRING:portletHandle=" + portletHandle );
-
-            if ( desiredLocales != null && desiredLocales.length > 0 )
-            {
-                for ( int x = 0; x < desiredLocales.length; x++ )
-                {
-                    LOG.debug( "INPUT:STRING[" + x + "]:desiredLocales=" + desiredLocales[x] );
-                }
-            }
-            else
-            {
-                LOG.debug( "INPUT:STRING[]:desiredLocales=NULL or length=0" );
-            }
-        }
-
-    }
     
     private MarkupType[] getMarkupTypes( PortletDD portletDefinition )
     {
@@ -576,7 +433,16 @@
         return markupTypes;
     }
     
-    
+    public void setProducerConfiguration( ProducerConfiguration config )
+    {
+        if ( config == null )
+        {
+            final String msg = "Producer configuration must not be null.";
+            LOG.error( msg );
+            throw new IllegalArgumentException( msg );
+        }
+        this.config = config;
+    }
     private void localizePortletDescription( String[] desiredLocales, PortletDD portletDefinition, 
             PortletDescription portletDescription ) throws WSRPException
     {
@@ -871,5 +737,5 @@
             }
         }
     }
-        
+           
 }

Modified: portals/wsrp4j/trunk/producer/src/main/java/org/apache/wsrp4j/producer/provider/pluto/driver/PortletInvokerImpl.java
URL: http://svn.apache.org/viewvc/portals/wsrp4j/trunk/producer/src/main/java/org/apache/wsrp4j/producer/provider/pluto/driver/PortletInvokerImpl.java?rev=657256&r1=657255&r2=657256&view=diff
==============================================================================
--- portals/wsrp4j/trunk/producer/src/main/java/org/apache/wsrp4j/producer/provider/pluto/driver/PortletInvokerImpl.java (original)
+++ portals/wsrp4j/trunk/producer/src/main/java/org/apache/wsrp4j/producer/provider/pluto/driver/PortletInvokerImpl.java Fri May 16 17:15:46 2008
@@ -376,7 +376,7 @@
         Portlet portlet = pool.get( portletHandle );
         if ( portlet instanceof ConsumerConfiguredPortlet )
         {
-            String parentHandle = ( (ConsumerConfiguredPortlet) portlet ).getParentHandle();
+            String parentHandle = ( (ConsumerConfiguredPortlet) portlet ).getParentHandle().toString();
             appId = parentHandle.substring( 0, parentHandle.lastIndexOf( "/" ) );
             portletName = parentHandle.substring( parentHandle.lastIndexOf( "/" ) + 1 );
         }

Modified: portals/wsrp4j/trunk/producer/src/main/java/org/apache/wsrp4j/producer/provider/pluto/driver/PortletPoolImpl.java
URL: http://svn.apache.org/viewvc/portals/wsrp4j/trunk/producer/src/main/java/org/apache/wsrp4j/producer/provider/pluto/driver/PortletPoolImpl.java?rev=657256&r1=657255&r2=657256&view=diff
==============================================================================
--- portals/wsrp4j/trunk/producer/src/main/java/org/apache/wsrp4j/producer/provider/pluto/driver/PortletPoolImpl.java (original)
+++ portals/wsrp4j/trunk/producer/src/main/java/org/apache/wsrp4j/producer/provider/pluto/driver/PortletPoolImpl.java Fri May 16 17:15:46 2008
@@ -40,7 +40,9 @@
 import org.apache.wsrp4j.commons.producer.provider.interfaces.Portlet;
 import org.apache.wsrp4j.commons.producer.provider.interfaces.PortletPool;
 import org.apache.wsrp4j.commons.producer.provider.interfaces.ProducerOfferedPortlet;
+import org.apache.wsrp4j.commons.util.Handle;
 import org.apache.wsrp4j.commons.util.HandleGenerator;
+import org.apache.wsrp4j.commons.util.impl.HandleImpl;
 
 /**
  * <p>
@@ -219,7 +221,7 @@
      */
     public synchronized Portlet clone( String portletHandle )
     {
-        String newPortletHandle = handleGenerator.generateHandle();
+        String newPortletHandle = handleGenerator.generateHandle().toString();
         ConsumerConfiguredPortlet clone = null;
 
         try
@@ -237,6 +239,7 @@
                 // portlet to be cloned is a Producer Offered Portlet
                 clone = new ConsumerConfiguredPortletImpl();
                 clone.setPortletHandle( newPortletHandle );
+                // TODO: fix the dependency on this impl.
                 clone.setParentHandle( portletHandle );
             }
 
@@ -459,6 +462,7 @@
     {
         String portletId = portletAppId + "/" + portletDD.getPortletName();
         ConsumerConfiguredPortlet portlet = new ConsumerConfiguredPortletImpl();
+        // TODO: fix the dependency on HandleImpl
         portlet.setPortletHandle( portletId );
         portlet.setParentHandle( null );
         return portlet;
@@ -468,6 +472,7 @@
     {
         String portletId = portletAppId + "/" + portletDD.getPortletName();
         ProducerOfferedPortlet portlet = new ProducerOfferedPortletImpl();
+        // TODO: fix the dependency on HandleImpl
         portlet.setPortletHandle( portletId );
         portlet.setRegistrationRequired( REGISTRATION_REQUIRED );
         return portlet;