FileDocCategorySizeDatePackage
JBossClientDDObjectFactory.javaAPI DocJBoss 4.2.15113Fri Jul 13 20:53:56 BST 2007org.jboss.ejb3.metamodel

JBossClientDDObjectFactory

public class JBossClientDDObjectFactory extends org.jboss.metamodel.descriptor.DDObjectFactory
A JBossXB object factory for parsing JBoss application client descriptor files. http://www.jboss.org/j2ee/dtd/jboss-client_5_0.dtd
author
Carlo de Wolf
version
$Revision: $

Fields Summary
private static final Logger
log
private ApplicationClientDD
dd
Constructors Summary
public JBossClientDDObjectFactory(ApplicationClientDD dd)

      // JBossXB will otherwise fail later on
      if (dd == null)
         throw new NullPointerException("dd is null");

      this.dd = dd;
   
Methods Summary
public voidaddChild(ApplicationClientDD parent, org.jboss.metamodel.descriptor.EjbRef ref, org.jboss.xb.binding.UnmarshallingContext navigator, java.lang.String namespaceURI, java.lang.String localName)

      dd.updateEjbRef(ref);
   
public voidaddChild(ApplicationClientDD parent, org.jboss.metamodel.descriptor.MessageDestinationRef ref, org.jboss.xb.binding.UnmarshallingContext navigator, java.lang.String namespaceURI, java.lang.String localName)

      dd.updateMessageDestinationRef(ref);
   
public voidaddChild(ApplicationClientDD parent, org.jboss.ws.integration.ServiceRefMetaData ref, org.jboss.xb.binding.UnmarshallingContext navigator, java.lang.String namespaceURI, java.lang.String localName)

      dd.addServiceRef(ref);
   
public voidaddChild(ApplicationClientDD dd, org.jboss.metamodel.descriptor.ResourceEnvRef envRef, org.jboss.xb.binding.UnmarshallingContext navigator, java.lang.String namespaceURI, java.lang.String localName)

      dd.updateResourceEnvRef(envRef);
   
public voidaddChild(ApplicationClientDD parent, org.jboss.metamodel.descriptor.ResourceRef ref, org.jboss.xb.binding.UnmarshallingContext navigator, java.lang.String namespaceURI, java.lang.String localName)

      dd.updateResourceRef(ref);
   
public java.lang.ObjectcompleteRoot(java.lang.Object root, org.jboss.xb.binding.UnmarshallingContext navigator, java.lang.String uri, java.lang.String name)

      return root;
   
public java.lang.ObjectnewChild(ApplicationClientDD dd, org.jboss.xb.binding.UnmarshallingContext navigator, java.lang.String namespaceURI, java.lang.String localName, org.xml.sax.Attributes attrs)

      Object child = null;

      child = newEnvRefGroupChild(localName);
      if (child != null)
         return child;

      // space for more

      return child;
   
public java.lang.ObjectnewRoot(java.lang.Object root, org.jboss.xb.binding.UnmarshallingContext navigator, java.lang.String namespaceURI, java.lang.String localName, org.xml.sax.Attributes attrs)

      return dd;
   
public static ApplicationClientDDparse(java.net.URL ddResource, ApplicationClientDD dd)


            
   
      // TODO: how to properly fix this
      if (dd == null)
         dd = new ApplicationClientDD();

      if (ddResource == null)
         return dd;

      log.debug("found jboss-client.xml " + ddResource);

      JBossClientDDObjectFactory factory = new JBossClientDDObjectFactory(dd);
      UnmarshallerFactory unmarshallerFactory = UnmarshallerFactory.newInstance();
      Unmarshaller unmarshaller = unmarshallerFactory.newUnmarshaller();
      unmarshaller.setEntityResolver(new JBossEntityResolver());
      unmarshaller.setNamespaceAware(true);
      unmarshaller.setSchemaValidation(true);
      unmarshaller.setValidation(true);

      dd = (ApplicationClientDD)unmarshaller.unmarshal(ddResource.openStream(), factory, null);

      return dd;
   
public voidsetValue(ApplicationClientDD dd, org.jboss.xb.binding.UnmarshallingContext navigator, java.lang.String namespaceURI, java.lang.String localName, java.lang.String value)

      if (localName.equals("jndi-name"))
         dd.setJndiName(value);
      else if (localName.equals("depends"))
         dd.addDependency(value);