001: /*
002: * Copyright 2000-2001,2004 The Apache Software Foundation.
003: *
004: * Licensed under the Apache License, Version 2.0 (the "License");
005: * you may not use this file except in compliance with the License.
006: * You may obtain a copy of the License at
007: *
008: * http://www.apache.org/licenses/LICENSE-2.0
009: *
010: * Unless required by applicable law or agreed to in writing, software
011: * distributed under the License is distributed on an "AS IS" BASIS,
012: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013: * See the License for the specific language governing permissions and
014: * limitations under the License.
015: */
016:
017: /*
018:
019: */
020:
021: package org.apache.wsrp4j.producer.provider;
022:
023: import java.util.Iterator;
024:
025: import org.apache.wsrp4j.exception.WSRPException;
026:
027: /**
028: * <p>This class provides the interface to the portlet pool. All portlets
029: * (producer offered as well as consumer configured portlets) should be kept
030: * within the portlet pool. It is recommended that this interface is
031: * implemented by a container associating portlet handles with portlet-objects.
032: * </p>
033: *
034: * @author <a href="mailto:stefan.behl@de.ibm.com">Stefan Behl</a>
035: */
036: public interface PortletPool {
037:
038: /**
039: * <p>Clones an portlet (Producer Offered or Consumer Configured Portlet)
040: * associated by portlet-handle. Only the portlet-object should be cloned,
041: * not the portlet-description the portlet references.</p>
042: * <p>Adds the new Consumer Configured Portlet (after assigning a new
043: * portletHandle)to the hashmap after cloning.</p>
044: * <p>Creates a new portlet state corresponding to the portlet state of
045: * the portlet to be cloned by calling the PortletStateManager.</p>
046: * <p>Throws CommonException if portlet to be cloned could not be found</p>
047: *
048: * @param portletHandle String identifying the portlet to be cloned.
049: *
050: * @return ConsumerConfiguredPortlet The portlet-clone.
051: */
052: public Portlet clone(String portletHandle) throws WSRPException;
053:
054: /**
055: * Returns all portlets that are currently stored within the
056: * PortletPool.
057: *
058: * @return Iterator of an portlet collection containing all portlets.
059: */
060: public Iterator getAllProducerOfferedPortlets();
061:
062: /**
063: * Returns all portlets that are currently stored within the
064: * PortletPool.
065: *
066: * @return Iterator of an portlet collection containing all portlets.
067: */
068: public Iterator getAllConsumerConfiguredPortlets();
069:
070: /**
071: * Returns a certain portlet identified by portletHandle.
072: * Throws CommonException if there is no portlet corresponding to portletHandle.
073: *
074: * @param portletHandle String representing the portletHandle.
075: *
076: * @return ProducerOfferedPortlet portlet-object identified by portletHandle.
077: */
078: public Portlet get(String portletHandle) throws WSRPException;
079:
080: /**
081: * <p>Deletes the portlet identified by portletHandle from the PortletPool.
082: * Only consumer configured portlets can be deleted, NOT producer offered ones.
083: * After update, the persistent file store is refreshed.</p>
084: * <p>Deletes all existing portlet sessions (SessionHandler) and portlet states
085: * (PortletStateManager) as well.</p>
086: * <p>Throws CommonException if portlet corresponding to portletHandle could not
087: * be found.</p>
088: *
089: * @param portletHandle String representing the portletHandle.
090: *
091: * @return Boolean indicating if deletion was successful. Returns false, if portletHandle
092: * refers to a producer offered portlet.
093: */
094: public boolean destroy(String portletHandle) throws WSRPException;
095:
096: /**
097: * Deletes several portlets from the PortletPool.
098: *
099: * @param portletHandles Iterator of portletHandles.
100: *
101: * @return Iterator containing those portletHandles refering to portlets
102: * that could not be deleted (e.g. producer offered portlets).
103: */
104: public Iterator destroySeveral(Iterator portletHandles);
105:
106: }
|