You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@uima.apache.org by jo...@apache.org on 2009/07/31 16:40:35 UTC
svn commit: r799624 - in
/incubator/uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/pear:
tools/ util/
Author: joern
Date: Fri Jul 31 14:40:34 2009
New Revision: 799624
URL: http://svn.apache.org/viewvc?rev=799624&view=rev
Log:
UIMA-1452
Modified:
incubator/uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/pear/tools/InstallationController.java
incubator/uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/pear/tools/InstallationDescriptor.java
incubator/uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/pear/tools/InstallationDescriptorHandler.java
incubator/uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/pear/tools/InstallationProcessor.java
incubator/uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/pear/tools/InstallationTester.java
incubator/uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/pear/tools/LocalInstallationAgent.java
incubator/uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/pear/tools/PackageBrowser.java
incubator/uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/pear/tools/PackageCreator.java
incubator/uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/pear/util/StringUtil.java
incubator/uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/pear/util/UIMAUtil.java
Modified: incubator/uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/pear/tools/InstallationController.java
URL: http://svn.apache.org/viewvc/incubator/uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/pear/tools/InstallationController.java?rev=799624&r1=799623&r2=799624&view=diff
==============================================================================
--- incubator/uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/pear/tools/InstallationController.java (original)
+++ incubator/uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/pear/tools/InstallationController.java Fri Jul 31 14:40:34 2009
@@ -37,12 +37,14 @@
import java.util.Enumeration;
import java.util.Hashtable;
import java.util.Iterator;
+import java.util.List;
import java.util.Properties;
import java.util.Set;
import java.util.jar.JarFile;
import org.apache.uima.UIMAFramework;
import org.apache.uima.internal.util.I18nUtil;
+import org.apache.uima.pear.tools.InstallationDescriptor.ComponentInfo;
import org.apache.uima.pear.util.FileUtil;
import org.apache.uima.pear.util.MessageRouter;
import org.apache.uima.pear.util.StringUtil;
@@ -313,9 +315,9 @@
private String _mainPearFileLocation = null;
- private Hashtable _installationTable = new Hashtable();
+ private Hashtable<String, String> _installationTable = new Hashtable<String, String>();
- private Hashtable _installationInsDs = new Hashtable();
+ private Hashtable<String, InstallationDescriptor> _installationInsDs = new Hashtable<String, InstallationDescriptor>();
private InstallationDescriptor _insdObject;
@@ -354,10 +356,10 @@
throws IOException {
// create list of JAR files in a given directory
if (libDir.isDirectory()) {
- Collection fileList = FileUtil.createFileList(libDir);
- Iterator files = fileList.iterator();
+ Collection<File> fileList = FileUtil.createFileList(libDir);
+ Iterator<File> files = fileList.iterator();
while (files.hasNext()) {
- File file = (File) files.next();
+ File file = files.next();
if (file.getName().toLowerCase().endsWith(JAR_FILE_EXT)) {
if (listBuffer.length() > 0)
listBuffer.append(File.pathSeparatorChar);
@@ -384,7 +386,7 @@
protected static boolean addToSystemEnvTable(Properties sysEnvTable, String localKey,
String localValue) {
boolean done = false;
- Enumeration sysKeys = sysEnvTable.keys();
+ Enumeration<Object> sysKeys = sysEnvTable.keys();
while (sysKeys.hasMoreElements() && !done) {
String sysKey = (String) sysKeys.nextElement();
// system key and local key could have different cases
@@ -407,16 +409,16 @@
*/
public static String[] buildArrayOfNetworkParams(InstallationDescriptor insdObject) {
String[] paramsArray = new String[0];
- ArrayList paramsList = new ArrayList();
+ List<String> paramsList = new ArrayList<String>();
StringBuffer itemBuffer = new StringBuffer();
- Set pNames = insdObject.getMainComponentNetworkParamNames();
+ Set<String> pNames = insdObject.getMainComponentNetworkParamNames();
// go through specified parameters and add them to the list
if (pNames != null) {
- Iterator pList = pNames.iterator();
+ Iterator<String> pList = pNames.iterator();
while (pList.hasNext()) {
- String pName = (String) pList.next();
+ String pName = pList.next();
Properties param = insdObject.getMainComponentNetworkParam(pName);
- Enumeration keys = param.keys();
+ Enumeration<Object> keys = param.keys();
while (keys.hasMoreElements()) {
String key = (String) keys.nextElement();
String value = param.getProperty(key);
@@ -464,12 +466,11 @@
cpBuffer = addListOfJarFiles(compLibDir, cpBuffer);
}
// append all specified CLASSPATH env.var. settings
- Iterator envActions = insdObject.getInstallationActions(
+ Iterator<InstallationDescriptor.ActionInfo> envActions = insdObject.getInstallationActions(
InstallationDescriptor.ActionInfo.SET_ENV_VARIABLE_ACT).iterator();
while (envActions.hasNext()) {
// if env.var.name is CLASSPATH, append value to the buffer
- InstallationDescriptor.ActionInfo actInfo = (InstallationDescriptor.ActionInfo) envActions
- .next();
+ InstallationDescriptor.ActionInfo actInfo = envActions.next();
if (actInfo.params != null) {
String varName = actInfo.params.getProperty(InstallationDescriptorHandler.VAR_NAME_TAG);
String varValue = actInfo.params.getProperty(InstallationDescriptorHandler.VAR_VALUE_TAG);
@@ -501,12 +502,11 @@
pBuffer.append(compBinDir.getAbsolutePath().replace('\\', '/'));
}
// append all specified PATH env.var. settings
- Iterator envActions = insdObject.getInstallationActions(
+ Iterator<InstallationDescriptor.ActionInfo> envActions = insdObject.getInstallationActions(
InstallationDescriptor.ActionInfo.SET_ENV_VARIABLE_ACT).iterator();
while (envActions.hasNext()) {
// if env.var.name is PATH, append value to the buffer
- InstallationDescriptor.ActionInfo actInfo = (InstallationDescriptor.ActionInfo) envActions
- .next();
+ InstallationDescriptor.ActionInfo actInfo = envActions.next();
if (actInfo.params != null) {
String varName = actInfo.params.getProperty(InstallationDescriptorHandler.VAR_NAME_TAG);
String varValue = actInfo.params.getProperty(InstallationDescriptorHandler.VAR_VALUE_TAG);
@@ -532,7 +532,7 @@
Properties envVarsTable = buildTableOfEnvVars(insdObject);
StringBuffer envBuffer = new StringBuffer();
// add env.var. setting in the JVM format
- Enumeration names = envVarsTable.keys();
+ Enumeration<Object> names = envVarsTable.keys();
while (names.hasMoreElements()) {
String varName = (String) names.nextElement();
String varValue = envVarsTable.getProperty(varName);
@@ -579,12 +579,11 @@
public static Properties buildTableOfEnvVars(InstallationDescriptor insdObject) {
Properties envVarsTable = new Properties();
// find all 'set_env_variable' actions
- Iterator envActions = insdObject.getInstallationActions(
+ Iterator<InstallationDescriptor.ActionInfo> envActions = insdObject.getInstallationActions(
InstallationDescriptor.ActionInfo.SET_ENV_VARIABLE_ACT).iterator();
while (envActions.hasNext()) {
// add env.var. settings to the table
- InstallationDescriptor.ActionInfo actInfo = (InstallationDescriptor.ActionInfo) envActions
- .next();
+ InstallationDescriptor.ActionInfo actInfo = envActions.next();
String varName = actInfo.params.getProperty(InstallationDescriptorHandler.VAR_NAME_TAG);
String varValue = actInfo.params.getProperty(InstallationDescriptorHandler.VAR_VALUE_TAG);
// exclude CLASSPATH and PATH
@@ -661,8 +660,8 @@
}
InstallationDescriptor insdObject = insdHandler.getInstallationDescriptor();
// get list of separate delegate components
- Hashtable dlgComponents = insdObject.getDelegateComponents();
- Enumeration dlgCompIds = dlgComponents.keys();
+ Hashtable<String, ComponentInfo> dlgComponents = insdObject.getDelegateComponents();
+ Enumeration<String> dlgCompIds = dlgComponents.keys();
while (dlgCompIds.hasMoreElements()) {
String dlgCompId = (String) dlgCompIds.nextElement();
if (!deleteInstalledFiles(dlgCompId, parentDir, true))
@@ -872,16 +871,16 @@
* @throws IOException
* If an I/O exception occurred while loading the installation descriptor files.
*/
- protected static Hashtable getDelegateInstallationDescriptors(Hashtable installationTable)
+ protected static Hashtable<String, InstallationDescriptor> getDelegateInstallationDescriptors(Hashtable<String, String> installationTable)
throws IOException {
// get list of separately installed delegate components
- Enumeration dlgIdList = installationTable.keys();
+ Enumeration<String> dlgIdList = installationTable.keys();
// build Hashtable of delegate InsD objects
- Hashtable dlgInsdObjects = new Hashtable();
+ Hashtable<String, InstallationDescriptor> dlgInsdObjects = new Hashtable<String, InstallationDescriptor>();
while (dlgIdList.hasMoreElements()) {
// process next delegate component
- String dlgId = (String) dlgIdList.nextElement();
- String dlgRootPath = (String) installationTable.get(dlgId);
+ String dlgId = dlgIdList.nextElement();
+ String dlgRootPath = installationTable.get(dlgId);
// get InsD object for this component
PackageBrowser dlgBrowser = new PackageBrowser(new File(dlgRootPath));
InstallationDescriptor dlgInsdObject = dlgBrowser.getInstallationDescriptor();
@@ -1446,11 +1445,11 @@
cpBuffer.append(mainClassPath);
// add component classpath for possible delegate components
if (_installationTable.size() > 0) {
- Enumeration dlgIdList = _installationTable.keys();
+ Enumeration<String> dlgIdList = _installationTable.keys();
while (dlgIdList.hasMoreElements()) {
// process next delegate component
- String dlgId = (String) dlgIdList.nextElement();
- String dlgRootPath = (String) _installationTable.get(dlgId);
+ String dlgId = dlgIdList.nextElement();
+ String dlgRootPath = _installationTable.get(dlgId);
InstallationDescriptor dlgInsD = (InstallationDescriptor) _installationInsDs.get(dlgId);
String dlgClassPath = buildComponentClassPath(dlgRootPath, dlgInsD, true);
if (dlgClassPath.length() > 0) {
@@ -1481,11 +1480,11 @@
pBuffer.append(mainPath);
// add component path for possible delegate components
if (_installationTable.size() > 0) {
- Enumeration dlgIdList = _installationTable.keys();
+ Enumeration<String> dlgIdList = _installationTable.keys();
while (dlgIdList.hasMoreElements()) {
// process next delegate component
- String dlgId = (String) dlgIdList.nextElement();
- String dlgRootPath = (String) _installationTable.get(dlgId);
+ String dlgId = dlgIdList.nextElement();
+ String dlgRootPath = _installationTable.get(dlgId);
InstallationDescriptor dlgInsD = (InstallationDescriptor) _installationInsDs.get(dlgId);
String dlgPath = buildComponentPath(dlgRootPath, dlgInsD);
if (dlgPath.length() > 0) {
@@ -1515,7 +1514,7 @@
Properties envVars = buildTableOfEnvVars(_insdObject);
// add required env vars for possible delegate components
if (_installationTable.size() > 0) {
- Enumeration dlgIdList = _installationTable.keys();
+ Enumeration<String> dlgIdList = _installationTable.keys();
while (dlgIdList.hasMoreElements()) {
// process next delegate component
String dlgId = (String) dlgIdList.nextElement();
@@ -1657,10 +1656,10 @@
*/
protected synchronized void installDelegateComponents() {
// get list of separate delegate components IDs
- Enumeration dlgList = _insdObject.getDelegateComponents().keys();
+ Enumeration<String> dlgList = _insdObject.getDelegateComponents().keys();
while (dlgList.hasMoreElements()) {
// get next separate delegate component ID
- String componentId = (String) dlgList.nextElement();
+ String componentId = dlgList.nextElement();
// check if the same component is available (not in use)
String componentRootPath = null;
try {
@@ -1707,10 +1706,10 @@
*/
protected synchronized void installDelegateComponentsDescriptors() {
// get list of separate delegate components IDs
- Enumeration dlgList = _insdObject.getDelegateComponents().keys();
+ Enumeration<String> dlgList = _insdObject.getDelegateComponents().keys();
while (dlgList.hasMoreElements()) {
// get next separate delegate component ID
- String componentId = (String) dlgList.nextElement();
+ String componentId = dlgList.nextElement();
// install XML descriptors of the next delegate component
InstallationController dlgController = new InstallationController(componentId,
_installationDirPath, false, this._msgRouter, this._defaultMsgListener,
@@ -1791,7 +1790,7 @@
fWriter.println("PATH=" + path);
// the rest of env.vars.
Properties envVarTable = buildTableOfEnvVars();
- Enumeration envVarList = envVarTable.keys();
+ Enumeration<Object> envVarList = envVarTable.keys();
while (envVarList.hasMoreElements()) {
String varName = (String) envVarList.nextElement();
String varValue = envVarTable.getProperty(varName);
@@ -1841,9 +1840,9 @@
// set local config params
packageConfig.setProperty(LocalInstallationAgent.MAIN_ROOT, _mainComponentRootPath.replace(
'\\', '/'));
- Iterator dlgIdList = _installationTable.keySet().iterator();
+ Iterator<String> dlgIdList = _installationTable.keySet().iterator();
while (dlgIdList.hasNext()) {
- String id = (String) dlgIdList.next();
+ String id = dlgIdList.next();
String idRoot = LocalInstallationAgent.COMP_ROOT_PREFIX + id
+ LocalInstallationAgent.COMP_ROOT_SUFFIX;
packageConfig.setProperty(idRoot, ((String) _installationTable.get(id)).replace('\\', '/'));
Modified: incubator/uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/pear/tools/InstallationDescriptor.java
URL: http://svn.apache.org/viewvc/incubator/uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/pear/tools/InstallationDescriptor.java?rev=799624&r1=799623&r2=799624&view=diff
==============================================================================
--- incubator/uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/pear/tools/InstallationDescriptor.java (original)
+++ incubator/uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/pear/tools/InstallationDescriptor.java Fri Jul 31 14:40:34 2009
@@ -104,7 +104,8 @@
*/
public static class ServiceInfo {
// private attributes
- private ArrayList _args = new ArrayList(); // array of ArgInfo objects
+
+ private ArrayList<ArgInfo> _args = new ArrayList<ArgInfo>();
// public attributes
public String command;
@@ -118,7 +119,7 @@
/**
* @return <code>Collection</code> of ArgInfo objects.
*/
- public Collection getArgs() {
+ public Collection<ArgInfo> getArgs() {
return _args;
}
}
@@ -162,7 +163,7 @@
public ServiceInfo serviceInfo = null;
- public Hashtable networkParams = null;
+ public Hashtable<String, Properties> networkParams = null;
public String collIteratorDescFilePath = null;
@@ -195,9 +196,9 @@
private ComponentInfo _mainComponent = null;
- private Hashtable _delegateComponents = new Hashtable();
+ private Hashtable<String, ComponentInfo> _delegateComponents = new Hashtable<String, ComponentInfo>();
- private ArrayList _installationActions = new ArrayList();
+ private ArrayList<ActionInfo> _installationActions = new ArrayList<ActionInfo>();
/**
* Adds a property specified by given name and value to a given <code>Properties</code> object.
@@ -353,7 +354,7 @@
// a) substitute $main_root and $comp_id$root in action fields
// b) substitute standard path separator (';') with OS dependent
// in FILE_TAG, REPLACE_WITH_TAG and VAR_VALUE_TAG values
- Enumeration keys = mAction.params.keys();
+ Enumeration<Object> keys = mAction.params.keys();
while (keys.hasMoreElements()) {
String key = (String) keys.nextElement();
String value = mAction.params.getProperty(key);
@@ -366,10 +367,10 @@
_mainComponent.rootDirPath);
mAction.params.setProperty(key, value);
}
- Iterator dlgEntries = getDelegateComponents().entrySet().iterator();
+ Iterator<Map.Entry<String, ComponentInfo>> dlgEntries = getDelegateComponents().entrySet().iterator();
while (dlgEntries.hasNext()) {
- Map.Entry dlgEntry = (Map.Entry) dlgEntries.next();
- ComponentInfo dlgInfo = (ComponentInfo) dlgEntry.getValue();
+ Map.Entry<String, ComponentInfo> dlgEntry = dlgEntries.next();
+ ComponentInfo dlgInfo = dlgEntry.getValue();
if (dlgInfo.rootDirPath != null) {
// substitute '$dlg_comp_id$root' macros
value = InstallationProcessor.substituteCompIdRootInString(value, dlgInfo.getId(),
@@ -490,9 +491,9 @@
* The given action name.
*/
public synchronized void deleteInstallationActions(String actionName) {
- Iterator actionList = _installationActions.iterator();
+ Iterator<ActionInfo> actionList = _installationActions.iterator();
while (actionList.hasNext()) {
- ActionInfo action = (ActionInfo) actionList.next();
+ ActionInfo action = actionList.next();
if (action.getName().equals(actionName)) {
_installationActions.remove(action);
actionList = _installationActions.iterator();
@@ -529,7 +530,7 @@
* @return The list of the <code>ComponentInfo</code> objects that encapsulate specifications of
* the registered delegate components (for aggregate component).
*/
- public Hashtable getDelegateComponents() {
+ public Hashtable <String, ComponentInfo>getDelegateComponents() {
return _delegateComponents;
}
@@ -545,7 +546,7 @@
* @return The list of the <code>ActionInfo</code> objects that encapsulate specifications of
* all requested installation actions.
*/
- public Collection getInstallationActions() {
+ public Collection<ActionInfo> getInstallationActions() {
return _installationActions;
}
@@ -557,11 +558,11 @@
*
* @return The list of the <code>ActionInfo</code> objects that have the given action name.
*/
- public Collection getInstallationActions(String actionName) {
- ArrayList selActions = new ArrayList();
- Iterator allActions = getInstallationActions().iterator();
+ public Collection<ActionInfo> getInstallationActions(String actionName) {
+ ArrayList<ActionInfo> selActions = new ArrayList<ActionInfo>();
+ Iterator<ActionInfo> allActions = getInstallationActions().iterator();
while (allActions.hasNext()) {
- ActionInfo actInfo = (ActionInfo) allActions.next();
+ ActionInfo actInfo = allActions.next();
if (actInfo.getName().equals(actionName))
selActions.add(actInfo);
}
@@ -731,7 +732,7 @@
/**
* @return The <code>Set</code> of the network component parameter names.
*/
- public synchronized Set getMainComponentNetworkParamNames() {
+ public synchronized Set<String> getMainComponentNetworkParamNames() {
return (_mainComponent != null && _mainComponent.networkParams != null) ? _mainComponent.networkParams
.keySet()
: null;
@@ -866,10 +867,10 @@
}
// substitute $dlg_comp_id$root macros in apropriate
// action fields
- Iterator list = getInstallationActions().iterator();
+ Iterator<ActionInfo> list = getInstallationActions().iterator();
while (list.hasNext()) {
- ActionInfo action = (ActionInfo) list.next();
- Enumeration keys = action.params.keys();
+ ActionInfo action = list.next();
+ Enumeration<Object> keys = action.params.keys();
while (keys.hasMoreElements()) {
String key = (String) keys.nextElement();
String value = action.params.getProperty(key);
@@ -1023,7 +1024,7 @@
public synchronized void setMainComponentNetworkParam(String paramName, Properties paramSpecs) {
if (_mainComponent != null) {
if (_mainComponent.networkParams == null)
- _mainComponent.networkParams = new Hashtable();
+ _mainComponent.networkParams = new Hashtable<String, Properties>();
_mainComponent.networkParams.put(paramName, paramSpecs);
}
}
@@ -1068,10 +1069,10 @@
_mainComponent.casConsumerDescFilePath = InstallationProcessor.substituteMainRootInString(
_mainComponent.casConsumerDescFilePath, _mainComponent.rootDirPath);
// substitute $main_root macros in all specs of actions
- Iterator list = getInstallationActions().iterator();
+ Iterator<ActionInfo> list = getInstallationActions().iterator();
while (list.hasNext()) {
ActionInfo action = (ActionInfo) list.next();
- Enumeration keys = action.params.keys();
+ Enumeration<Object> keys = action.params.keys();
while (keys.hasMoreElements()) {
String key = (String) keys.nextElement();
String value = action.params.getProperty(key);
Modified: incubator/uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/pear/tools/InstallationDescriptorHandler.java
URL: http://svn.apache.org/viewvc/incubator/uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/pear/tools/InstallationDescriptorHandler.java?rev=799624&r1=799623&r2=799624&view=diff
==============================================================================
--- incubator/uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/pear/tools/InstallationDescriptorHandler.java (original)
+++ incubator/uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/pear/tools/InstallationDescriptorHandler.java Fri Jul 31 14:40:34 2009
@@ -35,6 +35,9 @@
import javax.xml.parsers.SAXParser;
+import org.apache.uima.pear.tools.InstallationDescriptor.ActionInfo;
+import org.apache.uima.pear.tools.InstallationDescriptor.ArgInfo;
+import org.apache.uima.pear.tools.InstallationDescriptor.ComponentInfo;
import org.apache.uima.pear.util.XMLUtil;
import org.xml.sax.Attributes;
import org.xml.sax.SAXException;
@@ -255,12 +258,12 @@
// SERVICE_COMMAND_ARGS
XMLUtil.printXMLTag(SERVICE_COMMAND_ARGS_TAG, oWriter, false, 2);
oWriter.println();
- Iterator argList = service.getArgs().iterator();
+ Iterator<ArgInfo> argList = service.getArgs().iterator();
while (argList.hasNext()) {
// ARGUMENT - 3rd level
XMLUtil.printXMLTag(ARGUMENT_TAG, oWriter, false, 3);
oWriter.println();
- InstallationDescriptor.ArgInfo arg = (InstallationDescriptor.ArgInfo) argList.next();
+ InstallationDescriptor.ArgInfo arg = argList.next();
// VALUE - 4th level elements
XMLUtil.printXMLElement(VALUE_TAG, arg.value, oWriter, 4);
oWriter.println();
@@ -276,12 +279,12 @@
oWriter.println();
}
// network component parameters block
- Set netParamNames = insdObject.getMainComponentNetworkParamNames();
+ Set<String> netParamNames = insdObject.getMainComponentNetworkParamNames();
if (netParamNames != null) {
// NETWORK_PARAMETERS
XMLUtil.printXMLTag(NETWORK_PARAMETERS_TAG, oWriter, false, 2);
oWriter.println();
- Iterator nameList = netParamNames.iterator();
+ Iterator<String> nameList = netParamNames.iterator();
while (nameList.hasNext()) {
String name = (String) nameList.next();
Properties attributes = insdObject.getMainComponentNetworkParam(name);
@@ -333,14 +336,14 @@
XMLUtil.printXMLTag(INSTALLATION_TAG, oWriter, false, 1);
oWriter.println();
// delegate components, if specified
- Hashtable dlgTable = insdObject.getDelegateComponents();
- Iterator dlgList = dlgTable.keySet().iterator();
+ Hashtable<String, ComponentInfo> dlgTable = insdObject.getDelegateComponents();
+ Iterator<String> dlgList = dlgTable.keySet().iterator();
while (dlgList.hasNext()) {
// DELEGATE_COMPONENT specs - 2nd level
XMLUtil.printXMLTag(DELEGATE_COMPONENT_TAG, oWriter, false, 2);
oWriter.println();
// 3rd level elements
- String dlgId = (String) dlgList.next();
+ String dlgId = dlgList.next();
InstallationDescriptor.ComponentInfo dlgInfo = (InstallationDescriptor.ComponentInfo) dlgTable
.get(dlgId);
XMLUtil.printXMLElement(ID_TAG, dlgId, oWriter, 3);
@@ -352,10 +355,9 @@
oWriter.println();
}
// installation actions, if specified
- Iterator actList = insdObject.getInstallationActions().iterator();
+ Iterator<ActionInfo> actList = insdObject.getInstallationActions().iterator();
while (actList.hasNext()) {
- InstallationDescriptor.ActionInfo actInfo = (InstallationDescriptor.ActionInfo) actList
- .next();
+ ActionInfo actInfo = actList.next();
// PROCESS specs - 2nd level
XMLUtil.printXMLTag(PROCESS_TAG, oWriter, false, 2);
oWriter.println();
Modified: incubator/uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/pear/tools/InstallationProcessor.java
URL: http://svn.apache.org/viewvc/incubator/uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/pear/tools/InstallationProcessor.java?rev=799624&r1=799623&r2=799624&view=diff
==============================================================================
--- incubator/uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/pear/tools/InstallationProcessor.java (original)
+++ incubator/uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/pear/tools/InstallationProcessor.java Fri Jul 31 14:40:34 2009
@@ -72,11 +72,11 @@
// Attributes
private String _mainRootPath;
- private Hashtable _installationTable = new Hashtable();
+ private Hashtable<String, String> _installationTable = new Hashtable<String, String>();
- private Hashtable _urlSubstitutionTable = new Hashtable();
+ private Hashtable<String, String> _urlSubstitutionTable = new Hashtable<String, String>();
- private Hashtable _pathSubstitutionTable = new Hashtable();
+ private Hashtable<String, String> _pathSubstitutionTable = new Hashtable<String, String>();
private InstallationDescriptor _insdObject = null;
@@ -85,7 +85,7 @@
private InstallationController _controller = null;
/**
- * Builds $component_id$<suffix> reqular expression string for a given component ID and a given
+ * Builds $component_id$<suffix> regular expression string for a given component ID and a given
* 'suffix' string. Valid 'suffix' strings are InstallationDescriptor.DELEGATE_ROOT_SUFFIX_REGEX
* for absolute path, InstallationDescriptor.DELEGATE_ROOT_REL_SUFFIX_REGEX for relative path,
* InstallationDescriptor.DELEGATE_ROOT_URL_SUFFIX_REGEX for URL.
@@ -264,7 +264,7 @@
* @param installationTable
* The given table of installed delegate components.
*/
- public InstallationProcessor(String mainRootPath, Hashtable installationTable) {
+ public InstallationProcessor(String mainRootPath, Hashtable<String, String> installationTable) {
this(mainRootPath, installationTable, null);
}
@@ -279,7 +279,7 @@
* @param controller
* The given <code>InstallationController</code> requestor.
*/
- public InstallationProcessor(String mainRootPath, Hashtable installationTable,
+ public InstallationProcessor(String mainRootPath, Hashtable<String, String> installationTable,
InstallationController controller) {
_controller = controller;
_mainRootPath = mainRootPath.replace('\\', '/');
@@ -303,13 +303,13 @@
* The given main component root directory path.
*/
protected void initSubstitutionTables(String mainRootPath) {
- Enumeration idList = _installationTable.keys();
+ Enumeration<String> idList = _installationTable.keys();
while (idList.hasMoreElements()) {
- String id = (String) idList.nextElement();
+ String id = idList.nextElement();
String compIdRootUrlRegEx = componentIdRootRegExp(id, DELEGATE_ROOT_URL_SUFFIX_REGEX);
String compIdRootRegEx = componentIdRootRegExp(id, DELEGATE_ROOT_SUFFIX_REGEX);
// put 1 entry for URL and absolute path
- String rootPath = (String) _installationTable.get(id);
+ String rootPath = _installationTable.get(id);
String rootPathUrl = FileUtil.localPathToFileUrl(rootPath);
_urlSubstitutionTable.put(compIdRootUrlRegEx, rootPathUrl);
_pathSubstitutionTable.put(compIdRootRegEx, rootPath);
@@ -346,7 +346,7 @@
// set main root path
_insdObject.setMainComponentRoot(_mainRootPath);
// perform required actions
- Iterator actionList = _insdObject.getInstallationActions().iterator();
+ Iterator<InstallationDescriptor.ActionInfo> actionList = _insdObject.getInstallationActions().iterator();
while (actionList.hasNext()) {
InstallationDescriptor.ActionInfo action = (InstallationDescriptor.ActionInfo) actionList
.next();
@@ -377,7 +377,7 @@
* The given <code>Properties</code> object.
*/
protected void substituteStringVariablesInAction(Properties params) {
- Enumeration paramNames = params.propertyNames();
+ Enumeration<?> paramNames = params.propertyNames();
while (paramNames.hasMoreElements()) {
String paramName = (String) paramNames.nextElement();
String paramValue = params.getProperty(paramName);
@@ -391,10 +391,10 @@
// substitute '$main_root_url' and '$main_root'
paramValue = substituteMainRootInString(paramValue, _mainRootPath);
// substitute '$dlg_comp_id$root_url'
- Enumeration regexList = _urlSubstitutionTable.keys();
+ Enumeration<String> regexList = _urlSubstitutionTable.keys();
while (regexList.hasMoreElements()) {
- String regex = (String) regexList.nextElement();
- String replacement = (String) _urlSubstitutionTable.get(regex);
+ String regex = regexList.nextElement();
+ String replacement = _urlSubstitutionTable.get(regex);
paramValue = paramValue.replaceAll(regex, StringUtil.toRegExpReplacement(replacement));
}
// substitute '$dlg_comp_id$root'
@@ -421,9 +421,9 @@
*/
protected void substituteStringVariablesInFiles(File dir) throws IOException {
// get list of files in the given dir with subdirs
- Iterator fileList = FileUtil.createFileList(dir, true).iterator();
+ Iterator<File> fileList = FileUtil.createFileList(dir, true).iterator();
while (fileList.hasNext()) {
- File file = (File) fileList.next();
+ File file = fileList.next();
// substitute '$main_root_url'
String replacement = FileUtil.localPathToFileUrl(_mainRootPath);
FileUtil.replaceStringInFile(file, MAIN_ROOT_URL_REGEX, replacement);
@@ -431,10 +431,10 @@
replacement = _mainRootPath;
FileUtil.replaceStringInFile(file, MAIN_ROOT_REGEX, replacement);
// substitute '$dlg_comp_id$root_rel'
- Enumeration compList = _installationTable.keys();
+ Enumeration<String> compList = _installationTable.keys();
while (compList.hasMoreElements()) {
- String compId = (String) compList.nextElement();
- String compRootPath = (String) _installationTable.get(compId);
+ String compId = compList.nextElement();
+ String compRootPath = _installationTable.get(compId);
String regex = componentIdRootRegExp(compId, DELEGATE_ROOT_REL_SUFFIX_REGEX);
try {
replacement = FileUtil.computeRelativePath(file.getParentFile(), new File(compRootPath));
@@ -444,10 +444,10 @@
}
}
// substitute '$dlg_comp_id$root_url'
- Enumeration regexList = _urlSubstitutionTable.keys();
+ Enumeration<String> regexList = _urlSubstitutionTable.keys();
while (regexList.hasMoreElements()) {
- String regex = (String) regexList.nextElement();
- replacement = (String) _urlSubstitutionTable.get(regex);
+ String regex = regexList.nextElement();
+ replacement = _urlSubstitutionTable.get(regex);
FileUtil.replaceStringInFile(file, regex, replacement);
}
// substitute '$dlg_comp__id$root'
Modified: incubator/uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/pear/tools/InstallationTester.java
URL: http://svn.apache.org/viewvc/incubator/uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/pear/tools/InstallationTester.java?rev=799624&r1=799623&r2=799624&view=diff
==============================================================================
--- incubator/uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/pear/tools/InstallationTester.java (original)
+++ incubator/uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/pear/tools/InstallationTester.java Fri Jul 31 14:40:34 2009
@@ -20,7 +20,6 @@
package org.apache.uima.pear.tools;
import java.io.File;
-import java.io.FileOutputStream;
import java.io.IOException;
import java.util.Iterator;
import java.util.Properties;
@@ -170,7 +169,7 @@
// get pear env variables and set them as system properties
Properties props = pkgBrowser.getComponentEnvVars();
- Iterator keyIterator = props.keySet().iterator();
+ Iterator<Object> keyIterator = props.keySet().iterator();
while (keyIterator.hasNext()) {
String key = (String) keyIterator.next();
String value = (String) props.get(key);
Modified: incubator/uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/pear/tools/LocalInstallationAgent.java
URL: http://svn.apache.org/viewvc/incubator/uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/pear/tools/LocalInstallationAgent.java?rev=799624&r1=799623&r2=799624&view=diff
==============================================================================
--- incubator/uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/pear/tools/LocalInstallationAgent.java (original)
+++ incubator/uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/pear/tools/LocalInstallationAgent.java Fri Jul 31 14:40:34 2009
@@ -30,6 +30,7 @@
import org.apache.uima.UIMAException;
import org.apache.uima.pear.tools.InstallationController.TestStatus;
+import org.apache.uima.pear.tools.InstallationDescriptor.ComponentInfo;
import org.apache.uima.pear.util.FileUtil;
import org.apache.uima.resource.ResourceInitializationException;
@@ -112,11 +113,11 @@
InstallationDescriptor insdObject) {
boolean isOk = false;
if (packageConfig.getProperty(MAIN_ROOT) != null) {
- Hashtable dlgTable = insdObject.getDelegateComponents();
- Iterator idList = dlgTable.keySet().iterator();
+ Hashtable<String, ComponentInfo> dlgTable = insdObject.getDelegateComponents();
+ Iterator<String> idList = dlgTable.keySet().iterator();
int counter = 0;
while (idList.hasNext()) {
- String id = (String) idList.next();
+ String id = idList.next();
String idRoot = COMP_ROOT_PREFIX + id + COMP_ROOT_SUFFIX;
if (packageConfig.getProperty(idRoot) != null)
counter++;
@@ -153,7 +154,7 @@
FileUtil.replaceStringInFile(file, InstallationProcessor.MAIN_ROOT_REGEX, replacement);
}
// substitute $comp_id$root macros for all delegates
- Iterator idList = insdObject.getDelegateComponents().keySet().iterator();
+ Iterator<String> idList = insdObject.getDelegateComponents().keySet().iterator();
while (idList.hasNext()) {
String id = (String) idList.next();
String idRoot = COMP_ROOT_PREFIX + id + COMP_ROOT_SUFFIX;
@@ -190,9 +191,9 @@
String mainRootPath = packageConfig.getProperty(MAIN_ROOT);
insdObject.setMainComponentRoot(mainRootPath);
// set root dirs for all delegates
- Iterator idList = insdObject.getDelegateComponents().keySet().iterator();
+ Iterator<String> idList = insdObject.getDelegateComponents().keySet().iterator();
while (idList.hasNext()) {
- String id = (String) idList.next();
+ String id = idList.next();
String idRoot = COMP_ROOT_PREFIX + id + COMP_ROOT_SUFFIX;
String compRootPath = packageConfig.getProperty(idRoot);
insdObject.setDelegateComponentRoot(id, compRootPath);
@@ -324,15 +325,15 @@
protected synchronized File[] localizeComponentFiles() throws IOException {
// localize all files in conf & desc dirs
File confDir = new File(_mainRootDir, InstallationController.PACKAGE_CONF_DIR);
- Collection confDirFiles = FileUtil.createFileList(confDir, false);
+ Collection<File> confDirFiles = FileUtil.createFileList(confDir, false);
File descDir = new File(_mainRootDir, InstallationController.PACKAGE_DESC_DIR);
- Collection descDirFiles = FileUtil.createFileList(descDir, false);
+ Collection<File> descDirFiles = FileUtil.createFileList(descDir, false);
File[] fileList = new File[confDirFiles.size() + descDirFiles.size()];
int fileCounter = 0;
// backup and localize files in conf dir
- Iterator dirList = confDirFiles.iterator();
+ Iterator<File> dirList = confDirFiles.iterator();
while (dirList.hasNext()) {
- File orgFile = (File) dirList.next();
+ File orgFile = dirList.next();
String bakFileName = orgFile.getName().concat(BACKUP_FILE_SUFFIX);
File bakFile = new File(orgFile.getParent(), bakFileName);
if (FileUtil.copyFile(orgFile, bakFile)) {
Modified: incubator/uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/pear/tools/PackageBrowser.java
URL: http://svn.apache.org/viewvc/incubator/uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/pear/tools/PackageBrowser.java?rev=799624&r1=799623&r2=799624&view=diff
==============================================================================
--- incubator/uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/pear/tools/PackageBrowser.java (original)
+++ incubator/uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/pear/tools/PackageBrowser.java Fri Jul 31 14:40:34 2009
@@ -86,9 +86,9 @@
private boolean _archived;
- private TreeSet _allFiles = new TreeSet();
+ private TreeSet<File> _allFiles = new TreeSet<File>();
- private TreeSet _allDirs = new TreeSet();
+ private TreeSet<File> _allDirs = new TreeSet<File>();
/**
* Constructor that allows browsing a given PEAR package without unarchiving it.
@@ -240,10 +240,10 @@
public File[] findDirectory(String dirNamePattern) {
String pattern = dirNamePattern.replace('\\', '/');
File[] foundDirs = new File[0];
- ArrayList foundDirList = new ArrayList();
- Iterator list = _allDirs.iterator();
+ ArrayList<File> foundDirList = new ArrayList<File>();
+ Iterator<File> list = _allDirs.iterator();
while (list.hasNext()) {
- File dir = (File) list.next();
+ File dir = list.next();
String dirName = dir.getAbsolutePath().substring(_rootDir.getAbsolutePath().length())
.replace('\\', '/');
if (pattern.startsWith(File.separator)) {
@@ -272,10 +272,10 @@
public File[] findFile(String fileNamePattern) {
String pattern = fileNamePattern.replace('\\', '/');
File[] foundFiles = new File[0];
- ArrayList foundFileList = new ArrayList();
- Iterator list = _allFiles.iterator();
+ ArrayList<File> foundFileList = new ArrayList<File>();
+ Iterator<File> list = _allFiles.iterator();
while (list.hasNext()) {
- File file = (File) list.next();
+ File file = list.next();
String fileName = file.getAbsolutePath().substring(_rootDir.getAbsolutePath().length())
.replace('\\', '/');
if (pattern.startsWith(File.separator)) {
Modified: incubator/uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/pear/tools/PackageCreator.java
URL: http://svn.apache.org/viewvc/incubator/uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/pear/tools/PackageCreator.java?rev=799624&r1=799623&r2=799624&view=diff
==============================================================================
--- incubator/uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/pear/tools/PackageCreator.java (original)
+++ incubator/uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/pear/tools/PackageCreator.java Fri Jul 31 14:40:34 2009
@@ -189,7 +189,7 @@
// set additional environment variables
if (envVars != null) {
- Enumeration keys = envVars.keys();
+ Enumeration<Object> keys = envVars.keys();
while (keys.hasMoreElements()) {
InstallationDescriptor.ActionInfo actionInfo = new InstallationDescriptor.ActionInfo(
InstallationDescriptor.ActionInfo.SET_ENV_VARIABLE_ACT);
Modified: incubator/uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/pear/util/StringUtil.java
URL: http://svn.apache.org/viewvc/incubator/uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/pear/util/StringUtil.java?rev=799624&r1=799623&r2=799624&view=diff
==============================================================================
--- incubator/uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/pear/util/StringUtil.java (original)
+++ incubator/uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/pear/util/StringUtil.java Fri Jul 31 14:40:34 2009
@@ -51,7 +51,7 @@
// copy 'source' to 'result'
result.putAll(source);
// append 'plus' to 'result', checking same names
- Enumeration plusNames = plus.propertyNames();
+ Enumeration<?> plusNames = plus.propertyNames();
while (plusNames.hasMoreElements()) {
String name = (String) plusNames.nextElement();
String value = plus.getProperty(name);
@@ -121,7 +121,7 @@
* The given Java <code>Class</code>.
* @return The plain name (without package name) of the given Java <code>Class</code>.
*/
- public static String getPlainClassName(Class aClass) {
+ public static String getPlainClassName(Class<?> aClass) {
int index = aClass.getName().lastIndexOf('.');
return (index > 0) ? aClass.getName().substring(index + 1) : aClass.getName();
}
Modified: incubator/uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/pear/util/UIMAUtil.java
URL: http://svn.apache.org/viewvc/incubator/uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/pear/util/UIMAUtil.java?rev=799624&r1=799623&r2=799624&view=diff
==============================================================================
--- incubator/uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/pear/util/UIMAUtil.java (original)
+++ incubator/uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/pear/util/UIMAUtil.java Fri Jul 31 14:40:34 2009
@@ -79,7 +79,7 @@
public static final String REUSABLE_RESOURCE_CTG = "RR";
// static attributes
- private static Hashtable __errTableByUri = new Hashtable();
+ private static Hashtable<String, Exception> __errTableByUri = new Hashtable<String, Exception>();
/**
* Returns the last logged <code>Exception</code> object associated with a given XML descriptor