Examples of Unmarshaller


Examples of org.jboss.xb.binding.Unmarshaller

   }

   @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

Examples of org.jboss.xb.binding.Unmarshaller

   {
      // 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

Examples of org.jboss.xb.binding.Unmarshaller

{

   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

Examples of org.jboss.xb.binding.Unmarshaller

     
      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

Examples of org.jboss.xb.binding.Unmarshaller

      {
         // 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

Examples of org.jboss.xb.binding.Unmarshaller

         // 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

Examples of org.jboss.xb.binding.Unmarshaller

         // 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

Examples of org.jboss.xb.binding.Unmarshaller

      // 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

Examples of org.jboss.xb.binding.Unmarshaller

         VirtualFile jbossAppXml = getMetaDataFile(file, "META-INF/jboss-app.xml");
         VirtualFile lib;

         boolean scan = true;

         Unmarshaller unmarshaller = unmarshallerFactory.newUnmarshaller();
         unmarshaller.setValidation(useValidation);
         EarMetaData specMetaData = null;
         JBossAppMetaData appMetaData = null;
         if (applicationXml != null)
         {
            InputStream in = applicationXml.openStream();
            try
            {
               specMetaData = (EarMetaData) unmarshaller.unmarshal(in, resolver);
            }
            finally
            {
               in.close();
            }
            scan = false;
         }
         if (jbossAppXml != null)
         {
            InputStream in = jbossAppXml.openStream();
            try
            {
               appMetaData = (JBossAppMetaData) unmarshaller.unmarshal(in, resolver);
            }
            finally
            {
               in.close();
            }
View Full Code Here

Examples of org.jboss.xb.binding.Unmarshaller

      synchronized (this)
      {
         if (sharedTldMetaData == null && tldJars != null)
         {
            UnmarshallerFactory factory = UnmarshallerFactory.newInstance();
            Unmarshaller unmarshaller = factory.newUnmarshaller();
            SchemaBindingResolver resolver = SingletonSchemaResolverFactory
                  .getInstance().getSchemaBindingResolver();

            // Parse shared JARs for TLDs
            sharedTldMetaData = new ArrayList<TldMetaData>();
            if (tldJars != null)
            {
               VirtualFileFilter tldFilter = new SuffixMatchFilter(".tld", VisitorAttributes.DEFAULT);
               for (URL tldJar : tldJars)
               {
                  try
                  {
                     VirtualFile virtualFile = VFS.getChild(tldJar);
                     VirtualFile metaInf = virtualFile.getChild("META-INF");
                     if (metaInf != null)
                     {
                        List<VirtualFile> tlds = metaInf.getChildren(tldFilter);
                        for (VirtualFile tld : tlds)
                        {
                           TldMetaData tldMetaData = (TldMetaData) unmarshaller.unmarshal(tld.toURL().toString(), resolver);
                           sharedTldMetaData.add(tldMetaData);
                        }
                     }
                  }
                  catch (Exception e)
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.