View Javadoc

1    /****************************************************************************
2    * Copyright (c) 2005, 2006, 2007, 2008, 2009 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   package it.imolinfo.jbi4corba.webservice.generator;
9   
10  import it.imolinfo.jbi4corba.webservice.generator.typedef.TypeDef;
11  
12  import java.util.ArrayList;
13  import java.util.Collection;
14  import java.util.HashMap;
15  import java.util.HashSet;
16  import java.util.List;
17  import java.util.Map;
18  import java.util.Set;
19  
20  import org.apache.commons.lang.builder.EqualsBuilder;
21  import org.apache.commons.lang.builder.ReflectionToStringBuilder;
22  
23  /**
24   * Holds the CORBA service information.
25   *
26   */
27  /**
28   * @author marco
29   *
30   */
31  public class ClientCorbaClassesHolder {
32      
33    private Class helperClass;
34  
35    private Class corbaObjectClass;
36  
37    private Class operationsClass;
38    
39    // Collects method Signature
40    private List<MethodSignature> methodSignatures 
41        = new ArrayList<MethodSignature>();
42    
43    // String = ID; Object = FactoryInstance
44    private Map<String, Object> valueTypeIdAndInstance;
45    
46    /** the union types contained by corba operation */
47    private Map<String,UnionType> unionTypes = new HashMap<String, UnionType>();
48    
49    /** store correspondance between substituted fields and the Unions  */
50    private Map<String,Map<String,String>> substitutedUnionFields = new HashMap<String, Map<String,String>>();
51    
52    /** the Interface types contained by corba operation */
53    private Map<String,InterfaceType> interfaceTypes = new HashMap<String, InterfaceType>();
54    
55    /** store correspondance between substituted fields and the Interface */
56    private Map<String,Map<String,String>> substitutedInterafceFields = new HashMap<String, Map<String,String>>();
57    
58     /** the Any types contained by corba operation */
59    private Map<String,AnyType> anyTypes = new HashMap<String, AnyType>();
60    
61    /** the ID to ClassName Map */
62    private Map<String,String> idTOClassNameMap = new HashMap<String, String>();
63    
64    /** store correspondance between substituted fields and the Any */
65    private Map<String,Map<String,String>> substitutedAnyFields = new HashMap<String, Map<String,String>>();
66    
67    /** store all types defined in IDL */
68    private Set<Class> allIDLTypes = new HashSet<Class>();
69    
70    /** store all enums defined in IDL */
71    Map<String, List<String>> corbaEnumMap = new HashMap<String, List<String>>();
72    
73    /** All the typedefs informations */
74    private Map<String,TypeDef> typeDefs = new HashMap<String, TypeDef>();
75  
76  
77    /**
78     * Default constructor.
79     */
80    public ClientCorbaClassesHolder(){
81    }
82    
83  /**
84   * @return  The return
85   */
86    public Class getCorbaObjectClass() {
87      return corbaObjectClass;
88    }
89  
90    /**
91     * 
92     * @param corbaObjectClass  The corba object class
93     */
94    public void setCorbaObjectClass(Class corbaObjectClass) {
95      this.corbaObjectClass = corbaObjectClass;
96    }
97  
98    /**
99     * @return  The return
100    */
101   public Class getHelperClass() {
102     return helperClass;
103   }
104 
105   /**
106    * @param helperClass  The helper class
107    */
108   public void setHelperClass(Class helperClass) {
109     this.helperClass = helperClass;
110   }
111 
112   /**
113    * @return  The return
114    */
115   public Class getOperationsClass() {
116     return operationsClass;
117   }
118 
119   /**
120    * @param operationsClass  The operations class
121    */
122   public void setOperationsClass(Class operationsClass) {
123     this.operationsClass = operationsClass;
124   }
125 
126   /**
127    * @return  The return
128    */
129   public String toString() {
130     return ReflectionToStringBuilder.toString(this);
131   }
132 
133   /**
134    * @param obj  The object
135    * @return     The return
136    */
137   public boolean equals(Object obj) {
138     return EqualsBuilder.reflectionEquals(this, obj);
139   }
140 
141   /**
142    * @return  The return
143    */
144   public Map<String, Object> getValueTypeIdAndInstance() {
145 	  return valueTypeIdAndInstance;
146   }
147 
148   /**
149    * 
150    * @param valueTypeIdAndInstance  The value type Id and Instance
151    */
152   public void setValueTypeIdAndInstance(
153                                         Map<String, Object> valueTypeIdAndInstance) {
154       this.valueTypeIdAndInstance = valueTypeIdAndInstance;
155   }
156 
157   public List<MethodSignature> getMethodSignatures() {
158       return methodSignatures;
159   }
160 
161   public void setMethodSignatures(List<MethodSignature> methodSignatures) {
162       this.methodSignatures = methodSignatures;
163   }
164   
165   public UnionType getUnionType(String unionTypeName) {
166 		return unionTypes.get(unionTypeName);
167   }
168 	
169   public Collection<UnionType> getAllUnionTypes() {
170   	return unionTypes.values();
171   }
172   
173   public Map<String,UnionType> getAllUnionTypesMap() {
174 	  	return unionTypes;
175 	  }
176 
177   public void addUnionTypes(Map<String,UnionType> unionTypes) {
178   	this.unionTypes = unionTypes;
179   }
180 
181   public Map<String, Map<String,String>> getSubstitutedUnionFields() {
182 	 return substitutedUnionFields;
183   }
184 	
185   public void setSubstitutedUnionFields(Map<String, Map<String,String>> replacedUnionFields) {
186 	 this.substitutedUnionFields = replacedUnionFields;
187   }
188   
189   public Map<String,InterfaceType> getAllInterafceTypesMap() {
190       return interfaceTypes;
191   }
192   
193    public InterfaceType getInterfaceType(String interfaceTypeName) {
194       return interfaceTypes.get(interfaceTypeName);
195   
196   }
197 	
198   public Collection<InterfaceType> getAllInterfaceTypes() {
199   	return interfaceTypes.values();
200   }
201 
202   public void addInterfaceTypes(Map<String,InterfaceType> interfaceTypes) {
203   	this.interfaceTypes = interfaceTypes;
204   }
205 
206   public Map<String, Map<String,String>> getSubstitutedInterfaceFields() {
207 	 return substitutedInterafceFields;
208   }
209 	
210   public void setSubstitutedInterfaceFields(Map<String, Map<String,String>> replacedInterfaceFields) {
211 	 this.substitutedInterafceFields = replacedInterfaceFields;
212   }
213   
214     public AnyType getAnyType(String anyTypeName) {
215 		return anyTypes.get(anyTypeName);
216   }
217 	
218   public Collection<AnyType> getAllAnyTypes() {
219   	return anyTypes.values();
220   }
221 
222   public void addAnyTypes(Map<String,AnyType> anyTypes) {
223   	this.anyTypes = anyTypes;
224   }
225 
226   public Map<String, Map<String,String>> getSubstitutedAnyFields() {
227 	 return substitutedAnyFields;
228   }
229 	
230   public void setSubstitutedAnyFields(Map<String, Map<String,String>> replacedAnyFields) {
231 	 this.substitutedAnyFields = replacedAnyFields;
232   }
233 
234 public Set<Class> getAllIDLTypes() {
235 	return allIDLTypes;
236 }
237 
238 public void setAllIDLTypes(Set<Class> allIDLTypes) {
239 	this.allIDLTypes = allIDLTypes;
240 }
241 
242 public Map<String, List<String>> getCorbaEnumMap() {
243 	return corbaEnumMap;
244 }
245 
246 public void setCorbaEnumMap(Map<String, List<String>> corbaEnumMap) {
247 	this.corbaEnumMap = corbaEnumMap;
248 }
249 
250 public void setIdToClassMap(Map<String, String> idToClassMap) {
251        this.idTOClassNameMap= idToClassMap;
252 }
253 
254 public Map<String, String> getIdToClassMap() {
255        return idTOClassNameMap;
256 }
257 
258 public Map<String, TypeDef> getTypeDefs() {
259 	return typeDefs;
260 }
261 
262 public void setTypeDefs(Map<String, TypeDef> typeDefs) {
263 	this.typeDefs = typeDefs;
264 }
265 
266 
267 
268 }