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/23 21:27:03 UTC

cvs commit: ws-wsrp4j/sandbox/wsrp4j/commons/src/java/org/apache/wsrp4j/commons/producer/provider/driver ConsumerConfiguredPortletImpl.java ConsumerPortletRegistrationImpl.java PortletImpl.java

dlouzan     2005/08/23 12:27:03

  Added:       sandbox/wsrp4j/commons/src/java/org/apache/wsrp4j/commons/producer
                        Registration.java
               sandbox/wsrp4j/commons/src/java/org/apache/wsrp4j/commons/producer/driver
                        RegistrationImpl.java
               sandbox/wsrp4j/commons/src/java/org/apache/wsrp4j/commons/producer/provider
                        ConsumerConfiguredPortlet.java Portlet.java
               sandbox/wsrp4j/commons/src/java/org/apache/wsrp4j/commons/producer/provider/driver
                        ConsumerConfiguredPortletImpl.java
                        ConsumerPortletRegistrationImpl.java
                        PortletImpl.java
  Log:
  Initial version.
  
  Revision  Changes    Path
  1.1                  ws-wsrp4j/sandbox/wsrp4j/commons/src/java/org/apache/wsrp4j/commons/producer/Registration.java
  
  Index: Registration.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.producer;
  
  import oasis.names.tc.wsrp.v1.types.RegistrationContext;
  import oasis.names.tc.wsrp.v1.types.RegistrationData;
  
  
  /**
   * This interface provides access to Registration-objects.
   * Provides setters and getters.
   *
   * @author  <a href="mailto:stefan.behl@de.ibm.com">Stefan Behl</a>
   * @version $Id: Registration.java,v 1.1 2005/08/23 19:26:59 dlouzan Exp $
   */
  public interface Registration {
      
      /**
       * Returns the registration context. The registration context contains a
       * registration handle (required) and optionally a registration state.
       *
       * @return RegistrationContext
       */
      RegistrationContext getRegistrationContext();
      
      /**
       * Returns the registration data. Supplies consumer data required for
       * registration with a Producer.
       *
       * @return RegistrationData
       */
      RegistrationData getRegistrationData();
      
      /**
       * Sets the registration context. The registration context contains a
       * registration handle (required) and optionally a registration state.
       *
       * @param registrationContext The registration context of a certain 
       * Consumer.
       */
      void setRegistrationContext(RegistrationContext registrationContext);
      
      /**
       * Sets the registration data. Supplies consumer data required for
       * registration with a Producer.
       *
       * @param registrationData The registration data of a certain Consumer.
       */
      void setRegistrationData(RegistrationData registrationData);
      
  }
  
  
  
  1.1                  ws-wsrp4j/sandbox/wsrp4j/commons/src/java/org/apache/wsrp4j/commons/producer/driver/RegistrationImpl.java
  
  Index: RegistrationImpl.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.producer.driver;
  
  import java.io.Serializable;
  
  import oasis.names.tc.wsrp.v1.types.RegistrationContext;
  import oasis.names.tc.wsrp.v1.types.RegistrationData;
  
  import org.apache.wsrp4j.commons.producer.Registration;
  
  
  /**
   * <p>This class implements the Registration interface encapsulating
   * a registration-object. Provides setters and getters.</p>
   * <p>Implements the Serializable interface to enable serialization, e.g. to
   * an XML-file.</p>
   *
   * @author  <a href="mailto:stefan.behl@de.ibm.com">Stefan Behl</a>
   *
   * @see     Registration
   * @version $Id: RegistrationImpl.java,v 1.1 2005/08/23 19:26:59 dlouzan Exp $
   */
  public class RegistrationImpl implements Registration, Serializable {
      //a WSRP registration context
      private RegistrationContext context;
      //WSRP registration data
      private RegistrationData data;
      
      /**
       * Returns the registration context. The registration context contains a
       * registration handle (required) and optionally a registration state.
       *
       * @return RegistrationContext
       */
      public RegistrationContext getRegistrationContext() {
          return this.context;
      }
      
      /**
       * Returns the registration data. Supplies consumer data required for
       * registration with a Producer.
       *
       * @return RegistrationData
       */
      public RegistrationData getRegistrationData() {
          return this.data;
      }
      
      /**
       * Sets the registration context. The registration context contains a
       * registration handle (required) and optionally a registration state.
       *
       * @param registrationContext The registration context of a certain 
       * Consumer.
       */
      public void setRegistrationContext(
              RegistrationContext registrationContext) {
          this.context = registrationContext;
      }
      
      /**
       * Sets the registration data. Supplies consumer data required for
       * registration with a Producer.
       *
       * @param registrationData The registration data of a certain Consumer.
       */
      public void setRegistrationData(RegistrationData registrationData) {
          this.data = registrationData;
      }
      
  }
  
  
  
  1.1                  ws-wsrp4j/sandbox/wsrp4j/commons/src/java/org/apache/wsrp4j/commons/producer/provider/ConsumerConfiguredPortlet.java
  
  Index: ConsumerConfiguredPortlet.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.producer.provider;
  
  
  /**
   * Provides the interface to a class encapsulating a
   * ConsumerConfiguredPortlet-object. It extends the
   * ProducerOfferedPortlet-interface.
   *
   * @author   <a href="mailto:stefan.behl@de.ibm.com">Stefan Behl</a>
   *
   * @see Portlet
   * @version $Id: ConsumerConfiguredPortlet.java,v 1.1 2005/08/23 19:27:02 dlouzan Exp $
   */
  public interface ConsumerConfiguredPortlet extends Portlet {
      
      /**
       * Sets the portlet handle of the parent ProducerOfferedPortlet.
       *
       * @param handle String representing the portlet handle of the corresponding
       *               parent ProducerOfferedPortlet.
       */
      void setParentHandle(String handle);
      
      /**
       * Returns the portlet handle of the corresponding parent 
       * ProducerOfferedPortlet.
       *
       * @return String representing the portlet handle of the corresponding p
       * arent ProducerOfferedPortlet.
       */
      String getParentHandle();
      
      /**
       * Redefines the clone-method of the Cloneable-interface.
       *
       * @return    Object representing the cloned object.
       */
      Object clone();
      
  }
  
  
  
  1.1                  ws-wsrp4j/sandbox/wsrp4j/commons/src/java/org/apache/wsrp4j/commons/producer/provider/Portlet.java
  
  Index: Portlet.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.producer.provider;
  
  
  /**
   * Provides an interface to a class encapsulating Portlet-objects.
   *
   * @author  <a href="mailto:stefan.behl@de.ibm.com">Stefan Behl</a>
   * @version $Id: Portlet.java,v 1.1 2005/08/23 19:27:02 dlouzan Exp $
   */
  public interface Portlet extends Cloneable {
      
      /**
       * Returns the portletHandle.
       *
       * @return    A String representing the portletHandle.
       */
      String getPortletHandle();
      
      /**
       * Sets the portletHandle to enable identification of the portlet.
       *
       * @param     portletHandle  String to be assigned to handle.
       */
      void setPortletHandle(String portletHandle);
      
  }
  
  
  
  1.1                  ws-wsrp4j/sandbox/wsrp4j/commons/src/java/org/apache/wsrp4j/commons/producer/provider/driver/ConsumerConfiguredPortletImpl.java
  
  Index: ConsumerConfiguredPortletImpl.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.producer.provider.driver;
  
  import org.apache.wsrp4j.commons.producer.provider.ConsumerConfiguredPortlet;
  
  /**
   * This class implements the ConsumerConfiguredPortlet interface. It also
   * extends the PortletImpl class.
   *
   * @author  <a href="mailto:stefan.behl@de.ibm.com">Stefan Behl</a>
   *
   * @see     ConsumerConfiguredPortlet PortletImpl
   * @version $Id: ConsumerConfiguredPortletImpl.java,v 1.1 2005/08/23 19:27:03 dlouzan Exp $
   */
  public class ConsumerConfiguredPortletImpl extends PortletImpl 
          implements ConsumerConfiguredPortlet {
      
      /**
       * Portlet handle of the parent ProducerOfferedPortlet object
       */
      private String parentHandle = "";
      
      /**
       * Sets the portlet handle of the parent ProducerOfferedPortlet.
       *
       * @param handle String representing the portlet handle of the corresponding
       *               parent ProducerOfferedPortlet.
       */
      public void setParentHandle(String handle) {
          parentHandle = handle;
      }
      
      /**
       * Returns the portlet handle of the corresponding parent 
       * ProducerOfferedPortlet.
       *
       * @return String representing the portlet handle of the corresponding 
       * parent ProducerOfferedPortlet.
       */
      public String getParentHandle() {
          return parentHandle;
      }
      
      /**
       * Redefines the clone-method of the Cloneable-interface. This is necessary
       * as the clone-method is declared protected in the Object class.
       *
       * @return    Object representing the cloned object.
       */
      public Object clone() {
          ConsumerConfiguredPortlet clone = new ConsumerConfiguredPortletImpl();
          clone.setParentHandle(parentHandle);
          return clone;
      }
      
  }
  
  
  
  1.1                  ws-wsrp4j/sandbox/wsrp4j/commons/src/java/org/apache/wsrp4j/commons/producer/provider/driver/ConsumerPortletRegistrationImpl.java
  
  Index: ConsumerPortletRegistrationImpl.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.producer.provider.driver;
  
  import java.util.HashSet;
  import java.util.Collection;
  
  
  /**
   * This class collects the porlet handles for a registered consumer and 
   * is used for persistence purpose.
   *
   * @author  <a href="mailto:Ralf.Altrichter@de.ibm.com">Ralf Altrichter</a>
   *
   * @version $Id: ConsumerPortletRegistrationImpl.java,v 1.1 2005/08/23 19:27:03 dlouzan Exp $
   */
  public class ConsumerPortletRegistrationImpl
  {
  
      // the registrationHandle of the consumer
      private String _registrationHandle;
  
      // collects all portletHandles for this registrationHandle
      private HashSet _portletHandles = new HashSet();
  
      /**
       * Sets the registration handle for a specific consumer
       * 
       * @param regHandle consumer registration handle
       */
      public void setRegistrationHandle(String regHandle) 
      {
          _registrationHandle = regHandle;
      }
  
  
      /**
       * Returns the registration handle for a specific consumer
       * 
       * @return registrationHandle
       */
      public String getRegistrationHandle()
      {
          return _registrationHandle;
      }
  
  
      /**
       * Add a portlet handle to the current registration
       * 
       * @param portletHandle
       */
      public void addPortletHandle(String portletHandle)
      {
          _portletHandles.add(portletHandle);
      }
  
      /**
       * Returns true, if the portletHandle is associated to the 
       * current registration.
       * 
       * @return true on success, otherwise false
       */
      public boolean containsPortletHandle(String portletHandle)
      {
          return _portletHandles.contains(portletHandle);
      }
  
  
      /**
       * Removes a portlet handle from the current registration
       * 
       * @param portletHandle
       */
      public void deletePortletHandle(String portletHandle)
      {
          _portletHandles.remove(portletHandle);
      }
  
  
      /**
       * Sets a collection of portlet handles for this registration
       * 
       * @param collection
       */
      public void setPortletHandles(Collection collection)
      {
          _portletHandles = (HashSet) collection;
      }
  
  
      /**
       * Returns a collection of portlet handles for this registration
       * 
       * @return collection
       */
      public Collection getPortletHandles()
      {
          return _portletHandles;
      }
  
  
      /**
       * @return true, if no portlet handles are assigned to this registration
       *         false, if at least one portlet handle is assigned to his registration
       */
      public boolean isEmpty()
      {
          boolean retVal = false; 
  
          if(_portletHandles.size() == 0)
          {
              retVal = true;
          }
          return retVal;
      }
      
  }
  
  
  
  1.1                  ws-wsrp4j/sandbox/wsrp4j/commons/src/java/org/apache/wsrp4j/commons/producer/provider/driver/PortletImpl.java
  
  Index: PortletImpl.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.producer.provider.driver;
  
  import java.io.Serializable;
  
  import org.apache.wsrp4j.commons.producer.provider.Portlet;
  
  
  /**
   * <p>This abstract class implements the Portlet interface encapsulating
   * Portlet-objects. Provides setters and getters.</p>
   * <p>Implements the Cloneable interface to enable cloning of portlets.</p>
   * <p>Implements the Serializable interface to enable serialization, e.g. to
   * an XML-file.</p>
   *
   * @author  <a href="mailto:stefan.behl@de.ibm.com">Stefan Behl</a>
   *
   * @see     org.apache.wsrp4j.producer.provider.ProducerOfferedPortlet
   * @version $Id: PortletImpl.java,v 1.1 2005/08/23 19:27:03 dlouzan Exp $
   */
  public abstract class PortletImpl implements Portlet, Serializable {
      
      private String handle = "";
      
      /**
       * Returns the portletHandle.
       *
       * @return    A String representing the portletHandle.
       */
      public String getPortletHandle() {
          return this.handle;
      }
      
      /**
       * Sets the portletHandle to enable identification of the portlet.
       *
       * @param     portletHandle  String to be assigned to handle.
       */
      public void setPortletHandle(String portletHandle) {
          this.handle = portletHandle;
      }
      
      /**
       * Redefines the clone-method of the Cloneable-interface. This is necessary
       * as the clone-method is declared protected in the Object class.
       *
       * @return    Object representing the cloned object.
       */
      public abstract Object clone();
      
  }