KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > izforge > izpack > event > ActionBase


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 2004 Klaus Bartz
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.event;
23
24 import java.io.Serializable JavaDoc;
25 import java.util.HashSet JavaDoc;
26
27 /**
28  * Base class for action classes like AntAction.
29  *
30  * @author Klaus Bartz
31  *
32  */

33 public class ActionBase implements Serializable JavaDoc
34 {
35
36     // --- String constants for parsing the XML specification -----------------
37
// --- These definitions are placed here because the const strings are -----
38
// --- used by more than one InstallerListener and UninstallerListener -----
39
// --- class. --------------------------------------------------------------
40

41     private static final long serialVersionUID = 3690478013149884728L;
42
43     public static final String JavaDoc PACK = "pack";
44
45     public static final String JavaDoc NAME = "name";
46
47     // Order related "symbols"
48
public static final String JavaDoc ORDER = "order";
49
50     public static final String JavaDoc BEFOREPACK = "beforepack";
51
52     public static final String JavaDoc AFTERPACK = "afterpack";
53
54     public static final String JavaDoc BEFOREPACKS = "beforepacks";
55
56     public static final String JavaDoc AFTERPACKS = "afterpacks";
57
58     public static final String JavaDoc UNINSTALL_ORDER = "uninstall_order";
59
60     public static final String JavaDoc BEFOREDELETION = "beforedeletion";
61
62     public static final String JavaDoc AFTERDELETION = "afterdeletion";
63
64     public static final String JavaDoc PROPERTY = "property";
65
66     public static final String JavaDoc VALUE = "value";
67
68     public static final String JavaDoc YES = "yes";
69
70     public static final String JavaDoc NO = "no";
71
72     public static final String JavaDoc FALSE = "false";
73
74     public static final String JavaDoc TRUE = "true";
75
76     public static final String JavaDoc QUIET = "quiet";
77
78     public static final String JavaDoc VERBOSE = "verbose";
79
80     public static final String JavaDoc LOGFILE = "logfile";
81
82     public static final String JavaDoc BUILDFILE = "buildfile";
83
84     public static final String JavaDoc PROPERTYFILE = "propertyfile";
85
86     public static final String JavaDoc PATH = "path";
87
88     public static final String JavaDoc SRCDIR = "srcdir";
89
90     public static final String JavaDoc TARGETDIR = "targetdir";
91
92     public static final String JavaDoc TARGET = "target";
93
94     public static final String JavaDoc UNINSTALL_TARGET = "uninstall_target";
95
96     public static final String JavaDoc ACTION = "action";
97
98     public static final String JavaDoc UNINSTALL_ACTION = "uninstall_action";
99
100     public static final String JavaDoc ONDEST = "ondestination";
101
102     public static final String JavaDoc COPY = "copy";
103
104     public static final String JavaDoc REMOVE = "remove";
105
106     public static final String JavaDoc REWIND = "rewind";
107
108     public static final String JavaDoc TOUCH = "touch";
109
110     public static final String JavaDoc MOVE = "move";
111
112     public static final String JavaDoc OVERRIDE = "override";
113
114     public static final String JavaDoc UPDATE = "update";
115
116     public static final String JavaDoc NOTHING = "nothing";
117
118     public static final String JavaDoc FILESET = "fileset";
119
120     public static final String JavaDoc MESSAGEID = "messageid";
121
122     public static final String JavaDoc INCLUDE = "include";
123
124     public static final String JavaDoc INCLUDES = "includes";
125
126     public static final String JavaDoc EXCLUDE = "exclude";
127
128     public static final String JavaDoc EXCLUDES = "excludes";
129
130     public static final String JavaDoc OS = "os";
131
132     public static final String JavaDoc FAMILY = "family";
133
134     public static final String JavaDoc VERSION = "version";
135
136     public static final String JavaDoc ARCH = "arch";
137
138     public static final String JavaDoc CASESENSITIVE = "casesensitive";
139
140     public static final String JavaDoc UNIX = "unix";
141
142     public static final String JavaDoc WINDOWS = "windows";
143
144     public static final String JavaDoc MAC = "mac";
145
146     public static final String JavaDoc ASKTRUE = "asktrue";
147
148     public static final String JavaDoc ASKFALSE = "askfalse";
149
150     private static final HashSet JavaDoc installOrders = new HashSet JavaDoc();
151
152     private static final HashSet JavaDoc uninstallOrders = new HashSet JavaDoc();
153
154     protected String JavaDoc uninstallOrder = ActionBase.BEFOREDELETION;
155
156     protected String JavaDoc order = null;
157
158     protected String JavaDoc messageID = null;
159
160     static
161     {
162         installOrders.add(ActionBase.BEFOREPACK);
163         installOrders.add(ActionBase.AFTERPACK);
164         installOrders.add(ActionBase.BEFOREPACKS);
165         installOrders.add(ActionBase.AFTERPACKS);
166         uninstallOrders.add(ActionBase.BEFOREDELETION);
167         uninstallOrders.add(ActionBase.AFTERDELETION);
168     }
169
170     /**
171      * Default constructor
172      */

173     public ActionBase()
174     {
175         super();
176     }
177
178     /**
179      * Returns the order.
180      *
181      * @return the order
182      */

183     public String JavaDoc getOrder()
184     {
185         return order;
186     }
187
188     /**
189      * Sets the order to the given string. Valid values are "beforepacks", "beforepack", "afterpack"
190      * and "afterpacks".
191      *
192      * @param order order to be set
193      */

194     public void setOrder(String JavaDoc order) throws Exception JavaDoc
195     {
196         if (!installOrders.contains(order)) throw new Exception JavaDoc("Bad value for order.");
197         this.order = order;
198     }
199
200     /**
201      * Returns the order for uninstallation.
202      *
203      * @return the order for uninstallation
204      */

205     public String JavaDoc getUninstallOrder()
206     {
207         return uninstallOrder;
208     }
209
210     /**
211      * Sets the order to the given string for uninstallation. Valid values are "beforedeletion" and
212      * "afterdeletion".
213      *
214      * @param order order to be set
215      */

216     public void setUninstallOrder(String JavaDoc order) throws Exception JavaDoc
217     {
218         if (!uninstallOrders.contains(order)) throw new Exception JavaDoc("Bad value for order.");
219         this.uninstallOrder = order;
220     }
221
222     /**
223      * Returns the defined message ID for this action.
224      *
225      * @return the defined message ID
226      */

227     public String JavaDoc getMessageID()
228     {
229         return messageID;
230     }
231
232     /**
233      * Sets the message ID to the given string.
234      *
235      * @param string string to be used as message ID
236      */

237     public void setMessageID(String JavaDoc string)
238     {
239         messageID = string;
240     }
241
242 }
243
Popular Tags