KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jboss > kernel > plugins > deployment > xml > BeanSchemaBinding20


1 /*
2 * JBoss, Home of Professional Open Source
3 * Copyright 2005, JBoss Inc., and individual contributors as indicated
4 * by the @authors tag. See the copyright.txt in the distribution for a
5 * full listing of individual contributors.
6 *
7 * This is free software; you can redistribute it and/or modify it
8 * under the terms of the GNU Lesser General Public License as
9 * published by the Free Software Foundation; either version 2.1 of
10 * the License, or (at your option) any later version.
11 *
12 * This software is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
16 *
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with this software; if not, write to the Free
19 * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
20 * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
21 */

22 package org.jboss.kernel.plugins.deployment.xml;
23
24 import javax.xml.namespace.QName JavaDoc;
25
26 import org.jboss.xb.binding.sunday.unmarshalling.SchemaBinding;
27 import org.jboss.xb.binding.sunday.unmarshalling.TypeBinding;
28
29 /**
30  * The POJO schema binding.
31  *
32  * @author <a HREF="mailto:alex@jboss.org">Alexey Loubyansky</a>
33  * @author <a HREF="mailto:adrian@jboss.com">Adrian Brock</a>
34  * @version $Revision: 55828 $
35  */

36 public class BeanSchemaBinding20
37 {
38    /** The namespace */
39    public static final String JavaDoc BEAN_DEPLOYER_NS = "urn:jboss:bean-deployer:2.0";
40
41    /** The deployment binding */
42    public static final QName JavaDoc deploymentTypeQName = new QName JavaDoc(BEAN_DEPLOYER_NS, "deploymentType");
43
44    /** The bean binding */
45    public static final QName JavaDoc beanTypeQName = new QName JavaDoc(BEAN_DEPLOYER_NS, "beanType");
46
47    /** The bean element name */
48    public static final QName JavaDoc beanQName = new QName JavaDoc(BEAN_DEPLOYER_NS, "bean");
49
50    /** The beanfactory binding */
51    public static final QName JavaDoc beanFactoryTypeQName = new QName JavaDoc(BEAN_DEPLOYER_NS, "beanfactoryType");
52
53    /** The beanfactory element name */
54    public static final QName JavaDoc beanFactoryQName = new QName JavaDoc(BEAN_DEPLOYER_NS, "beanfactory");
55
56    /** The annotation binding */
57    public static final QName JavaDoc annotationTypeQName = new QName JavaDoc(BEAN_DEPLOYER_NS, "annotationType");
58
59    /** The annotation element name */
60    public static final QName JavaDoc annotationQName = new QName JavaDoc(BEAN_DEPLOYER_NS, "annotation");
61
62    /** The attribute element name */
63    public static final QName JavaDoc attributeQName = new QName JavaDoc(BEAN_DEPLOYER_NS, "attribute");
64
65    /** The classloader binding */
66    public static final QName JavaDoc classloaderTypeQName = new QName JavaDoc(BEAN_DEPLOYER_NS, "classloaderType");
67
68    /** The classloader element name */
69    public static final QName JavaDoc classloaderQName = new QName JavaDoc(BEAN_DEPLOYER_NS, "classloader");
70
71    /** The constructor binding */
72    public static final QName JavaDoc constructorTypeQName = new QName JavaDoc(BEAN_DEPLOYER_NS, "constructorType");
73
74    /** The constructor element name */
75    public static final QName JavaDoc constructorQName = new QName JavaDoc(BEAN_DEPLOYER_NS, "constructor");
76
77    /** The factory element name */
78    public static final QName JavaDoc factoryQName = new QName JavaDoc(BEAN_DEPLOYER_NS, "factory");
79
80    /** The parameter binding */
81    public static final QName JavaDoc parameterTypeQName = new QName JavaDoc(BEAN_DEPLOYER_NS, "parameterType");
82
83    /** The parameter element name */
84    public static final QName JavaDoc parameterQName = new QName JavaDoc(BEAN_DEPLOYER_NS, "parameter");
85
86    /** The lifecycle binding */
87    public static final QName JavaDoc lifecycleTypeQName = new QName JavaDoc(BEAN_DEPLOYER_NS, "lifecycleType");
88
89    /** The create element name */
90    public static final QName JavaDoc createQName = new QName JavaDoc(BEAN_DEPLOYER_NS, "create");
91
92    /** The start element name */
93    public static final QName JavaDoc startQName = new QName JavaDoc(BEAN_DEPLOYER_NS, "start");
94
95    /** The stop element name */
96    public static final QName JavaDoc stopQName = new QName JavaDoc(BEAN_DEPLOYER_NS, "stop");
97
98    /** The destroy element name */
99    public static final QName JavaDoc destroyQName = new QName JavaDoc(BEAN_DEPLOYER_NS, "destroy");
100
101    /** The install binding */
102    public static final QName JavaDoc installTypeQName = new QName JavaDoc(BEAN_DEPLOYER_NS, "installType");
103
104    /** The install element name */
105    public static final QName JavaDoc installQName = new QName JavaDoc(BEAN_DEPLOYER_NS, "install");
106
107    /** The start element name */
108    public static final QName JavaDoc uninstallQName = new QName JavaDoc(BEAN_DEPLOYER_NS, "uninstall");
109
110    /** The property binding */
111    public static final QName JavaDoc propertyTypeQName = new QName JavaDoc(BEAN_DEPLOYER_NS, "propertyType");
112
113    /** The property element name */
114    public static final QName JavaDoc propertyQName = new QName JavaDoc(BEAN_DEPLOYER_NS, "property");
115
116    /** The depends binding */
117    public static final QName JavaDoc dependsTypeQName = new QName JavaDoc(BEAN_DEPLOYER_NS, "dependsType");
118
119    /** The depends element name */
120    public static final QName JavaDoc dependsQName = new QName JavaDoc(BEAN_DEPLOYER_NS, "depends");
121
122    /** The demand binding */
123    public static final QName JavaDoc demandTypeQName = new QName JavaDoc(BEAN_DEPLOYER_NS, "demandType");
124
125    /** The demand element name */
126    public static final QName JavaDoc demandQName = new QName JavaDoc(BEAN_DEPLOYER_NS, "demand");
127
128    /** The supply binding */
129    public static final QName JavaDoc supplyTypeQName = new QName JavaDoc(BEAN_DEPLOYER_NS, "supplyType");
130
131    /** The supply element name */
132    public static final QName JavaDoc supplyQName = new QName JavaDoc(BEAN_DEPLOYER_NS, "supply");
133
134    /** The dependency binding */
135    public static final QName JavaDoc dependencyTypeQName = new QName JavaDoc(BEAN_DEPLOYER_NS, "dependencyType");
136
137    /** The dependency binding */
138    public static final QName JavaDoc injectionTypeQName = new QName JavaDoc(BEAN_DEPLOYER_NS, "injectionType");
139
140    /** The factory binding */
141    public static final QName JavaDoc factoryTypeQName = new QName JavaDoc(BEAN_DEPLOYER_NS, "factoryType");
142
143    /** The inject element name */
144    public static final QName JavaDoc injectQName = new QName JavaDoc(BEAN_DEPLOYER_NS, "inject");
145
146    /** The plain value binding */
147    public static final QName JavaDoc plainValueTypeQName = new QName JavaDoc(BEAN_DEPLOYER_NS, "plainValueType");
148
149    /** The value binding */
150    public static final QName JavaDoc valueTypeQName = new QName JavaDoc(BEAN_DEPLOYER_NS, "valueType");
151
152    /** The value element name */
153    public static final QName JavaDoc valueQName = new QName JavaDoc(BEAN_DEPLOYER_NS, "value");
154
155    /** The null element name */
156    public static final QName JavaDoc nullQName = new QName JavaDoc(BEAN_DEPLOYER_NS, "null");
157
158    /** The this element name */
159    public static final QName JavaDoc thisQName = new QName JavaDoc(BEAN_DEPLOYER_NS, "this");
160
161    /** The collection binding */
162    public static final QName JavaDoc collectionTypeQName = new QName JavaDoc(BEAN_DEPLOYER_NS, "collectionType");
163
164    /** The collection element name */
165    public static final QName JavaDoc collectionQName = new QName JavaDoc(BEAN_DEPLOYER_NS, "collection");
166
167    /** The list binding */
168    public static final QName JavaDoc listTypeQName = new QName JavaDoc(BEAN_DEPLOYER_NS, "listType");
169
170    /** The list element name */
171    public static final QName JavaDoc listQName = new QName JavaDoc(BEAN_DEPLOYER_NS, "list");
172
173    /** The set binding */
174    public static final QName JavaDoc setTypeQName = new QName JavaDoc(BEAN_DEPLOYER_NS, "setType");
175
176    /** The set element name */
177    public static final QName JavaDoc setQName = new QName JavaDoc(BEAN_DEPLOYER_NS, "set");
178
179    /** The array binding */
180    public static final QName JavaDoc arrayTypeQName = new QName JavaDoc(BEAN_DEPLOYER_NS, "arrayType");
181
182    /** The array element name */
183    public static final QName JavaDoc arrayQName = new QName JavaDoc(BEAN_DEPLOYER_NS, "array");
184
185    /** The map binding */
186    public static final QName JavaDoc mapTypeQName = new QName JavaDoc(BEAN_DEPLOYER_NS, "mapType");
187
188    /** The map element name */
189    public static final QName JavaDoc mapQName = new QName JavaDoc(BEAN_DEPLOYER_NS, "map");
190
191    /** The entry binding */
192    public static final QName JavaDoc entryTypeQName = new QName JavaDoc(BEAN_DEPLOYER_NS, "entryType");
193
194    /** The entry element name */
195    public static final QName JavaDoc entryQName = new QName JavaDoc(BEAN_DEPLOYER_NS, "entry");
196
197    /** The key element name */
198    public static final QName JavaDoc keyQName = new QName JavaDoc(BEAN_DEPLOYER_NS, "key");
199
200    /**
201     * Initialize the schema binding
202     *
203     * @param schemaBinding the schema binding
204     */

205    public static void init(SchemaBinding schemaBinding)
206    {
207       initDeployment(schemaBinding);
208       initBean(schemaBinding);
209       initBeanFactory(schemaBinding);
210       initArtifacts(schemaBinding);
211    }
212
213    /**
214     * Initialize deployment part of the schema binding
215     *
216     * @param schemaBinding the schema binding
217     */

218    public static void initDeployment(SchemaBinding schemaBinding)
219    {
220       // deployment binding
221
TypeBinding deploymentType = schemaBinding.getType(deploymentTypeQName);
222       BeanSchemaBindingHelper.initDeploymentHandlers(deploymentType);
223    }
224
225    /**
226     * Initialize bean part of the schema binding
227     *
228     * @param schemaBinding the schema binding
229     */

230    public static void initBean(SchemaBinding schemaBinding)
231    {
232       // bean binding
233
TypeBinding beanType = schemaBinding.getType(beanTypeQName);
234       BeanSchemaBindingHelper.initBeanHandlers(beanType);
235    }
236
237    /**
238     * Initialize bean factory part of the schema binding
239     *
240     * @param schemaBinding the schema binding
241     */

242    public static void initBeanFactory(SchemaBinding schemaBinding)
243    {
244       // beanfactory binding
245
TypeBinding beanFactoryType = schemaBinding.getType(beanFactoryTypeQName);
246       BeanSchemaBindingHelper.initBeanFactoryHandlers(beanFactoryType);
247    }
248
249    /**
250     * Initialize other parts of the schema binding
251     *
252     * @param schemaBinding the schema binding
253     */

254    public static void initArtifacts(SchemaBinding schemaBinding)
255    {
256       // classloader binding
257
TypeBinding classloaderType = schemaBinding.getType(classloaderTypeQName);
258       BeanSchemaBindingHelper.initClassLoaderHandlers(classloaderType);
259
260       // constructor binding
261
TypeBinding constructorType = schemaBinding.getType(constructorTypeQName);
262       BeanSchemaBindingHelper.initConstructorHandlers(constructorType);
263
264       // parameter binding
265
TypeBinding parameterType = schemaBinding.getType(parameterTypeQName);
266       BeanSchemaBindingHelper.initParameterHandlers(parameterType);
267
268       // lifecycle binding
269
TypeBinding lifecycleType = schemaBinding.getType(lifecycleTypeQName);
270       BeanSchemaBindingHelper.initLifecycleHandlers(lifecycleType);
271
272       // annotation binding
273
TypeBinding annotationType = schemaBinding.getType(annotationTypeQName);
274       BeanSchemaBindingHelper.initAnnotationHandlers(annotationType);
275
276       // install binding
277
TypeBinding installType = schemaBinding.getType(installTypeQName);
278       BeanSchemaBindingHelper.initInstallHandlers(installType);
279
280       // property binding
281
TypeBinding propertyType = schemaBinding.getType(propertyTypeQName);
282       BeanSchemaBindingHelper.initPropertyHandlers(propertyType);
283
284       // dependency binding
285
TypeBinding dependsType = schemaBinding.getType(dependsTypeQName);
286       BeanSchemaBindingHelper.initDependsHandlers(dependsType);
287
288       // demand binding
289
TypeBinding demandType = schemaBinding.getType(demandTypeQName);
290       BeanSchemaBindingHelper.initDemandHandlers(demandType);
291
292       // supply binding
293
TypeBinding supplyType = schemaBinding.getType(supplyTypeQName);
294       BeanSchemaBindingHelper.initSupplyHandlers(supplyType);
295
296       // dependency binding
297
TypeBinding dependencyType = schemaBinding.getType(dependencyTypeQName);
298       BeanSchemaBindingHelper.initDependencyHandlers(dependencyType);
299
300       // injection binding
301
TypeBinding injectionType = schemaBinding.getType(injectionTypeQName);
302       BeanSchemaBindingHelper.initInjectionHandlers(injectionType);
303
304       // factory binding
305
TypeBinding factoryType = schemaBinding.getType(factoryTypeQName);
306       BeanSchemaBindingHelper.initFactoryHandlers(factoryType);
307
308       // value binding
309
TypeBinding plainValueType = schemaBinding.getType(plainValueTypeQName);
310       BeanSchemaBindingHelper.initPlainValueHandlers(plainValueType);
311
312       // value binding
313
TypeBinding valueType = schemaBinding.getType(valueTypeQName);
314       BeanSchemaBindingHelper.initValueHandlers(valueType);
315
316       // collection binding
317
BeanSchemaBindingHelper.configureCollection(schemaBinding, collectionTypeQName);
318
319       // list binding
320
BeanSchemaBindingHelper.configureCollection(schemaBinding, listTypeQName);
321
322       // set binding
323
BeanSchemaBindingHelper.configureCollection(schemaBinding, setTypeQName);
324
325       // array binding
326
BeanSchemaBindingHelper.configureCollection(schemaBinding, arrayTypeQName);
327
328       // map binding
329
TypeBinding mapType = schemaBinding.getType(mapTypeQName);
330       BeanSchemaBindingHelper.initMapHandlers(mapType);
331
332       // entry binding
333
TypeBinding entryType = schemaBinding.getType(entryTypeQName);
334       BeanSchemaBindingHelper.initEntryHandlers(entryType);
335    }
336 }
337
Popular Tags