Package org.kie.api.marshalling

Examples of org.kie.api.marshalling.Marshaller.unmarshall()


        out.close();

        ObjectInputStream in = new DroolsObjectInputStream( new ByteArrayInputStream( baos.toByteArray() ) );
        kbase = (KnowledgeBase) in.readObject();
        marshaller = createSerializableMarshaller( kbase );
        ksession = (StatefulKnowledgeSession) marshaller.unmarshall( in );
        in.close();

        // setting the global again, since it is not serialized with the session
        List<List> results = (List<List>) new ArrayList<List>();
        ksession.setGlobal( "results",
View Full Code Here


                           KieSessionConfiguration config) {
        try {
            Marshaller marshaller = MarshallerFactory.newMarshaller( knowledgeBase );
            ByteArrayOutputStream o = new ByteArrayOutputStream();
            marshaller.marshall( o, ksession );
            ksession = marshaller.unmarshall( new ByteArrayInputStream( o.toByteArray() ), config, KnowledgeBaseFactory.newEnvironment() );
            ksession.fireAllRules();
            //scheduler = ksession.<SessionClock>getSessionClock();
        } catch ( Exception e ) {
            throw new RuntimeException( e );
        }
View Full Code Here

          ByteArrayOutputStream baos = new ByteArrayOutputStream();
          marshaller.marshall(baos, ksession);
          marshaller = MarshallerFactory.newMarshaller(kbase);
          ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray());
          baos.close();
          ksession = (StatefulKnowledgeSession)marshaller.unmarshall(bais);
          bais.close();
        } catch (Exception e) {
          e.printStackTrace();
          fail("unexpected exception :" + e.getMessage());
        }
View Full Code Here

            ByteArrayOutputStream baos = new ByteArrayOutputStream();
            marshaller.marshall(baos, ksession);
            marshaller = MarshallerFactory.newMarshaller(kbase);
            ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray());
            baos.close();
            ksession = (StatefulKnowledgeSession)marshaller.unmarshall(bais);
            bais.close();
        } catch (Exception e) {
            e.printStackTrace();
            fail("unexpected exception :" + e.getMessage());
        }
View Full Code Here

          ByteArrayOutputStream baos = new ByteArrayOutputStream();
          marshaller.marshall(baos, ksession);
          marshaller = MarshallerFactory.newMarshaller(kbase);
          ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray());
          baos.close();
          ksession = (StatefulKnowledgeSession)marshaller.unmarshall(bais);
          bais.close();
        } catch (Exception e) {
          e.printStackTrace();
          fail("unexpected exception :" + e.getMessage());
        }
View Full Code Here

          ByteArrayOutputStream baos = new ByteArrayOutputStream();
          marshaller.marshall(baos, ksession);
          marshaller = MarshallerFactory.newMarshaller(kbase);
          ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray());
          baos.close();
          ksession = (StatefulKnowledgeSession)marshaller.unmarshall(bais);
          bais.close();
        } catch (Exception e) {
          e.printStackTrace();
          fail("unexpected exception :" + e.getMessage());
        }
View Full Code Here

        ObjectInputStream in = new DroolsObjectInputStream( new ByteArrayInputStream( baos.toByteArray() ) );
        Person deserializedBob = (Person) in.readObject();
        kbase = (KnowledgeBase) in.readObject();
        marshaller = createSerializableMarshaller( kbase );
        session = (StatefulKnowledgeSession) marshaller.unmarshall( in );

        assertSame( "these two object references should be same",
                    deserializedBob,
                    session.getObjects().iterator().next() );
        in.close();
View Full Code Here

        out.close();

        ObjectInputStream in = new DroolsObjectInputStream( new ByteArrayInputStream( baos.toByteArray() ) );
        kbase = (KnowledgeBase) in.readObject();
        marshaller = createSerializableMarshaller( kbase );
        ksession = (StatefulKnowledgeSession) marshaller.unmarshall( in );
        in.close();

        // setting the global again, since it is not serialized with the session
        List<List> results = (List<List>) new ArrayList<List>();
        ksession.setGlobal( "results",
View Full Code Here

                           KieSessionConfiguration config) {
        try {
            Marshaller marshaller = MarshallerFactory.newMarshaller( knowledgeBase );
            ByteArrayOutputStream o = new ByteArrayOutputStream();
            marshaller.marshall( o, ksession );
            ksession = marshaller.unmarshall( new ByteArrayInputStream( o.toByteArray() ), config, KnowledgeBaseFactory.newEnvironment() );
            ksession.fireAllRules();
            //scheduler = ksession.<SessionClock>getSessionClock();
        } catch ( Exception e ) {
            throw new RuntimeException( e );
        }
View Full Code Here

        KieSession ksession = null;
        DroolsObjectInputStream droolsIn = new DroolsObjectInputStream( input, this.getClass().getClassLoader() );
        try {
            KnowledgeBase kbase = (KnowledgeBase) droolsIn.readObject();
            Marshaller mas = createMarshaller( kbase );
            ksession = mas.unmarshall(droolsIn);
        } catch ( EOFException e ) {
            e.printStackTrace();
            fail( e.getMessage() );
        } finally {
            droolsIn.close();
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.