KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jboss > resource > deployment > ResourceAdapterObjectModelFactory


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.resource.deployment;
23
24 import org.jboss.logging.Logger;
25 import org.jboss.resource.metadata.AdminObjectMetaData;
26 import org.jboss.resource.metadata.AuthenticationMechanismMetaData;
27 import org.jboss.resource.metadata.ConfigPropertyMetaData;
28 import org.jboss.resource.metadata.ConnectionDefinitionMetaData;
29 import org.jboss.resource.metadata.ConnectorMetaData;
30 import org.jboss.resource.metadata.DescriptionGroupMetaData;
31 import org.jboss.resource.metadata.DescriptionMetaData;
32 import org.jboss.resource.metadata.LicenseMetaData;
33 import org.jboss.resource.metadata.MessageListenerMetaData;
34 import org.jboss.resource.metadata.RequiredConfigPropertyMetaData;
35 import org.jboss.resource.metadata.SecurityPermissionMetaData;
36 import org.jboss.resource.metadata.TransactionSupportMetaData;
37 import org.jboss.xb.binding.ObjectModelFactory;
38 import org.jboss.xb.binding.UnmarshallingContext;
39 import org.xml.sax.Attributes JavaDoc;
40
41 /**
42  * Object factory for resource adapter metadata
43  *
44  * @author <a HREF="mailto:adrian@jboss.com">Adrian Brock</a>
45  * @version $Revision: 38341 $
46  */

