View Javadoc

1   /*
2    *  Copyright (c) 2005, 2006 Imola Informatica.
3    *  All rights reserved. This program and the accompanying materials
4    *  are made available under the terms of the LGPL License v2.1
5    *  which accompanies this distribution, and is available at
6    *  http://www.gnu.org/licenses/lgpl.html
7    */
8   
9   
10  package it.imolinfo.jbi4cics.webservices.descriptor;
11  
12  import it.imolinfo.jbi4cics.connection.InteractionDescription;
13  import it.imolinfo.jbi4cics.locator.ServiceLocation;
14  import it.imolinfo.jbi4cics.messageformat.MappingDescriptor;
15  import it.imolinfo.jbi4cics.security.Account;
16  
17  public final class ServiceDescriptor {
18  
19  
20    // parametri necessari all'esposizione webservice
21  
22  
23    private String serviceName;
24    private String operationName;
25    private String serviceNameSpace;
26  
27  
28    // parametri relativi all'implementazione java del webservice
29  
30  
31    private String serviceInterfaceName;
32    private String inputBeanClassName;
33    private String outputBeanClassName;
34    private String serviceInterfacePackageName;
35    private Class serviceInterface;
36  
37  
38    // parametri relativi alla esecuzione della chiamata del servizio legacy
39  
40  
41    private MappingDescriptor inputMappingDescriptor;
42    private MappingDescriptor outputMappingDescriptor;
43    private ServiceLocation serviceLocation;
44    private Account account;
45    private InteractionDescription interactionDescription;
46  
47    private String codePage;
48  
49    /**
50     * Does nothing.
51     */
52    public ServiceDescriptor() {
53    }
54  
55    /**
56     * @return Returns the inputBean.
57     */
58    public Class getInputBean() {
59      return inputMappingDescriptor.getBeanClass();
60    }
61  
62    /**
63     * @param inputBean The inputBean to set.
64     */
65    public void setInputBean(Class inputBean) {
66      inputMappingDescriptor.setBeanClass(inputBean);
67    }
68  
69    /**
70     * @return Returns the operationName.
71     */
72    public String getOperationName() {
73      return operationName;
74    }
75  
76    /**
77     * @param operationName The operationName to set.
78     */
79    public void setOperationName(String operationName) {
80      this.operationName = operationName;
81    }
82  
83    /**
84     * @return Returns the outputBean.
85     */
86    public Class getOutputBean() {
87      return outputMappingDescriptor.getBeanClass();
88    }
89  
90    /**
91     * @param outputBean The outputBean to set.
92     */
93    public void setOutputBean(Class outputBean) {
94      outputMappingDescriptor.setBeanClass(outputBean);
95    }
96  
97    /**
98     * @return Returns the serviceName.
99     */
100   public String getServiceName() {
101     return serviceName;
102   }
103 
104   /**
105    * @param serviceName The serviceName to set.
106    */
107   public void setServiceName(String serviceName) {
108     this.serviceName = serviceName;
109   }
110 
111   /**
112    * @return Returns the account.
113    */
114   public Account getAccount() {
115     return account;
116   }
117 
118   /**
119    * @param account The account to set.
120    */
121   public void setAccount(Account account) {
122     this.account = account;
123   }
124 
125   /**
126    * @return Returns the inputMappingDescriptor.
127    */
128   public MappingDescriptor getInputMappingDescriptor() {
129     return inputMappingDescriptor;
130   }
131 
132   /**
133    * @param inputMappingDescriptor The inputMappingDescriptor to set.
134    */
135   public void setInputMappingDescriptor(MappingDescriptor inputMappingDescriptor) {
136     this.inputMappingDescriptor = inputMappingDescriptor;
137   }
138 
139   /**
140    * @return Returns the interactionDescription.
141    */
142   public InteractionDescription getInteractionDescription() {
143     return interactionDescription;
144   }
145 
146   /**
147    * @param interactionDescription The interactionDescription to set.
148    */
149   public void setInteractionDescription(InteractionDescription interactionDescription) {
150     this.interactionDescription = interactionDescription;
151   }
152 
153   /**
154    * @return Returns the outputMappingDescriptor.
155    */
156   public MappingDescriptor getOutputMappingDescriptor() {
157     return outputMappingDescriptor;
158   }
159 
160   /**
161    * @param outputMappingDescriptor The outputMappingDescriptor to set.
162    */
163   public void setOutputMappingDescriptor(MappingDescriptor outputMappingDescriptor) {
164     this.outputMappingDescriptor = outputMappingDescriptor;
165   }
166 
167   /**
168    * @return Returns the serviceLocation.
169    */
170   public ServiceLocation getServiceLocation() {
171     return serviceLocation;
172   }
173 
174   /**
175    * @param serviceLocation The serviceLocation to set.
176    */
177   public void setServiceLocation(ServiceLocation serviceLocation) {
178     this.serviceLocation = serviceLocation;
179   }
180 
181   /**
182    * @return Returns the serviceInterface.
183    */
184   public Class getServiceInterface() {
185     return serviceInterface;
186   }
187 
188   /**
189    * @param serviceInterface The serviceInterface to set.
190    */
191   public void setServiceInterface(Class serviceInterface) {
192     this.serviceInterface = serviceInterface;
193   }
194 
195   /**
196    * @return Returns the serviceInterfaceName.
197    */
198   public String getServiceInterfaceName() {
199     return serviceInterfaceName;
200   }
201 
202   /**
203    * @param serviceInterfaceName The serviceInterfaceName to set.
204    */
205   public void setServiceInterfaceName(String serviceInterfaceName) {
206     this.serviceInterfaceName = serviceInterfaceName;
207   }
208 
209   /**
210    * @return Returns the serviceInterfacePackageName.
211    */
212   public String getServiceInterfacePackageName() {
213     return serviceInterfacePackageName;
214   }
215 
216   /**
217    * @param serviceInterfacePackageName The serviceInterfacePackageName to set.
218    */
219   public void setServiceInterfacePackageName(String serviceInterfacePackageName) {
220     this.serviceInterfacePackageName = serviceInterfacePackageName;
221   }
222 
223   /**
224    * @return Returns the serviceNameSpace.
225    */
226   public String getServiceNameSpace() {
227     return serviceNameSpace;
228   }
229 
230   /**
231    * @param serviceNameSpace The serviceNameSpace to set.
232    */
233   public void setServiceNameSpace(String serviceNameSpace) {
234     this.serviceNameSpace = serviceNameSpace;
235   }
236 
237   /**
238    * @return Returns the inputBeanClassName.
239    */
240   public String getInputBeanClassName() {
241     return inputBeanClassName;
242   }
243 
244   /**
245    * @param inputBeanClassName The inputBeanClassName to set.
246    */
247   public void setInputBeanClassName(String inputBeanClassName) {
248     this.inputBeanClassName = inputBeanClassName;
249   }
250 
251   /**
252    * @return Returns the outputBeanClassName.
253    */
254   public String getOutputBeanClassName() {
255     return outputBeanClassName;
256   }
257 
258   /**
259    * @param outputBeanClassName The outputBeanClassName to set.
260    */
261   public void setOutputBeanClassName(String outputBeanClassName) {
262     this.outputBeanClassName = outputBeanClassName;
263   }
264 
265   public void setCodePage(String codePage){
266     this.codePage=codePage;
267     inputMappingDescriptor.setCodePage(codePage);
268     outputMappingDescriptor.setCodePage(codePage);
269   }
270 
271   public String getCodePage(){
272     return codePage;
273   }
274 
275   /**
276    * Sets default values for fields currently <code>null</code>. Some default
277    * values are calculated from the actual <i>serviceName</i>, so this method
278    * must be called when <code>getServiceName()</code> returns a not
279    * <code>null</code> value to avoid <code>NullPointerException</code>.
280    *
281    * @see #getServiceName()
282    * @see #setServiceName(String)
283    */
284   public void setDefaultValuesIfNecessary() {
285     if (getOperationName() == null) {
286       setOperationName("execute");
287     }
288     if (getServiceInterfaceName() == null) {
289       setServiceInterfaceName(getServiceName().concat("Interface"));
290     }
291     if (getInputBeanClassName() == null) {
292       setInputBeanClassName(getServiceName().concat("InputBean"));
293     }
294     if (getOutputBeanClassName() == null) {
295       setOutputBeanClassName(getServiceName().concat("OutputBean"));
296     }
297   }
298 }