Package org.jboss.xb.binding

Examples of org.jboss.xb.binding.Unmarshaller


   protected ServiceReferenceHandlerChainsMetaData unmarshall(InputStream in) throws JBossXBException
   {
      if(in == null)
         throw new IllegalArgumentException("InputStream may not be null.");
     
      Unmarshaller unmarshaller = UnmarshallerFactory.newInstance().newUnmarshaller();
      return (ServiceReferenceHandlerChainsMetaData) unmarshaller.unmarshal(in, resolver);
   }
View Full Code Here


   private static final Logger log = Logger.getLogger(EjbJarDDObjectFactory.class);

   public static EjbJarDD parse(URL ddResource) throws JBossXBException, IOException
   {
      ObjectModelFactory factory = null;
      Unmarshaller unmarshaller = null;
      EjbJarDD dd = null;

      if (ddResource != null)
      {
         log.debug("found ejb-jar.xml " + ddResource);

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

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

      return dd;
   }
View Full Code Here

         URL wsddUrl = wsdd.toURL();
         try
         {
            InputStream is = wsddUrl.openStream();
            Unmarshaller unmarshaller = UnmarshallerFactory.newInstance().newUnmarshaller();
            ObjectModelFactory factory = new WebservicesFactory(wsddUrl);
            webservices = (WebservicesMetaData)unmarshaller.unmarshal(is, factory, null);
            is.close();
         }
         catch (Exception e)
         {
            throw new WebServiceException("Failed to unmarshall webservices.xml:" + e.getMessage());
View Full Code Here

            URL wsURL = vfWebservices.toURL();
            Element root = DOMUtils.parse(wsURL.openStream());
            String namespaceURI = root.getNamespaceURI();
            if (namespaceURI.equals("http://java.sun.com/xml/ns/j2ee"))
            {
               Unmarshaller unmarshaller = UnmarshallerFactory.newInstance().newUnmarshaller();
               ObjectModelFactory factory = new WebservicesFactory(wsURL);
               wsMetaData = (WebservicesMetaData)unmarshaller.unmarshal(wsURL.openStream(), factory, null);
               unit.addAttachment(WebservicesMetaData.class, wsMetaData);
            }
         }
         catch (Exception ex)
         {
View Full Code Here

   {
      LoginConfigObjectModelFactory lcomf = new LoginConfigObjectModelFactory();
      UsersObjectModelFactory uomf = new UsersObjectModelFactory();

      InputStreamReader xmlReader = loadURL(loginConfigURL);
      Unmarshaller unmarshaller = UnmarshallerFactory.newInstance()
            .newUnmarshaller();
      unmarshaller.mapFactoryToNamespace(uomf, "http://www.jboss.org/j2ee/schemas/XMLLoginModule");
      Object root = null;
      PolicyConfig config = (PolicyConfig) unmarshaller.unmarshal(xmlReader, lcomf, root);
      configNames.addAll(config.getConfigNames());
      appConfigs.copy(config);
   }
View Full Code Here

   protected JBossWebMetaData unmarshal(String name, Class clazz)
      throws Exception
   {
      UnmarshallerFactory factory = UnmarshallerFactory.newInstance();
      Unmarshaller unmarshaller = factory.newUnmarshaller();
      unmarshaller.setSchemaValidation(true);
      URL webXml = getClass().getResource(name);
      if (webXml == null)
         throw new IllegalStateException("Unable to find: "+name);
      SchemaBinding schema = JBossXBBuilder.build(clazz);
      WebMetaData confWebMD = (WebMetaData) unmarshaller.unmarshal(webXml.toString(), schema);
      JBoss50WebMetaData sharedMetaData = new JBoss50WebMetaData();
      sharedMetaData.merge(null, confWebMD);

      return sharedMetaData;
   }
View Full Code Here

    * @return
    * @throws JBossXBException
    */
   private static <T> T unmarshal(Class<T> type, String resource) throws JBossXBException
   {
      Unmarshaller unmarshaller = unmarshallerFactory.newUnmarshaller();
      unmarshaller.setValidation(false);
      URL url = type.getResource(resource);
      if (url == null)
         throw new IllegalArgumentException("Failed to find resource " + resource);
      return type.cast(unmarshaller.unmarshal(url.toString(), schemaBindingResolver));
   }
View Full Code Here

   {
      if (resolver == null)
         resolver = defaultResolver;
     
      long start = System.currentTimeMillis();
      Unmarshaller unmarshaller = unmarshallerFactory.newUnmarshaller();
      unmarshaller.setSchemaValidation(validateSchema);
      log.debug("Initialized parsing in " + (System.currentTimeMillis() - start) + "ms");
      try
      {
         Object result = unmarshaller.unmarshal(url, resolver);
         log.debug("Total parse for " + url + " took " + (System.currentTimeMillis() - start) + "ms");
         return result;
      }
      catch (Exception e)
      {
View Full Code Here

    * @throws Exception for any error
    */
   public Object unmarshal(String url, SchemaBinding schema) throws Exception
   {
      long start = System.currentTimeMillis();
      Unmarshaller unmarshaller = unmarshallerFactory.newUnmarshaller();
      unmarshaller.setSchemaValidation(isValidateSchema());
      log.debug("Initialized parsing in " + (System.currentTimeMillis() - start) + "ms");
      try
      {
         Object result = unmarshaller.unmarshal(url, schema);
         log.debug("Total parse for " + url + " took " + (System.currentTimeMillis() - start) + "ms");
         return result;
      }
      catch (Exception e)
      {
View Full Code Here

   {
      SecurityConfigObjectModelFactory lcomf = new SecurityConfigObjectModelFactory();
      UsersObjectModelFactory uomf = new UsersObjectModelFactory();
     
      InputStreamReader xmlReader = new InputStreamReader(loginConfigURL.openStream());
      Unmarshaller unmarshaller = UnmarshallerFactory.newInstance().newUnmarshaller();
      unmarshaller.mapFactoryToNamespace(uomf, "http://www.jboss.org/j2ee/schemas/XMLLoginModule");
      policyConfig = (PolicyConfig) unmarshaller.unmarshal(xmlReader, lcomf, (Object)null);
   }
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.