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.consumer.driver;
022:
023: import oasis.names.tc.wsrp.v1.types.StateChange;
024:
025: import org.apache.wsrp4j.consumer.ConsumerEnvironment;
026: import org.apache.wsrp4j.consumer.PortletDriverRegistry;
027: import org.apache.wsrp4j.consumer.PortletRegistry;
028: import org.apache.wsrp4j.consumer.ProducerRegistry;
029: import org.apache.wsrp4j.consumer.SessionHandler;
030: import org.apache.wsrp4j.consumer.URLRewriter;
031: import org.apache.wsrp4j.consumer.URLTemplateComposer;
032: import org.apache.wsrp4j.consumer.UserRegistry;
033:
034: public abstract class GenericConsumerEnvironment implements
035: ConsumerEnvironment {
036:
037: private String consumerAgent = null;
038:
039: private String[] supportedLocales = null;
040:
041: private String[] supportedModes = null;
042:
043: private String[] supportedWindowStates = null;
044:
045: private StateChange portletStateChange = null;
046:
047: private String userAuthMethod = null;
048:
049: private String[] characterEncoding = null;
050:
051: private String[] mimeTypes = null;
052:
053: private UserRegistry userRegistry = null;
054:
055: private ProducerRegistry producerRegistry = null;
056:
057: private PortletRegistry portletRegistry = null;
058:
059: private PortletDriverRegistry portletDriverRegistry = null;
060:
061: private SessionHandler sessionHandler = null;
062:
063: private URLTemplateComposer templateComposer = null;
064:
065: private URLRewriter urlRewriter = null;
066:
067: public GenericConsumerEnvironment() {
068: }
069:
070: /**
071: * Get the name of the consumer
072: *
073: * @return The name of the consumer
074: **/
075: public String getConsumerAgent() {
076: return consumerAgent;
077: }
078:
079: /**
080: * Set the name of the consumer
081: *
082: * @param name The new name of the consumer
083: **/
084: public void setConsumerAgent(String name) {
085: consumerAgent = name;
086: }
087:
088: /**
089: * Get the locales which are supported by the consumer.
090: * (ISO-639 + "_" + ISO-3166)
091: *
092: * @return Array with String representations of the locales which are
093: * supported by the consumer
094: **/
095: public String[] getSupportedLocales() {
096: return supportedLocales;
097: }
098:
099: /**
100: * Set the locales which are supported by the consumer.
101: * Pattern: ISO-639 + "_" + ISO-3166
102: *
103: * @param locales Array of String representations of the supported locales
104: **/
105: public void setSupportedLocales(String[] locales) {
106: supportedLocales = locales;
107: }
108:
109: /**
110: * Get the portlet modes the consumer is willing to manage.
111: *
112: * @return Array with string representations of the portlet modes which are
113: * supported by the consumer
114: **/
115: public String[] getSupportedModes() {
116: return supportedModes;
117: }
118:
119: /**
120: * Set the portlet modes which are supported by the consumer.
121: *
122: * @param modes Array of string representations of portlet modes
123: **/
124: public void setSupportedModes(String[] modes) {
125: supportedModes = modes;
126: }
127:
128: /**
129: * Get the window states the consumer is willing to manage.
130: *
131: * @return Array with string representations of the window states which are
132: * supported by the consumer
133: **/
134: public String[] getSupportedWindowStates() {
135: return supportedWindowStates;
136: }
137:
138: /**
139: * Set the window states which are supported by the consumer.
140: *
141: * @param states Array of string representations of window states
142: **/
143: public void setSupportedWindowStates(String[] states) {
144: supportedWindowStates = states;
145: }
146:
147: /**
148: * Returns a flag which is used to indicate the producer wether or not
149: * the processing of portlets is allowed to modify the portlet state.
150: *
151: * @return A flag
152: **/
153: public StateChange getPortletStateChange() {
154: return portletStateChange;
155: }
156:
157: /**
158: * Set a flag which is used to indicate the producer wether or not
159: * the processing of portlets is allowed to modify the portlet state.
160: *
161: * @param portletStateChange A flag with one of the following values (OK, Clone, Fault)
162: **/
163: public void setPortletStateChange(StateChange portletStateChange) {
164: this .portletStateChange = portletStateChange;
165: }
166:
167: /**
168: * Get the character sets the consumer wants the remote portlet to use for encoding the markup.
169: * Valid character sets are defined <a href='http://www.iana.org/assignments/character-sets'>here</a>
170: *
171: * @return Array of string representations of the character encoding.
172: **/
173: public String[] getCharacterEncodingSet() {
174: return characterEncoding;
175: }
176:
177: /**
178: * Set the character set the consumer wants the remote portlet to use for encoding the markup.
179: * Valid character sets are defined <a href='http://www.iana.org/assignments/character-sets'>here</a>
180: *
181: * @param charEncoding Array of string representations of the character encoding.
182: **/
183: public void setCharacterEncodingSet(String[] charEncoding) {
184: characterEncoding = charEncoding;
185: }
186:
187: /**
188: * Get an array of mime types which are supported by the consumer.
189: * The order in the array defines the order of preference of the consumer.
190: *
191: * @return An array of mimes types the consumer supports.
192: **/
193: public String[] getMimeTypes() {
194: return mimeTypes;
195: }
196:
197: /**
198: * Set the mime types the consumer supports
199: * The order in the array defines the order of preference of the consumer.
200: *
201: * @param mimeTypes An array of mimes types the consumer supports.
202: **/
203: public void setMimeTypes(String[] mimeTypes) {
204: this .mimeTypes = mimeTypes;
205: }
206:
207: /**
208: * Get the method which is used by the consumer to authenticate its users.
209: *
210: * @return String indicating how end-users were authenticated by the consumer.
211: **/
212: public String getUserAuthentication() {
213: return userAuthMethod;
214: }
215:
216: /**
217: * Set the method of end user authentication used by the consumer..
218: *
219: * @param authMethod String indicating how end-users are authenticated by the consumer.
220: **/
221: public void setUserAuthentication(String authMethod) {
222: userAuthMethod = authMethod;
223: }
224:
225: /**
226: * Get the user registry of the consumer.
227: *
228: * @return The consumer specific user registry
229: **/
230: public UserRegistry getUserRegistry() {
231: return userRegistry;
232: }
233:
234: /**
235: * Set the user registry of the consumer.
236: *
237: * @param userRegistry The consumer specific user registry
238: **/
239: public void setUserRegistry(UserRegistry userRegistry) {
240: this .userRegistry = userRegistry;
241: }
242:
243: /**
244: * Get the producer registry of the consumer.
245: *
246: * @return The consumer specific producer registry
247: **/
248: public ProducerRegistry getProducerRegistry() {
249: return producerRegistry;
250: }
251:
252: /**
253: * Set the producer registry of the consumer.
254: *
255: * @param producerRegistry The consumer specific producer registry
256: **/
257: public void setProducerRegistry(ProducerRegistry producerRegistry) {
258: this .producerRegistry = producerRegistry;
259: }
260:
261: /**
262: * Get the portlet registry of the consumer.
263: *
264: * @return Interface to the consumer specific portlet registry
265: **/
266: public PortletRegistry getPortletRegistry() {
267: return portletRegistry;
268: }
269:
270: /**
271: * Set the portlet registry of the consumer.
272: *
273: * @param portletRegistry The consumer specific portlet registry
274: **/
275: public void setPortletRegistry(PortletRegistry portletRegistry) {
276: this .portletRegistry = portletRegistry;
277: }
278:
279: /**
280: * Get the portlet driver registry of the consumer.
281: *
282: * @return Interface to the consumer specific portlet driver registry
283: **/
284: public PortletDriverRegistry getPortletDriverRegistry() {
285: return portletDriverRegistry;
286: }
287:
288: /**
289: * Set the portlet driver registry of the consumer.
290: *
291: * @param portletDriverRegistry The consumer specific portlet driver registry
292: **/
293: public void setPortletDriverRegistry(
294: PortletDriverRegistry portletDriverRegistry) {
295: this .portletDriverRegistry = portletDriverRegistry;
296: }
297:
298: /**
299: * Get the session handler of the consumer.
300: *
301: * @return Interface to the consumer specific session handler
302: **/
303: public SessionHandler getSessionHandler() {
304: return sessionHandler;
305: }
306:
307: /**
308: * Set the session handler of the consumer.
309: *
310: * @param sessionHandler The consumer specific session handler
311: **/
312: public void setSessionHandler(SessionHandler sessionHandler) {
313: this .sessionHandler = sessionHandler;
314: }
315:
316: /**
317: * Get the url template composer for template proccessing
318: *
319: * @return Interface to the consumer specific template composer
320: **/
321: public URLTemplateComposer getTemplateComposer() {
322: return templateComposer;
323: }
324:
325: /**
326: * Set the url template composer for template proccessing
327: *
328: * @param templateComposer The consumer specific template composer
329: **/
330: public void setTemplateComposer(URLTemplateComposer templateComposer) {
331: this .templateComposer = templateComposer;
332: }
333:
334: /**
335: * Get the url rewriter for consumer url-rewriting
336: *
337: * @return The consumer specific url rewriter
338: **/
339: public URLRewriter getURLRewriter() {
340: return urlRewriter;
341: }
342:
343: /**
344: * Set the url rewriter for consumer url-rewriting
345: *
346: * @param urlRewriter The consumer specific url rewriter
347: **/
348: public void setURLRewriter(URLRewriter urlRewriter) {
349: this.urlRewriter = urlRewriter;
350: }
351:
352: }
|