01: /**
02: * Copyright 2007 Jens Dietrich Licensed under the Apache License, Version 2.0 (the "License");
03: * you may not use this file except in compliance with the License.
04: * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
05: * Unless required by applicable law or agreed to in writing, software distributed under the
06: * License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
07: * either express or implied. See the License for the specific language governing permissions
08: * and limitations under the License.
09: */package test.nz.org.take.compiler.scenario2;
10:
11: import org.apache.log4j.BasicConfigurator;
12: import nz.org.take.KnowledgeBase;
13: import nz.org.take.KnowledgeSource;
14: import nz.org.take.TakeException;
15: import nz.org.take.compiler.reference.DefaultCompiler;
16: import nz.org.take.compiler.util.jalopy.JalopyCodeFormatter;
17:
18: /**
19: * Script to generate the interface for the test kb.
20: * @see KBFactory
21: * @author <a href="http://www-ist.massey.ac.nz/JBDietrich/">Jens Dietrich</a>
22: */
23:
24: public class GenerateInterfaces {
25:
26: /**
27: * Generate the interface for the example.
28: * @param args
29: */
30: public static void main(String[] args) throws Exception {
31: BasicConfigurator.configure();
32: nz.org.take.compiler.Compiler compiler = new DefaultCompiler();
33: compiler.add(new JalopyCodeFormatter());
34:
35: // generate kb
36: KnowledgeBase kb = null;
37: try {
38: KnowledgeSource KSrc = new GenerateKB();
39: kb = KSrc.getKnowledgeBase();
40: } catch (TakeException e) {
41: e.printStackTrace();
42: }
43: compiler
44: .setPackageName("test.nz.org.take.compiler.scenario2.generated");
45: compiler.setClassName("KB");
46: compiler.compileInterface(kb);
47:
48: }
49:
50: }
|