47 public class ResourceAdapterObjectModelFactory implements ObjectModelFactory
48 {
49    /** The logger */
50    private static final Logger log = Logger.getLogger(ResourceAdapterObjectModelFactory.class);
51    
52    /** Trace enabled */
53    private boolean trace = log.isTraceEnabled();
54
55    /**
56     * connector child elements
57     *
58     * @param cmd the connector meta data
59     * @param navigator the content navigator
60     * @param namespaceURI the namespace of the element
61     * @param localName the local name of the element
62     * @param attrs the attributes
63     */

64    public Object JavaDoc newChild(ConnectorMetaData cmd, UnmarshallingContext navigator, String JavaDoc namespaceURI, String JavaDoc localName, Attributes JavaDoc attrs)
65    {
66       if (trace)
67          log.trace("connector newChild: nuri=" + namespaceURI + " localName=" + localName + " attrs=" + attrs);
68
69       if (localName.equals("vendor-name") ||
70             localName.equals("eis-type") ||
71             localName.equals("resourceadapter-version") ||
72             (localName.equals("resourceadapter") && cmd.getVersion().equals("1.0") == false) ||
73             localName.equals("resourceadapter-class") ||
74             localName.equals("reauthentication-support"))
75       {
76          return null;
77       }
78       else if (localName.equals("description") ||
79                localName.equals("display-name") ||
80                localName.equals("small-icon") ||
81                localName.equals("large-icon"))
82       {
83          String JavaDoc language = attrs.getValue("xml:lang");
84          DescriptionGroupMetaData dmd = null;
85          if (language == null)
86             dmd = cmd.getDescription();
87          else
88             dmd = cmd.getDescription(language);
89          if (dmd == null)
90             dmd = new DescriptionGroupMetaData(language);
91          cmd.addDescription(dmd);
92          return dmd;
93       }
94       else if (localName.equals("icon") && cmd.getVersion().equals("1.0"))
95       {
96          return null;
97       }
98       else if (localName.equals("config-property"))
99       {
100          ConfigPropertyMetaData cpmd = new ConfigPropertyMetaData();
101          cmd.addProperty(cpmd);
102          return cpmd;
103       }
104       else if (localName.equals("license"))
105       {
106          return cmd.getLicense();
107       }
108       else if (localName.equals("outbound-resourceadapter"))
109       {
110          return null;
111       }
112       else if (localName.equals("connection-definition") ||
113                (localName.equals("resourceadapter") && cmd.getVersion().equals("1.0")))
114       {
115          ConnectionDefinitionMetaData cdmd = new ConnectionDefinitionMetaData(cmd);
116          cmd.addConnectionDefinition(cdmd);
117          return cdmd;
118       }
119       else if (localName.equals("transaction-support"))
120       {
121          TransactionSupportMetaData tsmd = new TransactionSupportMetaData();
122          cmd.setTransactionSupport(tsmd);
123          return tsmd;
124       }
125       else if (localName.equals("authentication-mechanism"))
126       {
127          AuthenticationMechanismMetaData ammd = new AuthenticationMechanismMetaData();
128          cmd.setAuthenticationMechansim(ammd);
129          return ammd;
130       }
131       else if (localName.equals("inbound-resourceadapter") ||
132                localName.equals("messageadapter"))
133       {
134          return null;
135       }
136       else if (localName.equals("messagelistener"))
137       {
138          MessageListenerMetaData mlmd = new MessageListenerMetaData();
139          cmd.addMessageListener(mlmd);
140          return mlmd;
141       }
142       else if (localName.equals("adminobject"))
143       {
144          AdminObjectMetaData aomd = new AdminObjectMetaData();
145          cmd.addAdminObject(aomd);
146          return aomd;
147       }
148       else if (localName.equals("security-permission"))
149       {
150          SecurityPermissionMetaData spmd = new SecurityPermissionMetaData();
151          cmd.addSecurityPermission(spmd);
152          return spmd;
153       }
154       // 1.0
155
else if (localName.equals("spec-version") ||
156                localName.equals("version"))
157       {
158          return null;
159       }
160       throw new IllegalArgumentException JavaDoc("Unknown connector newChild: nuri=" +namespaceURI + " localName=" + localName + " attrs=" + attrs);
161    }
162
163    /**
164     * connector elements
165     *
166     * @param cmd the connector meta data
167     * @param navigator the content navigator
168     * @param namespaceURI the namespace of the element
169     * @param localName the local name of the element
170     * @param value the value
171     */

172    public void setValue(ConnectorMetaData cmd, UnmarshallingContext navigator, String JavaDoc namespaceURI, String JavaDoc localName, String JavaDoc value)
173    {
174       if (trace)
175          log.trace("connector setValue: nuri=" + namespaceURI + " localName=" + localName + " value=" + value);
176       if (localName.equals("connector") ||
177           localName.equals("resourceadapter") ||
178           localName.equals("outbound-resourceadapter") ||
179           localName.equals("inbound-resourceadapter") ||
180           localName.equals("messageadapter"))
181       {
182       }
183       else if (localName.equals("vendor-name"))
184          cmd.setVendorName(value);
185       else if (localName.equals("eis-type"))
186          cmd.setEISType(value);
187       else if (localName.equals("resourceadapter-version"))
188          cmd.setRAVersion(value);
189       else if (localName.equals("resourceadapter-class"))
190          cmd.setRAClass(value);
191       else if (localName.equals("reauthentication-support"))
192          cmd.setReauthenticationSupport(Boolean.valueOf(value).booleanValue());
193       // 1.0
194
else if (localName.equals("spec-version"))
195          cmd.setVersion(value);
196       else if (localName.equals("version"))
197          cmd.setRAVersion(value);
198       else
199          throw new IllegalArgumentException JavaDoc("Unknown connector setValue: nuri=" + namespaceURI + " localName=" + localName + " value=" + value);
200    }
201
202    /**
203     * description group elements
204     *
205     * @param dmd the description meta data
206     * @param navigator the content navigator
207     * @param namespaceURI the namespace of the element
208     * @param localName the local name of the element
209     * @param value the value
210     */

211    public void setValue(DescriptionGroupMetaData dmd, UnmarshallingContext navigator, String JavaDoc namespaceURI, String JavaDoc localName, String JavaDoc value)
212    {
213       if (trace)
214          log.trace("description group setValue: nuri=" + namespaceURI + " localName=" + localName + " value=" + value);
215       if (localName.equals("description"))
216          dmd.setDescription(value);
217       else if (localName.equals("display-name"))
218          dmd.setDisplayName(value);
219       else if (localName.equals("small-icon"))
220          dmd.setSmallIcon(value);
221       else if (localName.equals("large-icon"))
222          dmd.setLargeIcon(value);
223       else
224          throw new IllegalArgumentException JavaDoc("Unknown description group setValue: nuri=" + namespaceURI + " localName=" + localName + " value=" + value);
225    }
226
227    /**
228     * description elements
229     *
230     * @param dmd the description meta data
231     * @param navigator the content navigator
232     * @param namespaceURI the namespace of the element
233     * @param localName the local name of the element
234     * @param value the value
235     */

236    public void setValue(DescriptionMetaData dmd, UnmarshallingContext navigator, String JavaDoc namespaceURI, String JavaDoc localName, String JavaDoc value)
237    {
238       if (trace)
239          log.trace("description setValue: nuri=" + namespaceURI + " localName=" + localName + " value=" + value);
240       if (localName.equals("description"))
241          dmd.setDescription(value);
242       else
243          throw new IllegalArgumentException JavaDoc("Unknown description setValue: nuri=" + namespaceURI + " localName=" + localName + " value=" + value);
244    }
245
246    /**
247     * config property child elements
248     *
249     * @param cpmd the config property meta data
250     * @param navigator the content navigator
251     * @param namespaceURI the namespace of the element
252     * @param localName the local name of the element
253     * @param attrs the attributes
254     */

255    public Object JavaDoc newChild(ConfigPropertyMetaData cpmd, UnmarshallingContext navigator, String JavaDoc namespaceURI, String JavaDoc localName, Attributes JavaDoc attrs)
256    {
257       if (trace)
258          log.trace("config property newChild: nuri=" + namespaceURI + " localName=" + localName + " attrs=" + attrs);
259       if (localName.equals("config-property-name") ||
260           localName.equals("config-property-type") ||
261           localName.equals("config-property-value"))
262       {
263          return null;
264       }
265       else if (localName.equals("description"))
266       {
267          String JavaDoc language = attrs.getValue("xml:lang");
268          DescriptionMetaData dmd = null;
269          if (language == null)
270             dmd = cpmd.getDescription();
271          else
272             dmd = cpmd.getDescription(language);
273          if (dmd == null)
274             dmd = new DescriptionMetaData(language);
275          cpmd.addDescription(dmd);
276          return dmd;
277       }
278       
279       throw new IllegalArgumentException JavaDoc("Unknown config property newChild: nuri=" +namespaceURI + " localName=" + localName + " attrs=" + attrs);
280    }
281
282    /**
283     * config property elements
284     *
285     * @param cpmd the description meta data
286     * @param navigator the content navigator
287     * @param namespaceURI the namespace of the element
288     * @param localName the local name of the element
289     * @param value the value
290     */

291    public void setValue(ConfigPropertyMetaData cpmd, UnmarshallingContext navigator, String JavaDoc namespaceURI, String JavaDoc localName, String JavaDoc value)
292    {
293       if (trace)
294          log.trace("config property setValue: nuri=" + namespaceURI + " localName=" + localName + " value=" + value);
295       if (localName.equals("config-property"))
296       {
297       }
298       else if (localName.equals("config-property-name"))
299          cpmd.setName(value);
300       else if (localName.equals("config-property-type"))
301          cpmd.setType(value);
302       else if (localName.equals("config-property-value"))
303          cpmd.setValue(value);
304       else
305          throw new IllegalArgumentException JavaDoc("Unknown config property setValue: nuri=" + namespaceURI + " localName=" + localName + " value=" + value);
306    }
307
308    /**
309     * license child elements
310     *
311     * @param lmd the license meta data
312     * @param navigator the content navigator
313     * @param namespaceURI the namespace of the element
314     * @param localName the local name of the element
315     * @param attrs the attributes
316     */

317    public Object JavaDoc newChild(LicenseMetaData lmd, UnmarshallingContext navigator, String JavaDoc namespaceURI, String JavaDoc localName, Attributes JavaDoc attrs)
318    {
319       if (trace)
320          log.trace("license newChild: nuri=" + namespaceURI + " localName=" + localName + " attrs=" + attrs);
321       if (localName.equals("license"))
322       {
323          return null;
324       }
325       else if (localName.equals("license-required"))
326       {
327          return null;
328       }
329       else if (localName.equals("description"))
330       {
331          String JavaDoc language = attrs.getValue("xml:lang");
332          DescriptionMetaData dmd = null;
333          if (language == null)
334             dmd = lmd.getDescription();
335          else
336             dmd = lmd.getDescription(language);
337          if (dmd == null)
338             dmd = new DescriptionMetaData(language);
339          lmd.addDescription(dmd);
340          return dmd;
341       }
342       
343       throw new IllegalArgumentException JavaDoc("Unknown license newChild: nuri=" +namespaceURI + " localName=" + localName + " attrs=" + attrs);
344    }
345
346    /**
347     * license elements
348     *
349     * @param lmd the license meta data
350     * @param navigator the content navigator
351     * @param namespaceURI the namespace of the element
352     * @param localName the local name of the element
353     * @param value the value
354     */

355    public void setValue(LicenseMetaData lmd, UnmarshallingContext navigator, String JavaDoc namespaceURI, String JavaDoc localName, String JavaDoc value)
356    {
357       if (trace)
358          log.trace("license setValue: nuri=" + namespaceURI + " localName=" + localName + " value=" + value);
359       if (localName.equals("license"))
360       {
361       }
362       else if (localName.equals("license-required"))
363          lmd.setRequired(Boolean.valueOf(value).booleanValue());
364       else
365          throw new IllegalArgumentException JavaDoc("Unknown license setValue: nuri=" + namespaceURI + " localName=" + localName + " value=" + value);
366    }
367
368    /**
369     * connection definition child elements
370     *
371     * @param cdmd the message listener meta data
372     * @param navigator the content navigator
373     * @param namespaceURI the namespace of the element
374     * @param localName the local name of the element
375     * @param attrs the attributes
376     */

377    public Object JavaDoc newChild(ConnectionDefinitionMetaData cdmd, UnmarshallingContext navigator, String JavaDoc namespaceURI, String JavaDoc localName, Attributes JavaDoc attrs)
378    {
379       if (trace)
380          log.trace("connection definition newChild: nuri=" + namespaceURI + " localName=" + localName + " attrs=" + attrs);
381       if (localName.equals("connection-definition") ||
382           localName.equals("managedconnectionfactory-class") ||
383           localName.equals("connectionfactory-interface") ||
384           localName.equals("connectionfactory-impl-class") ||
385           localName.equals("connection-interface") ||
386           localName.equals("connection-impl-class"))
387       {
388          return null;
389       }
390       else if (localName.equals("config-property"))
391       {
392          ConfigPropertyMetaData cpmd = new ConfigPropertyMetaData();
393          cdmd.addProperty(cpmd);
394          return cpmd;
395       }
396       // 1.0
397
else if (localName.equals("transaction-support"))
398       {
399          TransactionSupportMetaData tsmd = new TransactionSupportMetaData();
400          cdmd.getConnector().setTransactionSupport(tsmd);
401          return tsmd;
402       }
403       else if (localName.equals("authentication-mechanism"))
404       {
405          AuthenticationMechanismMetaData ammd = new AuthenticationMechanismMetaData();
406          cdmd.getConnector().setAuthenticationMechansim(ammd);
407          return ammd;
408       }
409       else if (localName.equals("security-permission"))
410       {
411          SecurityPermissionMetaData spmd = new SecurityPermissionMetaData();
412          cdmd.getConnector().addSecurityPermission(spmd);
413          return spmd;
414       }
415       else if (localName.equals("reauthentication-support"))
416       {
417          return null;
418       }
419       
420       throw new IllegalArgumentException JavaDoc("Unknown connection definition newChild: nuri=" +namespaceURI + " localName=" + localName + " attrs=" + attrs);
421    }
422
423    /**
424     * connection definition elements
425     *
426     * @param cdmd the description meta data
427     * @param navigator the content navigator
428     * @param namespaceURI the namespace of the element
429     * @param localName the local name of the element
430     * @param value the value
431     */

432    public void setValue(ConnectionDefinitionMetaData cdmd, UnmarshallingContext navigator, String JavaDoc namespaceURI, String JavaDoc localName, String JavaDoc value)
433    {
434       if (trace)
435          log.trace("connection definition setValue: nuri=" + namespaceURI + " localName=" + localName + " value=" + value);
436       if (localName.equals("connection-definition"))
437       {
438       }
439       else if (localName.equals("managedconnectionfactory-class"))
440          cdmd.setManagedConnectionFactoryClass(value);
441       else if (localName.equals("connectionfactory-interface"))
442          cdmd.setConnectionFactoryInterfaceClass(value);
443       else if (localName.equals("connectionfactory-impl-class"))
444          cdmd.setConnectionFactoryImplementationClass(value);
445       else if (localName.equals("connection-interface"))
446          cdmd.setConnectionInterfaceClass(value);
447       else if (localName.equals("connection-impl-class"))
448          cdmd.setConnectionImplementationClass(value);
449       // 1.0
450
else if (localName.equals("reauthentication-support"))
451          cdmd.getConnector().setReauthenticationSupport(Boolean.valueOf(value).booleanValue());
452       else
453          throw new IllegalArgumentException JavaDoc("Unknown connection definition setValue: nuri=" + namespaceURI + " localName=" + localName + " value=" + value);
454    }
455
456    /**
457     * transaction support child elements
458     *
459     * @param tsmd the transaction support meta data
460     * @param navigator the content navigator
461     * @param namespaceURI the namespace of the element
462     * @param localName the local name of the element
463     * @param attrs the attributes
464     */

465    public Object JavaDoc newChild(TransactionSupportMetaData tsmd, UnmarshallingContext navigator, String JavaDoc namespaceURI, String JavaDoc localName, Attributes JavaDoc attrs)
466    {
467       if (trace)
468          log.trace("transaction support newChild: nuri=" + namespaceURI + " localName=" + localName + " attrs=" + attrs);
469       if (localName.equals("transaction-support"))
470          return null;
471       throw new IllegalArgumentException JavaDoc("Unknown transaction support newChild: nuri=" +namespaceURI + " localName=" + localName + " attrs=" + attrs);
472    }
473
474    /**
475     * transaction support elements
476     *
477     * @param tsmd the transaction support meta data
478     * @param navigator the content navigator
479     * @param namespaceURI the namespace of the element
480     * @param localName the local name of the element
481     * @param value the value
482     */

483    public void setValue(TransactionSupportMetaData tsmd, UnmarshallingContext navigator, String JavaDoc namespaceURI, String JavaDoc localName, String JavaDoc value)
484    {
485       if (trace)
486          log.trace("transaction support setValue: nuri=" + namespaceURI + " localName=" + localName + " value=" + value);
487       if (localName.equals("transaction-support") && value.equals("NoTransaction"))
488          tsmd.setTransactionSupport(TransactionSupportMetaData.NoTransaction);
489       else if (localName.equals("transaction-support") && value.equals("LocalTransaction"))
490          tsmd.setTransactionSupport(TransactionSupportMetaData.LocalTransaction);
491       else if (localName.equals("transaction-support") && value.equals("XATransaction"))
492          tsmd.setTransactionSupport(TransactionSupportMetaData.XATransaction);
493       else
494          throw new IllegalArgumentException JavaDoc("Unknown transaction support setValue: nuri=" + namespaceURI + " localName=" + localName + " value=" + value);
495    }
496
497    /**
498     * authentication mechanism child elements
499     *
500     * @param ammd the authentication mechanism meta data
501     * @param navigator the content navigator
502     * @param namespaceURI the namespace of the element
503     * @param localName the local name of the element
504     * @param attrs the attributes
505     */

506    public Object JavaDoc newChild(AuthenticationMechanismMetaData ammd, UnmarshallingContext navigator, String JavaDoc namespaceURI, String JavaDoc localName, Attributes JavaDoc attrs)
507    {
508       if (trace)
509          log.trace("authentication mechanism newChild: nuri=" + namespaceURI + " localName=" + localName + " attrs=" + attrs);
510       if (localName.equals("authentication-mechanism") ||
511           localName.equals("authentication-mechanism-type") ||
512           localName.equals("credential-interface"))
513       {
514          return null;
515       }
516       else if (localName.equals("description"))
517       {
518          String JavaDoc language = attrs.getValue("xml:lang");
519          DescriptionMetaData dmd = null;
520          if (language == null)
521             dmd = ammd.getDescription();
522          else
523             dmd = ammd.getDescription(language);
524          if (dmd == null)
525             dmd = new DescriptionMetaData(language);
526          ammd.addDescription(dmd);
527          return dmd;
528       }
529       
530       throw new IllegalArgumentException JavaDoc("Unknown authentication mechanism newChild: nuri=" +namespaceURI + " localName=" + localName + " attrs=" + attrs);
531    }
532
533    /**
534     * authentication mechanism elements
535     *
536     * @param ammd the authentication mechanism meta data
537     * @param navigator the content navigator
538     * @param namespaceURI the namespace of the element
539     * @param localName the local name of the element
540     * @param value the value
541     */

542    public void setValue(AuthenticationMechanismMetaData ammd, UnmarshallingContext navigator, String JavaDoc namespaceURI, String JavaDoc localName, String JavaDoc value)
543    {
544       if (trace)
545          log.trace("authentication mechanism setValue: nuri=" + namespaceURI + " localName=" + localName + " value=" + value);
546       if (localName.equals("authentication-mechanism"))
547       {
548       }
549       else if (localName.equals("authentication-mechanism-type"))
550          ammd.setAuthenticationMechansimType(value);
551       else if (localName.equals("credential-interface"))
552          ammd.setCredentialInterfaceClass(value);
553       else
554          throw new IllegalArgumentException JavaDoc("Unknown authentication mechanism setValue: nuri=" + namespaceURI + " localName=" + localName + " value=" + value);
555    }
556
557    /**
558     * message listener child elements
559     *
560     * @param mlmd the message listener meta data
561     * @param navigator the content navigator
562     * @param namespaceURI the namespace of the element
563     * @param localName the local name of the element
564     * @param attrs the attributes
565     */

566    public Object JavaDoc newChild(MessageListenerMetaData mlmd, UnmarshallingContext navigator, String JavaDoc namespaceURI, String JavaDoc localName, Attributes JavaDoc attrs)
567    {
568       if (trace)
569          log.trace("message listener newChild: nuri=" + namespaceURI + " localName=" + localName + " attrs=" + attrs);
570       if (localName.equals("messagelistener-type") ||
571           localName.equals("activationspec") ||
572           localName.equals("activationspec-class"))
573       {
574          return null;
575       }
576       else if (localName.equals("required-config-property"))
577       {
578          RequiredConfigPropertyMetaData rcpmd = new RequiredConfigPropertyMetaData();
579          mlmd.addRequiredConfigProperty(rcpmd);
580          return rcpmd;
581       }
582       
583       throw new IllegalArgumentException JavaDoc("Unknown message listener newChild: nuri=" +namespaceURI + " localName=" + localName + " attrs=" + attrs);
584    }
585
586    /**
587     * message listener elements
588     *
589     * @param mlmd the description meta data
590     * @param navigator the content navigator
591     * @param namespaceURI the namespace of the element
592     * @param localName the local name of the element
593     * @param value the value
594     */

595    public void setValue(MessageListenerMetaData mlmd, UnmarshallingContext navigator, String JavaDoc namespaceURI, String JavaDoc localName, String JavaDoc value)
596    {
597       if (trace)
598          log.trace("message listener setValue: nuri=" + namespaceURI + " localName=" + localName + " value=" + value);
599       if (localName.equals("messagelistener") ||
600           localName.equals("activationspec"))
601       {
602       }
603       else if (localName.equals("messagelistener-type"))
604          mlmd.setType(value);
605       else if (localName.equals("activationspec-class"))
606          mlmd.setActivationSpecType(value);
607       else
608          throw new IllegalArgumentException JavaDoc("Unknown mesasge listener setValue: nuri=" + namespaceURI + " localName=" + localName + " value=" + value);
609    }
610
611    /**
612     * admin object child elements
613     *
614     * @param aomd the admin object meta data
615     * @param navigator the content navigator
616     * @param namespaceURI the namespace of the element
617     * @param localName the local name of the element
618     * @param attrs the attributes
619     */

620    public Object JavaDoc newChild(AdminObjectMetaData aomd, UnmarshallingContext navigator, String JavaDoc namespaceURI, String JavaDoc localName, Attributes JavaDoc attrs)
621    {
622       if (trace)
623          log.trace("admin object newChild: nuri=" + namespaceURI + " localName=" + localName + " attrs=" + attrs);
624       if (localName.equals("adminobject") ||
625           localName.equals("adminobject-interface") ||
626           localName.equals("adminobject-class"))
627       {
628          return null;
629       }
630       else if (localName.equals("config-property"))
631       {
632          ConfigPropertyMetaData cpmd = new ConfigPropertyMetaData();
633          aomd.addProperty(cpmd);
634          return cpmd;
635       }
636       
637       throw new IllegalArgumentException JavaDoc("Unknown admin object newChild: nuri=" +namespaceURI + " localName=" + localName + " attrs=" + attrs);
638    }
639
640    /**
641     * admin object definition elements
642     *
643     * @param aomd the admin object meta data
644     * @param navigator the content navigator
645     * @param namespaceURI the namespace of the element
646     * @param localName the local name of the element
647     * @param value the value
648     */

649    public void setValue(AdminObjectMetaData aomd, UnmarshallingContext navigator, String JavaDoc namespaceURI, String JavaDoc localName, String JavaDoc value)
650    {
651       if (trace)
652          log.trace("admin object setValue: nuri=" + namespaceURI + " localName=" + localName + " value=" + value);
653       if (localName.equals("adminobject"))
654       {
655       }
656       else if (localName.equals("adminobject-interface"))
657          aomd.setAdminObjectInterfaceClass(value);
658       else if (localName.equals("adminobject-class"))
659          aomd.setAdminObjectImplementationClass(value);
660       else
661          throw new IllegalArgumentException JavaDoc("Unknown admin object setValue: nuri=" + namespaceURI + " localName=" + localName + " value=" + value);
662    }
663
664    /**
665     * security permission child elements
666     *
667     * @param spmd the security permission meta data
668     * @param navigator the content navigator
669     * @param namespaceURI the namespace of the element
670     * @param localName the local name of the element
671     * @param attrs the attributes
672     */

673    public Object JavaDoc newChild(SecurityPermissionMetaData spmd, UnmarshallingContext navigator, String JavaDoc namespaceURI, String JavaDoc localName, Attributes JavaDoc attrs)
674    {
675       if (trace)
676          log.trace("security permission newChild: nuri=" + namespaceURI + " localName=" + localName + " attrs=" + attrs);
677       if (localName.equals("security-permission") ||
678           localName.equals("security-permission-spec"))
679       {
680          return null;
681       }
682       else if (localName.equals("description"))
683       {
684          String JavaDoc language = attrs.getValue("xml:lang");
685          DescriptionMetaData dmd = null;
686          if (language == null)
687             dmd = spmd.getDescription();
688          else
689             dmd = spmd.getDescription(language);
690          if (dmd == null)
691             dmd = new DescriptionMetaData(language);
692          spmd.addDescription(dmd);
693          return dmd;
694       }
695       
696       throw new IllegalArgumentException JavaDoc("Unknown security permission newChild: nuri=" +namespaceURI + " localName=" + localName + " attrs=" + attrs);
697    }
698
699    /**
700     * security permission elements
701     *
702     * @param spmd the security permission meta data
703     * @param navigator the content navigator
704     * @param namespaceURI the namespace of the element
705     * @param localName the local name of the element
706     * @param value the value
707     */

708    public void setValue(SecurityPermissionMetaData spmd, UnmarshallingContext navigator, String JavaDoc namespaceURI, String JavaDoc localName, String JavaDoc value)
709    {
710       if (trace)
711          log.trace("security permission setValue: nuri=" + namespaceURI + " localName=" + localName + " value=" + value);
712       if (localName.equals("security-permission"))
713       {
714       }
715       else if (localName.equals("security-permission-spec"))
716          spmd.setSecurityPermissionSpec(value);
717       else
718          throw new IllegalArgumentException JavaDoc("Unknown security permission setValue: nuri=" + namespaceURI + " localName=" + localName + " value=" + value);
719    }
720
721    /**
722     * required config property child elements
723     *
724     * @param rcpmd the config property meta data
725     * @param navigator the content navigator
726     * @param namespaceURI the namespace of the element
727     * @param localName the local name of the element
728     * @param attrs the attributes
729     */

730    public Object JavaDoc newChild(RequiredConfigPropertyMetaData rcpmd, UnmarshallingContext navigator, String JavaDoc namespaceURI, String JavaDoc localName, Attributes JavaDoc attrs)
731    {
732       if (trace)
733          log.trace("required config property newChild: nuri=" + namespaceURI + " localName=" + localName + " attrs=" + attrs);
734       if (localName.equals("config-property-name"))
735       {
736          return null;
737       }
738       else if (localName.equals("description"))
739       {
740          String JavaDoc language = attrs.getValue("xml:lang");
741          DescriptionMetaData dmd = null;
742          if (language == null)
743             dmd = rcpmd.getDescription();
744          else
745             dmd = rcpmd.getDescription(language);
746          if (dmd == null)
747             dmd = new DescriptionMetaData(language);
748          rcpmd.addDescription(dmd);
749          return dmd;
750       }
751       
752       throw new IllegalArgumentException JavaDoc("Unknown required config property newChild: nuri=" +namespaceURI + " localName=" + localName + " attrs=" + attrs);
753    }
754
755    /**
756     * required config property elements
757     *
758     * @param rcpmd the required config property meta data
759     * @param navigator the content navigator
760     * @param namespaceURI the namespace of the element
761     * @param localName the local name of the element
762     * @param value the value
763     */

764    public void setValue(RequiredConfigPropertyMetaData rcpmd, UnmarshallingContext navigator, String JavaDoc namespaceURI, String JavaDoc localName, String JavaDoc value)
765    {
766       if (trace)
767          log.trace("required config property setValue: nuri=" + namespaceURI + " localName=" + localName + " value=" + value);
768       if (localName.equals("required-config-property"))
769       {
770       }
771       else if (localName.equals("config-property-name"))
772          rcpmd.setName(value);
773       else
774          throw new IllegalArgumentException JavaDoc("Unknown required config property setValue: nuri=" + namespaceURI + " localName=" + localName + " value=" + value);
775    }
776
777    public Object JavaDoc newRoot(Object JavaDoc root,
778                                UnmarshallingContext navigator,
779                                String JavaDoc namespaceURI,
780                                String JavaDoc localName,
781                                Attributes JavaDoc attrs)
782    {
783       if (!localName.equals("connector"))
784       {
785          throw new IllegalStateException JavaDoc("Unexpected root element: was expecting 'connector' but got '" + localName + "'");
786       }
787
788       final ConnectorMetaData cmd = new ConnectorMetaData();
789       String JavaDoc version = attrs.getValue("version");
790       if (version != null)
791       {
792          cmd.setVersion(version);
793       }
794       return cmd;
795    }
796
797    public Object JavaDoc completeRoot(Object JavaDoc root, UnmarshallingContext ctx, String JavaDoc uri, String JavaDoc name)
798    {
799       return root;
800    }
801 }
802
Popular Tags