001: package org.objectweb.celtix.tools.common.model;
002:
003: import java.util.*;
004: import javax.jws.soap.SOAPBinding;
005: import org.w3c.dom.Element;
006: import org.objectweb.celtix.tools.common.ToolException;
007: import org.objectweb.celtix.tools.extensions.jaxws.JAXWSBinding;
008:
009: public class JavaInterface {
010:
011: private String name;
012: private String packageName;
013: private String namespace;
014: private String location;
015: private JavaModel model;
016: private SOAPBinding.Style soapStyle;
017: private SOAPBinding.Use soapUse;
018: private SOAPBinding.ParameterStyle soapParameterStyle;
019:
020: private final List<JavaMethod> methods = new ArrayList<JavaMethod>();
021: private final List<String> annotations = new ArrayList<String>();
022: private final Set<String> imports = new TreeSet<String>();
023:
024: private JAXWSBinding jaxwsBinding = new JAXWSBinding();
025: private JAXWSBinding bindingExt = new JAXWSBinding();
026:
027: private String webserviceName;
028: private Element handlerChains;
029:
030: public JavaInterface() {
031: }
032:
033: public JavaInterface(JavaModel m) {
034: this .model = m;
035: }
036:
037: public void setWebServiceName(String wsn) {
038: this .webserviceName = wsn;
039: }
040:
041: public String getWebServiceName() {
042: return this .webserviceName;
043: }
044:
045: public void setSOAPStyle(SOAPBinding.Style s) {
046: this .soapStyle = s;
047: }
048:
049: public SOAPBinding.Style getSOAPStyle() {
050: return this .soapStyle;
051: }
052:
053: public void setSOAPUse(SOAPBinding.Use u) {
054: this .soapUse = u;
055: }
056:
057: public SOAPBinding.Use getSOAPUse() {
058: return this .soapUse;
059: }
060:
061: public void setSOAPParameterStyle(SOAPBinding.ParameterStyle p) {
062: this .soapParameterStyle = p;
063: }
064:
065: public SOAPBinding.ParameterStyle getSOAPParameterStyle() {
066: return this .soapParameterStyle;
067: }
068:
069: public JavaModel getJavaModel() {
070: return this .model;
071: }
072:
073: public void setName(String n) {
074: this .name = n;
075: }
076:
077: public String getName() {
078: return name;
079: }
080:
081: public void setLocation(String l) {
082: this .location = l;
083: }
084:
085: public String getLocation() {
086: return this .location;
087: }
088:
089: public List<JavaMethod> getMethods() {
090: return methods;
091: }
092:
093: public boolean hasMethod(JavaMethod method) {
094: if (method != null) {
095: String signature = method.getSignature();
096: for (int i = 0; i < methods.size(); i++) {
097: if (signature.equals(methods.get(i).getSignature())) {
098: return true;
099: }
100: }
101: }
102: return false;
103: }
104:
105: public int indexOf(JavaMethod method) {
106: if (method != null) {
107: String signature = method.getSignature();
108: for (int i = 0; i < methods.size(); i++) {
109: if (signature.equals(methods.get(i).getSignature())) {
110: return i;
111: }
112: }
113: }
114: return -1;
115: }
116:
117: public int removeMethod(JavaMethod method) {
118: int index = indexOf(method);
119: if (index > -1) {
120: methods.remove(index);
121: }
122: return index;
123: }
124:
125: public void replaceMethod(JavaMethod method) {
126: int index = removeMethod(method);
127: methods.add(index, method);
128: }
129:
130: public void addMethod(JavaMethod method) throws ToolException {
131: if (hasMethod(method)) {
132: replaceMethod(method);
133: } else {
134: methods.add(method);
135: }
136: }
137:
138: public String getPackageName() {
139: return this .packageName;
140: }
141:
142: public void setPackageName(String pn) {
143: this .packageName = pn;
144: }
145:
146: public String getNamespace() {
147: return this .namespace;
148: }
149:
150: public void setNamespace(String ns) {
151: this .namespace = ns;
152: }
153:
154: public void addAnnotation(String annotation) {
155: this .annotations.add(annotation);
156: }
157:
158: public List getAnnotations() {
159: return this .annotations;
160: }
161:
162: public JAXWSBinding getJAXWSBinding() {
163: return this .jaxwsBinding;
164: }
165:
166: public void setJAXWSBinding(JAXWSBinding binding) {
167: if (binding != null) {
168: this .jaxwsBinding = binding;
169: }
170: }
171:
172: public void addImport(String i) {
173: imports.add(i);
174: }
175:
176: public Iterator<String> getImports() {
177: return imports.iterator();
178: }
179:
180: public Element getHandlerChains() {
181: return this .handlerChains;
182: }
183:
184: public void setHandlerChains(Element elem) {
185: this .handlerChains = elem;
186: }
187:
188: public JAXWSBinding getBindingExt() {
189: return bindingExt;
190: }
191:
192: public void setBindingExt(JAXWSBinding pBindingExt) {
193: this.bindingExt = pBindingExt;
194: }
195: }
|