KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > versant > core > jdo > tools > ant > VdsSchemaTask


1
2 /*
3  * Copyright (c) 1998 - 2005 Versant Corporation
4  * All rights reserved. This program and the accompanying materials
5  * are made available under the terms of the Eclipse Public License v1.0
6  * which accompanies this distribution, and is available at
7  * http://www.eclipse.org/legal/epl-v10.html
8  *
9  * Contributors:
10  * Versant Corporation - initial API and implementation
11  */

12 /*
13  * Created on Aug 23, 2004
14  */

15
16 /**
17  * This file was edited for Poleposition to make it compilable.
18  * June 20 2005
19  * see XXPP
20  */

21
22 package com.versant.core.jdo.tools.ant;
23
24 import java.util.*;
25
26
27 // XXPP commented out
28
// import com.versant.core.vds.tools.jdo.SchemaTool;
29

30
31
32
33
34 /**
35  * @author hzhao
36  */

37
38 /**
39  * This ant task will create/evolve the VDS schema for a set of .jdo files and
40  * classes. The classes do not have to be enhanced. The schema will be created
41  * in VDS database specified in the project file. This class is a wrapper class
42  * of {@link com.versant.core.vds.tools.jdo.SchemaTool} which should be used
43  * outside of Ant by creating an instance and setting properties or by using
44  * the mainmethod and command line args. {@see com.versant.jdo.tools.SchemaTool}
45  * for options and arguments.
46  */

47 public class VdsSchemaTask extends JdoTaskBase {
48
49     private ArrayList cmdArgs = new ArrayList();
50   
51
52     public void execute() {
53         cmdArgs.add("-cp");
54       cmdArgs.add(classpath.toString());
55       cmdArgs.add("-p");
56       cmdArgs.add(configFilename);
57
58       String JavaDoc[] args = new String JavaDoc[cmdArgs.size()];
59       cmdArgs.toArray(args);
60
61       try {
62           
63 // XXPP commented out
64
// SchemaTool.main(args);
65

66       } catch (Exception JavaDoc exp) {
67         System.err.println (exp);
68         exp.printStackTrace();
69       }
70     }
71
72
73     public void setOutputdir(String JavaDoc out) {
74       cmdArgs.add("-out");
75       cmdArgs.add(out);
76     }
77
78     public void setDefine(String JavaDoc s) {
79       if (isTrue(s)) {
80         cmdArgs.add("-action");
81         cmdArgs.add("define");
82       }
83     }
84
85     public void setCompare(String JavaDoc s) {
86       if (isTrue(s)) {
87         cmdArgs.add("-action");
88         cmdArgs.add("compare");
89       }
90     }
91
92     public void setEvolve(String JavaDoc s) {
93       if (isTrue(s)) {
94         cmdArgs.add("-action");
95         cmdArgs.add("evolve");
96       }
97     }
98
99     private static boolean isTrue(String JavaDoc s) {
100         return "*".equals(s) || "true".equals(s);
101     }
102 }
103
Popular Tags