Package org.jboss.xb.binding

Examples of org.jboss.xb.binding.Unmarshaller


  
   public EjbJar21MetaData getEJBMetaData(InputStream ejbJarXml)
      throws JBossXBException
   {
      UnmarshallerFactory unmarshallerFactory = UnmarshallerFactory.newInstance();
      Unmarshaller unmarshaller = unmarshallerFactory.newUnmarshaller();
      SchemaBinding schema = JBossXBBuilder.build(EjbJar21MetaData.class);
      JBossEntityResolver entityResolver = new JBossEntityResolver();
      unmarshaller.setEntityResolver(entityResolver);

      return (EjbJar21MetaData) unmarshaller.unmarshal(ejbJarXml, schema);
   }
View Full Code Here


  
   public WebMetaData getWebMetaData(InputStream webxml)
      throws JBossXBException
   {
      UnmarshallerFactory unmarshallerFactory = UnmarshallerFactory.newInstance();
      Unmarshaller unmarshaller = unmarshallerFactory.newUnmarshaller();
      SchemaBinding schema = JBossXBBuilder.build(Web24MetaData.class);
      JBossEntityResolver entityResolver = new JBossEntityResolver();
      unmarshaller.setEntityResolver(entityResolver);

      return (WebMetaData) unmarshaller.unmarshal(webxml, schema);
   }
View Full Code Here

   }

   @Override
   protected RepositoryContentMetadata loadMetadata(File metadataStore) throws Exception
   {
      Unmarshaller unmarshaller = UnmarshallerFactory.newInstance().newUnmarshaller();
      return (RepositoryContentMetadata) unmarshaller.unmarshal(metadataStore.toURL().openStream(), resolver);
   }
View Full Code Here

   {
      // get the XML stream
      InputStream is = new FileInputStream(file);

      // create unmarshaller
      Unmarshaller unmarshaller = UnmarshallerFactory.newInstance().newUnmarshaller();

      // create an instance of ObjectModelFactory
      ObjectModelFactory factory = new ConfigInfoBinding();

      // let the object model factory to create an instance of Book and populate it with data from XML
      ConfigInfo ci = (ConfigInfo)unmarshaller.unmarshal(is, factory, null);

      // close the XML stream
      is.close();

      return ci;
View Full Code Here

{

   public void test() throws Exception
   {
      SchemaBinding schema = JBossXBBuilder.build(ServerMetaData.class);
      Unmarshaller u = UnmarshallerFactory.newInstance().newUnmarshaller();
      u.setSchemaValidation(false);
      u.setValidation(false);
      u.setEntityResolver(new JBossEntityResolver());

      InputStream is = Thread.currentThread().getContextClassLoader().getResourceAsStream("test/metadata/server.xml");

      ServerMetaData m = ServerMetaData.class.cast(u.unmarshal(is, schema));
      assertNotNull(m);
      assertNotNull(m.getListeners());
      assertNotNull(m.getServices());
     
      assertEquals(2, m.getListeners().size());
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

      {
         // locate resource
         is = SecurityActions.getThreadContextClassLoaderResource(resourceName);
        
         // create unmarshaller
         Unmarshaller unmarshaller = UnmarshallerFactory.newInstance().newUnmarshaller();

         // let JBossXB do it's magic using the AttributeMappingsBinding
         mappings = (AttributeMappings)unmarshaller.unmarshal(is, omf, null);        
      }
      catch (Exception e)
      {
         log.error("Accessing resource '" + resourceName + "'");
         throw e;
View Full Code Here

         // locate managers.xml
         final String resName = this.managersResName;
         is = SecurityActions.getThreadContextClassLoaderResource(resName);
        
         // create unmarshaller
         Unmarshaller unmarshaller = UnmarshallerFactory.newInstance()
               .newUnmarshaller();
        
         // let JBossXB do it's magic using the MappingObjectModelFactory
         managerList = (ArrayList)unmarshaller.unmarshal(is, momf, null);        
      }
      catch (Exception e)
      {
         log.error("Accessing resource '" + managersResName + "'");
         throw e;
View Full Code Here

         // locate notifications.xml
         final String resName = notificationMapResName;
         is = SecurityActions.getThreadContextClassLoaderResource(resName);
        
         // create unmarshaller
         Unmarshaller unmarshaller = UnmarshallerFactory.newInstance().newUnmarshaller();

         // let JBossXB do it's magic using the MappingObjectModelFactory
         this.notificationMapList = (ArrayList)unmarshaller.unmarshal(is, omf, null);        
      }
      catch (Exception e)
      {
         log.error("Accessing resource '" + notificationMapResName + "'");
         throw e;
View Full Code Here

      // Get the attribute element content in a parsable form
      StringBuffer buffer = getElementContent(element);

      // Parse the attribute element content
      SchemaBindingResolver resolver = SingletonSchemaResolverFactory.getInstance().getSchemaBindingResolver();
      Unmarshaller unmarshaller = UnmarshallerFactory.newInstance().newUnmarshaller();
      StringReader reader = new StringReader(buffer.toString());
      Object bean = unmarshaller.unmarshal(reader, resolver);
      return bean;
   }
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.