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 java.net.MalformedURLException;
024: import java.net.URL;
025:
026: import oasis.names.tc.wsrp.v1.intf.WSRP_v1_Markup_PortType;
027: import oasis.names.tc.wsrp.v1.wsdl.WSRPServiceLocator;
028:
029: import org.apache.wsrp4j.consumer.InitCookieInfo;
030: import org.apache.wsrp4j.exception.ErrorCodes;
031: import org.apache.wsrp4j.exception.WSRPException;
032: import org.apache.wsrp4j.exception.WSRPXHelper;
033: import org.apache.wsrp4j.log.LogManager;
034: import org.apache.wsrp4j.log.Logger;
035:
036: public class InitCookieInfoImpl implements InitCookieInfo {
037:
038: private Logger logger = null;;
039:
040: private String markupInterfaceURL = null;
041:
042: private boolean initCookieRequired;
043:
044: private boolean initCookieDone;
045:
046: private WSRP_v1_Markup_PortType markupInterface;
047:
048: public InitCookieInfoImpl(String markupURL) throws WSRPException {
049: final String MN = "init";
050:
051: logger = LogManager.getLogManager().getLogger(getClass());
052:
053: this .initCookieDone = false;
054: this .initCookieRequired = false;
055: this .markupInterfaceURL = markupURL;
056:
057: try {
058: WSRPServiceLocator serviceLocator = new WSRPServiceLocator();
059: serviceLocator.setMaintainSession(true);
060:
061: markupInterface = serviceLocator
062: .getWSRPBaseService(new URL(markupURL));
063:
064: } catch (javax.xml.rpc.ServiceException xmlEx) {
065: WSRPXHelper.throwX(logger, Logger.ERROR, MN,
066: ErrorCodes.INIT_OF_MARKUP_PORT_FAILED, xmlEx);
067: } catch (MalformedURLException urlEx) {
068: WSRPXHelper.throwX(logger, Logger.ERROR, MN,
069: ErrorCodes.INVALID_URL_OF_MARKUP_PORT, urlEx);
070: }
071: }
072:
073: public boolean isInitCookieRequired() {
074: return initCookieRequired;
075: }
076:
077: public void setInitCookieRequired(boolean initCookieRequired) {
078: this .initCookieRequired = initCookieRequired;
079: }
080:
081: public boolean isInitCookieDone() {
082: return initCookieDone;
083: }
084:
085: public void setInitCookieDone(boolean initCookieDone) {
086: this .initCookieDone = initCookieDone;
087: }
088:
089: public String getMarkupInterfaceURL() {
090: return markupInterfaceURL;
091: }
092:
093: public WSRP_v1_Markup_PortType getWSRPBaseService() {
094: return markupInterface;
095: }
096:
097: public void setWSRPBaseService(
098: WSRP_v1_Markup_PortType markupPortType) {
099: if (markupPortType != null) {
100: this.markupInterface = markupPortType;
101: }
102: }
103:
104: }
|