Examples of Marshaller


Examples of javax.xml.bind.Marshaller

  static public OutputStream marshall(Object obj, String pkg,
      ClassLoader loader) throws Exception {
    LOGGER.debug("Marshalling " + obj + " in package " + pkg); //$NON-NLS-1$ //$NON-NLS-2$
    JAXBContext jc = JAXBContext.newInstance(pkg, loader);
    Marshaller m = jc.createMarshaller();
    OutputStream ostream = new ByteArrayOutputStream();

    m.marshal(obj, ostream);

    return ostream;
  }
View Full Code Here

Examples of javax.xml.bind.Marshaller

    return ostream;
  }
 
  static public Document marshall(Object obj, String pkg, Document targetDoc, ClassLoader loader) throws Exception {
    JAXBContext jc = JAXBContext.newInstance(pkg, loader);
    Marshaller m = jc.createMarshaller();

    m.marshal(obj, targetDoc);

    return targetDoc;
  }
View Full Code Here

Examples of javax.xml.bind.Marshaller

    throws WebServiceException
  {
    try {
      ByteArrayOutputStream baos = new ByteArrayOutputStream();

      Marshaller marshaller = context.createMarshaller();
      marshaller.marshal(payload, baos);

      ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray());
      _source = new StreamSource(bais);
    }
    catch (Exception e) {
View Full Code Here

Examples of javax.xml.bind.Marshaller

    Map<String,Object> properties = new HashMap<String,Object>();
    properties.put(JAXBContextImpl.TARGET_NAMESPACE, namespace);

    JAXBContextImpl jaxbContext =
      new JAXBContextImpl(jaxbClassArray, properties);
    Marshaller marshaller = jaxbContext.createMarshaller();
    Unmarshaller unmarshaller = jaxbContext.createUnmarshaller();

    DirectSkeleton skel =
      new DirectSkeleton(type, api, jaxbContext, wsdlLocation, namespace, wsdl);
View Full Code Here

Examples of org.apache.activemq.kaha.Marshaller

   
    protected MapContainer addSubscriberMessageContainer(String clientId, String subscriptionName) throws IOException {
        MapContainer container = store.getMapContainer(getSubscriptionContainerName(getSubscriptionKey(clientId, subscriptionName)));
        container.setKeyMarshaller(Store.MESSAGEID_MARSHALLER);
        Marshaller marshaller = new ConsumerMessageRefMarshaller();
        container.setValueMarshaller(marshaller);
        TopicSubContainer tsc = new TopicSubContainer(container);
        subscriberMessages.put(getSubscriptionKey(clientId, subscriptionName), tsc);
        return container;
    }
View Full Code Here

Examples of org.davinci.server.review.persistence.Marshaller

    Comment lastAccessTime = reviewHash.get(LAST_ACCESS_TIME);
    reviewHash.remove(LAST_ACCESS_TIME);
    // clearUnconsistentComments(reviewHash);
    doc.setCommentList(new ArrayList<Comment>(reviewHash.values()));

    Marshaller marshaller = new Marshaller(project);
    try {
      synchronized(project){
        marshaller.marshall(false);
        reviewHash.put(LAST_ACCESS_TIME, lastAccessTime);
        return true;
      }
    } catch (Exception e) {
      e.printStackTrace();
View Full Code Here

Examples of org.drools.marshalling.Marshaller

    public static StatefulKnowledgeSession getSerialisedStatefulKnowledgeSession(StatefulKnowledgeSession ksession,
                                                                                 ObjectMarshallingStrategy strategy,
                                                                                 boolean dispose) throws Exception {

        Marshaller marshaller = MarshallerFactory.newMarshaller( ksession.getKnowledgeBase(),
                                                                 new ObjectMarshallingStrategy[]{strategy} );

        ByteArrayOutputStream bos = new ByteArrayOutputStream();
        marshaller.marshall( bos,
                             ksession );
        final byte[] b1 = bos.toByteArray();
        bos.close();

        ByteArrayInputStream bais = new ByteArrayInputStream( b1 );
        StatefulKnowledgeSession ksession2 = marshaller.unmarshall( bais,
                                                                    new SessionConfiguration(),
                                                                    EnvironmentFactory.newEnvironment() );
        bais.close();

        bos = new ByteArrayOutputStream();
        marshaller.marshall( bos,
                             ksession2 );
        final byte[] b2 = bos.toByteArray();
        bos.close();

        // bytes should be the same.
View Full Code Here

Examples of org.drools.marshalling.Marshaller

   
        session.startProcess("com.sample.ruleflow", null);
        assertEquals(1, session.getProcessInstances().size());
       
        StatefulKnowledgeSession ksession = new StatefulKnowledgeSessionImpl( (ReteooWorkingMemory) session );
        Marshaller marshaller = MarshallerFactory.newMarshaller( ksession.getKnowledgeBase() );
    

        ByteArrayOutputStream baos = new ByteArrayOutputStream();
        marshaller.marshall( baos, ksession );
        byte[] b1 = baos.toByteArray();
        session.halt();
        session.dispose();
        Thread.sleep(400);
       
        ByteArrayInputStream bais = new ByteArrayInputStream( b1 );       
        final StatefulSession session2 = ( StatefulSession ) (( StatefulKnowledgeSessionImpl) marshaller.unmarshall( bais ) ).session;
       
    new Thread(new Runnable() {
      public void run() {
            session2.fireUntilHalt();        
      }
View Full Code Here

Examples of org.exolab.castor.xml.Marshaller

    if (f1.exists()) {
      Mapping mapping = new Mapping();
      try {
  mapping.loadMapping(mappingfile);
  Writer writer = new FileWriter(filename);
  Marshaller marshaller = new Marshaller(writer);
  marshaller.setMapping(mapping);
  marshaller.marshal(this);
  writer.close();
 
  log.info("written to XML");
      } catch (Exception e) {
  log.error(e.getMessage());
View Full Code Here

Examples of org.exolab.castor.xml.Marshaller

     * @see de.netseeker.ejoe.adapter.SerializeAdapter#write(java.lang.Object, java.io.OutputStream)
     */
    public void write( Object obj, OutputStream out ) throws Exception
    {
        Writer writer = new OutputStreamWriter( out, EJConstants.EJOE_DEFAULT_CHARSET );
        Marshaller marshaller = new Marshaller( writer );
        try
        {
            if ( _mapping != null )
            {
                marshaller.setMapping( _mapping );
            }
            // marshaller.setResolver(_cdr);
            marshaller.setValidation( false );
            marshaller.setSuppressXSIType( false );
            marshaller.setUseXSITypeAtRoot( true );
            marshaller.setMarshalExtendedType( true );
            marshaller.setResolver( _cdr );
            marshaller.marshal( obj );
        }
        finally
        {
            IOUtil.closeQuiet( writer );
        }
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.