1 19 20 package org.netbeans.modules.websvc.api.jaxws.wsdlmodel; 21 22 import com.sun.tools.ws.processor.model.Operation; 23 import com.sun.tools.ws.processor.model.java.JavaParameter; 24 import java.util.*; 25 import org.openide.util.NbBundle; 26 27 31 public class WsdlOperation { 32 public static final int TYPE_NORMAL=0; 33 public static final int TYPE_ASYNC_POLLING=1; 34 public static final int TYPE_ASYNC_CALLBACK=2; 35 36 private Operation operation; 37 38 public WsdlOperation(Operation operation) { 39 this.operation=operation; 40 } 41 42 public Object getInternalJAXWSOperation() { 43 return operation; 44 } 45 46 public String getName() { 47 String operationName = operation.getName().getLocalPart(); 48 String postfix=null; 49 switch (getOperationType()) { 50 case TYPE_NORMAL:break; 51 case TYPE_ASYNC_POLLING: { 52 postfix = NbBundle.getMessage(WsdlOperation.class,"TXT_asyncPolling"); 53 break; 54 } 55 case TYPE_ASYNC_CALLBACK: { 56 postfix = NbBundle.getMessage(WsdlOperation.class,"TXT_asyncCallback"); 57 break; 58 } 59 } 60 if (postfix!=null) 61 operationName = NbBundle.getMessage(WsdlOperation.class,"TXT_operationName",operationName,postfix); 62 return operationName; 63 } 64 65 public String getJavaName() { 66 return operation.getJavaMethod().getName(); 67 } 68 69 public String getReturnTypeName() { 70 return operation.getJavaMethod().getReturnType().getName(); 71 } 72 73 public List<WsdlParameter> getParameters() { 74 List<WsdlParameter> wsdlParameters = new ArrayList<WsdlParameter> (); 75 if (operation==null) return wsdlParameters; 76 List<JavaParameter> parameterList = operation.getJavaMethod().getParametersList(); 77 for (JavaParameter param: parameterList) 78 wsdlParameters.add(new WsdlParameter(param)); 79 return wsdlParameters; 80 } 81 82 public Iterator<String > getExceptions() { 83 return operation.getJavaMethod().getExceptions(); 84 } 85 86 public int getOperationType() { 87 String returnType = getReturnTypeName(); 88 if (returnType.startsWith("javax.xml.ws.Response")) { return TYPE_ASYNC_POLLING; 90 } else if (returnType.startsWith("java.util.concurrent.Future")) { return TYPE_ASYNC_CALLBACK; 92 } else return TYPE_NORMAL; 93 94 } 95 96 } 97 | Popular Tags |