Package org.jboss.xb.binding

Examples of org.jboss.xb.binding.Unmarshaller


   {
      boolean trace = log.isTraceEnabled();

      if (trace)
         log.trace("Parsing " + deploymentName);
      Unmarshaller unmarshaller = factory.newUnmarshaller();
      KernelDeployment deployment = (KernelDeployment) unmarshaller.unmarshal(stream, resolver);
      if (deployment == null)
         throw new RuntimeException("The deployment " + deploymentName + " is not well formed!");
      deployment.setName(deploymentName);

      deploy(deployment);
View Full Code Here


      TwoLifecycleMethodsBean.annotatedPostConstructRan = false;
      TwoLifecycleMethodsBean.otherPostConstructRan = false;
     
      // Bootstrap metadata
      UnmarshallerFactory unmarshallerFactory = UnmarshallerFactory.newInstance();
      Unmarshaller unmarshaller = unmarshallerFactory.newUnmarshaller();
      URL url = Thread.currentThread().getContextClassLoader().getResource("metadatacomplete/META-INF/ejb-jar.xml");
      assertNotNull("Can't find descriptor metadatacomplete/META-INF/ejb-jar.xml", url);
      EjbJar30MetaData metaData = (EjbJar30MetaData) unmarshaller.unmarshal(url.toString(), schemaResolverForClass(EjbJar30MetaData.class));
      JBoss50MetaData jbossMetaData = new JBoss50MetaData();
      jbossMetaData.merge(null, metaData);
     
      beanMetaData = jbossMetaData.getEnterpriseBean("TwoLifecycleMethodsBean");
      assertNotNull(beanMetaData);  
View Full Code Here

   @Before
   public void before() throws Exception
   {
      // Bootstrap metadata
      UnmarshallerFactory unmarshallerFactory = UnmarshallerFactory.newInstance();
      Unmarshaller unmarshaller = unmarshallerFactory.newUnmarshaller();
      URL url = Thread.currentThread().getContextClassLoader().getResource("ejbthree1595/META-INF/ejb-jar.xml");
      assertNotNull("Can't find descriptor ejbthree1595/META-INF/ejb-jar.xml", url);
      EjbJar30MetaData metaData = (EjbJar30MetaData) unmarshaller.unmarshal(url.toString(), schemaResolverForClass(EjbJar30MetaData.class));
      JBoss50MetaData jbossMetaData = new JBoss50MetaData();
      jbossMetaData.merge(null, metaData);
     
      beanMetaData = jbossMetaData.getEnterpriseBean("XMLOnlySLSB");
      assertNotNull(beanMetaData);  
View Full Code Here

               if (jbossStructure != null)
               {
                  log.trace("... context has a META-INF/jboss-structure.xml");
                  URL url = jbossStructure.toURL();
                  UnmarshallerFactory factory = UnmarshallerFactory.newInstance();
                  Unmarshaller unmarshaller = factory.newUnmarshaller();
                  StructureMetaDataObjectFactory ofactory = new StructureMetaDataObjectFactory();
                  unmarshaller.unmarshal(url.toString(), ofactory, metaData);
                  isJBossStructure = true;
               }
            }
            catch (IOException e)
            {
View Full Code Here

      ObjectName objectName = new ObjectName(objectNameS);

      // Parse main server.xml
      // FIXME: this could be done somewhere else
      SchemaBinding schema = JBossXBBuilder.build(ServerMetaData.class);
      Unmarshaller u = UnmarshallerFactory.newInstance().newUnmarshaller();
      u.setSchemaValidation(false);
      u.setValidation(false);
      u.setEntityResolver(new JBossEntityResolver());
      InputStream is = null;
      ServerMetaData serverMetaData = null;
      try {
         File configFile = new File(tomcatDeployer.getConfigFile());
         if (configFile.exists())
         {
            is = new FileInputStream(configFile);
         }
         else
         {
            is = getClass().getClassLoader().getResourceAsStream(tomcatDeployer.getConfigFile());
         }
         if (is == null) {
            log.error("Could not read configured server.xml (will try default): " + tomcatDeployer.getConfigFile());
            is = getClass().getClassLoader().getResourceAsStream("server.xml");
         }
         serverMetaData = ServerMetaData.class.cast(u.unmarshal(is, schema));
      } finally {
         if (is != null) {
            try {
               is.close();
            } catch (IOException e) {
View Full Code Here

   {
      ContextMetaData contextMetaData = null;
      try
      {
         SchemaBinding schema = JBossXBBuilder.build(ContextMetaData.class);
         Unmarshaller u = UnmarshallerFactory.newInstance().newUnmarshaller();
         u.setSchemaValidation(false);
         u.setValidation(false);
         u.setEntityResolver(new JBossEntityResolver());
        
         InputStream is = null;
         try
         {
            if (local)
            {
               DeploymentUnit localUnit = deploymentUnitLocal.get();
               if (localUnit instanceof VFSDeploymentUnit)
               {
                  VFSDeploymentUnit vfsUnit = (VFSDeploymentUnit)localUnit;
                  VirtualFile vf = vfsUnit.getFile(resourceName);
                  if (vf != null)
                     is = vf.openStream();
               }
            }

            if (is == null)
               is = getClass().getClassLoader().getResourceAsStream(resourceName);

            if (is != null)
               contextMetaData = ContextMetaData.class.cast(u.unmarshal(is, schema));
         }
         finally
         {
            if (is != null)
            {
View Full Code Here

   public void start() throws Exception
   {
      super.start();

      // Parse shared web.xml
      Unmarshaller unmarshaller = factory.newUnmarshaller();
      URL webXml = this.getClass().getClassLoader().getResource("web.xml");
      if (webXml == null)
      {
         webXml = this.getClass().getClassLoader().getResource("conf/web.xml");
      }
      if (webXml == null)
         throw new IllegalStateException("Unable to find shared web.xml or conf/web.xml");

      SchemaBinding schema = JBossXBBuilder.build(Web25MetaData.class);
      Web25MetaData confWebMD = (Web25MetaData) unmarshaller.unmarshal(webXml.toString(), schema);
      sharedMetaData = new JBoss50WebMetaData();
      sharedMetaData.merge(null, confWebMD);
   }
View Full Code Here

                  if (trace)
                     log.trace("... context has a META-INF/jboss-structure.xml");

                  URL url = jbossStructure.toURL();
                  UnmarshallerFactory factory = UnmarshallerFactory.newInstance();
                  Unmarshaller unmarshaller = factory.newUnmarshaller();
                  StructureMetaDataObjectFactory ofactory = new StructureMetaDataObjectFactory();
                  unmarshaller.unmarshal(url.toString(), ofactory, structureContext.getMetaData());
                  mountChildren(structureContext);
                  isJBossStructure = true;
               }
            }
            catch (IOException e)
View Full Code Here

      {
         log.trace("Parsing " + url);
      }
      long start = System.currentTimeMillis();

      Unmarshaller unmarshaller = factory.newUnmarshaller();
      KernelDeployment deployment = null;
      try
      {
         deployment = (KernelDeployment) unmarshaller.unmarshal(url.toString(), resolver);
      }
      catch (Exception e)
      {
         throw new RuntimeException("Failed to parse xml " + url, e);
      }
View Full Code Here

         {
            throw new RuntimeException("Couldn't open default XML WSRP Consumer configuration file", e);
         }
      }

      Unmarshaller unmarshaller = UnmarshallerFactory.newInstance().newUnmarshaller();
      ObjectModelFactory factory = new XMLWSRPConsumerFactory(this);
      if (entityResolver == null)
      {
         log.debug("Could not obtain entity resolver for XMLConsumerRegistry");
         entityResolver = new NullEntityResolver();
      }
      try
      {
         unmarshaller.setEntityResolver(entityResolver);
         initConsumers((SortedMap<String, WSRPConsumer>)unmarshaller.unmarshal(configurationIS, factory, null));
      }
      catch (JBossXBException e)
      {
         throw new RuntimeException("Couldn't unmarshall WSRP Consumers configuration", e);
      }
View Full Code Here

TOP

Related Classes of org.jboss.xb.binding.Unmarshaller

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.