View Javadoc

1   /*
2    * Licensed to the Apache Software Foundation (ASF) under one or more
3    * contributor license agreements.  See the NOTICE file distributed with
4    * this work for additional information regarding copyright ownership.
5    * The ASF licenses this file to You under the Apache License, Version 2.0
6    * (the "License"); you may not use this file except in compliance with
7    * the License.  You may obtain a copy of the License at
8    * 
9    *      http://www.apache.org/licenses/LICENSE-2.0
10   * 
11   * Unless required by applicable law or agreed to in writing, software
12   * distributed under the License is distributed on an "AS IS" BASIS,
13   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14   * See the License for the specific language governing permissions and
15   * limitations under the License.
16   */
17  package org.apache.jetspeed.container.window;
18  
19  import java.util.Set;
20  
21  import org.apache.jetspeed.components.portletentity.PortletEntityNotStoredException;
22  import org.apache.jetspeed.om.page.ContentFragment;
23  import org.apache.pluto.om.entity.PortletEntity;
24  import org.apache.pluto.om.window.PortletWindow;
25  
26  /***
27   * Portlet Window Accessor
28   *
29   * @author <a href="mailto:taylor@apache.org">David Sean Taylor</a>
30   * @version $Id: PortletWindowAccessor.java,v 1.7 2005/04/29 13:59:46 weaver Exp $
31   */
32  public interface PortletWindowAccessor 
33  {
34      /***
35       * Get a portlet window for the given fragment
36       * 
37       * @param fragment
38       * @return
39       * @throws FailedToRetrievePortletWindow
40       * @throws PortletEntityNotStoredException 
41       * @throws InconsistentWindowStateException If the window references a non-existsent PortletEntity
42       */
43      PortletWindow getPortletWindow(ContentFragment fragment) throws FailedToRetrievePortletWindow, PortletEntityNotStoredException;
44      
45      /***
46       * Get the portlet window for a fragment and given principal
47       * @param fragment
48       * @param principal
49       * @return
50       * @throws FailedToCreateWindowException
51       * @throws FailedToRetrievePortletWindow
52       * @throws PortletEntityNotStoredException 
53       * @throws InconsistentWindowStateException If the window references a non-existsent PortletEntity
54       */
55      PortletWindow getPortletWindow(ContentFragment fragment, String principal) throws FailedToCreateWindowException, FailedToRetrievePortletWindow, PortletEntityNotStoredException;
56  
57      /***
58       * Lookup a portlet window in the cache
59       * If not found, return null
60       * 
61       * @param windowId 
62       * @return the window from the cache or null
63       */
64      PortletWindow getPortletWindow(String windowId);
65  
66      /***
67       * Given a portlet entity, create a portlet window for that entity.
68       * 
69       * @param entity
70       * @param windowId
71       * @return new window
72       */
73      PortletWindow createPortletWindow(PortletEntity entity, String windowId);
74  
75      /***
76       * Create a temporary portlet window
77       * This window does not have an entity associated with it.
78       * 
79       * @param windowId
80       * @return
81       */
82      PortletWindow createPortletWindow(String windowId);
83      
84      /***
85       * 
86       * <p>
87       * removeWindows
88       * </p>
89       * 
90       * Removes all <code>PortletWindow</code>s associated with this
91       * <code>PortletEntity</code>
92       *
93       * @param portletEntity
94       */
95      void removeWindows(PortletEntity portletEntity);
96      
97      /***
98       * 
99       * <p>
100      * removeWindow
101      * </p>
102      * 
103      * Removes a <code>PortletWindow</code> from the window cache.
104      *
105      * @param window
106      */
107     void removeWindow(PortletWindow window);
108     
109     /***
110      *  Gets a {@link Set} of currently available {@link PortletWindow}s within
111      *  the current engine instance.
112      *  
113      * @return {@link Set} of {@link PortletWindow}s, never returns <code>null</code>
114      */
115     Set getPortletWindows();
116 }