SessionConfiguration config,
ProtobufMessages.KnowledgeSession _session) throws IOException {
FactHandleFactory handleFactory = context.ruleBase.newFactHandleFactory( _session.getRuleData().getLastId(),
_session.getRuleData().getLastRecency() );
InternalFactHandle initialFactHandle = new DefaultFactHandle( _session.getRuleData().getInitialFact().getId(),
InitialFactImpl.getInstance(),
_session.getRuleData().getInitialFact().getRecency(),
null );
context.handles.put( initialFactHandle.getId(),
initialFactHandle );
DefaultAgenda agenda = context.ruleBase.getConfiguration().getComponentFactory().getAgendaFactory().createAgenda( context.ruleBase, false );
readAgenda( context,
_session.getRuleData(),
agenda );
ReteooStatefulSession session = new ReteooStatefulSession( id,
context.ruleBase,
handleFactory,
initialFactHandle,
0,
config,
agenda,
environment );
new StatefulKnowledgeSessionImpl( session );
initialFactHandle.setEntryPoint( session.getEntryPoints().get( EntryPoint.DEFAULT.getEntryPointId() ) );
return session;
}