Package org.drools.marshalling.impl

Examples of org.drools.marshalling.impl.MarshallerReaderContext


                                              Environment env) {
        this.env = env;
        if ( processInstance == null ) {
            try {
                ByteArrayInputStream bais = new ByteArrayInputStream( processInstanceByteArray );
                MarshallerReaderContext context = new MarshallerReaderContext( bais,
                                                                               (InternalRuleBase) ((InternalKnowledgeBase) kruntime.getKnowledgeBase()).getRuleBase(),
                                                                               null,
                                                                               null,
                                                                               this.env
                                                                              );
                ProcessInstanceMarshaller marshaller = getMarshallerFromContext( context );
                context.wm = ((StatefulKnowledgeSessionImpl) kruntime).getInternalWorkingMemory();
                processInstance = marshaller.readProcessInstance(context);
                context.close();
            } catch ( IOException e ) {
                e.printStackTrace();
                throw new IllegalArgumentException( "IOException while loading process instance: " + e.getMessage(),
                                                    e );
            }
View Full Code Here


    private static WorkItem unmarshallWorkItem(byte [] marshalledSessionByteArray) throws Exception {
        // Setup env/context/stream
        Environment env = EnvironmentFactory.newEnvironment();
        ByteArrayInputStream bais = new ByteArrayInputStream(marshalledSessionByteArray);
        MarshallerReaderContext context = new MarshallerReaderContext(bais, null, null, null, env);
      
        // Unmarshall
        WorkItem unmarshalledWorkItem =  InputMarshaller.readWorkItem(context);
       
        context.close();
       
        return unmarshalledWorkItem;
    }
View Full Code Here

    public WorkItem getWorkItem() {
        if ( workItem == null ) {
            try {
                ByteArrayInputStream bais = new ByteArrayInputStream( workItemByteArray );
                MarshallerReaderContext context = new MarshallerReaderContext( bais,
                                                                               null,
                                                                               null,
                                                                               null );
                workItem = InputMarshaller.readWorkItem( context );
                context.close();
            } catch ( IOException e ) {
                e.printStackTrace();
                throw new IllegalArgumentException( "IOException while loading process instance: " + e.getMessage() );
            }
        }
View Full Code Here

            ObjectMarshallingStrategy[] newStrats
                = new ObjectMarshallingStrategy[] {
                    MarshallerFactory.newSerializeMarshallingStrategy()  };
   
            ByteArrayInputStream bais = new ByteArrayInputStream(byteArray);
            MarshallerReaderContext inContext = new MarshallerReaderContext( bais, null, null,
                new ObjectMarshallingStrategyStoreImpl(newStrats), Collections.EMPTY_MAP,
                true, true, null);
            inContext.wm = wm;
            newFactHandle = InputMarshaller.readFactHandle(inContext);
            inContext.close();
        }

        assertTrue( "Serialized FactHandle not the same as the original.", compareInstances(factHandle, newFactHandle) );
    }
View Full Code Here

        OutputMarshaller.writeWorkItem(outContext, workItem);
       
        // unmarshall/deserialize workItem
        byte [] byteArray = baos.toByteArray();
        ByteArrayInputStream bais = new ByteArrayInputStream(byteArray);
        MarshallerReaderContext inContext = new MarshallerReaderContext( bais, null, null,
                new ObjectMarshallingStrategyStore(strats), true, true, null);
        workItem = InputMarshaller.readWorkItem(inContext);
      
        // Check
        checkWorkItem(workItem, input);
View Full Code Here

                = new ObjectMarshallingStrategy[] {
                    new MarshallerProviderImpl().newIdentityMarshallingStrategy(),
                    MarshallerFactory.newSerializeMarshallingStrategy()  };
   
            ByteArrayInputStream bais = new ByteArrayInputStream(byteArray);
            MarshallerReaderContext inContext = new MarshallerReaderContext( bais, null, null,
                new ObjectMarshallingStrategyStore(newStrats), true, true, null);
            workItem = InputMarshaller.readWorkItem(inContext);
        }
       
        // Check
View Full Code Here

            ObjectMarshallingStrategy[] newStrats
                = new ObjectMarshallingStrategy[] {
                    MarshallerFactory.newSerializeMarshallingStrategy()  };
   
            ByteArrayInputStream bais = new ByteArrayInputStream(byteArray);
            MarshallerReaderContext inContext = new MarshallerReaderContext( bais, null, null,
                new ObjectMarshallingStrategyStore(newStrats), true, true, null);
            workItem = InputMarshaller.readWorkItem(inContext);
        }
       
        // Check
View Full Code Here

            // Only put serialization strategy in
            ObjectMarshallingStrategy[] newStrats
                = new ObjectMarshallingStrategy[] { };
   
            ByteArrayInputStream bais = new ByteArrayInputStream(byteArray);
            MarshallerReaderContext inContext = new MarshallerReaderContext( bais, null, null,
                new ObjectMarshallingStrategyStore(newStrats), true, true, null);
          
            try {
                workItem = InputMarshaller.readWorkItem(inContext);
                fail( "An exception was expected here." );
View Full Code Here

            ObjectMarshallingStrategy[] newStrats
                = new ObjectMarshallingStrategy[] {
                    MarshallerFactory.newSerializeMarshallingStrategy()  };
   
            ByteArrayInputStream bais = new ByteArrayInputStream(byteArray);
            MarshallerReaderContext inContext = new MarshallerReaderContext( bais, null, null,
                new ObjectMarshallingStrategyStore(newStrats), true, true, null);
            workItem = InputMarshaller.readWorkItem(inContext);
        }
       
        // Check
View Full Code Here

            ObjectMarshallingStrategy[] newStrats
                = new ObjectMarshallingStrategy[] {
                    MarshallerFactory.newSerializeMarshallingStrategy()  };
   
            ByteArrayInputStream bais = new ByteArrayInputStream(byteArray);
            MarshallerReaderContext inContext = new MarshallerReaderContext( bais, null, null,
                new ObjectMarshallingStrategyStore(newStrats), true, true, null);
            inContext.wm = wm;
            newFactHandle = InputMarshaller.readFactHandle(inContext);
            inContext.close();
        }

        assertTrue( "Serialized FactHandle not the same as the original.", compareInstances(factHandle, newFactHandle) );
    }
View Full Code Here

TOP

Related Classes of org.drools.marshalling.impl.MarshallerReaderContext

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.