KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > axis2 > wsdl > builder > wsdl4j > WSDL11MEPFinder


1 /*
2  * Copyright 2001-2004 The Apache Software Foundation.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */

16 package org.apache.axis2.wsdl.builder.wsdl4j;
17
18 import org.apache.wsdl.WSDLConstants;
19 import org.apache.wsdl.impl.WSDLProcessingException;
20
21 import javax.wsdl.Operation;
22 import javax.wsdl.OperationType;
23
24 /**
25  * @author chathura@opensource.lk
26  *
27  */

28 public class WSDL11MEPFinder {
29
30     public static String JavaDoc getMEP(Operation operation){
31 // boolean inMessageExist = false, outMessageExist = false;
32
// if(null != operation.getInput()){
33
// inMessageExist = true;
34
// }
35
// if(null != operation.getOutput()){
36
// outMessageExist = true;
37
// }
38
//
39
// if(inMessageExist && outMessageExist){
40
// return WSDLConstants.MEP_URI_IN_OUT;
41
// }
42
//
43
// if(inMessageExist && !outMessageExist){
44
// return WSDLConstants.MEP_URI_IN_ONLY;
45
// }
46
//
47
// if(!inMessageExist && outMessageExist){
48
// return WSDLConstants.MEP_URI_OUT_ONLY;
49
// }
50
//
51
OperationType operationType = operation.getStyle();
52          if (null != operationType) {
53
54             if (operationType.equals(OperationType.REQUEST_RESPONSE))
55                 return WSDLConstants.MEP_URI_IN_OUT;
56
57             if (operationType.equals(OperationType.ONE_WAY))
58                 return WSDLConstants.MEP_URI_IN_ONLY;
59
60             if (operationType.equals(OperationType.NOTIFICATION))
61                 return WSDLConstants.MEP_URI_OUT_ONLY;
62
63             if (operationType.equals(OperationType.SOLICIT_RESPONSE))
64                 return WSDLConstants.MEP_URI_OUT_IN;
65         }
66         throw new WSDLProcessingException("Cannot Determine the MEP");
67         
68     }
69 }
70
Popular Tags