001: /*
002: * JBoss, Home of Professional Open Source.
003: * Copyright 2006, Red Hat Middleware LLC, and individual contributors
004: * as indicated by the @author tags. See the copyright.txt file in the
005: * distribution for a full listing of individual contributors.
006: *
007: * This is free software; you can redistribute it and/or modify it
008: * under the terms of the GNU Lesser General Public License as
009: * published by the Free Software Foundation; either version 2.1 of
010: * the License, or (at your option) any later version.
011: *
012: * This software is distributed in the hope that it will be useful,
013: * but WITHOUT ANY WARRANTY; without even the implied warranty of
014: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
015: * Lesser General Public License for more details.
016: *
017: * You should have received a copy of the GNU Lesser General Public
018: * License along with this software; if not, write to the Free
019: * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
020: * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
021: */
022: package org.jboss.resource.deployment;
023:
024: import org.jboss.logging.Logger;
025: import org.jboss.resource.metadata.AdminObjectMetaData;
026: import org.jboss.resource.metadata.AuthenticationMechanismMetaData;
027: import org.jboss.resource.metadata.ConfigPropertyMetaData;
028: import org.jboss.resource.metadata.ConnectionDefinitionMetaData;
029: import org.jboss.resource.metadata.ConnectorMetaData;
030: import org.jboss.resource.metadata.DescriptionGroupMetaData;
031: import org.jboss.resource.metadata.DescriptionMetaData;
032: import org.jboss.resource.metadata.LicenseMetaData;
033: import org.jboss.resource.metadata.MessageListenerMetaData;
034: import org.jboss.resource.metadata.RequiredConfigPropertyMetaData;
035: import org.jboss.resource.metadata.SecurityPermissionMetaData;
036: import org.jboss.resource.metadata.TransactionSupportMetaData;
037: import org.jboss.xb.binding.ObjectModelFactory;
038: import org.jboss.xb.binding.UnmarshallingContext;
039: import org.xml.sax.Attributes;
040:
041: /**
042: * Object factory for resource adapter metadata
043: *
044: * @author <a href="mailto:adrian@jboss.com">Adrian Brock</a>
045: * @version $Revision: 57189 $
046: */
047: public class ResourceAdapterObjectModelFactory implements
048: ObjectModelFactory {
049: /** The logger */
050: private static final Logger log = Logger
051: .getLogger(ResourceAdapterObjectModelFactory.class);
052:
053: /** Trace enabled */
054: private boolean trace = log.isTraceEnabled();
055:
056: /**
057: * connector child elements
058: *
059: * @param cmd the connector meta data
060: * @param navigator the content navigator
061: * @param namespaceURI the namespace of the element
062: * @param localName the local name of the element
063: * @param attrs the attributes
064: */
065: public Object newChild(ConnectorMetaData cmd,
066: UnmarshallingContext navigator, String namespaceURI,
067: String localName, Attributes attrs) {
068: if (trace)
069: log.trace("connector newChild: nuri=" + namespaceURI
070: + " localName=" + localName + " attrs=" + attrs);
071:
072: if (localName.equals("vendor-name")
073: || localName.equals("eis-type")
074: || localName.equals("resourceadapter-version")
075: || (localName.equals("resourceadapter") && cmd
076: .getVersion().equals("1.0") == false)
077: || localName.equals("resourceadapter-class")
078: || localName.equals("reauthentication-support")) {
079: return null;
080: } else if (localName.equals("description")
081: || localName.equals("display-name")
082: || localName.equals("small-icon")
083: || localName.equals("large-icon")) {
084: String language = attrs.getValue("xml:lang");
085: DescriptionGroupMetaData dmd = null;
086: if (language == null)
087: dmd = cmd.getDescription();
088: else
089: dmd = cmd.getDescription(language);
090: if (dmd == null)
091: dmd = new DescriptionGroupMetaData(language);
092: cmd.addDescription(dmd);
093: return dmd;
094: } else if (localName.equals("icon")
095: && cmd.getVersion().equals("1.0")) {
096: return null;
097: } else if (localName.equals("config-property")) {
098: ConfigPropertyMetaData cpmd = new ConfigPropertyMetaData();
099: cmd.addProperty(cpmd);
100: return cpmd;
101: } else if (localName.equals("license")) {
102: return cmd.getLicense();
103: } else if (localName.equals("outbound-resourceadapter")) {
104: return null;
105: } else if (localName.equals("connection-definition")
106: || (localName.equals("resourceadapter") && cmd
107: .getVersion().equals("1.0"))) {
108: ConnectionDefinitionMetaData cdmd = new ConnectionDefinitionMetaData(
109: cmd);
110: cmd.addConnectionDefinition(cdmd);
111: return cdmd;
112: } else if (localName.equals("transaction-support")) {
113: TransactionSupportMetaData tsmd = new TransactionSupportMetaData();
114: cmd.setTransactionSupport(tsmd);
115: return tsmd;
116: } else if (localName.equals("authentication-mechanism")) {
117: AuthenticationMechanismMetaData ammd = new AuthenticationMechanismMetaData();
118: cmd.setAuthenticationMechansim(ammd);
119: return ammd;
120: } else if (localName.equals("inbound-resourceadapter")
121: || localName.equals("messageadapter")) {
122: return null;
123: } else if (localName.equals("messagelistener")) {
124: MessageListenerMetaData mlmd = new MessageListenerMetaData();
125: cmd.addMessageListener(mlmd);
126: return mlmd;
127: } else if (localName.equals("adminobject")) {
128: AdminObjectMetaData aomd = new AdminObjectMetaData();
129: cmd.addAdminObject(aomd);
130: return aomd;
131: } else if (localName.equals("security-permission")) {
132: SecurityPermissionMetaData spmd = new SecurityPermissionMetaData();
133: cmd.addSecurityPermission(spmd);
134: return spmd;
135: }
136: // 1.0
137: else if (localName.equals("spec-version")
138: || localName.equals("version")) {
139: return null;
140: }
141: throw new IllegalArgumentException(
142: "Unknown connector newChild: nuri=" + namespaceURI
143: + " localName=" + localName + " attrs=" + attrs);
144: }
145:
146: /**
147: * connector elements
148: *
149: * @param cmd the connector meta data
150: * @param navigator the content navigator
151: * @param namespaceURI the namespace of the element
152: * @param localName the local name of the element
153: * @param value the value
154: */
155: public void setValue(ConnectorMetaData cmd,
156: UnmarshallingContext navigator, String namespaceURI,
157: String localName, String value) {
158: if (trace)
159: log.trace("connector setValue: nuri=" + namespaceURI
160: + " localName=" + localName + " value=" + value);
161: if (localName.equals("connector")
162: || localName.equals("resourceadapter")
163: || localName.equals("outbound-resourceadapter")
164: || localName.equals("inbound-resourceadapter")
165: || localName.equals("messageadapter")) {
166: } else if (localName.equals("vendor-name"))
167: cmd.setVendorName(value);
168: else if (localName.equals("eis-type"))
169: cmd.setEISType(value);
170: else if (localName.equals("resourceadapter-version"))
171: cmd.setRAVersion(value);
172: else if (localName.equals("resourceadapter-class"))
173: cmd.setRAClass(value);
174: else if (localName.equals("reauthentication-support"))
175: cmd.setReauthenticationSupport(Boolean.valueOf(value)
176: .booleanValue());
177: // 1.0
178: else if (localName.equals("spec-version"))
179: cmd.setVersion(value);
180: else if (localName.equals("version"))
181: cmd.setRAVersion(value);
182: else
183: throw new IllegalArgumentException(
184: "Unknown connector setValue: nuri=" + namespaceURI
185: + " localName=" + localName + " value="
186: + value);
187: }
188:
189: /**
190: * description group elements
191: *
192: * @param dmd the description meta data
193: * @param navigator the content navigator
194: * @param namespaceURI the namespace of the element
195: * @param localName the local name of the element
196: * @param value the value
197: */
198: public void setValue(DescriptionGroupMetaData dmd,
199: UnmarshallingContext navigator, String namespaceURI,
200: String localName, String value) {
201: if (trace)
202: log.trace("description group setValue: nuri="
203: + namespaceURI + " localName=" + localName
204: + " value=" + value);
205: if (localName.equals("description"))
206: dmd.setDescription(value);
207: else if (localName.equals("display-name"))
208: dmd.setDisplayName(value);
209: else if (localName.equals("small-icon"))
210: dmd.setSmallIcon(value);
211: else if (localName.equals("large-icon"))
212: dmd.setLargeIcon(value);
213: else
214: throw new IllegalArgumentException(
215: "Unknown description group setValue: nuri="
216: + namespaceURI + " localName=" + localName
217: + " value=" + value);
218: }
219:
220: /**
221: * description elements
222: *
223: * @param dmd the description meta data
224: * @param navigator the content navigator
225: * @param namespaceURI the namespace of the element
226: * @param localName the local name of the element
227: * @param value the value
228: */
229: public void setValue(DescriptionMetaData dmd,
230: UnmarshallingContext navigator, String namespaceURI,
231: String localName, String value) {
232: if (trace)
233: log.trace("description setValue: nuri=" + namespaceURI
234: + " localName=" + localName + " value=" + value);
235: if (localName.equals("description"))
236: dmd.setDescription(value);
237: else
238: throw new IllegalArgumentException(
239: "Unknown description setValue: nuri="
240: + namespaceURI + " localName=" + localName
241: + " value=" + value);
242: }
243:
244: /**
245: * config property child elements
246: *
247: * @param cpmd the config property meta data
248: * @param navigator the content navigator
249: * @param namespaceURI the namespace of the element
250: * @param localName the local name of the element
251: * @param attrs the attributes
252: */
253: public Object newChild(ConfigPropertyMetaData cpmd,
254: UnmarshallingContext navigator, String namespaceURI,
255: String localName, Attributes attrs) {
256: if (trace)
257: log.trace("config property newChild: nuri=" + namespaceURI
258: + " localName=" + localName + " attrs=" + attrs);
259: if (localName.equals("config-property-name")
260: || localName.equals("config-property-type")
261: || localName.equals("config-property-value")) {
262: return null;
263: } else if (localName.equals("description")) {
264: String language = attrs.getValue("xml:lang");
265: DescriptionMetaData dmd = null;
266: if (language == null)
267: dmd = cpmd.getDescription();
268: else
269: dmd = cpmd.getDescription(language);
270: if (dmd == null)
271: dmd = new DescriptionMetaData(language);
272: cpmd.addDescription(dmd);
273: return dmd;
274: }
275:
276: throw new IllegalArgumentException(
277: "Unknown config property newChild: nuri="
278: + namespaceURI + " localName=" + localName
279: + " 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,
292: UnmarshallingContext navigator, String namespaceURI,
293: String localName, String value) {
294: if (trace)
295: log.trace("config property setValue: nuri=" + namespaceURI
296: + " localName=" + localName + " value=" + value);
297: if (localName.equals("config-property")) {
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(
306: "Unknown config property setValue: nuri="
307: + namespaceURI + " localName=" + localName
308: + " value=" + value);
309: }
310:
311: /**
312: * license child elements
313: *
314: * @param lmd the license meta data
315: * @param navigator the content navigator
316: * @param namespaceURI the namespace of the element
317: * @param localName the local name of the element
318: * @param attrs the attributes
319: */
320: public Object newChild(LicenseMetaData lmd,
321: UnmarshallingContext navigator, String namespaceURI,
322: String localName, Attributes attrs) {
323: if (trace)
324: log.trace("license newChild: nuri=" + namespaceURI
325: + " localName=" + localName + " attrs=" + attrs);
326: if (localName.equals("license")) {
327: return null;
328: } else if (localName.equals("license-required")) {
329: return null;
330: } else if (localName.equals("description")) {
331: String 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(
344: "Unknown license newChild: nuri=" + namespaceURI
345: + " localName=" + localName + " attrs=" + attrs);
346: }
347:
348: /**
349: * license elements
350: *
351: * @param lmd the license meta data
352: * @param navigator the content navigator
353: * @param namespaceURI the namespace of the element
354: * @param localName the local name of the element
355: * @param value the value
356: */
357: public void setValue(LicenseMetaData lmd,
358: UnmarshallingContext navigator, String namespaceURI,
359: String localName, String value) {
360: if (trace)
361: log.trace("license setValue: nuri=" + namespaceURI
362: + " localName=" + localName + " value=" + value);
363: if (localName.equals("license")) {
364: } else if (localName.equals("license-required"))
365: lmd.setRequired(Boolean.valueOf(value).booleanValue());
366: else
367: throw new IllegalArgumentException(
368: "Unknown license setValue: nuri=" + namespaceURI
369: + " localName=" + localName + " value="
370: + value);
371: }
372:
373: /**
374: * connection definition child elements
375: *
376: * @param cdmd the message listener meta data
377: * @param navigator the content navigator
378: * @param namespaceURI the namespace of the element
379: * @param localName the local name of the element
380: * @param attrs the attributes
381: */
382: public Object newChild(ConnectionDefinitionMetaData cdmd,
383: UnmarshallingContext navigator, String namespaceURI,
384: String localName, Attributes attrs) {
385: if (trace)
386: log.trace("connection definition newChild: nuri="
387: + namespaceURI + " localName=" + localName
388: + " attrs=" + attrs);
389: if (localName.equals("connection-definition")
390: || localName.equals("managedconnectionfactory-class")
391: || localName.equals("connectionfactory-interface")
392: || localName.equals("connectionfactory-impl-class")
393: || localName.equals("connection-interface")
394: || localName.equals("connection-impl-class")) {
395: return null;
396: } else if (localName.equals("config-property")) {
397: ConfigPropertyMetaData cpmd = new ConfigPropertyMetaData();
398: cdmd.addProperty(cpmd);
399: return cpmd;
400: }
401: // 1.0
402: else if (localName.equals("transaction-support")) {
403: TransactionSupportMetaData tsmd = new TransactionSupportMetaData();
404: cdmd.getConnector().setTransactionSupport(tsmd);
405: return tsmd;
406: } else if (localName.equals("authentication-mechanism")) {
407: AuthenticationMechanismMetaData ammd = new AuthenticationMechanismMetaData();
408: cdmd.getConnector().setAuthenticationMechansim(ammd);
409: return ammd;
410: } else if (localName.equals("security-permission")) {
411: SecurityPermissionMetaData spmd = new SecurityPermissionMetaData();
412: cdmd.getConnector().addSecurityPermission(spmd);
413: return spmd;
414: } else if (localName.equals("reauthentication-support")) {
415: return null;
416: }
417:
418: throw new IllegalArgumentException(
419: "Unknown connection definition newChild: nuri="
420: + namespaceURI + " localName=" + localName
421: + " attrs=" + attrs);
422: }
423:
424: /**
425: * connection definition elements
426: *
427: * @param cdmd the description meta data
428: * @param navigator the content navigator
429: * @param namespaceURI the namespace of the element
430: * @param localName the local name of the element
431: * @param value the value
432: */
433: public void setValue(ConnectionDefinitionMetaData cdmd,
434: UnmarshallingContext navigator, String namespaceURI,
435: String localName, String value) {
436: if (trace)
437: log.trace("connection definition setValue: nuri="
438: + namespaceURI + " localName=" + localName
439: + " value=" + value);
440: if (localName.equals("connection-definition")) {
441: } else if (localName.equals("managedconnectionfactory-class"))
442: cdmd.setManagedConnectionFactoryClass(value);
443: else if (localName.equals("connectionfactory-interface"))
444: cdmd.setConnectionFactoryInterfaceClass(value);
445: else if (localName.equals("connectionfactory-impl-class"))
446: cdmd.setConnectionFactoryImplementationClass(value);
447: else if (localName.equals("connection-interface"))
448: cdmd.setConnectionInterfaceClass(value);
449: else if (localName.equals("connection-impl-class"))
450: cdmd.setConnectionImplementationClass(value);
451: // 1.0
452: else if (localName.equals("reauthentication-support"))
453: cdmd.getConnector().setReauthenticationSupport(
454: Boolean.valueOf(value).booleanValue());
455: else
456: throw new IllegalArgumentException(
457: "Unknown connection definition setValue: nuri="
458: + namespaceURI + " localName=" + localName
459: + " value=" + value);
460: }
461:
462: /**
463: * transaction support child elements
464: *
465: * @param tsmd the transaction support meta data
466: * @param navigator the content navigator
467: * @param namespaceURI the namespace of the element
468: * @param localName the local name of the element
469: * @param attrs the attributes
470: */
471: public Object newChild(TransactionSupportMetaData tsmd,
472: UnmarshallingContext navigator, String namespaceURI,
473: String localName, Attributes attrs) {
474: if (trace)
475: log.trace("transaction support newChild: nuri="
476: + namespaceURI + " localName=" + localName
477: + " attrs=" + attrs);
478: if (localName.equals("transaction-support"))
479: return null;
480: throw new IllegalArgumentException(
481: "Unknown transaction support newChild: nuri="
482: + namespaceURI + " localName=" + localName
483: + " attrs=" + attrs);
484: }
485:
486: /**
487: * transaction support elements
488: *
489: * @param tsmd the transaction support meta data
490: * @param navigator the content navigator
491: * @param namespaceURI the namespace of the element
492: * @param localName the local name of the element
493: * @param value the value
494: */
495: public void setValue(TransactionSupportMetaData tsmd,
496: UnmarshallingContext navigator, String namespaceURI,
497: String localName, String value) {
498: if (trace)
499: log.trace("transaction support setValue: nuri="
500: + namespaceURI + " localName=" + localName
501: + " value=" + value);
502: if (localName.equals("transaction-support")
503: && value.equals("NoTransaction"))
504: tsmd
505: .setTransactionSupport(TransactionSupportMetaData.NoTransaction);
506: else if (localName.equals("transaction-support")
507: && value.equals("LocalTransaction"))
508: tsmd
509: .setTransactionSupport(TransactionSupportMetaData.LocalTransaction);
510: else if (localName.equals("transaction-support")
511: && value.equals("XATransaction"))
512: tsmd
513: .setTransactionSupport(TransactionSupportMetaData.XATransaction);
514: else
515: throw new IllegalArgumentException(
516: "Unknown transaction support setValue: nuri="
517: + namespaceURI + " localName=" + localName
518: + " value=" + value);
519: }
520:
521: /**
522: * authentication mechanism child elements
523: *
524: * @param ammd the authentication mechanism meta data
525: * @param navigator the content navigator
526: * @param namespaceURI the namespace of the element
527: * @param localName the local name of the element
528: * @param attrs the attributes
529: */
530: public Object newChild(AuthenticationMechanismMetaData ammd,
531: UnmarshallingContext navigator, String namespaceURI,
532: String localName, Attributes attrs) {
533: if (trace)
534: log.trace("authentication mechanism newChild: nuri="
535: + namespaceURI + " localName=" + localName
536: + " attrs=" + attrs);
537: if (localName.equals("authentication-mechanism")
538: || localName.equals("authentication-mechanism-type")
539: || localName.equals("credential-interface")) {
540: return null;
541: } else if (localName.equals("description")) {
542: String language = attrs.getValue("xml:lang");
543: DescriptionMetaData dmd = null;
544: if (language == null)
545: dmd = ammd.getDescription();
546: else
547: dmd = ammd.getDescription(language);
548: if (dmd == null)
549: dmd = new DescriptionMetaData(language);
550: ammd.addDescription(dmd);
551: return dmd;
552: }
553:
554: throw new IllegalArgumentException(
555: "Unknown authentication mechanism newChild: nuri="
556: + namespaceURI + " localName=" + localName
557: + " attrs=" + attrs);
558: }
559:
560: /**
561: * authentication mechanism elements
562: *
563: * @param ammd the authentication mechanism meta data
564: * @param navigator the content navigator
565: * @param namespaceURI the namespace of the element
566: * @param localName the local name of the element
567: * @param value the value
568: */
569: public void setValue(AuthenticationMechanismMetaData ammd,
570: UnmarshallingContext navigator, String namespaceURI,
571: String localName, String value) {
572: if (trace)
573: log.trace("authentication mechanism setValue: nuri="
574: + namespaceURI + " localName=" + localName
575: + " value=" + value);
576: if (localName.equals("authentication-mechanism")) {
577: } else if (localName.equals("authentication-mechanism-type"))
578: ammd.setAuthenticationMechansimType(value);
579: else if (localName.equals("credential-interface"))
580: ammd.setCredentialInterfaceClass(value);
581: else
582: throw new IllegalArgumentException(
583: "Unknown authentication mechanism setValue: nuri="
584: + namespaceURI + " localName=" + localName
585: + " value=" + value);
586: }
587:
588: /**
589: * message listener child elements
590: *
591: * @param mlmd the message listener meta data
592: * @param navigator the content navigator
593: * @param namespaceURI the namespace of the element
594: * @param localName the local name of the element
595: * @param attrs the attributes
596: */
597: public Object newChild(MessageListenerMetaData mlmd,
598: UnmarshallingContext navigator, String namespaceURI,
599: String localName, Attributes attrs) {
600: if (trace)
601: log.trace("message listener newChild: nuri=" + namespaceURI
602: + " localName=" + localName + " attrs=" + attrs);
603: if (localName.equals("messagelistener-type")
604: || localName.equals("activationspec")
605: || localName.equals("activationspec-class")) {
606: return null;
607: } else if (localName.equals("required-config-property")) {
608: RequiredConfigPropertyMetaData rcpmd = new RequiredConfigPropertyMetaData();
609: mlmd.addRequiredConfigProperty(rcpmd);
610: return rcpmd;
611: }
612:
613: throw new IllegalArgumentException(
614: "Unknown message listener newChild: nuri="
615: + namespaceURI + " localName=" + localName
616: + " attrs=" + attrs);
617: }
618:
619: /**
620: * message listener elements
621: *
622: * @param mlmd the description meta data
623: * @param navigator the content navigator
624: * @param namespaceURI the namespace of the element
625: * @param localName the local name of the element
626: * @param value the value
627: */
628: public void setValue(MessageListenerMetaData mlmd,
629: UnmarshallingContext navigator, String namespaceURI,
630: String localName, String value) {
631: if (trace)
632: log.trace("message listener setValue: nuri=" + namespaceURI
633: + " localName=" + localName + " value=" + value);
634: if (localName.equals("messagelistener")
635: || localName.equals("activationspec")) {
636: } else if (localName.equals("messagelistener-type"))
637: mlmd.setType(value);
638: else if (localName.equals("activationspec-class"))
639: mlmd.setActivationSpecType(value);
640: else
641: throw new IllegalArgumentException(
642: "Unknown mesasge listener setValue: nuri="
643: + namespaceURI + " localName=" + localName
644: + " value=" + value);
645: }
646:
647: /**
648: * admin object child elements
649: *
650: * @param aomd the admin object meta data
651: * @param navigator the content navigator
652: * @param namespaceURI the namespace of the element
653: * @param localName the local name of the element
654: * @param attrs the attributes
655: */
656: public Object newChild(AdminObjectMetaData aomd,
657: UnmarshallingContext navigator, String namespaceURI,
658: String localName, Attributes attrs) {
659: if (trace)
660: log.trace("admin object newChild: nuri=" + namespaceURI
661: + " localName=" + localName + " attrs=" + attrs);
662: if (localName.equals("adminobject")
663: || localName.equals("adminobject-interface")
664: || localName.equals("adminobject-class")) {
665: return null;
666: } else if (localName.equals("config-property")) {
667: ConfigPropertyMetaData cpmd = new ConfigPropertyMetaData();
668: aomd.addProperty(cpmd);
669: return cpmd;
670: }
671:
672: throw new IllegalArgumentException(
673: "Unknown admin object newChild: nuri=" + namespaceURI
674: + " localName=" + localName + " attrs=" + attrs);
675: }
676:
677: /**
678: * admin object definition elements
679: *
680: * @param aomd the admin object meta data
681: * @param navigator the content navigator
682: * @param namespaceURI the namespace of the element
683: * @param localName the local name of the element
684: * @param value the value
685: */
686: public void setValue(AdminObjectMetaData aomd,
687: UnmarshallingContext navigator, String namespaceURI,
688: String localName, String value) {
689: if (trace)
690: log.trace("admin object setValue: nuri=" + namespaceURI
691: + " localName=" + localName + " value=" + value);
692: if (localName.equals("adminobject")) {
693: } else if (localName.equals("adminobject-interface"))
694: aomd.setAdminObjectInterfaceClass(value);
695: else if (localName.equals("adminobject-class"))
696: aomd.setAdminObjectImplementationClass(value);
697: else
698: throw new IllegalArgumentException(
699: "Unknown admin object setValue: nuri="
700: + namespaceURI + " localName=" + localName
701: + " value=" + value);
702: }
703:
704: /**
705: * security permission child elements
706: *
707: * @param spmd the security permission meta data
708: * @param navigator the content navigator
709: * @param namespaceURI the namespace of the element
710: * @param localName the local name of the element
711: * @param attrs the attributes
712: */
713: public Object newChild(SecurityPermissionMetaData spmd,
714: UnmarshallingContext navigator, String namespaceURI,
715: String localName, Attributes attrs) {
716: if (trace)
717: log.trace("security permission newChild: nuri="
718: + namespaceURI + " localName=" + localName
719: + " attrs=" + attrs);
720: if (localName.equals("security-permission")
721: || localName.equals("security-permission-spec")) {
722: return null;
723: } else if (localName.equals("description")) {
724: String language = attrs.getValue("xml:lang");
725: DescriptionMetaData dmd = null;
726: if (language == null)
727: dmd = spmd.getDescription();
728: else
729: dmd = spmd.getDescription(language);
730: if (dmd == null)
731: dmd = new DescriptionMetaData(language);
732: spmd.addDescription(dmd);
733: return dmd;
734: }
735:
736: throw new IllegalArgumentException(
737: "Unknown security permission newChild: nuri="
738: + namespaceURI + " localName=" + localName
739: + " attrs=" + attrs);
740: }
741:
742: /**
743: * security permission elements
744: *
745: * @param spmd the security permission meta data
746: * @param navigator the content navigator
747: * @param namespaceURI the namespace of the element
748: * @param localName the local name of the element
749: * @param value the value
750: */
751: public void setValue(SecurityPermissionMetaData spmd,
752: UnmarshallingContext navigator, String namespaceURI,
753: String localName, String value) {
754: if (trace)
755: log.trace("security permission setValue: nuri="
756: + namespaceURI + " localName=" + localName
757: + " value=" + value);
758: if (localName.equals("security-permission")) {
759: } else if (localName.equals("security-permission-spec"))
760: spmd.setSecurityPermissionSpec(value);
761: else
762: throw new IllegalArgumentException(
763: "Unknown security permission setValue: nuri="
764: + namespaceURI + " localName=" + localName
765: + " value=" + value);
766: }
767:
768: /**
769: * required config property child elements
770: *
771: * @param rcpmd the config property meta data
772: * @param navigator the content navigator
773: * @param namespaceURI the namespace of the element
774: * @param localName the local name of the element
775: * @param attrs the attributes
776: */
777: public Object newChild(RequiredConfigPropertyMetaData rcpmd,
778: UnmarshallingContext navigator, String namespaceURI,
779: String localName, Attributes attrs) {
780: if (trace)
781: log.trace("required config property newChild: nuri="
782: + namespaceURI + " localName=" + localName
783: + " attrs=" + attrs);
784: if (localName.equals("config-property-name")) {
785: return null;
786: } else if (localName.equals("description")) {
787: String language = attrs.getValue("xml:lang");
788: DescriptionMetaData dmd = null;
789: if (language == null)
790: dmd = rcpmd.getDescription();
791: else
792: dmd = rcpmd.getDescription(language);
793: if (dmd == null)
794: dmd = new DescriptionMetaData(language);
795: rcpmd.addDescription(dmd);
796: return dmd;
797: }
798:
799: throw new IllegalArgumentException(
800: "Unknown required config property newChild: nuri="
801: + namespaceURI + " localName=" + localName
802: + " attrs=" + attrs);
803: }
804:
805: /**
806: * required config property elements
807: *
808: * @param rcpmd the required config property meta data
809: * @param navigator the content navigator
810: * @param namespaceURI the namespace of the element
811: * @param localName the local name of the element
812: * @param value the value
813: */
814: public void setValue(RequiredConfigPropertyMetaData rcpmd,
815: UnmarshallingContext navigator, String namespaceURI,
816: String localName, String value) {
817: if (trace)
818: log.trace("required config property setValue: nuri="
819: + namespaceURI + " localName=" + localName
820: + " value=" + value);
821: if (localName.equals("required-config-property")) {
822: } else if (localName.equals("config-property-name"))
823: rcpmd.setName(value);
824: else
825: throw new IllegalArgumentException(
826: "Unknown required config property setValue: nuri="
827: + namespaceURI + " localName=" + localName
828: + " value=" + value);
829: }
830:
831: public Object newRoot(Object root, UnmarshallingContext navigator,
832: String namespaceURI, String localName, Attributes attrs) {
833: if (!localName.equals("connector")) {
834: throw new IllegalStateException(
835: "Unexpected root element: was expecting 'connector' but got '"
836: + localName + "'");
837: }
838:
839: final ConnectorMetaData cmd = new ConnectorMetaData();
840: String version = attrs.getValue("version");
841: if (version != null) {
842: cmd.setVersion(version);
843: }
844: return cmd;
845: }
846:
847: public Object completeRoot(Object root, UnmarshallingContext ctx,
848: String uri, String name) {
849: return root;
850: }
851: }
|