/*
* Enhydra Java Application Server Project
*
* The contents of this file are subject to the Enhydra Public License
* Version 1.1 (the "License"); you may not use this file except in
* compliance with the License. You may obtain a copy of the License on
* the Enhydra web site ( http://www.enhydra.org/ ).
*
* Software distributed under the License is distributed on an "AS IS"
* basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
* the License for the specific terms governing rights and limitations
* under the License.
*
* The Initial Developer of the Enhydra Application Server is Lutris
* Technologies, Inc. The Enhydra Application Server and portions created
* by Lutris Technologies, Inc. are Copyright Lutris Technologies, Inc.
* All Rights Reserved.
*
* Contributor(s):
* Paul Mahar
*
*/
package org.enhydra.tool.codegen;
// ToolBox imports
import org.enhydra.tool.common.ReplacementSet;
import org.enhydra.tool.common.Replacement;
import org.enhydra.tool.common.ToolException;
// Standard imports
import java.io.File;
import java.util.Calendar;
/**
* This class instantiates a set of default Replacements during
* initialization.
*/
public class ProjectReplacementSet extends ReplacementSet implements Constants {
/**
* Replacement key for the project name which may be used as
* a directory name and as part of some file names.
*/
public static final String at_PROJECT_at = "at_PROJECT_at"; // nores
/**
* Replacement key for the package directory.
*/
public static final String at_PACKAGE_DIR_at =
"at_PACKAGE_DIR_at"; // nores
/**
* Replacement key for the Java package name.
*/
public static final String JAVA_PACKAGE = "@JAVA_PACKAGE@"; // nores
/**
* Replacement key for the shell package directory.
*/
public static final String SHELL_PACKAGE_DIR =
"@SHELL_PACKAGE_DIR@"; // nores
/**
* Replacement key for the shell Root directory.
*/
public static final String SHELL_ROOT_PATH = "@SHELL_ROOT_PATH@"; // nores
/**
* Replacement key for the copyright
*/
public static final String COPYRIGHT = "@COPYRIGHT@"; // nores
/**
* Replacement key for the year
*/
public static final String at_YEAR_at = "at_YEAR_at"; // nores
/**
* Create a default set of replacement operations. This is a convenience
* class that can be used as the basis for building custom replacement
* set within a generator.
*/
public ProjectReplacementSet() {
Calendar cal = Calendar.getInstance();
try {
this.add(new Replacement(ProjectReplacementSet.at_PROJECT_at,
ProjectReplacementSet.at_PROJECT_at));
this.add(new Replacement(ProjectReplacementSet.at_PACKAGE_DIR_at,
ProjectReplacementSet.at_PACKAGE_DIR_at));
this.add(new Replacement(ProjectReplacementSet.JAVA_PACKAGE,
ProjectReplacementSet.JAVA_PACKAGE));
this.add(new Replacement(ProjectReplacementSet.SHELL_PACKAGE_DIR,
ProjectReplacementSet.SHELL_PACKAGE_DIR));
this.add(new Replacement(ProjectReplacementSet.SHELL_ROOT_PATH,
ProjectReplacementSet.SHELL_ROOT_PATH));
this.add(new Replacement(ProjectReplacementSet.COPYRIGHT,
new String()));
this.add(new Replacement(ProjectReplacementSet.at_YEAR_at,
Integer.toString(cal.get(Calendar.YEAR))));
} catch (ToolException e) {
e.printStackTrace();
}
}
}
|