001: /*
002: * Licensed to the Apache Software Foundation (ASF) under one
003: * or more contributor license agreements. See the NOTICE file
004: * distributed with this work for additional information
005: * regarding copyright ownership. The ASF licenses this file
006: * to you under the Apache License, Version 2.0 (the
007: * "License"); you may not use this file except in compliance
008: * with the License. You may obtain a copy of the License at
009: *
010: * http://www.apache.org/licenses/LICENSE-2.0
011: *
012: * Unless required by applicable law or agreed to in writing,
013: * software distributed under the License is distributed on an
014: * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
015: * KIND, either express or implied. See the License for the
016: * specific language governing permissions and limitations
017: * under the License.
018: */
019: package org.apache.axis2.description;
020:
021: import org.apache.axis2.AxisFault;
022: import org.apache.axis2.i18n.Messages;
023: import org.apache.axis2.wsdl.WSDLConstants;
024:
025: public class AxisOperationFactory implements WSDLConstants {
026:
027: public static AxisOperation getAxisOperation(int mepURI)
028: throws AxisFault {
029: AxisOperation abOpdesc;
030:
031: switch (mepURI) {
032: case WSDLConstants.MEP_CONSTANT_IN_ONLY: {
033: abOpdesc = new InOnlyAxisOperation();
034: abOpdesc
035: .setMessageExchangePattern(WSDL2Constants.MEP_URI_IN_ONLY);
036: break;
037: }
038: case WSDLConstants.MEP_CONSTANT_OUT_ONLY: {
039: abOpdesc = new OutOnlyAxisOperation();
040: abOpdesc
041: .setMessageExchangePattern(WSDL2Constants.MEP_URI_OUT_ONLY);
042: break;
043: }
044: case WSDLConstants.MEP_CONSTANT_IN_OUT: {
045: abOpdesc = new InOutAxisOperation();
046: abOpdesc
047: .setMessageExchangePattern(WSDL2Constants.MEP_URI_IN_OUT);
048: break;
049: }
050: case WSDLConstants.MEP_CONSTANT_IN_OPTIONAL_OUT: {
051: abOpdesc = new InOutAxisOperation();
052: abOpdesc
053: .setMessageExchangePattern(WSDL2Constants.MEP_URI_IN_OPTIONAL_OUT);
054: break;
055: }
056: case WSDLConstants.MEP_CONSTANT_ROBUST_IN_ONLY: {
057: abOpdesc = new InOutAxisOperation();
058: abOpdesc
059: .setMessageExchangePattern(WSDL2Constants.MEP_URI_ROBUST_IN_ONLY);
060: break;
061: }
062: case WSDLConstants.MEP_CONSTANT_OUT_IN: {
063: abOpdesc = new OutInAxisOperation();
064: abOpdesc
065: .setMessageExchangePattern(WSDL2Constants.MEP_URI_OUT_IN);
066: break;
067: }
068: case WSDLConstants.MEP_CONSTANT_OUT_OPTIONAL_IN: {
069: abOpdesc = new OutInAxisOperation();
070: abOpdesc
071: .setMessageExchangePattern(WSDL2Constants.MEP_URI_OUT_OPTIONAL_IN);
072: break;
073: }
074: case WSDLConstants.MEP_CONSTANT_ROBUST_OUT_ONLY: {
075: abOpdesc = new RobustOutOnlyAxisOperation();
076: abOpdesc
077: .setMessageExchangePattern(WSDL2Constants.MEP_URI_ROBUST_OUT_ONLY);
078: break;
079: }
080: default: {
081: throw new AxisFault(Messages.getMessage("unSupportedMEP",
082: "ID is " + mepURI));
083: }
084: }
085: return abOpdesc;
086: }
087:
088: //FIXME add in the latest MEP URIs AND needs to double check on about the mep we had in 2004
089: public static AxisOperation getOperationDescription(String mepURI)
090: throws AxisFault {
091: AxisOperation abOpdesc;
092: if (WSDL2Constants.MEP_URI_IN_ONLY.equals(mepURI)
093: || WSDL20_2006Constants.MEP_URI_IN_ONLY.equals(mepURI)
094: || WSDL20_2004_Constants.MEP_URI_IN_ONLY.equals(mepURI)) {
095: abOpdesc = new InOnlyAxisOperation();
096: } else if (WSDL2Constants.MEP_URI_OUT_ONLY.equals(mepURI)
097: || WSDL20_2006Constants.MEP_URI_OUT_ONLY.equals(mepURI)
098: || WSDL20_2004_Constants.MEP_URI_OUT_ONLY
099: .equals(mepURI)) {
100: abOpdesc = new OutOnlyAxisOperation();
101: } else if (WSDL2Constants.MEP_URI_IN_OUT.equals(mepURI)
102: || WSDL20_2006Constants.MEP_URI_IN_OUT.equals(mepURI)
103: || WSDL20_2004_Constants.MEP_URI_IN_OUT.equals(mepURI)) {
104: abOpdesc = new InOutAxisOperation();
105: } else if (WSDL2Constants.MEP_URI_IN_OPTIONAL_OUT
106: .equals(mepURI)
107: || WSDL20_2006Constants.MEP_URI_IN_OPTIONAL_OUT
108: .equals(mepURI)
109: || WSDL20_2004_Constants.MEP_URI_IN_OPTIONAL_OUT
110: .equals(mepURI)) {
111: abOpdesc = new InOutAxisOperation();
112: } else if (WSDL2Constants.MEP_URI_OUT_IN.equals(mepURI)
113: || WSDL20_2006Constants.MEP_URI_OUT_IN.equals(mepURI)
114: || WSDL20_2004_Constants.MEP_URI_OUT_IN.equals(mepURI)) {
115: abOpdesc = new OutInAxisOperation();
116: } else if (WSDL2Constants.MEP_URI_OUT_OPTIONAL_IN
117: .equals(mepURI)
118: || WSDL20_2006Constants.MEP_URI_OUT_OPTIONAL_IN
119: .equals(mepURI)
120: || WSDL20_2004_Constants.MEP_URI_OUT_OPTIONAL_IN
121: .equals(mepURI)) {
122: abOpdesc = new OutInAxisOperation();
123: } else if (WSDL2Constants.MEP_URI_ROBUST_OUT_ONLY
124: .equals(mepURI)
125: || WSDL20_2006Constants.MEP_URI_ROBUST_OUT_ONLY
126: .equals(mepURI)
127: || WSDL20_2004_Constants.MEP_URI_ROBUST_OUT_ONLY
128: .equals(mepURI)) {
129: abOpdesc = new OutInAxisOperation();
130: abOpdesc
131: .setMessageExchangePattern(WSDL2Constants.MEP_URI_ROBUST_OUT_ONLY);
132: } else if (WSDL2Constants.MEP_URI_ROBUST_IN_ONLY.equals(mepURI)
133: || WSDL20_2006Constants.MEP_URI_ROBUST_IN_ONLY
134: .equals(mepURI)
135: || WSDL20_2004_Constants.MEP_URI_ROBUST_IN_ONLY
136: .equals(mepURI)) {
137: abOpdesc = new InOnlyAxisOperation();
138: abOpdesc
139: .setMessageExchangePattern(WSDL2Constants.MEP_URI_ROBUST_IN_ONLY);
140: } else {
141: throw new AxisFault(Messages.getMessage("unSupportedMEP",
142: "ID is " + mepURI));
143: }
144: return abOpdesc;
145: }
146: }
|