Package org.jibx.runtime

Examples of org.jibx.runtime.IMarshallingContext


         JDBCConfigurationPersister persiter = new JDBCConfigurationPersister();
         persiter.init(props);

         IBindingFactory bfact = BindingDirectory.getFactory(RepositoryServiceConfiguration.class);
         IMarshallingContext mctx = bfact.createMarshallingContext();
         OutputStream saveStream = new ByteArrayOutputStream();
         mctx.marshalDocument(repositoryService.getConfig(), "ISO-8859-1", null, saveStream);
         saveStream.close();

         persiter.write(new ByteArrayInputStream(((ByteArrayOutputStream)saveStream).toByteArray()));

         IBindingFactory factory = BindingDirectory.getFactory(RepositoryServiceConfiguration.class);
View Full Code Here


        this.setBindingName(bindingName);
    }

    public void marshal(Exchange exchange, Object body, OutputStream stream) throws Exception {
        IBindingFactory bindingFactory = createBindingFactory(body.getClass(), bindingName);
        IMarshallingContext marshallingContext = bindingFactory.createMarshallingContext();
        marshallingContext.marshalDocument(body, null, null, stream);
    }
View Full Code Here

     */
    public void serialize(OutputStream output, OMOutputFormat format) throws XMLStreamException {
        try {
           
            // marshal with all namespace declarations, since external state unknown
            IMarshallingContext ctx = bindingFactory.createMarshallingContext();
            ctx.setOutput(output, format == null ? null : format.getCharSetEncoding());
            marshal(true, ctx);
           
        } catch (JiBXException e) {
            throw new XMLStreamException("Error in JiBX marshalling: " + e.getMessage(), e);
        }
View Full Code Here

     */
    public void serialize(Writer writer, OMOutputFormat format) throws XMLStreamException {
        try {
           
            // marshal with all namespace declarations, since external state unknown
            IMarshallingContext ctx = bindingFactory.createMarshallingContext();
            ctx.setOutput(writer);
            marshal(true, ctx);
           
        } catch (JiBXException e) {
            throw new XMLStreamException("Error in JiBX marshalling: " + e.getMessage(), e);
        }
View Full Code Here

                }
            }
           
            // marshal with all namespace declarations, since external state unknown
            IXMLWriter writer = new StAXWriter(nss, xmlWriter);
            IMarshallingContext ctx = bindingFactory.createMarshallingContext();
            ctx.setXmlWriter(writer);
            marshal(full, ctx);
           
        } catch (JiBXException e) {
            throw new XMLStreamException("Error in JiBX marshalling: " + e.getMessage(), e);
        }
View Full Code Here

               throw new RepositoryException("Can't back up configuration on path " + sourceConfig.getAbsolutePath());
            saveStream = new FileOutputStream(sourceConfig);
         }

         IBindingFactory bfact = BindingDirectory.getFactory(RepositoryServiceConfiguration.class);
         IMarshallingContext mctx = bfact.createMarshallingContext();

         mctx.marshalDocument(this, "ISO-8859-1", null, saveStream);
         saveStream.close();

         // writing configuration in to the persister
         if (configurationPersister != null)
         {
View Full Code Here

            else
            {
               throw new RuntimeException(cause);
            }
         }
         IMarshallingContext mctx = bfact.createMarshallingContext();
     
         mctx.marshalDocument(newRepositoryServiceConfiguration, "ISO-8859-1", null, saveStream);
         saveStream.close();
     
         writer.writeStartElement("original-repository-config");
         writer.writeCharacters(config.getName());
         writer.writeEndElement();
View Full Code Here

                                         final File file)
      throws JiBXException, IOException {
      final Writer writer = new FileWriter(file);
      final IBindingFactory factory =
         BindingDirectory.getFactory(Controller.class);
      final IMarshallingContext context = factory.createMarshallingContext();
      context.setIndent(INDENT);
      context.setOutput(writer);
      context.marshalDocument(controller, ENCODING, null);
   }
View Full Code Here

   public static void marshallService(final Service service, final File file)
      throws JiBXException, IOException {
      final Writer writer = new FileWriter(file);
      final IBindingFactory factory =
         BindingDirectory.getFactory(Service.class);
      final IMarshallingContext context = factory.createMarshallingContext();
      context.setIndent(INDENT);
      context.setOutput(writer);
      context.marshalDocument(service, ENCODING, null);
   }
View Full Code Here

   public static void marshallServices(final Services services, final File file)
      throws JiBXException, IOException {
      final Writer writer = new FileWriter(file);
      final IBindingFactory factory =
         BindingDirectory.getFactory(Services.class);
      final IMarshallingContext context = factory.createMarshallingContext();
      context.setIndent(INDENT);
      context.setOutput(writer);
      context.marshalDocument(services, ENCODING, null);
   }
View Full Code Here

TOP

Related Classes of org.jibx.runtime.IMarshallingContext

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.