svn-gvsig-desktop / trunk / build / distribution / IzPack / src / lib / com / izforge / izpack / event / ActionBase.java @ 21757
History | View | Annotate | Download (6.37 KB)
1 |
/*
|
---|---|
2 |
* $Id: ActionBase.java 5819 2006-06-14 07:29:09Z cesar $
|
3 |
* IzPack
|
4 |
* Copyright (C) 2004 Klaus Bartz
|
5 |
*
|
6 |
* File : ActionBase.java
|
7 |
* Description : Data class for ant action listeners.
|
8 |
* Author's email : bartzkau@users.berlios.de
|
9 |
* Website : http://www.izforge.com
|
10 |
*
|
11 |
* This program is free software; you can redistribute it and/or
|
12 |
* modify it under the terms of the GNU General Public License
|
13 |
* as published by the Free Software Foundation; either version 2
|
14 |
* of the License, or any later version.
|
15 |
*
|
16 |
* This program is distributed in the hope that it will be useful,
|
17 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
18 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
19 |
* GNU General Public License for more details.
|
20 |
*
|
21 |
* You should have received a copy of the GNU General Public License
|
22 |
* along with this program; if not, write to the Free Software
|
23 |
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
24 |
*/
|
25 |
package com.izforge.izpack.event; |
26 |
|
27 |
import java.io.Serializable; |
28 |
import java.util.HashSet; |
29 |
|
30 |
/**
|
31 |
* Base class for action classes like AntAction.
|
32 |
*
|
33 |
* @author Klaus Bartz
|
34 |
*
|
35 |
*/
|
36 |
public class ActionBase implements Serializable |
37 |
{ |
38 |
// --- String constants for parsing the XML specification -----------------
|
39 |
// --- These definitions are placed here because the const strings are -----
|
40 |
// --- used by more than one InstallerListener and UninstallerListener -----
|
41 |
// --- class. --------------------------------------------------------------
|
42 |
|
43 |
public static final String PACK = "pack"; |
44 |
public static final String NAME = "name"; |
45 |
// Order related "symbols"
|
46 |
public static final String ORDER = "order"; |
47 |
public static final String BEFOREPACK = "beforepack"; |
48 |
public static final String AFTERPACK = "afterpack"; |
49 |
public static final String BEFOREPACKS = "beforepacks"; |
50 |
public static final String AFTERPACKS = "afterpacks"; |
51 |
public static final String UNINSTALL_ORDER = "uninstall_order"; |
52 |
public static final String BEFOREDELETION = "beforedeletion"; |
53 |
public static final String AFTERDELETION = "afterdeletion"; |
54 |
|
55 |
public static final String PROPERTY = "property"; |
56 |
public static final String VALUE = "value"; |
57 |
|
58 |
public static final String YES = "yes"; |
59 |
public static final String NO = "no"; |
60 |
public static final String FALSE = "false"; |
61 |
public static final String TRUE = "true"; |
62 |
|
63 |
public static final String QUIET = "quiet"; |
64 |
public static final String VERBOSE = "verbose"; |
65 |
|
66 |
public static final String LOGFILE = "logfile"; |
67 |
public static final String BUILDFILE = "buildfile"; |
68 |
public static final String PROPERTYFILE = "propertyfile"; |
69 |
|
70 |
public static final String PATH = "path"; |
71 |
public static final String SRCDIR = "srcdir"; |
72 |
public static final String TARGETDIR = "targetdir"; |
73 |
|
74 |
public static final String TARGET = "target"; |
75 |
public static final String UNINSTALL_TARGET = "uninstall_target"; |
76 |
public static final String ACTION = "action"; |
77 |
public static final String UNINSTALL_ACTION = "uninstall_action"; |
78 |
|
79 |
public static final String ONDEST = "ondestination"; |
80 |
public static final String COPY = "copy"; |
81 |
public static final String REMOVE = "remove"; |
82 |
public static final String REWIND = "rewind"; |
83 |
public static final String TOUCH = "touch"; |
84 |
public static final String MOVE = "move"; |
85 |
public static final String OVERRIDE = "override"; |
86 |
public static final String UPDATE = "update"; |
87 |
public static final String NOTHING = "nothing"; |
88 |
|
89 |
public static final String FILESET = "fileset"; |
90 |
public static final String MESSAGEID = "messageid"; |
91 |
public static final String INCLUDE = "include"; |
92 |
public static final String INCLUDES = "includes"; |
93 |
public static final String EXCLUDE = "exclude"; |
94 |
public static final String EXCLUDES = "excludes"; |
95 |
|
96 |
public static final String OS = "os"; |
97 |
public static final String FAMILY = "family"; |
98 |
public static final String VERSION = "version"; |
99 |
public static final String ARCH = "arch"; |
100 |
public static final String CASESENSITIVE = "casesensitive"; |
101 |
public static final String UNIX = "unix"; |
102 |
public static final String WINDOWS = "windows"; |
103 |
public static final String MAC = "mac"; |
104 |
public static final String ASKTRUE = "asktrue"; |
105 |
public static final String ASKFALSE = "askfalse"; |
106 |
|
107 |
private static final HashSet installOrders = new HashSet(); |
108 |
private static final HashSet uninstallOrders = new HashSet(); |
109 |
|
110 |
protected String uninstallOrder = ActionBase.BEFOREDELETION; |
111 |
|
112 |
protected String order = null; |
113 |
|
114 |
protected String messageID = null; |
115 |
|
116 |
static
|
117 |
{ |
118 |
installOrders.add(ActionBase.BEFOREPACK); |
119 |
installOrders.add(ActionBase.AFTERPACK); |
120 |
installOrders.add(ActionBase.BEFOREPACKS); |
121 |
installOrders.add(ActionBase.AFTERPACKS); |
122 |
uninstallOrders.add(ActionBase.BEFOREDELETION); |
123 |
uninstallOrders.add(ActionBase.AFTERDELETION); |
124 |
} |
125 |
|
126 |
/**
|
127 |
* Default constructor
|
128 |
*/
|
129 |
public ActionBase()
|
130 |
{ |
131 |
super();
|
132 |
} |
133 |
|
134 |
/**
|
135 |
* Returns the order.
|
136 |
* @return the order
|
137 |
*/
|
138 |
public String getOrder() |
139 |
{ |
140 |
return order;
|
141 |
} |
142 |
|
143 |
/**
|
144 |
* Sets the order to the given string.
|
145 |
* Valid values are "beforepacks", "beforepack",
|
146 |
* "afterpack" and "afterpacks".
|
147 |
* @param order order to be set
|
148 |
*/
|
149 |
public void setOrder( String order ) throws Exception |
150 |
{ |
151 |
if( ! installOrders.contains(order ))
|
152 |
throw new Exception("Bad value for order."); |
153 |
this.order = order;
|
154 |
} |
155 |
|
156 |
/**
|
157 |
* Returns the order for uninstallation.
|
158 |
* @return the order for uninstallation
|
159 |
*/
|
160 |
public String getUninstallOrder() |
161 |
{ |
162 |
return uninstallOrder;
|
163 |
} |
164 |
|
165 |
/**
|
166 |
* Sets the order to the given string for uninstallation.
|
167 |
* Valid values are "beforedeletion" and "afterdeletion".
|
168 |
* @param order order to be set
|
169 |
*/
|
170 |
public void setUninstallOrder( String order ) throws Exception |
171 |
{ |
172 |
if( ! uninstallOrders.contains(order ))
|
173 |
throw new Exception("Bad value for order."); |
174 |
this.uninstallOrder = order;
|
175 |
} |
176 |
|
177 |
|
178 |
|
179 |
/**
|
180 |
* Returns the defined message ID for this action.
|
181 |
* @return the defined message ID
|
182 |
*/
|
183 |
public String getMessageID() |
184 |
{ |
185 |
return messageID;
|
186 |
} |
187 |
|
188 |
/**
|
189 |
* Sets the message ID to the given string.
|
190 |
* @param string string to be used as message ID
|
191 |
*/
|
192 |
public void setMessageID(String string) |
193 |
{ |
194 |
messageID = string; |
195 |
} |
196 |
|
197 |
} |