01: /*
02: * IzPack - Copyright 2001-2008 Julien Ponge, All Rights Reserved.
03: *
04: * http://izpack.org/
05: * http://izpack.codehaus.org/
06: *
07: * Copyright 2005 Chad McHenry
08: *
09: * Licensed under the Apache License, Version 2.0 (the "License");
10: * you may not use this file except in compliance with the License.
11: * You may obtain a copy of the License at
12: *
13: * http://www.apache.org/licenses/LICENSE-2.0
14: *
15: * Unless required by applicable law or agreed to in writing, software
16: * distributed under the License is distributed on an "AS IS" BASIS,
17: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18: * See the License for the specific language governing permissions and
19: * limitations under the License.
20: */
21:
22: package com.izforge.izpack.ant;
23:
24: import java.util.Properties;
25:
26: import org.apache.tools.ant.Project;
27:
28: /**
29: * A subclass of Ant Property to validate values, but not add to the ant
30: * project's properties.
31: *
32: * @author Chad McHenry
33: */
34: public class Property extends org.apache.tools.ant.taskdefs.Property {
35: /** Store the property[s] of this Property tag. */
36: protected Properties props = new Properties();
37:
38: /** Creates new IZPackTask */
39: public Property() {
40: super (false);
41: }
42:
43: public Properties getProperties() {
44: return props;
45: }
46:
47: /**
48: * Overridden to store properties locally, not in the Ant Project.
49: *
50: * @param n name of property
51: * @param v value to set
52: */
53: protected void addProperty(String n, String v) {
54: if (props.get(n) == null)
55: props.put(n, v);
56: else
57: log("Override ignored for " + n, Project.MSG_VERBOSE);
58: }
59: }
|