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: package org.apache.wsrp4j.consumer.driver;
018:
019: import oasis.names.tc.wsrp.v1.types.ClientData;
020:
021: import org.apache.wsrp4j.consumer.WSRPBaseRequest;
022: import org.apache.wsrp4j.log.LogManager;
023: import org.apache.wsrp4j.log.Logger;
024:
025: public abstract class GenericWSRPBaseRequestImpl implements
026: WSRPBaseRequest {
027:
028: protected Logger logger = LogManager.getLogManager().getLogger(
029: GenericWSRPBaseRequestImpl.class);
030:
031: public abstract String getSessionID();
032:
033: public abstract String getPortletInstanceKey();
034:
035: public abstract String getNavigationalState();
036:
037: public abstract String getWindowState();
038:
039: public abstract String getMode();
040:
041: public abstract ClientData getClientData();
042:
043: public abstract String[] getLocales();
044:
045: public abstract String[] getModes();
046:
047: public abstract String[] getWindowStates();
048:
049: public abstract String[] getMimeTypes();
050:
051: public abstract String[] getCharacterEncodingSet();
052:
053: public boolean isModeSupported(String wsrpMode) {
054: final String MN = "isModeSupported(String)";
055:
056: if (logger.isLogging(Logger.TRACE_HIGH)) {
057: logger.entry(Logger.TRACE_HIGH, MN);
058: }
059:
060: if (wsrpMode == null)
061: throw new IllegalArgumentException("mode must not be null");
062:
063: String[] mods = getModes();
064: for (int i = 0; i < mods.length; i++) {
065: if (wsrpMode.equalsIgnoreCase(mods[i])) {
066: return true;
067: }
068: }
069:
070: if (logger.isLogging(Logger.TRACE_HIGH)) {
071: logger.exit(Logger.TRACE_HIGH, MN);
072: }
073:
074: return false;
075: }
076:
077: public boolean isWindowStateSupported(String wsrpWindowState) {
078: final String MN = "isWindowStateSupported(String)";
079:
080: if (logger.isLogging(Logger.TRACE_HIGH)) {
081: logger.entry(Logger.TRACE_HIGH, MN);
082: }
083:
084: if (wsrpWindowState == null)
085: throw new IllegalArgumentException(
086: "window state must not be null");
087:
088: String[] stats = getWindowStates();
089: for (int i = 0; i < stats.length; i++) {
090: if (wsrpWindowState.equalsIgnoreCase(stats[i])) {
091: return true;
092: }
093: }
094:
095: if (logger.isLogging(Logger.TRACE_HIGH)) {
096: logger.exit(Logger.TRACE_HIGH, MN);
097: }
098:
099: return false;
100: }
101:
102: public abstract String getUserAuthentication();
103: }
|