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 oasis.names.tc.wsrp.v1.types.ModelDescription;
024: import oasis.names.tc.wsrp.v1.types.PropertyList;
025:
026: /**
027: Manages the portlet states. Provides convenience mehtods usefull for state handling
028: * @author Stefan Behl
029: *
030: */
031: public interface PortletStateManager {
032:
033: /** defines an error state */
034: public static final int INITIALIZATION_FAILED = 3007;//TODO do we need this?
035:
036: /**
037: Returns the portlet's state for a given portlet handle
038: @param portletHandle String representing a portlet handle
039: @return PortletState
040: */
041: public PortletState get(String portletHandle);
042:
043: /**
044: Returns the portlet's state as String for a given portlet handle
045: @param portletHandle String representing a portlet handle
046: @return String representing the portlet's state
047: */
048: public String getAsString(String portletHandle);
049:
050: /**
051: Converts a PortletState object to java.lang.String
052: @param state PortletState
053: @return java.lang.String representing a portlet state
054: */
055: public String getAsString(PortletState state);
056:
057: /**
058: Converts a subset of the portlet stateto java.lang.String.
059: The subset of the state is represented by an array of names.
060: @param portletHandle String representing a portlet handle
061: @param names array of String
062: @return String representing a subset of a portlte state
063: */
064: public String getAsString(String portletHandle, String[] names);
065:
066: /**
067: Returns the portlet's state as PropertyList
068: @param portletHandle String representing a portlte handle
069: @return PropertyList
070: */
071: public PropertyList getAsPropertyList(String portletHandle);
072:
073: /**
074: Converts a portlet's state to a PropertyList
075: @param state the portlet's state
076: @return PropertyList
077: */
078: public PropertyList getAsPropertyList(PortletState state);
079:
080: /**
081: Converts a subset of the portlet state to a PropertyList. The subset
082: of the state is represented by an array of names.
083: @param portletHandle String representing a portlet handle
084: @param names array of String
085: @return PropertyList
086: */
087: public PropertyList getAsPropertyList(String portletHandle,
088: String[] names);
089:
090: /**
091: Set the portlet's state
092: @param portletHandle String representing a portlet handle
093: @param state PortletState
094: */
095: public void set(String portletHandle, PortletState state);
096:
097: /**
098: Set the portlet state
099: @param portletHandle String representing a portlet handle
100: @param state String representing the portlet's state
101: */
102: public void setAsString(String portletHandle, String state);
103:
104: /**
105: Set the portlet state
106: @param portletHandle String representing a portlet handle
107: @param state PropretyList representing the portlte's state
108: */
109: public void setAsPropertyList(String portletHandle,
110: PropertyList state);
111:
112: /**
113: Destroys a portlet state
114: @param portletHandle String representing a portlet handle
115: */
116: public void destroy(String portletHandle);
117:
118: /**
119: Returns the WSRP model description for a portlet's state.
120: @param portletHandle String representing a portlet handle
121: @param desiredLocales determine the desired locales
122: @param sendAllLocales indicates if all locales are desired
123: @return ModelDescription
124: */
125: public ModelDescription getModelDescription(String portletHandle,
126: String[] desiredLocales, boolean sendAllLocales);
127:
128: }
|