public static ClockType resolveClockType( String id ) { if( PSEUDO_CLOCK.getId().equalsIgnoreCase( id ) ) { return PSEUDO_CLOCK; } else if( REALTIME_CLOCK.getId().equalsIgnoreCase( id ) ) { return REALTIME_CLOCK; } throw new IllegalArgumentException( "Illegal enum value '" + id + "' for ClockType" ); }
/** * Creates a new KnowledgeSessionConfiguration given the specified component implementation config. * @param cic the component implementation config * @return the config */ public static KnowledgeSessionConfiguration getSessionConfiguration(ComponentImplementationConfig cic) { KnowledgeSessionConfiguration ksessionConfig = KnowledgeBaseFactory.newKnowledgeSessionConfiguration(getProperties(cic)); ClockType clock = cic.getModel().getClock(); if (clock != null) { switch (clock) { case REALTIME: ksessionConfig.setOption(ClockTypeOption.get(org.drools.ClockType.REALTIME_CLOCK.getId())); break; case PSEUDO: ksessionConfig.setOption(ClockTypeOption.get(org.drools.ClockType.PSEUDO_CLOCK.getId())); break; } } return ksessionConfig; }
private void init(Properties properties, ClassLoader... classLoader) { this.classLoader = ClassLoaderUtil.getClassLoader( classLoader, getClass(), false ); this.immutable = false; this.chainedProperties = new ChainedProperties( "session.conf", this.classLoader ); if ( properties != null ) { this.chainedProperties.addProperties( properties ); } setKeepReference( Boolean.valueOf( this.chainedProperties.getProperty( KeepReferenceOption.PROPERTY_NAME, "true" ) ).booleanValue() ); setBeliefSystemType( BeliefSystemType.resolveBeliefSystemType( this.chainedProperties.getProperty( BeliefSystemTypeOption.PROPERTY_NAME, BeliefSystemType.SIMPLE.getId())) ); setClockType( ClockType.resolveClockType( this.chainedProperties.getProperty( ClockTypeOption.PROPERTY_NAME, ClockType.REALTIME_CLOCK.getId() ) ) ); setQueryListenerClass( this.chainedProperties.getProperty( QueryListenerOption.PROPERTY_NAME, QueryListenerOption.STANDARD.getAsString() ) ); setTimerJobFactoryType( TimerJobFactoryType.resolveTimerJobFactoryType( this.chainedProperties.getProperty( TimerJobFactoryOption.PROPERTY_NAME, TimerJobFactoryType.DEFUALT.getId() ) ) ); }