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/28 23:34:16 UTC

cvs commit: ws-wsrp4j/sandbox/wsrp4j/commons-consumer/src/java/org/apache/wsrp4j/commons/consumer/interfaces/session GroupSession.java GroupSessionMgr.java InitCookieInfo.java PortletSession.java PortletWindowSession.java SessionHandler.java UserSession.java UserSessionMgr.java

dlouzan     2005/08/28 14:34:16

  Added:       sandbox/wsrp4j/commons-consumer/src/java/org/apache/wsrp4j/commons/consumer/interfaces/session
                        GroupSession.java GroupSessionMgr.java
                        InitCookieInfo.java PortletSession.java
                        PortletWindowSession.java SessionHandler.java
                        UserSession.java UserSessionMgr.java
  Log:
  Initial commit.
  
  Revision  Changes    Path
  1.1                  ws-wsrp4j/sandbox/wsrp4j/commons-consumer/src/java/org/apache/wsrp4j/commons/consumer/interfaces/session/GroupSession.java
  
  Index: GroupSession.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.consumer.interfaces.session;
  
  
  import java.util.Iterator;
  
  
  /**
   * Interface for a consumer based group session.A group session
   * is used to hold portlet session objects of portlet instances 
   * which belong to the same group of the same producer according to their 
   * portlet description. 
   * 
   * @author Stephan Laertz
   * @author <a href='mailto:peter.fischer@de.ibm.com'>Peter Fischer</a>
   *
   * @version $Id: GroupSession.java,v 1.1 2005/08/28 21:34:13 dlouzan Exp $
   **/
  public interface GroupSession {
  
      /**
       * Get the ID of the group this group session belongs to.
       * 
       * @return The group ID
       **/
      String getGroupID();
  
      /**
       * Get the portlet session object which is identified with
       * the givven instanceKey from the group session. If no portlet session
       * with that instanceKey exists it depends of the implementation wether
       * null or a newly created portlet session object is returned.
       * 
       * @param instanceKey The key which identifies the portlet session object
       * 
       * @return The portlet session with the given key
       **/
      PortletSession getPortletSession(String instanceKey);
  
      /**
       * Get all portlet session objects currently stored in the group session.
       * 
       * @return Iterator with all portlet session objects in the group session.
       **/
      Iterator getAllPortletSessions();
  
      /**
       * Check if the group session holds a portlet session with the given key.
       * 
       * @return True if the group session holds a protlet session with the 
       * given key; false otherwise
       **/
      boolean existsPortletSession(String instanceKey);
  
      /**
      * Set the ID of the group this group session belongs to.
      * 
      * @param groupID ID of the group
      **/
      void setGroupID(String groupID);
  
      /**
       * Add a portlet session to this group session.
       * 
       * @param portletSession The portlet session which should be 
       *                      added to this group session.
       **/
      void addPortletSession(PortletSession portletSession);
  
      /**
       * Remove the portlet session object with the given key from the 
       * group session. Subsequent calls of getPortletSession with the same
       * key should either return null or a newly created object.
       * 
       * @param instanceKey Key which identifies the portlet session object to 
       * be removed.
       **/
      void removePortletSession(String instanceKey);
  
      /**
       * Removes all portlet session objects from the group session. Consequently
       * this methods can be used to clear the group session.     
       **/
      void removeAllPortletSessions();
  
  }
  
  
  
  1.1                  ws-wsrp4j/sandbox/wsrp4j/commons-consumer/src/java/org/apache/wsrp4j/commons/consumer/interfaces/session/GroupSessionMgr.java
  
  Index: GroupSessionMgr.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.consumer.interfaces.session;
  
  
  /**
   * Interface for a consumer based group session.A group session
   * is used to hold portlet session objects of portlet instances 
   * which belong to the same group of the same producer according to their 
   * portlet description. 
   * 
   * @author <a href='mailto:peter.fischer@de.ibm.com'>Peter Fischer</a>
   *
   * @version $Id: GroupSessionMgr.java,v 1.1 2005/08/28 21:34:13 dlouzan Exp $
   **/
  public interface GroupSessionMgr extends GroupSession, InitCookieInfo {
  
      // just a combination of the two interfaces
  }
  
  
  
  1.1                  ws-wsrp4j/sandbox/wsrp4j/commons-consumer/src/java/org/apache/wsrp4j/commons/consumer/interfaces/session/InitCookieInfo.java
  
  Index: InitCookieInfo.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.consumer.interfaces.session;
  
  
  import oasis.names.tc.wsrp.v1.intf.WSRP_v1_Markup_PortType;
  
  
  /**
   * The init cookie information provides a mean to store
   * information if a <code>InitCookie</code> call is required before 
   * performing any other wsrp call. Since a call of init cookie may
   * be required only once for a group or a user per producer, this interface 
   * also offers method to check this call has been done already or not.
   * 
   * As an initCookie call in WSRP can be required on a per group or
   * per user basis an object implementing this interface can typically
   * be hold in a user or group session.
   * 
   * Implementations of this interface hold a MarkupPortType stub
   * to handle cookies correctly
   * 
   * @author Stephan Laertz
   * @author <a href='mailto:peter.fischer@de.ibm.com'>Peter Fischer</a>
   *
   * @version $Id: InitCookieInfo.java,v 1.1 2005/08/28 21:34:13 dlouzan Exp $
   **/
  public interface InitCookieInfo {
  
      /**
       * Check if an initCookie call is generally required. This
       * does not necessarily say anything if the required initCookie call
       * has been done already. Use <code>isInitCookieDone</code> for 
       * this purpose.
       * 
       * @return True if a call of init cookie is generally required.
       **/
      boolean isInitCookieRequired();
  
      /**
       * Set a boolean value to indicate if an initCookie call
       * needs to be done.
       * 
       * @param initCookieRequired True if an initCookie call is generally 
       * required
       **/
      void setInitCookieRequired(boolean initCookieRequired);
  
      /**
       * Check wether a initCookie call has been done already or not.
       * 
       * @return True if an initCookie has been done already
       **/
      boolean isInitCookieDone();
  
      /**
       * Set if an initCookie call has been done already or not.
       * 
       * @param initCookieDone Set to true if the call has been done; false 
       * otherwise
       **/
      void setInitCookieDone(boolean initCookieDone);
      
  	/**
  	 * Get the markup interface URL
  	 * 
  	 * @return the markup interface URL
  	 **/
  	String getMarkupInterfaceURL();
  
  	/**
  	 * Get the markup interface portType
  	 * 
  	 * @return the markup interface portType
  	 **/
  	WSRP_v1_Markup_PortType getWSRPBaseService();
  
  	/**
  	 * set the markup interface portType
  	 * 
  	 * @param markupPortType the markup interface portType
  	 **/
  	void setWSRPBaseService(WSRP_v1_Markup_PortType markupPortType);
  }
  
  
  
  1.1                  ws-wsrp4j/sandbox/wsrp4j/commons-consumer/src/java/org/apache/wsrp4j/commons/consumer/interfaces/session/PortletSession.java
  
  Index: PortletSession.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.consumer.interfaces.session;
  
  
  import java.util.Iterator;
  
  import oasis.names.tc.wsrp.v1.types.SessionContext;
  
  
  /**
   * Defines a session object at the consumer-side
   * to store remote portlet related information that
   * are needed to interact with the portlet. 
   * Since a session context is not mandatory in WSRP
   * a consumer portlet instance key is taken to
   * uniquely identify a portlet session.
   * 
   * @version $Id: PortletSession.java,v 1.1 2005/08/28 21:34:13 dlouzan Exp $
   **/
  public interface PortletSession {
      
      /**
       * Get the portlet handle which uniquely identifies the
       * portlet session at the consumer side.
       * 
       * @return The portlet handle
       **/
      String getPortletHandle();
  
      /**
       * Set the portlet handle of the portlet
       * this session belongs to.
       * 
       * @param portletHandle The portlet handle 
       **/
      void setPortletHandle(String portletHandle);
  
      /**
       * Get the WSRP session context of
       * the portlet instance. If no session context was set
       * from the producer this method returns null.
       * 
       * @return The the session context if set from the producer 
       *         or null otherwise.
       **/
      SessionContext getSessionContext();
  
      /**
       * Set the session context of the portlet instance.
       * 
       * @param sessionContext The session context.
       **/
      void setSessionContext(SessionContext sessionContext);
  
      /**
       * Get the <code>SimplePortletWindowSession</code> of the portlet window 
       * with the given ID.
       * 
       * @param windowID The ID of the portlet window
       * @return The <code>PorletWindowSession</code> with the given ID.    
       **/
      PortletWindowSession getPortletWindowSession(String windowID);
  
      /**
       * Get all window session which belong to the portlet session
       * 
       * @return An Iterator of <code>SimplePortletWindowSession</code> objects.     
       **/
      Iterator getAllPorletWindowSessions();
  
      /**
       * Remove the porlet window session with the given window id.
       * 
       * @param windowID The ObjectID of the portlet window whichs session should 
       * be removed
       * @return The portlet window session which has been removed or null if the 
       * session did not exist.    
       **/
      PortletWindowSession removePortletWindowSession(String windowID);
  
      /**
       * Remove all portlet window sessions which  belong to this portlet session.
       **/
      void removeAllPortletWindowSessions();
  }
  
  
  
  1.1                  ws-wsrp4j/sandbox/wsrp4j/commons-consumer/src/java/org/apache/wsrp4j/commons/consumer/interfaces/session/PortletWindowSession.java
  
  Index: PortletWindowSession.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.consumer.interfaces.session;
  
  
  import oasis.names.tc.wsrp.v1.types.MarkupContext;
  
  
  /**
   * The portlet window session is a session which is unique for
   * every window of a portlet instance. 
   * 
   * @version $Id: PortletWindowSession.java,v 1.1 2005/08/28 21:34:13 dlouzan Exp $
   **/
  public interface PortletWindowSession {
  
      /**
       * Get the ID of the portlets window this session belongs to.
       * 
       * @return The ID of the portlet window.
       **/
      String getWindowID();
  
      /**
       * Set the ID of the portlets window this sessions belongs to.
       * 
       * @param windowID The ID of the portlet window.    
       **/
      void setWindowID(String windowID);   
  
      /**
       * Get the markup context which has been cached. This might be useful
       * to retrieve the markup which was returned 
       * <code>performBlockingInteraction</code>
       * calls in order to save an additional <code>getMarkup</code> call.
       * 
       * @return The cached markup context or null in case the cache is empty.
       **/
      MarkupContext getCachedMarkup();
  
      /**
       * Update the cache which holds the markup context. This might be useful
       * to store the markup which was returned by 
       * <code>performBlockingInteraction</code>
       * calls in order to save an additional <code>getMarkup</code> call.
       * Updateing the cache with a null value clears the markup cache.
       * 
       * @param markupContext The markup context or null in case the cache 
       * should be cleared.
       **/
      void updateMarkupCache(MarkupContext markupContext);
      
      /**
       * Get the portlet session this window session belongs to.
       * 
       * @return The <code>PortletSession</code> this window session belongs to.     
       **/
      PortletSession getPortletSession();
  }
  
  
  
  1.1                  ws-wsrp4j/sandbox/wsrp4j/commons-consumer/src/java/org/apache/wsrp4j/commons/consumer/interfaces/session/SessionHandler.java
  
  Index: SessionHandler.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.consumer.interfaces.session;
  
  
  import org.apache.wsrp4j.commons.exception.WSRPException;
  
  
  /**
   * Interface of a session handler on the consumer side.
   * 
   * @author Stephan Laertz
   *
   * @version $Id: SessionHandler.java,v 1.1 2005/08/28 21:34:13 dlouzan Exp $
   **/
  public interface SessionHandler {
  
      /**
       * Get the session manager of the user session with the given user ID and 
       * producer ID.
       * 
       * @return The user session object representing a session between an 
       * end-user and a producer.
       **/
      UserSessionMgr getUserSession(String producerID, String userID) 
      throws WSRPException;
  }
  
  
  
  1.1                  ws-wsrp4j/sandbox/wsrp4j/commons-consumer/src/java/org/apache/wsrp4j/commons/consumer/interfaces/session/UserSession.java
  
  Index: UserSession.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.consumer.interfaces.session;
  
  
  import java.util.Iterator;
  
  import org.apache.wsrp4j.commons.exception.WSRPException;
  
  
  /**
   * A consumer based session which represents a user session with a certain 
   * producer.
   * This user session contains one or more group sessions.
   * 
   * @see GroupSession
   * 
   * @author <a href="mailto:stephan.laertz@de.ibm.com">Stephan Laertz</a>
   * @author <a href='mailto:peter.fischer@de.ibm.com'>Peter Fischer</a>
   *
   * @version $Id: UserSession.java,v 1.1 2005/08/28 21:34:13 dlouzan Exp $
   **/
  public interface UserSession {
  
      /**
       * Get ID of the user this session is bind to
       * 
       * @return User ID
       **/
      String getUserID();
  
      /**
       * Get ID of the producer this session is bind to
       * 
       * @return ID of the producer
       **/
      String getProducerID();
  
      /**
       * Get the group session for this group ID
       *     
       * @param groupID ID of the portlet application
       * @return The a group session for the provided group ID or a new 
       * groupSession
       **/
      GroupSessionMgr getGroupSession(String groupID) throws WSRPException;
  
      /**
        * Get all group session
        *      
        * @return Iterator with all group sessions for the given producer 
        * access point
        **/
      Iterator getAllGroupSessions();
  
      /**
       * Set the ID of the user this session is bind to 
       * 
       * @param userID ID of the user
       **/
      void setUserID(String userID);
  
      /**
       * Set the ID of the producer this session is bind to.
       * 
       * @param producerID of the producer
       **/
      void setProducerID(String producerID);
  
      /**
       * Add a group session to the user session
       * 
       * @param groupSession A group session
       **/
      void addGroupSession(GroupSession groupSession);
  
      /**
       * Remove a group session from the user session
       *      
       * @param groupID ID of the portlet application
       **/
      void removeGroupSession(String groupID);
  
      /**
       * Remove all group sessions
       *      
       **/
      void removeAllGroupSessions();
  }
  
  
  
  1.1                  ws-wsrp4j/sandbox/wsrp4j/commons-consumer/src/java/org/apache/wsrp4j/commons/consumer/interfaces/session/UserSessionMgr.java
  
  Index: UserSessionMgr.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.consumer.interfaces.session;
  
  
  /**
   * A consumer based session which represents a user session with a certain 
   * producer.
   * This user session contains one or more group sessions.
   * 
   * @see GroupSession
   * 
   * @author <a href='mailto:peter.fischer@de.ibm.com'>Peter Fischer</a>
   *
   * @version $Id: UserSessionMgr.java,v 1.1 2005/08/28 21:34:13 dlouzan Exp $
   **/
  public interface UserSessionMgr extends UserSession, InitCookieInfo {
  
      // just a combination of the two interfaces
  }