Package org.jboss.xb.binding

Examples of org.jboss.xb.binding.Unmarshaller


      {
         // locate notifications.xml
         is = this.getClass().getResourceAsStream(notificationMapResName);
        
         // 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


      {
         // locate resource
         is = getClass().getResourceAsStream(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
         is = this.getClass().getResourceAsStream(this.managersResName);
        
         // 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

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

            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

      JavaBeanSchemaInitializer si = new JavaBeanSchemaInitializer();
      resolver.addSchemaInitializer("urn:jboss:simplejavabean:1.0", si);
      resolver.addSchemaLocation("urn:jboss-test:xmbean:2.0", "xml/mbeanserver/jboss_xmbean_2_0.xsd");
      resolver.addSchemaLocation("urn:jboss:simplejavabean:1.0", "xml/mbeanserver/simplejavabean_1_0.xsd");

      Unmarshaller unmarshaller = UnmarshallerFactory.newInstance().newUnmarshaller();
      String xmlPath = getResourcePath("xml/mbeanserver/testXMBean2.xml");
      Object root = unmarshaller.unmarshal(xmlPath, resolver);

      assertTrue("", root instanceof ModelMBeanInfoSupportWrapper);
      ModelMBeanInfoSupportWrapper mbean = (ModelMBeanInfoSupportWrapper) root;
      Descriptor descriptor = mbean.getDescriptors();
      Object i = descriptor.getFieldValue("interceptors");
View Full Code Here

         {
            throw new UnsupportedOperationException("resolveResource is not implemented.");
         }
      });

      Unmarshaller unmarshaller = UnmarshallerFactory.newInstance().newUnmarshaller();
      InputStream is2 = getResource("xml/mbeanserver/testObjFactory.xml");
      Services services = (Services)unmarshaller.unmarshal(is2, schemaBinding);
      List mbeans = services.getMBeans();
      assertEquals("There is 1 mbean", 1, mbeans.size());

      MBeanData mbean = (MBeanData) mbeans.get(0);
      assertTrue("ClassName == org.jboss.security.auth.login.DynamicLoginConfig",
View Full Code Here

      can be easily specified to the SARDeployer, or the schema can be made
      available to the entity resolver via some other configuration.
      */
      final URL url = Thread.currentThread().getContextClassLoader().getResource("xml/naming/");

      Unmarshaller unmarshaller = UnmarshallerFactory.newInstance().newUnmarshaller();
      unmarshaller.setEntityResolver(new JBossEntityResolver(){
         public InputSource resolveEntity(String publicId, String systemId) throws SAXException, IOException
         {
            if(systemId.endsWith("custom-object-binding.xsd") ||
               systemId.endsWith("jndi-binding-service_1_0.xsd"))
            {
               String fileName = systemId.substring(systemId.lastIndexOf('/') + 1);
               URL url = Thread.currentThread().getContextClassLoader().
                  getResource("xml/naming/" + fileName);
               return new InputSource(url.toExternalForm());
            }
            else
            {
               return super.resolveEntity(publicId, systemId);
            }
         }
      });

      JNDIBindings bindings = (JNDIBindings) unmarshaller.unmarshal(is2,
         new SchemaBindingResolver(){
            public String getBaseURI()
            {
               throw new UnsupportedOperationException("getBaseURI is not implemented.");
            }
View Full Code Here

   {
      URL url = getResource("xml/naming/jndi-binding-service_1_0.xsd");
      SchemaBinding schemaBinding = XsdBinder.bind(url.toString());
      schemaBinding.setIgnoreUnresolvedFieldOrClass(false);

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

      URL xml = getResource("xml/naming/testBindings.xml");
      JNDIBindings bindings = (JNDIBindings)unmarshaller.unmarshal(xml.openStream(), schemaBinding);
      JNDIBinding[] values = bindings.getBindings();
      assertTrue("There are 5 bindings("+values.length+")", values.length == 5);

      JNDIBinding key1 = values[0];
      assertTrue("values[0] name is ctx1/key1", key1.getName().equals("ctx1/key1"));
View Full Code Here

      so that the xsds can be found, but this baseURI
      can be easily specified to the SARDeployer, or the schema can be made
      available to the entity resolver via some other configuration.
      */
      final URL url = Thread.currentThread().getContextClassLoader().getResource("xml/loginconfig/");
      Unmarshaller unmarshaller = UnmarshallerFactory.newInstance().newUnmarshaller();
      unmarshaller.setEntityResolver(new EntityResolver(){
         public InputSource resolveEntity(String publicId, String systemId)
         {
            return null;
         }
      });
      Object root = unmarshaller.unmarshal(is, new SchemaBindingResolver(){
         public String getBaseURI()
         {
            throw new UnsupportedOperationException("getBaseURI is not implemented.");
         }

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.