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 dl...@apache.org on 2005/08/22 20:52:12 UTC

cvs commit: ws-wsrp4j/sandbox/wsrp4j/commons/src/java/org/apache/wsrp4j/commons/util/impl HandleGeneratorFactoryImpl.java HandleGeneratorImpl.java StateChangedServiceImpl.java

dlouzan     2005/08/22 11:52:12

  Modified:    sandbox/wsrp4j/commons/src/java/org/apache/wsrp4j/commons/exception
                        ErrorCodes.java Messages.java WSRPException.java
                        WSRPXHelper.java
               sandbox/wsrp4j/commons/src/java/org/apache/wsrp4j/commons/log
                        LogManager.java Logger.java LoggerImpl.java
               sandbox/wsrp4j/commons/src/java/org/apache/wsrp4j/commons/util
                        Constants.java Modes.java ParameterChecker.java
                        Utility.java WindowStates.java
  Added:       sandbox/wsrp4j/commons/src/java/org/apache/wsrp4j/commons/persistence
                        ClientPersistentFactory.java
                        PersistentDataObject.java PersistentFactory.java
                        PersistentHandler.java PersistentInformation.java
                        PersistentInformationProvider.java
               sandbox/wsrp4j/commons/src/java/org/apache/wsrp4j/commons/util
                        HandleGenerator.java HandleGeneratorFactory.java
                        StateChangedEvent.java StateChangedListener.java
                        StateChangedService.java
               sandbox/wsrp4j/commons/src/java/org/apache/wsrp4j/commons/util/impl
                        HandleGeneratorFactoryImpl.java
                        HandleGeneratorImpl.java
                        StateChangedServiceImpl.java
  Log:
  Code formatting and added cvs info.
  
  Revision  Changes    Path
  1.2       +3 -0      ws-wsrp4j/sandbox/wsrp4j/commons/src/java/org/apache/wsrp4j/commons/exception/ErrorCodes.java
  
  Index: ErrorCodes.java
  ===================================================================
  RCS file: /home/cvs/ws-wsrp4j/sandbox/wsrp4j/commons/src/java/org/apache/wsrp4j/commons/exception/ErrorCodes.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- ErrorCodes.java	21 Jul 2005 17:07:26 -0000	1.1
  +++ ErrorCodes.java	22 Aug 2005 18:52:10 -0000	1.2
  @@ -17,6 +17,9 @@
   package org.apache.wsrp4j.commons.exception;
   
   
  +/*
  + * @version $Id$
  + */
   public interface ErrorCodes
   {
   
  
  
  
  1.3       +3 -1      ws-wsrp4j/sandbox/wsrp4j/commons/src/java/org/apache/wsrp4j/commons/exception/Messages.java
  
  Index: Messages.java
  ===================================================================
  RCS file: /home/cvs/ws-wsrp4j/sandbox/wsrp4j/commons/src/java/org/apache/wsrp4j/commons/exception/Messages.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- Messages.java	21 Jul 2005 17:42:02 -0000	1.2
  +++ Messages.java	22 Aug 2005 18:52:10 -0000	1.3
  @@ -24,7 +24,9 @@
   import org.apache.wsrp4j.commons.log.Logger;
   
   /**
  -  Holds all exception messages
  + * Holds all exception messages
  + *
  + * @version $Id$
   */
   public class Messages
   {
  
  
  
  1.2       +2 -0      ws-wsrp4j/sandbox/wsrp4j/commons/src/java/org/apache/wsrp4j/commons/exception/WSRPException.java
  
  Index: WSRPException.java
  ===================================================================
  RCS file: /home/cvs/ws-wsrp4j/sandbox/wsrp4j/commons/src/java/org/apache/wsrp4j/commons/exception/WSRPException.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- WSRPException.java	21 Jul 2005 17:07:26 -0000	1.1
  +++ WSRPException.java	22 Aug 2005 18:52:10 -0000	1.2
  @@ -19,6 +19,8 @@
   
   /**
    * Common Exception class within the WSRP environment 
  + *
  + * @version $Id$
    */
   public class WSRPException extends Exception
   {
  
  
  
  1.3       +2 -0      ws-wsrp4j/sandbox/wsrp4j/commons/src/java/org/apache/wsrp4j/commons/exception/WSRPXHelper.java
  
  Index: WSRPXHelper.java
  ===================================================================
  RCS file: /home/cvs/ws-wsrp4j/sandbox/wsrp4j/commons/src/java/org/apache/wsrp4j/commons/exception/WSRPXHelper.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- WSRPXHelper.java	21 Jul 2005 17:42:03 -0000	1.2
  +++ WSRPXHelper.java	22 Aug 2005 18:52:10 -0000	1.3
  @@ -54,6 +54,8 @@
    * simply type <code>ExceptionHelper throwX(1234)</code>
    * So the appropriate messages can be handled in a central place.
    * Also the Exceptions will be logged
  + *
  + * @version $Id$
    */
   public class WSRPXHelper
   {
  
  
  
  1.2       +28 -17    ws-wsrp4j/sandbox/wsrp4j/commons/src/java/org/apache/wsrp4j/commons/log/LogManager.java
  
  Index: LogManager.java
  ===================================================================
  RCS file: /home/cvs/ws-wsrp4j/sandbox/wsrp4j/commons/src/java/org/apache/wsrp4j/commons/log/LogManager.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- LogManager.java	21 Jul 2005 17:15:47 -0000	1.1
  +++ LogManager.java	22 Aug 2005 18:52:10 -0000	1.2
  @@ -16,13 +16,13 @@
   
   package org.apache.wsrp4j.commons.log;
   
  -
   import java.io.InputStream;
   import java.util.Properties;
   
   /**
  -  Logger factory return an appropriate implementation of a Logger
  -*/
  + * Logger factory return an appropriate implementation of a Logger.
  + * @version $Id$
  + */
   public class LogManager
   {
   
  @@ -32,14 +32,14 @@
       private static final String GLOBAL_LOG_LEVEL_PROPERTY = "wsrp4j.logger";
       private static int globalLogLevel = Logger.ERROR;
       private static Properties wsrp4jLevels = new Properties();
  -    private static LogManager logManager = new LogManager();
  +    private static LogManager logManager;
   
       /**
  -      private constructor prohibits sub-classing
  -    */
  -    private LogManager()
  +     * Use this method to initialize the log4j support
  +     */
  +    private void initLog4j()
       {
  -         try
  +        try
           {
               InputStream propertiesInputStream;
               propertiesInputStream = this.getClass().getClassLoader().
  @@ -62,8 +62,8 @@
   
               //initialize wsrp4j-logger levels from properties
               int userDefinedGlobalLevel =
  -                getLevelFromString(wsrp4jLevels.
  -                    getProperty(GLOBAL_LOG_LEVEL_PROPERTY));
  +                getLevelFromString(wsrp4jLevels.getProperty(
  +                    GLOBAL_LOG_LEVEL_PROPERTY));
               if (userDefinedGlobalLevel != 0)
               {
                   globalLogLevel = userDefinedGlobalLevel;
  @@ -88,10 +88,23 @@
       */
       public static LogManager getLogManager()
       {
  +        if ( logManager == null ) 
  +        {
  +            logManager = new LogManager();
  +            logManager.initLog4j();
  +        }
           return logManager;
       }
   
       /**
  +     * Sets a different LogManager implementation
  +     */
  +    public static void setLogManager(LogManager manager)
  +    {
  +        logManager = manager;
  +    }
  +
  +    /**
         Returns a Logger instance for the calling class
         
         @param aClass The class that requests the logger instance.
  @@ -106,8 +119,8 @@
           //determine log level for aClass
           String propertyName = PROPERTY_PREFIX + aClass.getName();
           int level = globalLogLevel;
  -        int userDefinedLevel = 
  -                getLevelFromString(wsrp4jLevels.getProperty(propertyName));
  +        int userDefinedLevel = getLevelFromString(
  +                wsrp4jLevels.getProperty(propertyName));
           if (userDefinedLevel != 0)
           {
               level = userDefinedLevel;
  @@ -116,8 +129,8 @@
       }
   
       /*
  -      Returns an int LogLevel defined by a String 
  -      {ERROR, WARN, INFO, TRACE_HIGH, TRACE_MEDIUM, TRACE_LOW}.
  +      Returns an int LogLevel defined by a String {ERROR, WARN, INFO, 
  +      TRACE_HIGH, TRACE_MEDIUM, TRACE_LOW}.
         Use this method to convert levels defined in a properties file
         If the string does not represent a correct level this method returns 0
       */
  @@ -147,10 +160,8 @@
               {
                   return 0;
               }
  -        } else
  -        {
  -            return 0;
           }
  +        return 0;
       }
   
       /*
  
  
  
  1.2       +3 -0      ws-wsrp4j/sandbox/wsrp4j/commons/src/java/org/apache/wsrp4j/commons/log/Logger.java
  
  Index: Logger.java
  ===================================================================
  RCS file: /home/cvs/ws-wsrp4j/sandbox/wsrp4j/commons/src/java/org/apache/wsrp4j/commons/log/Logger.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- Logger.java	21 Jul 2005 17:15:47 -0000	1.1
  +++ Logger.java	22 Aug 2005 18:52:10 -0000	1.2
  @@ -69,6 +69,9 @@
      <P>
    */
   
  +/*
  + * @version $Id$
  + */
   public interface Logger
   {
       /**
  
  
  
  1.2       +6 -7      ws-wsrp4j/sandbox/wsrp4j/commons/src/java/org/apache/wsrp4j/commons/log/LoggerImpl.java
  
  Index: LoggerImpl.java
  ===================================================================
  RCS file: /home/cvs/ws-wsrp4j/sandbox/wsrp4j/commons/src/java/org/apache/wsrp4j/commons/log/LoggerImpl.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- LoggerImpl.java	21 Jul 2005 17:15:47 -0000	1.1
  +++ LoggerImpl.java	22 Aug 2005 18:52:10 -0000	1.2
  @@ -18,11 +18,12 @@
   
   
   /**
  -  Wrapper class for a log4j logger
  -*/
  + * Wrapper class for a log4j logger
  + * @version $Id$
  + */
   public final class LoggerImpl implements Logger
   {
  -    private org.apache.log4j.Logger logger = null;
  +    private org.apache.log4j.Logger logger;
       private int level = Logger.ERROR; // default logLevel defined by wsrp4j
   
       LoggerImpl(org.apache.log4j.Logger aLogger, int logLevel)
  @@ -37,10 +38,8 @@
           if (log4jLevel != org.apache.log4j.Level.OFF)
           {
               return (logLevel <= level && logger.isEnabledFor(log4jLevel));
  -        } else
  -        {
  -            return false;
           }
  +        return false;
       }
   
       public void text(int logLevel, String loggingMethod, String text)
  @@ -74,7 +73,7 @@
               return;
           }
           //logger.log("text", org.apache.log4j.Level.ERROR, "isLogging return 
  -        //true with level " + logLevel, null); 
  +        // true with level " + logLevel, null); 
   
           //determine log4j log level
           org.apache.log4j.Level log4jLevel = determineLog4jLevel(logLevel);
  
  
  
  1.1                  ws-wsrp4j/sandbox/wsrp4j/commons/src/java/org/apache/wsrp4j/commons/persistence/ClientPersistentFactory.java
  
  Index: ClientPersistentFactory.java
  ===================================================================
  /*
   * Copyright 2003-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.wsrp4j.commons.persistence;
  
  import org.apache.wsrp4j.commons.exception.WSRPException;
  
  
  /**
   * This class is the interface definition for the client persistence
   * support factory class. E.g. a consumer uses client persistent 
   * support. 
   *
   * @author  <a href="mailto:Ralf.Altrichter@de.ibm.com">Ralf Altrichter</a>
   *
   * @version $Id: ClientPersistentFactory.java,v 1.1 2005/08/22 18:52:10 dlouzan Exp $
   */
  public interface ClientPersistentFactory extends PersistentFactory
  {
  
      /**
       * Returns a PageList
       *
       * @return PersistentDataObject
       * @throws WSRPException
       */
      public PersistentDataObject getPageList() throws WSRPException;
  
  
       /**
       * Returns the ConsumerPortletContextList
       * 
       * @return PersistentDataObject
       * @throws WSRPException
       */
      public PersistentDataObject getConsumerPortletContextList() 
      throws WSRPException;
  
  }
  
  
  
  1.1                  ws-wsrp4j/sandbox/wsrp4j/commons/src/java/org/apache/wsrp4j/commons/persistence/PersistentDataObject.java
  
  Index: PersistentDataObject.java
  ===================================================================
  /*
   * Copyright 2003-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.wsrp4j.commons.persistence;
  
  import java.util.Iterator;
  
  
  /**
   * This class is the generic interface for the PersistentDataObject 
   * implementations used to store and retrieve objects from a persistent
   * store. 
   * 
   * @author  <a href="mailto:Ralf.Altrichter@de.ibm.com">Ralf Altrichter</a>
   *
   * @version $Id: PersistentDataObject.java,v 1.1 2005/08/22 18:52:10 dlouzan Exp $
   */
  public interface PersistentDataObject
  {
  
      /**
       * Sets the PersistentInformation object for this PersistentDataObject
       *
       * @param persistentInfo 
       * @see PersistentInformation
       */
      public void setPersistentInformation(PersistentInformation persistentInfo);
  
      /**
       * Get the PersistentInformation for this PersistentDataObject
       *
       * @return PersistentInformation
       * @see PersistentInformation
       */
      public PersistentInformation getPersistentInformation();
  
      /**
       * Clear the internal object collection 
       */
      public void clear();
  
      /**
       * Returns all objects in the object map as an iterator
       * 
       * @return Iterator
       */
      public Iterator getObjects();
  
      /**
       * Add an element to the internal map
       * 
       * @param object Object as element
       * 
       */
      public void addObject(Object object);
  
      /**
       * Returns the last element added
       * 
       * @return Object as last element
       */
      public Object getLastElement();
  
  }
  
  
  
  1.1                  ws-wsrp4j/sandbox/wsrp4j/commons/src/java/org/apache/wsrp4j/commons/persistence/PersistentFactory.java
  
  Index: PersistentFactory.java
  ===================================================================
  /*
   * Copyright 2003-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.wsrp4j.commons.persistence;
  
  import org.apache.wsrp4j.commons.exception.WSRPException;
  
  
  /**
   * This class is the base interface definition for the persistence
   * support factory class.
   *
   * @author  <a href="mailto:Ralf.Altrichter@de.ibm.com">Ralf Altrichter</a>
   *
   * @version $Id: PersistentFactory.java,v 1.1 2005/08/22 18:52:10 dlouzan Exp $
   */
  public interface PersistentFactory
  {
  
      /**
       * Returns the PersistentHandler
       * 
       * @return PersistentHandler
       */
      public PersistentHandler getPersistentHandler();
  
      /**
       * Returns the PersistentInformationProvider
       * 
       * @return PersistentInformationProvider
       */
      public PersistentInformationProvider getPersistentInformationProvider();
  
  
       /**
       * Returns the PortletList
       * 
       * @return PersistentDataObject
       */
      public PersistentDataObject getPortletList() throws WSRPException;
  
      /**
       * Returns the UserList
       * 
       * @return PersistentDataObject
       */
      public PersistentDataObject getUserList() throws WSRPException;
  
          /**
       * Returns the ProducerList
       * 
       * @return PersistentDataObject
       */
      public PersistentDataObject getProducerList() throws WSRPException;
  
  }
  
  
  
  1.1                  ws-wsrp4j/sandbox/wsrp4j/commons/src/java/org/apache/wsrp4j/commons/persistence/PersistentHandler.java
  
  Index: PersistentHandler.java
  ===================================================================
  /*
   * Copyright 2003-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.wsrp4j.commons.persistence;
  
  import org.apache.wsrp4j.commons.exception.WSRPException;
  
  /**
   * This class is the generic interface for the PersistentHandler implementation.
   * A PersistentHandler is used to store and retrieve objects from a persistent
   * store.
   *
   * @author  <a href="mailto:Ralf.Altrichter@de.ibm.com">Ralf Altrichter</a>
   *
   * @version $Id: PersistentHandler.java,v 1.1 2005/08/22 18:52:10 dlouzan Exp $
   */
  public interface PersistentHandler
  {
  
      /**
       * Store a single object from the PersistentDataObject to persistent
       * store.
       * 
       * @param persistentDataObject
       * @throws WSRPException
       */
      public void store(PersistentDataObject persistentDataObject) 
      throws WSRPException;
  
      /**
       * Restore a single object into the persistentDataObject from the 
       * persistent store
       * 
       * @param persistentDataObject
       * @throws WSRPException
       */
      public PersistentDataObject restore(
              PersistentDataObject persistentDataObject)
      throws WSRPException;
  
      /**
       * Restore all known objects into the persistentDataObject from the persistent store
       * 
       * @param persistentDataObject
       * @throws WSRPException
       */
      public PersistentDataObject restoreMultiple(
              PersistentDataObject persistentDataObject)
      throws WSRPException;
  
      /**
       * Delete a object from the persistent store
       */
      public void delete(PersistentDataObject persistentDataObject);
  
  }
  
  
  
  1.1                  ws-wsrp4j/sandbox/wsrp4j/commons/src/java/org/apache/wsrp4j/commons/persistence/PersistentInformation.java
  
  Index: PersistentInformation.java
  ===================================================================
  /*
   * Copyright 2003-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.wsrp4j.commons.persistence;
  
  
  /**
   * This class is the generic interface for the persistent information used
   * with PersistentDataObjects.
   *
   * @author  <a href="mailto:Ralf.Altrichter@de.ibm.com">Ralf Altrichter</a>
   * @version $Id: PersistentInformation.java,v 1.1 2005/08/22 18:52:10 dlouzan Exp $
   */
  public interface PersistentInformation
  {
  
      /**
       * Set a group identifier. All PersistentDataObjects with this
       * PersistentInformation will be stored in the persistent store
       * with this groupID.
       * 
       * @param groupID as String
       */
      public void setGroupID(String groupID);
  
      /**
       * Returns a group identifier
       * 
       * @return groupID as String
       */
      public String getGroupID();
  
  }
  
  
  
  1.1                  ws-wsrp4j/sandbox/wsrp4j/commons/src/java/org/apache/wsrp4j/commons/persistence/PersistentInformationProvider.java
  
  Index: PersistentInformationProvider.java
  ===================================================================
  /*
   * Copyright 2003-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.wsrp4j.commons.persistence;
  
  
  /**
   * This class is the generic interface for the PersistentInformationProviders.
   *
   * @author  <a href="mailto:Ralf.Altrichter@de.ibm.com">Ralf Altrichter</a>
   * @version $Id: PersistentInformationProvider.java,v 1.1 2005/08/22 18:52:10 dlouzan Exp $
   */
  public interface PersistentInformationProvider
  {
  
  }
  
  
  
  1.2       +3 -0      ws-wsrp4j/sandbox/wsrp4j/commons/src/java/org/apache/wsrp4j/commons/util/Constants.java
  
  Index: Constants.java
  ===================================================================
  RCS file: /home/cvs/ws-wsrp4j/sandbox/wsrp4j/commons/src/java/org/apache/wsrp4j/commons/util/Constants.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- Constants.java	21 Jul 2005 17:43:24 -0000	1.1
  +++ Constants.java	22 Aug 2005 18:52:11 -0000	1.2
  @@ -17,6 +17,9 @@
   package org.apache.wsrp4j.commons.util;
   
   
  +/*
  + * @version $Id$
  + */
   public final class Constants
   {
   
  
  
  
  1.2       +15 -12    ws-wsrp4j/sandbox/wsrp4j/commons/src/java/org/apache/wsrp4j/commons/util/Modes.java
  
  Index: Modes.java
  ===================================================================
  RCS file: /home/cvs/ws-wsrp4j/sandbox/wsrp4j/commons/src/java/org/apache/wsrp4j/commons/util/Modes.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- Modes.java	3 Aug 2005 20:16:25 -0000	1.1
  +++ Modes.java	22 Aug 2005 18:52:11 -0000	1.2
  @@ -20,28 +20,31 @@
   import javax.portlet.PortletMode;
   
   
  +/*
  + * @version $Id$
  + */
   public class Modes implements java.io.Serializable
   {
  -    private java.lang.String _value_;
  +    private String _value_;
       private static java.util.HashMap _table_ = new java.util.HashMap();
   
       // Constructor
  -    protected Modes(java.lang.String value)
  +    protected Modes(String value)
       {
           _value_ = value;
           _table_.put(_value_, this);
       }
   
       // define the modes we can currently handle
  -    public static final java.lang.String _view = "wsrp:view";
  -    public static final java.lang.String _edit = "wsrp:edit";
  -    public static final java.lang.String _help = "wsrp:help";
  -    public static final java.lang.String _preview = "wsrp:preview";
  +    public static final String _view = "wsrp:view";
  +    public static final String _edit = "wsrp:edit";
  +    public static final String _help = "wsrp:help";
  +    public static final String _preview = "wsrp:preview";
       public static final Modes view = new Modes(_view);
       public static final Modes edit = new Modes(_edit);
       public static final Modes help = new Modes(_help);
       public static final Modes preview = new Modes(_preview);
  -    public java.lang.String getValue()
  +    public String getValue()
       {
           return _value_;
       }
  @@ -52,7 +55,7 @@
        * @param value <code>String</string> representation of the WSRP mode
        * @return The WSRP <code>Mode</code> represented by the passed string
        */
  -    public static Modes fromValue(java.lang.String value)
  +    public static Modes fromValue(String value)
       {
           return (Modes)_table_.get(value);
       }
  @@ -63,12 +66,12 @@
        * @param value <code>String</string> representation of the WSRP mode
        * @return The WSRP <code>Mode</code> represented by the passed string
        */
  -    public static Modes fromString(java.lang.String value)
  +    public static Modes fromString(String value)
       {
           return fromValue(value);
       }
   
  -    public boolean equals(java.lang.Object obj)
  +    public boolean equals(Object obj)
       {
           return (obj == this);
       }
  @@ -78,12 +81,12 @@
           return toString().hashCode();
       }
   
  -    public java.lang.String toString()
  +    public String toString()
       {
           return _value_;
       }
   
  -    public java.lang.Object readResolve() throws java.io.ObjectStreamException
  +    public Object readResolve() throws java.io.ObjectStreamException
       {
           return fromValue(_value_);
       }
  
  
  
  1.2       +183 -490  ws-wsrp4j/sandbox/wsrp4j/commons/src/java/org/apache/wsrp4j/commons/util/ParameterChecker.java
  
  Index: ParameterChecker.java
  ===================================================================
  RCS file: /home/cvs/ws-wsrp4j/sandbox/wsrp4j/commons/src/java/org/apache/wsrp4j/commons/util/ParameterChecker.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- ParameterChecker.java	3 Aug 2005 16:58:41 -0000	1.1
  +++ ParameterChecker.java	22 Aug 2005 18:52:11 -0000	1.2
  @@ -59,28 +59,20 @@
   import org.apache.wsrp4j.commons.log.Logger;
   
   /**
  - * This class validates the objects and their attributes used for the WSRP 
  - * communication requests. The object and attribute tree is scanned including 
  - * the 2nd level. This means, that the input object, it's attributes and ,if 
  - * the attribute is itself an object, the subsequent object and It's attributes 
  - * are also checked. The checking is done only for required (R) parameters in 
  - * the WSRP specification. Optional (O) parameters are ignored. If a parameter 
  - * is specified as 'nillable' in the WSRP specification, the check is
  + * This class validates the objects and their attributes used for the WSRP communication 
  + * requests. The object and attribute tree is scanned including the 2nd level. This means, 
  + * that the input object, it's attributes and ,if the attribute is itself an object, the 
  + * subsequent object and It's attributes are also checked. The checking is done only for 
  + * required (R) parameters in the WSRP specification. Optional (O) parameters are ignored. 
  + * If a parameter is specified as 'nillable' in the WSRP specification, the check is
    * performed if the value is 'not null'. On null value, no checking is done.  
  + * @version $Id$
    */
   public class ParameterChecker
   {
   
       // for logging and exception support
  -    private Logger logger = 
  -            LogManager.getLogManager().getLogger(ParameterChecker.class);
  -
  -    /**
  -     * Default Constructor
  -     */
  -    public ParameterChecker()
  -    {
  -    }
  +    private Logger logger = LogManager.getLogManager().getLogger(ParameterChecker.class);
   
   	/**
   	 * @return true if we check
  @@ -110,24 +102,14 @@
        * 
        * @see GetServiceDescription
        */
  -    public void check(GetServiceDescription request) 
  -    throws MissingParametersFault
  +    public void check(GetServiceDescription request) throws MissingParametersFault
       {
       	if (isCheckEnabled())
       	{
   			// check ClonePortlet request object pointer
  -			if (request instanceof GetServiceDescription)
  -			{
  -
  -				// check for registration context
  -				check(request.getRegistrationContext(), 
  -                        Constants.NILLABLE_TRUE);
  +			// check for registration context
  +   		    check(request.getRegistrationContext(), Constants.NILLABLE_TRUE);
   
  -			} else
  -			{
  -				throwMissingParametersFault("Input object is not from type " +
  -                        "GetServiceDescription or is null");
  -			}
       	}
       }
   
  @@ -147,20 +129,10 @@
       {
   		if (isCheckEnabled())
   		{
  -			// check ClonePortlet request object pointer
  -			if (request instanceof ModifyRegistration)
  -			{
  -
  -				// check for registration context
  -				check(request.getRegistrationContext(), 
  -                        Constants.NILLABLE_TRUE);
  -				check(request.getRegistrationData(), Constants.NILLABLE_FALSE);
  -
  -			} else
  -			{
  -				throwMissingParametersFault("Input object is not from type" +
  -                        " ModifyRegistration or is null");
  -			}
  +            // check ClonePortlet request object pointer
  +			// check for registration context
  +			check(request.getRegistrationContext(), Constants.NILLABLE_TRUE);
  +			check(request.getRegistrationData(), Constants.NILLABLE_FALSE);
   		}
       }
   
  @@ -184,28 +156,17 @@
   		if (isCheckEnabled())
   		{
   			// check ClonePortlet request object pointer
  -			if (request instanceof GetMarkup)
  -			{
  -
  -				// check for registration context
  -				check(request.getRegistrationContext(), 
  -                        Constants.NILLABLE_TRUE);
  -				check(request.getPortletContext(), Constants.NILLABLE_FALSE);
  -				check(request.getRuntimeContext(), Constants.NILLABLE_FALSE);
  -				check(request.getUserContext(), Constants.NILLABLE_TRUE);
  -				check(request.getMarkupParams(), Constants.NILLABLE_FALSE);
  -
  -			} else
  -			{
  -				throwMissingParametersFault("Input object is not from type " +
  -                        "GetMarkup or is null");
  -			}
  +			// check for registration context
  +			check(request.getRegistrationContext(), Constants.NILLABLE_TRUE);
  +			check(request.getPortletContext(), Constants.NILLABLE_FALSE);
  +			check(request.getRuntimeContext(), Constants.NILLABLE_FALSE);
  +			check(request.getUserContext(), Constants.NILLABLE_TRUE);
  +			check(request.getMarkupParams(), Constants.NILLABLE_FALSE);
   		}
       }
   
       /**
  -     * Check the PerformBlockingInteraction. The following attributes are 
  -     * mandatory:
  +     * Check the PerformBlockingInteraction. The following attributes are mandatory:
        * 
        * 1) RegistrationContext, only if available
        * 2) PortletContext
  @@ -220,30 +181,18 @@
        * 
        * @see PerformBlockingInteraction
        */
  -    public void check(PerformBlockingInteraction request) 
  -    throws MissingParametersFault
  +    public void check(PerformBlockingInteraction request) throws MissingParametersFault
       {
   		if (isCheckEnabled())
   		{
   			// check PerformBlockingInteraction request object pointer
  -			if (request instanceof PerformBlockingInteraction)
  -			{
  -
  -				// check for registration context
  -				check(request.getRegistrationContext(), 
  -                        Constants.NILLABLE_TRUE);
  -				check(request.getPortletContext(), Constants.NILLABLE_FALSE);
  -				check(request.getRuntimeContext(), Constants.NILLABLE_FALSE);
  -				check(request.getUserContext(), Constants.NILLABLE_TRUE);
  -				check(request.getMarkupParams(), Constants.NILLABLE_FALSE);
  -				check(request.getInteractionParams(), 
  -                        Constants.NILLABLE_FALSE);
  -
  -			} else
  -			{
  -				throwMissingParametersFault("Input object is not from type " +
  -                        "PerformBlockingInteraction or is null");
  -			}
  +        	// check for registration context
  +        	check(request.getRegistrationContext(), Constants.NILLABLE_TRUE);
  +        	check(request.getPortletContext(), Constants.NILLABLE_FALSE);
  +        	check(request.getRuntimeContext(), Constants.NILLABLE_FALSE);
  +        	check(request.getUserContext(), Constants.NILLABLE_TRUE);
  +        	check(request.getMarkupParams(), Constants.NILLABLE_FALSE);
  +        	check(request.getInteractionParams(), Constants.NILLABLE_FALSE);
   		}
       }
   
  @@ -263,24 +212,12 @@
   		if (isCheckEnabled())
   		{
   			// check InitCookie request object pointer
  -			if (request instanceof InitCookie)
  -			{
  -
  -				check(request.getRegistrationContext(), 
  -                        Constants.NILLABLE_TRUE);
  -
  -			} else
  -			{
  -
  -				throwMissingParametersFault("Input object is not from type " +
  -                        "InitCookie or is null");
  -			}
  +			check(request.getRegistrationContext(), Constants.NILLABLE_TRUE);
   		}	
       }
   
       /**
  -     * Parameter check for the GetPortletDescription object. 
  -     * The following attributes are mandatory
  +     * Parameter check for the GetPortletDescription object. The following attributes are mandatory
        * 
        * 1) RegistrationContext, only if available
        * 2) PortletContext
  @@ -292,30 +229,19 @@
        * 
        * @see GetPortletDescription
        */
  -    public void check(GetPortletDescription request) 
  -    throws MissingParametersFault
  +    public void check(GetPortletDescription request) throws MissingParametersFault
       {
   		if (isCheckEnabled())
   		{
   			// check GetPortletDescription request object pointer
  -			if (request instanceof GetPortletDescription)
  -			{
  -				check(request.getRegistrationContext(), 
  -                        Constants.NILLABLE_TRUE);
  -				check(request.getPortletContext(), Constants.NILLABLE_FALSE);
  -				check(request.getUserContext(), Constants.NILLABLE_TRUE);
  -
  -			} else
  -			{
  -				throwMissingParametersFault("Input object is not from type " +
  -                        "GetPortletDescription or is null");
  -			}
  +			check(request.getRegistrationContext(), Constants.NILLABLE_TRUE);
  +			check(request.getPortletContext(), Constants.NILLABLE_FALSE);
  +			check(request.getUserContext(), Constants.NILLABLE_TRUE);
   		}
       }
   
       /**
  -     * Parameter check for the ClonePortlet object. 
  -     * The following attributes are mandatory:
  +     * Parameter check for the ClonePortlet object. The following attributes are mandatory:
        * 
        * 1) RegistrationContext, only if available
        * 2) PortletContext
  @@ -332,27 +258,15 @@
   		if (isCheckEnabled())
   		{
   			// check ClonePortlet request object pointer
  -			if (request instanceof ClonePortlet)
  -			{
  -
  -				// check for registration context
  -				check(request.getRegistrationContext(), 
  -                        Constants.NILLABLE_TRUE);
  -				check(request.getPortletContext(), Constants.NILLABLE_FALSE);
  -				check(request.getUserContext(), Constants.NILLABLE_TRUE);
  -
  -			} else
  -			{
  -
  -				throwMissingParametersFault("Input object is not a " +
  -                        "ClonePortlet or is null");
  -			}
  +			// check for registration context
  +			check(request.getRegistrationContext(), Constants.NILLABLE_TRUE);
  +			check(request.getPortletContext(), Constants.NILLABLE_FALSE);
  +			check(request.getUserContext(), Constants.NILLABLE_TRUE);
   		}
       }
   
       /**
  -     * Parameter check for the DestroyEntites object. The following attributes 
  -     * are mandatory:
  +     * Parameter check for the DestroyEntites object. The following attributes are mandatory:
        * 
        * 1) RegistrationContext, only if available
        * 2) PortletHandle
  @@ -368,26 +282,14 @@
   		if (isCheckEnabled())
   		{
   			// check DestroyPortlet request object pointer
  -			if (request instanceof DestroyPortlets)
  -			{
  -
  -				// check for registration context
  -				check(request.getRegistrationContext(), 
  -                        Constants.NILLABLE_TRUE);
  -				check(request.getPortletHandles(), Constants.NILLABLE_FALSE);
  -
  -			} else
  -			{
  -
  -				throwMissingParametersFault("Input object is not a " +
  -                        "DestroyPortlets or is null");
  -			}
  +			// check for registration context
  +			check(request.getRegistrationContext(), Constants.NILLABLE_TRUE);
  +			check(request.getPortletHandles(), Constants.NILLABLE_FALSE);
   		}
       }
   
       /**
  -     * Parameter check for the SetPortletProperties object. 
  -     * The following attributes are mandatory:
  +     * Parameter check for the SetPortletProperties object. The following attributes are mandatory:
        * 
        * 1) RegistrationContext, only if available
        * 2) PortletContext
  @@ -400,34 +302,21 @@
        * 
        * @see SetPortletProperties
        */
  -    public void check(SetPortletProperties request) 
  -    throws MissingParametersFault
  +    public void check(SetPortletProperties request) throws MissingParametersFault
       {
   		if (isCheckEnabled())
   		{
   			// check SetPortletProperties request object pointer
  -			if (request instanceof SetPortletProperties)
  -			{
  -
  -				// check for registration context
  -				check(request.getRegistrationContext(), 
  -                        Constants.NILLABLE_TRUE);
  -				check(request.getPortletContext(), Constants.NILLABLE_FALSE);
  -				check(request.getUserContext(), Constants.NILLABLE_TRUE);
  -				check(request.getPropertyList(), Constants.NILLABLE_FALSE);
  -
  -			} else
  -			{
  -
  -				throwMissingParametersFault("Input object is not a " +
  -                        "SetPortletProperties or is null");
  -			}
  +			// check for registration context
  +			check(request.getRegistrationContext(), Constants.NILLABLE_TRUE);
  +			check(request.getPortletContext(), Constants.NILLABLE_FALSE);
  +			check(request.getUserContext(), Constants.NILLABLE_TRUE);
  +			check(request.getPropertyList(), Constants.NILLABLE_FALSE);
   		}
       }
   
       /**
  -     * Parameter check for the SetPortletProperties object. 
  -     * The following attributes are mandatory:
  +     * Parameter check for the SetPortletProperties object. The following attributes are mandatory:
        * 
        * 1) RegistrationContext, only if available
        * 2) PortletContext
  @@ -438,35 +327,23 @@
        *  
        * @throws MissingParametersFault
        * 
  -     * @see GetPortletPorperties
  +     * @see GetPortletProperties
        */
  -    public void check(GetPortletProperties request) 
  -    throws MissingParametersFault
  +    public void check(GetPortletProperties request) throws MissingParametersFault
       {
   		if (isCheckEnabled())
   		{
   			// check GetPortletProperties request object pointer
  -			if (request instanceof GetPortletProperties)
  -			{
  -
  -				// check for registration context
  -				check(request.getRegistrationContext(), 
  -                        Constants.NILLABLE_TRUE);
  -				check(request.getPortletContext(), Constants.NILLABLE_FALSE);
  -				check(request.getUserContext(), Constants.NILLABLE_TRUE);
  -				check(request.getNames(), Constants.NILLABLE_TRUE);
  -
  -			} else
  -			{
  -				throwMissingParametersFault("Input object is not a " +
  -                        "GetPortletProperties or is null");
  -			}
  +			// check for registration context
  +			check(request.getRegistrationContext(), Constants.NILLABLE_TRUE);
  +			check(request.getPortletContext(), Constants.NILLABLE_FALSE);
  +			check(request.getUserContext(), Constants.NILLABLE_TRUE);
  +			check(request.getNames(), Constants.NILLABLE_TRUE);
   		}
       }
   
       /**
  -     * Parameter check for the SetPortletProperties object. 
  -     * The following attributes are mandatory: 
  +     * Parameter check for the SetPortletProperties object. The following attributes are mandatory: 
        * 
        * 1) RegistrationContext, only if available
        * 2) PortletContext
  @@ -478,33 +355,20 @@
        * 
        * @see GetPortletPropertyDescription
        */
  -    public void check(GetPortletPropertyDescription request) 
  -    throws MissingParametersFault
  +    public void check(GetPortletPropertyDescription request) throws MissingParametersFault
       {
   		if (isCheckEnabled())
   		{
   			// check GetPortletPropertyDescription request object pointer
  -			if (request instanceof GetPortletPropertyDescription)
  -			{
  -
  -				// check for registration context
  -				check(request.getRegistrationContext(), 
  -                        Constants.NILLABLE_TRUE);
  -				check(request.getPortletContext(), Constants.NILLABLE_FALSE);
  -				check(request.getUserContext(), Constants.NILLABLE_TRUE);
  -
  -			} else
  -			{
  -
  -				throwMissingParametersFault("Input object is not a " +
  -                        "GetPortletPropertyDescription or is null");
  -			}
  +			// check for registration context
  +			check(request.getRegistrationContext(), Constants.NILLABLE_TRUE);
  +			check(request.getPortletContext(), Constants.NILLABLE_FALSE);
  +			check(request.getUserContext(), Constants.NILLABLE_TRUE);
   		}
       }
   
       /**
  -     * Parameter check for the ReleaseSession object. 
  -     * The following attributes are mandatory:
  +     * Parameter check for the ReleaseSession object. The following attributes are mandatory:
        * 
        * 1) RegistrationContext, only if available
        * 2) String[] SessionHandles
  @@ -513,29 +377,18 @@
        *  
        * @throws MissingParametersFault
        * 
  -     * @see ReleaseSession
  +     * @see ReleaseSessions
        */
       public void check(ReleaseSessions request) throws MissingParametersFault
       {
   		if (isCheckEnabled())
   		{
   			// check ReleaseSession request object pointer
  -			if (request instanceof ReleaseSessions)
  -			{
  -
  -				// check for registration context
  -				check(request.getRegistrationContext(), 
  -                        Constants.NILLABLE_TRUE);
  -
  -				// check sessionhandles array
  -				check(request.getSessionIDs(), Constants.NILLABLE_FALSE);
  -
  -			} else
  -			{
  +			// check for registration context
  +			check(request.getRegistrationContext(), Constants.NILLABLE_TRUE);
   
  -				throwMissingParametersFault("Input object is not a " +
  -                        "ReleaseSession or is null");
  -			}
  +			// check sessionhandles array
  +			check(request.getSessionIDs(), Constants.NILLABLE_FALSE);
   		}
       }
   
  @@ -544,8 +397,7 @@
        */
   
       /**
  -     * Parameter check for the ServiceDescription object. 
  -     * The following attribute needs to be set:
  +     * Parameter check for the ServiceDescription object. The following attribute needs to be set:
        *  
        * - requiresRegistration
        *
  @@ -555,50 +407,38 @@
        * 
        * @see ServiceDescription
        */
  -    public void check(ServiceDescription response) 
  -    throws MissingParametersFault
  +    public void check(ServiceDescription response) throws MissingParametersFault
       {
           if (isCheckEnabled()) {
               if (response != null) {
                   // check ServiceDescription  object pointer
  -                if (response instanceof ServiceDescription) {
  -
  -                    if (response.getOfferedPortlets() != null) {
  -
  -                        PortletDescription[] portletDesc = 
  -                                response.getOfferedPortlets();
  +                if (response.getOfferedPortlets() != null) {
   
  -                        for (int i = 0; i < portletDesc.length; i++) {
  +                    PortletDescription[] portletDesc = response.getOfferedPortlets();
   
  -                            check(portletDesc[i]);
  -                        }
  +                    for (int i = 0; i < portletDesc.length; i++) {
   
  -                    } else if (response.getRequiresInitCookie() != null) {
  +                        check(portletDesc[i]);
  +                    }
   
  -                        check(response.getRequiresInitCookie(), true);
  +                } else if (response.getRequiresInitCookie() != null) {
   
  -                    } else if (response.getResourceList() != null) {
  +                    check(response.getRequiresInitCookie(), true);
   
  -                        check(response.getResourceList(), true);
  +                } else if (response.getResourceList() != null) {
   
  -                    }
  -                } else {
  +                    check(response.getResourceList(), true);
   
  -                    throwMissingParametersFault("No valid service " +
  -                            "description.");
                   }
  -
               } else {
   
  -                throwMissingParametersFault("No valid service description " +
  -                        "response found.");
  +                throwMissingParametersFault("No valid service description response found.");
               }
           }
       }
   
       /**
  -     * Parameter check for the BlockingInteractionResponse object. 
  -     * The following attribute needs to be set:
  +     * Parameter check for the BlockingInteractionResponse object. The following attribute needs to be set:
        *  
        * either
        *  - updateResponse
  @@ -611,46 +451,33 @@
        * 
        * @see BlockingInteractionResponse
        */
  -    public void check(BlockingInteractionResponse response) 
  -    throws MissingParametersFault
  +    public void check(BlockingInteractionResponse response) throws MissingParametersFault
       {
   		if (isCheckEnabled())
   		{
   			// check BlockingInteractionResponse  object pointer
  -			if (response instanceof BlockingInteractionResponse)
  +			if (response.getUpdateResponse() != null && response.getRedirectURL() == null)
   			{
   
  -				if (response.getUpdateResponse() != null && 
  -                        response.getRedirectURL() == null)
  -				{
  -
  -					check(response.getUpdateResponse());
  +				check(response.getUpdateResponse());
   
  -				} else if (response.getRedirectURL() != null && 
  -                        response.getUpdateResponse() == null)
  -				{
  -
  -					// everything is fine
  +			} else if (response.getRedirectURL() != null && response.getUpdateResponse() == null)
  +			{
   
  -				} else
  -				{
  +				// everything is fine
   
  -					throwMissingParametersFault(
  -						"No valid blocking interaction response. UpdateResponse"
  -							+ "and redirect url are mutually exclusive");
  -				}
   			} else
   			{
   
  -				throwMissingParametersFault("No valid blocking interaction " +
  -                        "response found.");
  +				throwMissingParametersFault(
  +					"No valid blocking interaction response. UpdateResponse"
  +						+ "and redirect url are mutually exclusive");
   			}
   		}
       }
   
       /**
  -     * Parameter check for the UpdateResponse object. 
  -     * The following attribute needs to be set:
  +     * Parameter check for the UpdateResponse object. The following attribute needs to be set:
        *  
        * 1) SessionContext, only if available
        * 2) PortletContext, only if available
  @@ -667,25 +494,15 @@
       {
   
           // check UpdateResponse  object pointer
  -        if (response instanceof UpdateResponse)
  -        {
  -
  -            check(response.getSessionContext(), Constants.NILLABLE_TRUE);
  -            check(response.getPortletContext(), Constants.NILLABLE_TRUE);
  -            check(response.getMarkupContext(), Constants.NILLABLE_TRUE);
  +        check(response.getSessionContext(), Constants.NILLABLE_TRUE);
  +        check(response.getPortletContext(), Constants.NILLABLE_TRUE);
  +        check(response.getMarkupContext(), Constants.NILLABLE_TRUE);
   
  -            // TODO: check for valid window states and portlet modes
  -
  -        } else
  -        {
  -
  -            throwMissingParametersFault("No valid update response found.");
  -        }
  +        // TODO: check for valid window states and portlet modes
       }
   
       /**
  -     * Parameter check for the MarkupResponse object. 
  -     * The following attribute needs to be set:
  +     * Parameter check for the MarkupResponse object. The following attribute needs to be set:
        * 
        * 1) MarkupContext
        * 2) SessionContext, only if available
  @@ -701,17 +518,8 @@
   		if (isCheckEnabled())
   		{
   			// check MarkupResponse  object pointer
  -			if (response instanceof MarkupResponse)
  -			{
  -
  -				check(response.getMarkupContext(), Constants.NILLABLE_FALSE);
  -				check(response.getSessionContext(), Constants.NILLABLE_TRUE);
  -
  -			} else
  -			{
  -
  -				throwMissingParametersFault("No valid markup response found.");
  -			}
  +			check(response.getMarkupContext(), Constants.NILLABLE_FALSE);
  +			check(response.getSessionContext(), Constants.NILLABLE_TRUE);
   		}
       }
   
  @@ -727,24 +535,13 @@
        * 
        * @see PortletDescriptionResponse
        */
  -    public void check(PortletDescriptionResponse response) 
  -    throws MissingParametersFault
  +    public void check(PortletDescriptionResponse response) throws MissingParametersFault
       {
   		if (isCheckEnabled())
   		{
   			// check MarkupResponse  object pointer
  -			if (response instanceof PortletDescriptionResponse)
  -			{
  -
  -				check(response.getPortletDescription());
  -				check(response.getResourceList(), Constants.NILLABLE_TRUE);
  -
  -			} else
  -			{
  -
  -				throwMissingParametersFault("No valid " +
  -                        "PortletDescriptionResponse response found.");
  -			}
  +			check(response.getPortletDescription());
  +			check(response.getResourceList(), Constants.NILLABLE_TRUE);
   		}
       }
   
  @@ -759,25 +556,14 @@
        * 
        * @see PortletPropertyDescriptionResponse
        */
  -    public void check(PortletPropertyDescriptionResponse response) 
  -    throws MissingParametersFault
  +    public void check(PortletPropertyDescriptionResponse response) throws MissingParametersFault
       {
   		if (isCheckEnabled())
   		{
   			// check MarkupResponse  object pointer
  -			if (response instanceof PortletPropertyDescriptionResponse)
  -			{
  -
  -				// TODO: check ModelDescription
  -
  -				check(response.getResourceList(), Constants.NILLABLE_TRUE);
  -
  -			} else
  -			{
  +			// TODO: check ModelDescription
   
  -				throwMissingParametersFault("No valid " +
  -                        "PortletPropertyDescriptionResponse response found.");
  -			}
  +			check(response.getResourceList(), Constants.NILLABLE_TRUE);
   		}
       }
   
  @@ -792,23 +578,12 @@
        * 
        * @see DestroyPortletsResponse
        */
  -    public void check(DestroyPortletsResponse response) 
  -    throws MissingParametersFault
  +    public void check(DestroyPortletsResponse response) throws MissingParametersFault
       {
   		if (isCheckEnabled())
   		{
   			// check MarkupResponse  object pointer
  -			if (response instanceof DestroyPortletsResponse)
  -			{
  -
  -				check(response.getDestroyFailed(), Constants.NILLABLE_TRUE);
  -
  -			} else
  -			{
  -
  -				throwMissingParametersFault("No valid " +
  -                        "PortletDescriptionResponse response found.");
  -			}
  +			check(response.getDestroyFailed(), Constants.NILLABLE_TRUE);
   		}
       }
   
  @@ -817,8 +592,7 @@
        */
   
       /**
  -    * Parameter check for the PortletDescription object. 
  -     * The following parameter needs to be set:
  +    * Parameter check for the PortletDescription object. The following parameter needs to be set:
       * 
       * 1) portletHandle
       * 2) markupType[] 
  @@ -834,33 +608,20 @@
   		if (isCheckEnabled())
   		{
   			// check PortletDescription  object pointer
  -			if (element instanceof PortletDescription)
  +			if (element.getPortletHandle() == null)
   			{
  +				throwMissingParametersFault("A portlet handle has to be set in the portlet description.");
  +			}
   
  -				if (element.getPortletHandle() == null)
  -				{
  -					throwMissingParametersFault("A portlet handle has to " +
  -                            "be set in the portlet description.");
  -				}
  -
  -				if (element.getMarkupTypes() == null)
  -				{
  -					throwMissingParametersFault("Markup types have to " +
  -                            "be defined in the portlet description.");
  -				}
  -
  -			} else
  +			if (element.getMarkupTypes() == null)
   			{
  -
  -				throwMissingParametersFault("No valid portlet description " +
  -                        "found.");
  +				throwMissingParametersFault("Markup types have to be defined in the portlet description.");
   			}
   		}
       }
   
       /**
  -     * Parameter check for the PortletDescription object. 
  -     * The following parameter needs to be set:
  +     * Parameter check for the PortletDescription object. The following parameter needs to be set:
        * 
        * all templates...
        *
  @@ -875,30 +636,20 @@
   		if (isCheckEnabled())
   		{
   			// check PortletDescription  object pointer
  -			if (element instanceof Templates)
  +			if (element.getDefaultTemplate() == null)
   			{
  -				if (element.getDefaultTemplate() == null)
  -				{
  -					throwMissingParametersFault("DefaultTemplate has not " +
  -                            "been set!");
  -				}
  +				throwMissingParametersFault("DefaultTemplate has not been set!");
  +			}
   
  -				if (element.getSecureDefaultTemplate() == null)
  -				{
  -					throwMissingParametersFault("SecureDefaultTemplate " +
  -                            "Template has not been set!");
  -				}
  -			} else
  +			if (element.getSecureDefaultTemplate() == null)
   			{
  -				throwMissingParametersFault("Consumer has to provide " +
  -                        "templates!");
  +				throwMissingParametersFault("SecureDefaultTemplate Template has not been set!");
   			}
   		}
       }
   
       /**
  -     * Parameter check for the SessionContext object. 
  -     * The following parameter needs to be set:
  +     * Parameter check for the SessionContext object. The following parameter needs to be set:
        * 
        * 1) sessionID
        * 2) expire
  @@ -911,15 +662,13 @@
        * 
        * @see SessionContext
        */
  -    private void check(SessionContext context, boolean nillable) 
  -    throws MissingParametersFault
  +    private void check(SessionContext context, boolean nillable) throws MissingParametersFault
       {
           if (context != null)
           {
               if (context.getSessionID() == null)
               {
  -                throwMissingParametersFault("No valid session context " +
  -                        "found. No session handle set.");
  +                throwMissingParametersFault("No valid session context found. No session handle set.");
               } else
               {
                   // check, if the ID is valid, instance and length
  @@ -928,8 +677,7 @@
               }
               if (context.getExpires() == 0)
               {
  -                throwMissingParametersFault("No valid session context " +
  -                        "found. No session expire set.");
  +                throwMissingParametersFault("No valid session context found. No session expire set.");
               }
           } else
           {
  @@ -941,11 +689,9 @@
       }
   
       /**
  -     * Parameter check for the MarkupContext object. 
  -     * The following parameter needs to be set:
  +     * Parameter check for the MarkupContext object. The following parameter needs to be set:
        * 
  -     * 1) markupBinary and markupString mutually exclusive, if markupType 
  -     * is available
  +     * 1) markupBinary and markupString mutually exclusive, if markupType is available
        * 2) locale, if markupType is available
        * 
        * @param context MarkupContext
  @@ -956,8 +702,7 @@
        * 
        * @see MarkupContext
        */
  -    private void check(MarkupContext context, boolean nillable) 
  -    throws MissingParametersFault
  +    private void check(MarkupContext context, boolean nillable) throws MissingParametersFault
       {
           if (context != null)
           {
  @@ -976,14 +721,12 @@
               {
                   if (context.getMimeType() == null)
                   {
  -                    throwMissingParametersFault("MimeType not set in " +
  -                            "MarkupContext.");
  +                    throwMissingParametersFault("MimeType not set in MarkupContext.");
                   } else
                   {
                       if (context.getLocale() == null)
                       {
  -                        throwMissingParametersFault("Locale not set in " +
  -                                "MarkupContext.");
  +                        throwMissingParametersFault("Locale not set in MarkupContext.");
                       }
                   }
               }
  @@ -1009,20 +752,17 @@
        * 
        * @see PropertyList
        */
  -    public void check(PropertyList propertyList, boolean nillable) 
  -    throws MissingParametersFault
  +    public void check(PropertyList propertyList, boolean nillable) throws MissingParametersFault
       {
   		if (isCheckEnabled())
   		{
  -			// check only, if object not null, otherwise ignore. Object is 
  -            //defined as nillable
  +			// check only, if object not null, otherwise ignore. Object is defined as nillable
   			if (propertyList != null)
   			{
   				// property is mandatory
   				if (propertyList.getProperties() == null)
   				{
  -					throwMissingParametersFault("PropertyList[] in " +
  -                            "PropertyList is null");
  +					throwMissingParametersFault("PropertyList[] in PropertyList is null");
   				}
   
   			} else
  @@ -1050,26 +790,22 @@
        * 
        * @see RegistrationData
        */
  -    public void check(RegistrationData registrationData, boolean nillable) 
  -    throws MissingParametersFault
  +    public void check(RegistrationData registrationData, boolean nillable) throws MissingParametersFault
       {
   		if (isCheckEnabled())
   		{
  -			// check only, if object not null, otherwise ignore. Object is 
  -            //defined as nillable
  +			// check only, if object not null, otherwise ignore. Object is defined as nillable
   			if (registrationData != null)
   			{
   				// check the consumer name, is mandatory
   				if (registrationData.getConsumerName() == null)
   				{
  -					throwMissingParametersFault("ConsumerName in " +
  -                            "RegistrationData is null");
  +					throwMissingParametersFault("ConsumerName in RegistrationData is null");
   				}
   				// check the consumer agent, is mandatory
   				if (registrationData.getConsumerAgent() == null)
   				{
  -					throwMissingParametersFault("ConsumerAgent in " +
  -                            "RegistrationData is null");
  +					throwMissingParametersFault("ConsumerAgent in RegistrationData is null");
   				}
   
   			} else
  @@ -1077,8 +813,7 @@
   				// if registrationcontext is null, check if nillable is allowed
   				if (nillable == false)
   				{
  -					throwMissingParametersFault("RegistrationData object " +
  -                            "is null");
  +					throwMissingParametersFault("RegistrationData object is null");
   				}
   			}
   		}
  @@ -1101,18 +836,15 @@
        * 
        * @see String
        */
  -    private void check(String[] array, boolean nillable) 
  -    throws MissingParametersFault
  +    private void check(String[] array, boolean nillable) throws MissingParametersFault
       {
  -        // check only, if object not null, otherwise ignore. Object is 
  -        //defined as nillable
  +        // check only, if object not null, otherwise ignore. Object is defined as nillable
           if (array != null)
           {
               // check the array
               if (array.length == 0)
               {
  -                throwMissingParametersFault("String[] array length is " +
  -                        "zero (0)");
  +                throwMissingParametersFault("String[] array length is zero (0)");
               }
           } else
           {
  @@ -1138,18 +870,15 @@
        * 
        * @see InteractionParams
        */
  -    private void check(InteractionParams interactionParams, boolean nillable) 
  -    throws MissingParametersFault
  +    private void check(InteractionParams interactionParams, boolean nillable) throws MissingParametersFault
       {
  -        // check only, if object not null, otherwise ignore. Object is defined 
  -        //as nillable
  +        // check only, if object not null, otherwise ignore. Object is defined as nillable
           if (interactionParams != null)
           {
               // check the portletHandle, is mandatory
               if (interactionParams.getPortletStateChange() == null)
               {
  -                throwMissingParametersFault("PortletStateChange in " +
  -                        "InteractionParams is null");
  +                throwMissingParametersFault("PortletStateChange in InteractionParams is null");
               }
           } else
           {
  @@ -1176,28 +905,24 @@
        * 
        * @see RegistrationContext
        */
  -    public void check(RegistrationContext registrationContext, boolean nillable) 
  -    throws MissingParametersFault
  +    public void check(RegistrationContext registrationContext, boolean nillable) throws MissingParametersFault
       {
   		if (isCheckEnabled())
   		{
  -			// check only, if object not null, otherwise ignore. Object is 
  -            //defined as nillable
  +			// check only, if object not null, otherwise ignore. Object is defined as nillable
   			if (registrationContext != null)
   			{
   				// check the registrationHandle, is mandatory
   				if (registrationContext.getRegistrationHandle() == null)
   				{
  -					throwMissingParametersFault("RegistrationHandle in " +
  -                            "RegistrationContext is null");
  +					throwMissingParametersFault("RegistrationHandle in RegistrationContext is null");
   				}
   			} else
   			{
   				// if registrationcontext is null, check if nillable is allowed
   				if (nillable == false)
   				{
  -					throwMissingParametersFault("RegistrationContext object " +
  -                            "is null");
  +					throwMissingParametersFault("RegistrationContext object is null");
   				}
   			}
   		}
  @@ -1217,28 +942,24 @@
        * 
        * @see PortletContext
        */
  -    public void check(PortletContext portletContext, boolean nillable) 
  -    throws MissingParametersFault
  +    public void check(PortletContext portletContext, boolean nillable) throws MissingParametersFault
       {
   		if (isCheckEnabled())
   		{
  -			// check only, if object not null, otherwise ignore. Object 
  -            //is defined as nillable
  +			// check only, if object not null, otherwise ignore. Object is defined as nillable
   			if (portletContext != null)
   			{
   				// check the portletHandle, is mandatory
   				if (portletContext.getPortletHandle() == null)
   				{
  -					throwMissingParametersFault("PortletHandle in " +
  -                            "PortletContext is null");
  +					throwMissingParametersFault("PortletHandle in PortletContext is null");
   				}
   			} else
   			{
   				// if registrationcontext is null, check if nillable is allowed
   				if (nillable == false)
   				{
  -					throwMissingParametersFault("PortletContext object " +
  -                            "is null");
  +					throwMissingParametersFault("PortletContext object is null");
   				}
   			}
   		}
  @@ -1259,18 +980,15 @@
        * 
        * @see RuntimeContext
        */
  -    private void check(RuntimeContext runtimeContext, boolean nillable) 
  -    throws MissingParametersFault
  +    private void check(RuntimeContext runtimeContext, boolean nillable) throws MissingParametersFault
       {
  -        // check only, if object not null, otherwise ignore. Object is 
  -        //defined as nillable
  +        // check only, if object not null, otherwise ignore. Object is defined as nillable
           if (runtimeContext != null)
           {
               // check the userAuthentication, is mandatory
               if (runtimeContext.getUserAuthentication() == null)
               {
  -                throwMissingParametersFault("UserAuthentication in " +
  -                        "RuntimeContext is null");
  +                throwMissingParametersFault("UserAuthentication in RuntimeContext is null");
               }
   
               // check the portletHandle, is mandatory
  @@ -1290,8 +1008,7 @@
       }
   
       /**
  -     * Validates the DestroyFailed Array. If DestroyFailed objects are 
  -     * available, 
  +     * Validates the DestroyFailed Array. If DestroyFailed objects are available, 
        * they are checked for their content. 
        * 
        * @param destroyFailedArray DestroyFailed[]
  @@ -1300,11 +1017,9 @@
        *                false, if the DestroyFailed[] is not nillable
        * 
        */
  -    private void check(DestroyFailed[] destroyFailedArray, boolean nillable) 
  -    throws MissingParametersFault
  +    private void check(DestroyFailed[] destroyFailedArray, boolean nillable) throws MissingParametersFault
       {
  -        // check only, if object not null, otherwise ignore. Object is defined 
  -        //as nillable
  +        // check only, if object not null, otherwise ignore. Object is defined as nillable
           if (destroyFailedArray != null)
           {
               if (destroyFailedArray.length > 0)
  @@ -1314,21 +1029,18 @@
                       // mandatory
                       if (destroyFailedArray[x].getPortletHandle() == null)
                       {
  -                        throwMissingParametersFault("Missing Portlet handle " +
  -                                "in DestroyFailed object.");
  +                        throwMissingParametersFault("Missing Portlet handle in DestroyFailed object.");
                       }
   
                       // mandatory
                       if (destroyFailedArray[x].getReason() == null)
                       {
  -                        throwMissingParametersFault("Missing Reason in " +
  -                                "DestroyFailed object.");
  +                        throwMissingParametersFault("Missing Reason in DestroyFailed object.");
                       }
                   }
               } else
               {
  -                throwMissingParametersFault("DestroyFailedArray length is " +
  -                        "zero (0).");
  +                throwMissingParametersFault("DestroyFailedArray length is zero (0).");
               }
           } else
           {
  @@ -1354,18 +1066,15 @@
        * 
        * @see UserContext
        */
  -    private void check(UserContext userContext, boolean nillable) 
  -    throws MissingParametersFault
  +    private void check(UserContext userContext, boolean nillable) throws MissingParametersFault
       {
  -        // check only, if object not null, otherwise ignore. Object is 
  -        //defined as nillable
  +        // check only, if object not null, otherwise ignore. Object is defined as nillable
           if (userContext != null)
           {
               // check the UserContextKey, is mandatory
               if (userContext.getUserContextKey() == null)
               {
  -                throwMissingParametersFault("UserContextKey in UserContext " +
  -                        "is null");
  +                throwMissingParametersFault("UserContextKey in UserContext is null");
               }
           } else
           {
  @@ -1381,12 +1090,11 @@
        * Validates the ResourceList object for available resources. 
        * 
        * @param resourceList
  -     * @param nillable, true if null is allowed
  +     * @param nillable true if null is allowed
        * 
        * @throws MissingParametersFault
        */
  -    private void check(ResourceList resourceList, boolean nillable) 
  -    throws MissingParametersFault
  +    private void check(ResourceList resourceList, boolean nillable) throws MissingParametersFault
       {
           // check only, if object not null.
           if (resourceList != null)
  @@ -1400,8 +1108,7 @@
                   Resource[] resourceArray = resourceList.getResources();
                   if (resourceArray.length < 1)
                   {
  -                    throwMissingParametersFault("ResourceArray length is " +
  -                            "zero (0).");
  +                    throwMissingParametersFault("ResourceArray length is zero (0).");
                   }
               }
           } else
  @@ -1418,35 +1125,28 @@
        * Validates the CookieProtocol object
        * 
        * @param requiresInit
  -     * @param nillable, true if null is allowed
  +     * @param nillable true if null is allowed
        * 
        * @throws MissingParametersFault
        */
  -    private void check(CookieProtocol requiresInit, boolean nillable) 
  -    throws MissingParametersFault
  +    private void check(CookieProtocol requiresInit, boolean nillable) throws MissingParametersFault
       {
           // check only, if object not null.
           if (requiresInit != null)
           {
  -            if (requiresInit.toString().equals(CookieProtocol._none))
  -            {
  -            } else if (requiresInit.toString().equals(CookieProtocol._perGroup))
  -            {
  -            } else if (requiresInit.toString().equals(CookieProtocol._perUser))
  -            {
  -            } else
  +            if (   !requiresInit.toString().equals(CookieProtocol._none)
  +                && !requiresInit.toString().equals(CookieProtocol._perGroup)
  +                && !requiresInit.toString().equals(CookieProtocol._perUser)) 
               {
                   throwMissingParametersFault(
  -                    "Invalid value (" + requiresInit.toString() + ") of " +
  -                        "CookieProtocol object.");
  +                    "Invalid value (" + requiresInit.toString() + ") of CookieProtocol object.");
               }
           } else
           {
               // if requiresInit is null, check if nillable is allowed
               if (nillable == false)
               {
  -                throwMissingParametersFault("RequiresInitCookie object is " +
  -                        "null");
  +                throwMissingParametersFault("RequiresInitCookie object is null");
               }
           }
       }
  @@ -1470,18 +1170,15 @@
        * 
        * @see MarkupParams
        */
  -    private void check(MarkupParams markupParams, boolean nillable) 
  -    throws MissingParametersFault
  +    private void check(MarkupParams markupParams, boolean nillable) throws MissingParametersFault
       {
  -        // check only, if object not null, otherwise ignore. Object is 
  -        //defined as nillable
  +        // check only, if object not null, otherwise ignore. Object is defined as nillable
           if (markupParams != null)
           {
               // check ClientData, is mandatory
               if (markupParams.getClientData() == null)
               {
  -                throwMissingParametersFault("ClientData in MarkupParams " +
  -                        "is null");
  +                throwMissingParametersFault("ClientData in MarkupParams is null");
               }
               if (markupParams.getLocales() == null)
               {
  @@ -1489,8 +1186,7 @@
               }
               if (markupParams.getMimeTypes() == null)
               {
  -                throwMissingParametersFault("MimeTypes in MarkupParams " +
  -                        "is null");
  +                throwMissingParametersFault("MimeTypes in MarkupParams is null");
               }
               if (markupParams.getMode() == null)
               {
  @@ -1498,8 +1194,7 @@
               }
               if (markupParams.getWindowState() == null)
               {
  -                throwMissingParametersFault("WindowState in MarkupParams " +
  -                        "is null");
  +                throwMissingParametersFault("WindowState in MarkupParams is null");
               }
           } else
           {
  @@ -1518,14 +1213,12 @@
        * 
        * @throws MissingParametersFault
        * 
  -     * @see MissingParameterFault
  +     * @see MissingParametersFault
        */
  -    private void throwMissingParametersFault(String msg) 
  -    throws MissingParametersFault
  +    private void throwMissingParametersFault(String msg) throws MissingParametersFault
       {
           MissingParametersFault e = new MissingParametersFault();
  -        e.setFaultCode(new QName("urn:oasis:names:tc:wsrp:v1:types", 
  -                "Interface.MissingParameters"));
  +        e.setFaultCode(new QName("urn:oasis:names:tc:wsrp:v1:types", "Interface.MissingParameters"));
           e.setFaultString(msg);
           throw e;
       }
  
  
  
  1.2       +3 -0      ws-wsrp4j/sandbox/wsrp4j/commons/src/java/org/apache/wsrp4j/commons/util/Utility.java
  
  Index: Utility.java
  ===================================================================
  RCS file: /home/cvs/ws-wsrp4j/sandbox/wsrp4j/commons/src/java/org/apache/wsrp4j/commons/util/Utility.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- Utility.java	21 Jul 2005 17:07:27 -0000	1.1
  +++ Utility.java	22 Aug 2005 18:52:11 -0000	1.2
  @@ -24,6 +24,9 @@
   import org.apache.wsrp4j.commons.exception.WSRPException;
   import org.apache.wsrp4j.commons.exception.WSRPXHelper;
   
  +/*
  + * @version $Id$
  + */
   public class Utility
   {
       
  
  
  
  1.2       +3 -0      ws-wsrp4j/sandbox/wsrp4j/commons/src/java/org/apache/wsrp4j/commons/util/WindowStates.java
  
  Index: WindowStates.java
  ===================================================================
  RCS file: /home/cvs/ws-wsrp4j/sandbox/wsrp4j/commons/src/java/org/apache/wsrp4j/commons/util/WindowStates.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- WindowStates.java	3 Aug 2005 20:16:25 -0000	1.1
  +++ WindowStates.java	22 Aug 2005 18:52:11 -0000	1.2
  @@ -22,6 +22,9 @@
   import javax.portlet.WindowState;
   
   
  +/*
  + * @version $Id$
  + */
   public class WindowStates implements java.io.Serializable
   {
       private String _value_;
  
  
  
  1.1                  ws-wsrp4j/sandbox/wsrp4j/commons/src/java/org/apache/wsrp4j/commons/util/HandleGenerator.java
  
  Index: HandleGenerator.java
  ===================================================================
  /*
   * Copyright 2003-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.wsrp4j.commons.util;
  
  
  /*
   * @version $Id: HandleGenerator.java,v 1.1 2005/08/22 18:52:11 dlouzan Exp $
   */
  public interface HandleGenerator
  {
  
      /**
       * Generates a new handle and returns it as a String.
       * Should be a synchronized method.
       *
       * @return String representing the new handle.
       */
      public String generateHandle();
  
  }
  
  
  
  1.1                  ws-wsrp4j/sandbox/wsrp4j/commons/src/java/org/apache/wsrp4j/commons/util/HandleGeneratorFactory.java
  
  Index: HandleGeneratorFactory.java
  ===================================================================
  /*
   * Copyright 2003-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.wsrp4j.commons.util;
  
  
  /*
   * @version $Id: HandleGeneratorFactory.java,v 1.1 2005/08/22 18:52:11 dlouzan Exp $
   */
  public interface HandleGeneratorFactory
  {
  
      /** 
       * Returns an instance of HandleGenerator by calling the constructor
       * of the corresponding class implementing the HandleGenerator-Interface.
       *
       * @return HandleGenerator  An instance of a class implementing the
       *                          HandleGenerator.
       */
      public HandleGenerator getHandleGenerator();
  
  }
  
  
  
  1.1                  ws-wsrp4j/sandbox/wsrp4j/commons/src/java/org/apache/wsrp4j/commons/util/StateChangedEvent.java
  
  Index: StateChangedEvent.java
  ===================================================================
  /*
   * Copyright 2003-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.wsrp4j.commons.util;
  
  import java.util.EventObject;
  
  
  /**
   * StateChangedEvent class, used as event for the StateChangedServiceImpl.
   * 
   * @author  <a href="mailto:Ralf.Altrichter@de.ibm.com">Ralf Altrichter</a>
   * 
   * @see StateChangedService
   * @see StateChangedListener
   *
   * @version $Id: StateChangedEvent.java,v 1.1 2005/08/22 18:52:11 dlouzan Exp $
   */
  public class StateChangedEvent extends EventObject
  {
  
      /**
       * Public default contructor 
       */
      public StateChangedEvent(Object source)
      {
          // call parent
          super(source);
      }
  }
  
  
  
  1.1                  ws-wsrp4j/sandbox/wsrp4j/commons/src/java/org/apache/wsrp4j/commons/util/StateChangedListener.java
  
  Index: StateChangedListener.java
  ===================================================================
  /*
   * Copyright 2003-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.wsrp4j.commons.util;
  
  
  /**
   * This class defines the StateChangedListener Interface. 
   * 
   * @author  <a href="mailto:Ralf.Altrichter@de.ibm.com">Ralf Altrichter</a>
   * 
   * @see StateChangedEvent
   * 
   * @version $Id: StateChangedListener.java,v 1.1 2005/08/22 18:52:11 dlouzan Exp $
   */
  public interface StateChangedListener {
  
      void stateChanged(StateChangedEvent e);
  
  }
  
  
  
  1.1                  ws-wsrp4j/sandbox/wsrp4j/commons/src/java/org/apache/wsrp4j/commons/util/StateChangedService.java
  
  Index: StateChangedService.java
  ===================================================================
  /*
   * Copyright 2003-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.wsrp4j.commons.util;
  
  
  /**
   * 
   * @author  <a href="mailto:Ralf.Altrichter@de.ibm.com">Ralf Altrichter</a>
   *
   * @version $Id: StateChangedService.java,v 1.1 2005/08/22 18:52:11 dlouzan Exp $
   */
  public interface StateChangedService {
  
      /**
       * Adds a new StateChangedListener to the internal list. All registered
       * Listeners will receive a notification, if the stateChanged() method 
       * is called. 
       * 
       * @param changeListener StateChangedListener
       */
      void addListener(StateChangedListener changeListener);
  
      /**
       * Must be called, if stateChanged occoured
       */
      void stateChanged();
  
  }
  
  
  
  1.1                  ws-wsrp4j/sandbox/wsrp4j/commons/src/java/org/apache/wsrp4j/commons/util/impl/HandleGeneratorFactoryImpl.java
  
  Index: HandleGeneratorFactoryImpl.java
  ===================================================================
  /*
   * Copyright 2003-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.wsrp4j.commons.util.impl;
  
  import org.apache.wsrp4j.commons.util.HandleGenerator;
  import org.apache.wsrp4j.commons.util.HandleGeneratorFactory;
  
  
  /*
   * @version $Id: HandleGeneratorFactoryImpl.java,v 1.1 2005/08/22 18:52:11 dlouzan Exp $
   */
  public class HandleGeneratorFactoryImpl implements HandleGeneratorFactory
  {
  
      private static HandleGeneratorImpl generator = null;
  
      /**
       * Returns an new handle and returns it as a String.
       *
       * @return String representing the new handle.
       */
      public HandleGenerator getHandleGenerator()
      {
          if (generator == null)
          {
              generator = HandleGeneratorImpl.create();
          }
  
          return generator;
      }
  
  }
  
  
  
  1.1                  ws-wsrp4j/sandbox/wsrp4j/commons/src/java/org/apache/wsrp4j/commons/util/impl/HandleGeneratorImpl.java
  
  Index: HandleGeneratorImpl.java
  ===================================================================
  /*
   * Copyright 2003-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.wsrp4j.commons.util.impl;
  
  import java.net.InetAddress;
  import java.util.Random;
  
  import org.apache.wsrp4j.commons.util.HandleGenerator;
  
  
  /**
   * This class implements the HandleGenerator interface.
   * 
   * @author  Stephan Laertz
   *
   * @version $Id: HandleGeneratorImpl.java,v 1.1 2005/08/22 18:52:11 dlouzan Exp $
   * 
   * @see     HandleGenerator 
   *
   */
  public class HandleGeneratorImpl implements HandleGenerator
  {
  
      private static int counter = 0;
  
      /**
       * Private constructor of HandleGeneratorImpl.
       */
      private HandleGeneratorImpl()
      {
      }
  
      /**
       * Returns an instance of HandleGeneratorImpl.
       *
       * @return String representing the new handle.
       */
      public static HandleGeneratorImpl create()
      {
          return new HandleGeneratorImpl();
      }
  
      /**
       * Generates a new handle and returns it as a String.
       *
       * @return String representing the new handle.
       */
      synchronized public String generateHandle()
      {
  
          String host = null;
          try
          {
  
              host = InetAddress.getLocalHost().getHostAddress().toString();
  
          } catch (Exception e)
          {
  
              host = Double.toString(
                      new Random(new Random().nextLong()).nextDouble());
  
          }
  
          StringBuffer handle = new StringBuffer(host);
          handle.append("_");
          handle.append(Long.toString(System.currentTimeMillis()));
          handle.append("_");
          handle.append(Integer.toString(counter++));
  
          return handle.toString();
      }
  
  }
  
  
  
  1.1                  ws-wsrp4j/sandbox/wsrp4j/commons/src/java/org/apache/wsrp4j/commons/util/impl/StateChangedServiceImpl.java
  
  Index: StateChangedServiceImpl.java
  ===================================================================
  /*
   * Copyright 2003-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.wsrp4j.commons.util.impl;
  
  import java.util.ArrayList;
  import java.util.Iterator;
  
  import org.apache.wsrp4j.commons.util.StateChangedService;
  import org.apache.wsrp4j.commons.util.StateChangedListener;
  import org.apache.wsrp4j.commons.util.StateChangedEvent;
  
  
  /**
   * This class implements the StateChangedService interface and is
   * the parent of all classes with StateChangeService functionality.
   * 
   * @author  <a href="mailto:Ralf.Altrichter@de.ibm.com">Ralf Altrichter</a>
   *
   * @version 1.0
   */
  
  public class StateChangedServiceImpl implements StateChangedService {
  
      // internal list of StateChangedListeners
      private ArrayList _listeners = new ArrayList();
  
      /**
       * Constructor
       */
      public StateChangedServiceImpl()
      {
  
      }
  
      /**
       * Adds a StateChangedListener object to the internal
       * array list. 
       * 
       * @param changeListener to be added
       */
      public void addListener(StateChangedListener changeListener)
      {
  
          _listeners.add(changeListener);
  
      }
  
      /**
       * Notifies all registered listeners by calling the 
       * stateChanged(StateChangedEvent e) method on the 
       * target object. 
       */
      public void stateChanged()
      {
          Iterator iterator = _listeners.iterator();
          while (iterator.hasNext())
          {
              StateChangedListener listener = 
                      (StateChangedListener)iterator.next();
              listener.stateChanged(new StateChangedEvent(this));
          }
      }
  }