KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > izforge > izpack > ant > Property


1 /*
2  * IzPack - Copyright 2001-2007 Julien Ponge, All Rights Reserved.
3  *
4  * http://www.izforge.com/izpack/
5  * http://developer.berlios.de/projects/izpack/
6  *
7  * Copyright 2005 Chad McHenry
8  *
9  * 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 JavaDoc;
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 {
36     /** Store the property[s] of this Property tag. */
37     protected Properties JavaDoc props = new Properties JavaDoc();
38     
39     /** Creates new IZPackTask */
40     public Property() {
41         super(false);
42     }
43
44     public Properties JavaDoc getProperties()
45     {
46         return props;
47     }
48     
49     /**
50      * Overridden to store properties locally, not in the Ant Project.
51      *
52      * @param n name of property
53      * @param v value to set
54      */

55     protected void addProperty(String JavaDoc n, String JavaDoc v) {
56         if (props.get(n) == null)
57             props.put(n, v);
58         else
59             log("Override ignored for " + n, Project.MSG_VERBOSE);
60     }
61 }
62
Popular Tags