1   /*******************************************************************************
2    * Copyright (c) 2009 Ordina and committers to Mod4j
3    * All rights reserved. This program and the accompanying materials
4    * are made available under the terms of the Eclipse Public License v1.0
5    * which accompanies this distribution, and is available at
6    * http://www.eclipse.org/legal/epl-v10.html
7    *
8    * Contributors:
9    *     Ordina - initial implementation
10   *******************************************************************************/
11  package org.mod4j.dslcommon.openarchitectureware;
12  
13  import org.mod4j.dslcommon.io.DirectoryWalker;
14  
15  public class Codegen {
16  
17      /**
18       * @param args
19       */
20      public static void main(String[] args) {
21          // TODO Auto-generated method stub
22          DslExtension dsl = new DslExtension("BusinessDomainDsl", "BusinessDomainDsl",
23                  "BusinessDomainDsl.BusinessDomainDslPackage", ".busmod", "crossx/busmod2crossx2.oaw",
24                  "codegen/BusinessDomainDsl.oaw", "businessDomain/BusinessDomainDsl.properties");
25  
26          String dir = "D:/mod4j/repository/modules/RecordShop-ExampleProject/RecordShop-dslModels";
27  
28          execute(dir, dsl);
29      }
30  
31      private static String MODEL_DIR = "src/model";
32  
33      public static void execute(String projectDir, DslExtension dsl) {
34          DirectoryWalker walker = new DirectoryWalker();
35          CrossxDirectoryVisitor vis = new CrossxDirectoryVisitor(dsl, projectDir, false);
36          try {
37              walker.walk(projectDir + "/" + MODEL_DIR, vis);
38              CodegenDirectoryVisitor codegen = new CodegenDirectoryVisitor(dsl, projectDir, false);
39              walker.walk(projectDir + "/" + MODEL_DIR, codegen);
40          } catch (Exception e) {
41              // TODO Auto-generated catch block
42              e.printStackTrace();
43          }
44      }
45  
46  }