FileDocCategorySizeDatePackage
ApplicationClientDDObjectFactory.javaAPI DocJBoss 4.2.16419Fri Jul 13 20:53:58 BST 2007org.jboss.ejb3.metamodel

ApplicationClientDDObjectFactory

public class ApplicationClientDDObjectFactory extends org.jboss.metamodel.descriptor.DDObjectFactory
A JBossXB object factory for parsing application client descriptor files. http://java.sun.com/xml/ns/javaee/application-client_5.xsd
author
Carlo de Wolf
version
$Revision: $

Fields Summary
private static final Logger
log
Constructors Summary
public ApplicationClientDDObjectFactory()


   // made public for the parsing deployer
    
   

   
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)

      parent.addEjbRef(ref);
   
public voidaddChild(ApplicationClientDD parent, org.jboss.metamodel.descriptor.EnvEntry entry, org.jboss.xb.binding.UnmarshallingContext navigator, java.lang.String namespaceURI, java.lang.String localName)
Called when parsing character is complete.

      parent.addEnvEntry(entry);
   
public voidaddChild(ApplicationClientDD parent, LifecycleCallback lifecycleCallback, org.jboss.xb.binding.UnmarshallingContext navigator, java.lang.String namespaceURI, java.lang.String localName)

      if (localName.equals("post-construct"))
         parent.getPostConstructs().add(lifecycleCallback);
      else if (localName.equals("pre-destroy"))
         parent.getPreDestroys().add(lifecycleCallback);
      else throw new IllegalArgumentException(localName);
   
public java.lang.ObjectcompleteRoot(java.lang.Object root, org.jboss.xb.binding.UnmarshallingContext ctx, java.lang.String uri, java.lang.String name)

      throw new RuntimeException("NYI");
   
public java.lang.ObjectnewChild(ApplicationClientDD parent, org.jboss.xb.binding.UnmarshallingContext navigator, java.lang.String namespaceURI, java.lang.String localName, org.xml.sax.Attributes attrs)

      Object child = super.newEnvRefGroupChild(localName);
      if (child != null)
         return child;

      if (localName.equals("post-construct") || localName.equals("pre-destroy"))
      {
         child = new LifecycleCallback();
      }

      // ignore things like display-name & description

      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)

      final ApplicationClientDD dd;
      if (root == null)
         root = dd = new ApplicationClientDD();
      else dd = (ApplicationClientDD)root;

      if (attrs.getLength() > 0)
      {
         for (int i = 0; i < attrs.getLength(); ++i)
         {
            if (attrs.getLocalName(i).equals("version"))
            {
               dd.setVersion(attrs.getValue(i));
            }
            else if (attrs.getLocalName(i).equals("metadata-complete"))
            {
               dd.setMetadataComplete(Boolean.parseBoolean(attrs.getValue(i)));
            }
            else if (attrs.getLocalName(i).equals("schemaLocation"))
            {
               // ignore
            }
            else if (attrs.getLocalName(i).equals("id"))
            {
               // ignore
            }
            else throw new IllegalArgumentException(attrs.getLocalName(i));
         }
      }

      return root;
   
public static ApplicationClientDDparse(java.net.URL ddResource)

      if (ddResource == null)
         return null;

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

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

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

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

      if (localName.equals("lifecycle-callback-class"))
         lifecycleCallback.setLifecycleCallbackClass(value);
      else if (localName.equals("lifecycle-callback-method"))
         lifecycleCallback.setLifecycleCallbackMethod(value);
      else throw new IllegalArgumentException(localName);
   
public voidsetValue(ApplicationClientDD dd, org.jboss.xb.binding.UnmarshallingContext navigator, java.lang.String namespaceURI, java.lang.String localName, java.lang.String value)
Called when a child element with simple content is read for DD.

      if (localName.equals("display-name"))
      {
         dd.setDisplayName(getValue(localName, value));
      }
      //      else if(localName.equals("description"))
      //      {
      //         // ignore
      //      }
      //      else
      //         throw new IllegalArgumentException(localName);