| PortletPool.java |
1 /*
2 * Copyright 2000-2001,2004 The Apache Software Foundation.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17 /*
18
19 */
20
21 package org.apache.wsrp4j.producer.provider;
22
23 import java.util.Iterator;
24
25 import org.apache.wsrp4j.exception.WSRPException;
26
27 /**
28 * <p>This class provides the interface to the portlet pool. All portlets
29 * (producer offered as well as consumer configured portlets) should be kept
30 * within the portlet pool. It is recommended that this interface is
31 * implemented by a container associating portlet handles with portlet-objects.
32 * </p>
33 *
34 * @author <a href="mailto:stefan.behl@de.ibm.com">Stefan Behl</a>
35 */
36 public interface PortletPool {
37
38 /**
39 * <p>Clones an portlet (Producer Offered or Consumer Configured Portlet)
40 * associated by portlet-handle. Only the portlet-object should be cloned,
41 * not the portlet-description the portlet references.</p>
42 * <p>Adds the new Consumer Configured Portlet (after assigning a new
43 * portletHandle)to the hashmap after cloning.</p>
44 * <p>Creates a new portlet state corresponding to the portlet state of
45 * the portlet to be cloned by calling the PortletStateManager.</p>
46 * <p>Throws CommonException if portlet to be cloned could not be found</p>
47 *
48 * @param portletHandle String identifying the portlet to be cloned.
49 *
50 * @return ConsumerConfiguredPortlet The portlet-clone.
51 */
52 public Portlet clone(String portletHandle) throws WSRPException;
53
54 /**
55 * Returns all portlets that are currently stored within the
56 * PortletPool.
57 *
58 * @return Iterator of an portlet collection containing all portlets.
59 */
60 public Iterator getAllProducerOfferedPortlets();
61
62 /**
63 * Returns all portlets that are currently stored within the
64 * PortletPool.
65 *
66 * @return Iterator of an portlet collection containing all portlets.
67 */
68 public Iterator getAllConsumerConfiguredPortlets();
69
70 /**
71 * Returns a certain portlet identified by portletHandle.
72 * Throws CommonException if there is no portlet corresponding to portletHandle.
73 *
74 * @param portletHandle String representing the portletHandle.
75 *
76 * @return ProducerOfferedPortlet portlet-object identified by portletHandle.
77 */
78 public Portlet get(String portletHandle) throws WSRPException;
79
80 /**
81 * <p>Deletes the portlet identified by portletHandle from the PortletPool.
82 * Only consumer configured portlets can be deleted, NOT producer offered ones.
83 * After update, the persistent file store is refreshed.</p>
84 * <p>Deletes all existing portlet sessions (SessionHandler) and portlet states
85 * (PortletStateManager) as well.</p>
86 * <p>Throws CommonException if portlet corresponding to portletHandle could not
87 * be found.</p>
88 *
89 * @param portletHandle String representing the portletHandle.
90 *
91 * @return Boolean indicating if deletion was successful. Returns false, if portletHandle
92 * refers to a producer offered portlet.
93 */
94 public boolean destroy(String portletHandle) throws WSRPException;
95
96 /**
97 * Deletes several portlets from the PortletPool.
98 *
99 * @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 }