The SDK contains several different resources and methods to read, analyze, and output the contents of a CCL file.
public void walkModel(String theFile) { XtextResourceSet myResourceSet = new XtextResourceSet(); URI uri = URI.createFileURI(theFile); Resource resource = myResourceSet.getResource(uri, true); EcoreUtil.resolveAll(resource); Statements root = (Statements)resource.getContents().get(0); List <TopStatement> stmnts = root.getStmts(); for(TopStatement d: stmnts) { printCclName(d); } prettyPrint(root); } void prettyPrint(EObject theEO) { try { ISerializer serializer = getSerializer(); if(serializer==null) { System.out.println("Injection bug"); } else { System.out.println(serializer.serialize(theEO)); } } catch(Exception e) { System.out.println(e.getMessage()); } }
DECLARE PARAMETER integer the_integer := 1; PARAMETER boolean the_boolean := FALSE; END; CREATE SCHEMA NewSchema ( col_0 integer , col_1 integer , col_2 integer , col_3 integer , col_4 integer , col_5 integer , col_6 integer , col_7 integer , col_8 integer , col_9 integer ); CREATE SCHEMA NewSchema2 ( AAAAA integer ); CREATE INPUT STREAM NewInputStream SCHEMA NewSchema; CREATE INPUT WINDOW NewInputWindowWithInlineSchema SCHEMA ( c_key integer , c_1 integer , c_2 long , c_3 string ) PRIMARY KEY ( c_key ); CREATE INPUT WINDOW NewInputWindow SCHEMA NewSchema PRIMARY KEY ( col_0 ) KEEP ALL ROWS; CREATE OUTPUT WINDOW NewDerivedWindow PRIMARY KEY DEDUCED AS SELECT * FROM NewInputWindow IN1; CREATE OUTPUT STREAM NewDerivedStream AS SELECT * FROM NewInputStream IN1; CREATE FLEX NewFlex IN NewInputStream OUT OUTPUT WINDOW NewFlex SCHEMA NewSchema PRIMARY KEY ( col_0 ) BEGIN ON NewInputStream { }; END; CREATE OUTPUT SPLITTER NewSplitter AS WHEN 1 THEN NewSplitter_Output SELECT * FROM NewInputWindow; CREATE INPUT WINDOW JoinInputWindow1 SCHEMA NewSchema PRIMARY KEY ( col_0 ) KEEP ALL ROWS; CREATE INPUT WINDOW JoinInputWindow2 SCHEMA NewSchema2 PRIMARY KEY ( AAAAA ) KEEP ALL ROWS; CREATE OUTPUT WINDOW NewJoinWindow PRIMARY KEY ( AAAAA ) AS SELECT * FROM JoinInputWindow1 J1 INNER JOIN JoinInputWindow2 J2 ON J1.col_0 = J2.AAAAA; CREATE INPUT STREAM NewInputStream1 SCHEMA NewSchema2; CREATE INPUT STREAM NewInputStream2 SCHEMA NewSchema2; CREATE OUTPUT STREAM NewUnionStream AS SELECT * FROM NewInputStream1 U1 UNION SELECT * FROM NewInputStream2 U2; CREATE OUTPUT ERROR STREAM NewErrorStream ON NewUnionStream; CREATE OUTPUT STREAM NewDerivedStreamSelective AS SELECT IN1.col_0 , IN1.col_1 , IN1.col_2 , IN1.col_3 , IN1.col_4 , IN1.col_5 , IN1.col_6 , IN1.col_7 , IN1.col_8 , IN1.col_9 FROM NewInputStream IN1; CREATE OUTPUT STREAM NewDeriveStreamWithPattern AS SELECT * FROM NewInputStream IN1 MATCHING [ 1 SECOND : IN1 ]; CREATE OUTPUT WINDOW NewCommaJoinWindowWithInputs PRIMARY KEY DEDUCED AS SELECT * FROM JoinInputWindow1 input_1 , JoinInputWindow2 input_2;
NewSchema kind = Schema col_0 integer col_1 integer col_2 integer col_3 integer col_4 integer col_5 integer col_6 integer col_7 integer col_8 integer col_9 integer NewSchema2 kind = Schema AAAAA integer NewInputStream kind = InputStream NewInputWindowWithInlineSchema kind = InputWindow NewInputWindow kind = InputWindow NewDerivedWindow kind = Window NewDerivedStream kind = Stream NewFlex kind = FlexOperator NewSplitter kind = Splitter JoinInputWindow1 kind = InputWindow JoinInputWindow2 kind = InputWindow NewJoinWindow kind = Window NewInputStream1 kind = InputStream NewInputStream2 kind = InputStream NewUnionStream kind = Stream NewErrorStream kind = ErrorStream NewDerivedStreamSelective kind = Stream NewDeriveStreamWithPattern kind = Stream NewCommaJoinWindowWithInputs kind = Window NewDerivedWindowWithWhere kind = Window