Package javax.xml.bind

Examples of javax.xml.bind.JAXBContext


      ManagedConnectionFactoryDeploymentGroup group = elem.getValue();
      return group;
   }
   public static ManagedConnectionFactoryDeploymentGroup unmarshalResource(String resourceName) throws Exception
   {
      JAXBContext ctx = JAXBContext.newInstance(CTX_CLASS);
      Unmarshaller um = ctx.createUnmarshaller();
      Document d = getDocumentForResource(resourceName);
      JAXBElement<ManagedConnectionFactoryDeploymentGroup> elem = um.unmarshal(d, ManagedConnectionFactoryDeploymentGroup.class);
      ManagedConnectionFactoryDeploymentGroup group = elem.getValue();
      //      ManagedConnectionFactoryDeploymentGroup group = elem.getValue();
      return group;     
View Full Code Here


   {
      if (log.isTraceEnabled())
      {
         log.trace("saveMetadata, metadataStore="+metadataStore+ ", metadata="+metadata);
      }
      JAXBContext ctx = JAXBContext.newInstance(metadata.getClass());
      Marshaller marshaller = ctx.createMarshaller();
      marshaller.setProperty("jaxb.formatted.output", Boolean.TRUE);
      marshaller.marshal(metadata, metadataStore);
   }
View Full Code Here

         else if(logTrace)
            log.trace("property not found: " + tempProp.getName());
      }

      Class[] classes = {ManagedConnectionFactoryDeploymentGroup.class};
      JAXBContext context = JAXBContext.newInstance(classes);     
      Marshaller marshaller = context.createMarshaller();
      marshaller.setProperty("jaxb.formatted.output", Boolean.TRUE);

      JAXBElement<ManagedConnectionFactoryDeploymentGroup> root =
            new JAXBElement<ManagedConnectionFactoryDeploymentGroup>(
                  new javax.xml.namespace.QName(rootElementName),
View Full Code Here

   @SuppressWarnings("unchecked")
   protected <T> T loadAttachment(File attachmentsStore, Class<T> expected) throws Exception
   {
      if(log.isTraceEnabled())
         log.trace("loadAttachment, attachmentsStore=" + attachmentsStore);
      JAXBContext ctx = JAXBContext.newInstance(expected);
      Unmarshaller unmarshaller = ctx.createUnmarshaller();
      InputStream is = new FileInputStream(attachmentsStore);
      try
      {
         return (T) unmarshaller.unmarshal(is);
      }
View Full Code Here

   protected void saveAttachment(File attachmentsStore, Object attachment) throws Exception
   {
      if(log.isTraceEnabled())
         log.trace("saveAttachment, attachmentsStore="+attachmentsStore+ ", attachment="+attachment);
      JAXBContext ctx = JAXBContext.newInstance(attachment.getClass());
      Marshaller marshaller = ctx.createMarshaller();
      marshaller.setProperty("jaxb.formatted.output", Boolean.TRUE);
      OutputStream os = new FileOutputStream(attachmentsStore);
      try
      {
         marshaller.marshal(attachment, os);
View Full Code Here

         topic.setBindings(bindings);
      }
      else
         throw new IllegalStateException("Unsupported destination type: " + destinationType);

      JAXBContext context = JAXBContext.newInstance(JAXBJMSConfiguration.class);
      Marshaller marshaller = context.createMarshaller();
      marshaller.setProperty("jaxb.formatted.output", Boolean.TRUE);

      JAXBElement<JAXBJMSConfiguration> root = new JAXBElement<JAXBJMSConfiguration>(
            new javax.xml.namespace.QName("urn:hornetq", "configuration"), JAXBJMSConfiguration.class, null, config);
View Full Code Here

         // I'm testing unknown content-length here
         GetMethod method = new GetMethod("http://localhost:8080/resteasy/xml");
         int status = client.executeMethod(method);
         Assert.assertEquals(HttpResponseCodes.SC_OK, status);
         String result = method.getResponseBodyAsString();
         JAXBContext ctx = JAXBContext.newInstance(Customer.class);
         Customer cust = (Customer) ctx.createUnmarshaller().unmarshal(new StringReader(result));
         Assert.assertEquals("Bill Burke", cust.getName());
         method.releaseConnection();
      }

   }
View Full Code Here

      input.setSystemId(url.toURI().toString());
      XMLReader reader = XMLReaderFactory.createXMLReader();
      reader.setEntityResolver(new JBossEntityResolver());
      SAXSource source = new SAXSource(reader, input);
      // New JAXB context
      JAXBContext context = JAXBContext.newInstance(ManagedConnectionFactoryDeploymentGroup.class);
      Unmarshaller um = context.createUnmarshaller();
      // Unmarshal
      JAXBElement<ManagedConnectionFactoryDeploymentGroup> elem = um.unmarshal(source,
            ManagedConnectionFactoryDeploymentGroup.class);
      return elem.getValue();
   }
View Full Code Here

      return deserialize(f);     
   }
  
   protected void serialize(PersistenceRoot moElement, File file) throws Exception
   {
      JAXBContext ctx = JAXBContext.newInstance(PersistenceRoot.class);
      Marshaller marshaller = ctx.createMarshaller();
      marshaller.setProperty("jaxb.formatted.output", Boolean.TRUE);
      marshaller.marshal(moElement, file);
      marshaller.marshal(moElement, System.out);
   }
View Full Code Here

      marshaller.marshal(moElement, System.out);
   }
  
   protected PersistenceRoot deserialize(File file) throws Exception
   {
      JAXBContext ctx = JAXBContext.newInstance(PersistenceRoot.class);
      Unmarshaller unmarshaller = ctx.createUnmarshaller();
      return (PersistenceRoot) unmarshaller.unmarshal(file);
   }
View Full Code Here

TOP

Related Classes of javax.xml.bind.JAXBContext

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.