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.state;
18  
19  import javax.portlet.PortletMode;
20  import javax.portlet.WindowState;
21  import javax.servlet.http.HttpServletRequest;
22  
23  import org.apache.jetspeed.container.url.PortalURL;
24  
25  /***
26   * NavigationalState
27   *
28   * @author <a href="mailto:taylor@apache.org">David Sean Taylor</a>
29   * @version $Id: NavigationalStateComponent.java 516448 2007-03-09 16:25:47Z ate $
30   */
31  public interface NavigationalStateComponent
32  {        
33      /***
34       * Creates a navigational state.
35       * Depending on the implementation, a navigational state context can be retrieved from 
36       * a persistence store to recover the state of a page such as portlet modes 
37       * and window states of portlets on a page.
38       *  
39       * @return A new navigational state.  This method will never return <code>null</code>
40       * @throws FailedToCreateNavStateException if the nav state could not be created.  Under normal
41       * circumstances, this should not happen.
42       */
43      NavigationalState create();
44  
45      /***
46       * Creates a Portal URL representing the URL of the request.
47       * 
48       * @param request The ubiqitious request.
49       * @param characterEncoding String containing the name of the chararacter encoding
50       * @return A new Portal URL.  This method will never return <code>null</code>;
51       * @throws FailedToCreatePortalUrlException if the portelt url could not be created.  Under normal
52       * circumstances, this should not happen.
53       */
54      PortalURL createURL(HttpServletRequest request, String characterEncoding);
55      
56      /***
57       * Given a window state name, look up its object.
58       * Ensures that we always use the same objects for WindowStates
59       * allowing for comparison by value.
60       * 
61       * @param name The string representation of the window state.
62       * @return The corresponding WindowState object
63       */
64      WindowState lookupWindowState(String name);
65  
66      /***
67       * Given a portlet mode name, look up its object.
68       * Ensures that we always use the same objects for Portlet Modes
69       * allowing for comparison by value.
70       * 
71       * @param name The string representation of the portlet mode.
72       * @return The corresponding PortletMode object
73       */    
74      PortletMode lookupPortletMode(String name);   
75  
76      /***
77       * Creates a Desktop Portal URL representing the URL of the request.
78       * 
79       * @param request The ubiqitious request.
80       * @param characterEncoding String containing the name of the chararacter encoding
81       * @return A new Portal URL.  This method will never return <code>null</code>;
82       * @throws FailedToCreatePortalUrlException if the portelt url could not be created.  Under normal
83       * circumstances, this should not happen.
84       */    
85      PortalURL createDesktopURL(HttpServletRequest request, String characterEncoding);
86  }