Examples of createMarshaller()


Examples of javax.xml.bind.JAXBContext.createMarshaller()

  
   public static String marshalResourceAsString(ManagedConnectionFactoryDeploymentGroup group) throws Exception
   {
      Class[] classes = {ManagedConnectionFactoryDeploymentGroup.class, ManagedConnectionFactoryDeploymentMetaData.class, LocalDataSourceDeploymentMetaData.class, NonXADataSourceDeploymentMetaData.class, DataSourceDeploymentMetaData.class};     
      JAXBContext context = JAXBContext.newInstance(classes);     
      Marshaller m = context.createMarshaller();     
      JAXBElement element = new JAXBElement(new QName("", "datasources"), group.getClass(), group);
      StringWriter w = new StringWriter();
      m.marshal(element, w);     
      return w.toString();     
   }
View Full Code Here

Examples of javax.xml.bind.JAXBContext.createMarshaller()

      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

Examples of javax.xml.bind.JAXBContext.createMarshaller()

            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

Examples of javax.xml.bind.JAXBContext.createMarshaller()

   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

Examples of javax.xml.bind.JAXBContext.createMarshaller()

      }
      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

Examples of javax.xml.bind.JAXBContext.createMarshaller()

   }
  
   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

Examples of javax.xml.bind.JAXBContext.createMarshaller()

         set.add(entry.getContent().getJAXBObject().getClass());
      }
      try
      {
         JAXBContext ctx = finder.findCacheContext(mediaType, annotations, set.toArray(new Class[set.size()]));
         Marshaller marshaller = ctx.createMarshaller();
         NamespacePrefixMapper mapper = new NamespacePrefixMapper()
         {
            public String getPreferredPrefix(String namespace, String s1, boolean b)
            {
               if (namespace.equals("http://www.w3.org/2005/Atom")) return "atom";
View Full Code Here

Examples of javax.xml.bind.JAXBContext.createMarshaller()

         }
      }
      try
      {
         JAXBContext ctx = finder.findCacheContext(mediaType, annotations, set.toArray(new Class[set.size()]));
         Marshaller marshaller = ctx.createMarshaller();
         NamespacePrefixMapper mapper = new NamespacePrefixMapper()
         {
            public String getPreferredPrefix(String namespace, String s1, boolean b)
            {
               if (namespace.equals("http://www.w3.org/2005/Atom")) return "atom";
View Full Code Here

Examples of javax.xml.bind.JAXBContext.createMarshaller()

      item.setProductName("My Thing");
      item.setQuantity(6);
      item.setUSPrice(new BigDecimal(13.99));
      items.getItem().add(item);
      po.setItems(items);
      Marshaller marshaller = ctx.createMarshaller();
      XmlSchema xmlSchema = PurchaseOrderType.class.getPackage().getAnnotation(XmlSchema.class);
      XmlNamespacePrefixMapper mapper = new XmlNamespacePrefixMapper(xmlSchema.xmlns());
      try
      {
         marshaller.setProperty("com.sun.xml.bind.namespacePrefixMapper", mapper);
View Full Code Here

Examples of javax.xml.bind.JAXBContext.createMarshaller()

                                      MediaType mediaType)
   {
      try
      {
         JAXBContext jaxb = findJAXBContext(type, annotations, mediaType, false);
         Marshaller marshaller = jaxb.createMarshaller();
         setCharset(mediaType, marshaller);
         // Pretty Print the XML response.
         Object formatted = mediaType.getParameters().get("formatted");
         if (formatted != null)
         {
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.