public static void main ( String [ ] args ) { //Adding custom equivalence class generation transformer - NOTE this will get applied during graph traversal--> //MODEL USAGE EXAMPLE: <assign name="var_out_V1_2" expr="%ssn"/> <dg:transform name="EQ"/> Map < String , DataTransformer > transformers = new HashMap < String , DataTransformer > ( ) ; transformers . put ( "EQ" , new EquivalenceClassTransformer ( ) ) ; Vector < CustomTagExtension > cte = new Vector < CustomTagExtension > ( ) ; cte . add ( new InLineTransformerExtension ( transformers ) ) ; Engine engine = new SCXMLEngine ( cte ) ; //will default to samplemachine, but you could specify a different file if you choose to InputStream is = CmdLine . class . getResourceAsStream ( "/" + ( args . length == 0 ? "samplemachine" : args [ 0 ] ) + ".xml" ) ; engine . setModelByInputFileStream ( is ) ; // Usually, this should be more than the number of threads you intend to run engine . setBootstrapMin ( 1 ) ; //Prepare the consumer with the proper writer and transformer DataConsumer consumer = new DataConsumer ( ) ; consumer . addDataTransformer ( new SampleMachineTransformer ( ) ) ; //Adding custom equivalence class generation transformer - NOTE this will get applied post data generation. //MODEL USAGE EXAMPLE: <dg:assign name="var_out_V2" set="%regex([0-9]{3}[A-Z0-9]{5})"/> consumer . addDataTransformer ( new EquivalenceClassTransformer ( ) ) ; consumer . addDataWriter ( new DefaultWriter ( System . out , new String [ ] { "var_1_1" , "var_1_2" , "var_1_3" , "var_1_4" , "var_1_5" , "var_1_6" , "var_1_7" , "var_2_1" , "var_2_2" , "var_2_3" , "var_2_4" , "var_2_5" , "var_2_6" , "var_2_7" , "var_2_8" } ) ) ; //Prepare the distributor DefaultDistributor defaultDistributor = new DefaultDistributor ( ) ; defaultDistributor . setThreadCount ( 1 ) ; defaultDistributor . setDataConsumer ( consumer ) ; Logger . getLogger ( "org.apache" ) . setLevel ( Level . WARN ) ; engine . process ( defaultDistributor ) ; }
Entry point for the example .