KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > enhydra > tool > codegen > ProjectReplacementSet


1
2 /*
3  * Enhydra Java Application Server Project
4  *
5  * The contents of this file are subject to the Enhydra Public License
6  * Version 1.1 (the "License"); you may not use this file except in
7  * compliance with the License. You may obtain a copy of the License on
8  * the Enhydra web site ( http://www.enhydra.org/ ).
9  *
10  * Software distributed under the License is distributed on an "AS IS"
11  * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
12  * the License for the specific terms governing rights and limitations
13  * under the License.
14  *
15  * The Initial Developer of the Enhydra Application Server is Lutris
16  * Technologies, Inc. The Enhydra Application Server and portions created
17  * by Lutris Technologies, Inc. are Copyright Lutris Technologies, Inc.
18  * All Rights Reserved.
19  *
20  * Contributor(s):
21  * Paul Mahar
22  *
23  */

24 package org.enhydra.tool.codegen;
25
26 // ToolBox imports
27
import org.enhydra.tool.common.ReplacementSet;
28 import org.enhydra.tool.common.Replacement;
29 import org.enhydra.tool.common.ToolException;
30 // Standard imports
31
import java.io.File JavaDoc;
32 import java.util.Calendar JavaDoc;
33
34 /**
35  * This class instantiates a set of default Replacements during
36  * initialization.
37  */

38 public class ProjectReplacementSet extends ReplacementSet implements Constants {
39
40     /**
41      * Replacement key for the project name which may be used as
42      * a directory name and as part of some file names.
43      */

44     public static final String JavaDoc at_PROJECT_at = "at_PROJECT_at"; // nores
45

46     /**
47      * Replacement key for the package directory.
48      */

49     public static final String JavaDoc at_PACKAGE_DIR_at =
50         "at_PACKAGE_DIR_at"; // nores
51

52     /**
53      * Replacement key for the Java package name.
54      */

55     public static final String JavaDoc JAVA_PACKAGE = "@JAVA_PACKAGE@"; // nores
56

57     /**
58      * Replacement key for the shell package directory.
59      */

60     public static final String JavaDoc SHELL_PACKAGE_DIR =
61         "@SHELL_PACKAGE_DIR@"; // nores
62

63     /**
64      * Replacement key for the shell Root directory.
65      */

66     public static final String JavaDoc SHELL_ROOT_PATH = "@SHELL_ROOT_PATH@"; // nores
67

68     /**
69      * Replacement key for the copyright
70      */

71     public static final String JavaDoc COPYRIGHT = "@COPYRIGHT@"; // nores
72

73     /**
74      * Replacement key for the year
75      */

76     public static final String JavaDoc at_YEAR_at = "at_YEAR_at"; // nores
77

78     /**
79      * Create a default set of replacement operations. This is a convenience
80      * class that can be used as the basis for building custom replacement
81      * set within a generator.
82      */

83     public ProjectReplacementSet() {
84         Calendar JavaDoc cal = Calendar.getInstance();
85         try {
86             this.add(new Replacement(ProjectReplacementSet.at_PROJECT_at,
87                                      ProjectReplacementSet.at_PROJECT_at));
88             this.add(new Replacement(ProjectReplacementSet.at_PACKAGE_DIR_at,
89                                      ProjectReplacementSet.at_PACKAGE_DIR_at));
90             this.add(new Replacement(ProjectReplacementSet.JAVA_PACKAGE,
91                                      ProjectReplacementSet.JAVA_PACKAGE));
92             this.add(new Replacement(ProjectReplacementSet.SHELL_PACKAGE_DIR,
93                                      ProjectReplacementSet.SHELL_PACKAGE_DIR));
94             this.add(new Replacement(ProjectReplacementSet.SHELL_ROOT_PATH,
95                                      ProjectReplacementSet.SHELL_ROOT_PATH));
96             this.add(new Replacement(ProjectReplacementSet.COPYRIGHT,
97                                      new String JavaDoc()));
98             this.add(new Replacement(ProjectReplacementSet.at_YEAR_at,
99                                      Integer.toString(cal.get(Calendar.YEAR))));
100         } catch (ToolException e) {
101             e.printStackTrace();
102         }
103     }
104
105 }
106
Popular Tags