This commit was manufactured by cvs2svn to create tag 'Eclipse322'.
diff --git a/plugins/org.eclipse.actf.core/.classpath b/plugins/org.eclipse.actf.core/.classpath
deleted file mode 100644
index 751c8f2..0000000
--- a/plugins/org.eclipse.actf.core/.classpath
+++ /dev/null
@@ -1,7 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<classpath>
- <classpathentry kind="src" path="src"/>
- <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
- <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
- <classpathentry kind="output" path="bin"/>
-</classpath>
diff --git a/plugins/org.eclipse.actf.core/.cvsignore b/plugins/org.eclipse.actf.core/.cvsignore
deleted file mode 100644
index 8fedc84..0000000
--- a/plugins/org.eclipse.actf.core/.cvsignore
+++ /dev/null
@@ -1,12 +0,0 @@
-*.jar
-*.args
-build.xml
-bin
-log.folder
-temp.folder
-@dot
-
-bin
-log.folder
-${plugin.destination}
-com.ibm.haac.raven.accessibility_0.2.0.jar
diff --git a/plugins/org.eclipse.actf.core/.options b/plugins/org.eclipse.actf.core/.options
deleted file mode 100644
index c4f7d2a..0000000
--- a/plugins/org.eclipse.actf.core/.options
+++ /dev/null
@@ -1,30 +0,0 @@
-org.eclipse.actf.core/debug = true
-org.eclipse.actf.core/debug/trace = true
-org.eclipse.actf.core/debug/trace/stream = c:/actfcore.out
-org.eclipse.actf.core/debug/trace/level = 0
-
-org.eclipse.actf.model/debug = true
-org.eclipse.actf.model/debug/trace = true
-org.eclipse.actf.model/debug/trace/stream = c:/actfmodel.out
-org.eclipse.actf.model/debug/trace/level = 0
-
-org.eclipse.actf.accservice/debug = true
-org.eclipse.actf.accservice/debug/trace = true
-org.eclipse.actf.accservice/debug/trace/stream = c:/actfacc.out
-org.eclipse.actf.accservice/debug/trace/level = 0
-
-org.eclipse.actf.validation/debug = true
-org.eclipse.actf.validation/debug/trace = true
-org.eclipse.actf.validation/debug/trace/stream = c:/actfval.out
-org.eclipse.actf.validation/debug/trace/level = 0
-
-org.eclipse.actf.validation.javapp/debug = true
-org.eclipse.actf.validation.javapp/debug/trace = true
-org.eclipse.actf.validation.javapp/debug/trace/stream = c:/actfjava.out
-org.eclipse.actf.validation.javapp/debug/trace/level = 0
-
-com.ibm.haac.raven.model.web.core/debug = true
-com.ibm.haac.raven.model.web.core/debug/trace = true
-com.ibm.haac.raven.model.web.core/debug/trace/stream = c:/actfweb.out
-com.ibm.haac.raven.model.web.core/debug/trace/level = 0
-
diff --git a/plugins/org.eclipse.actf.core/.project b/plugins/org.eclipse.actf.core/.project
deleted file mode 100644
index 15a4018..0000000
--- a/plugins/org.eclipse.actf.core/.project
+++ /dev/null
@@ -1,28 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<projectDescription>
- <name>org.eclipse.actf.core</name>
- <comment></comment>
- <projects>
- </projects>
- <buildSpec>
- <buildCommand>
- <name>org.eclipse.jdt.core.javabuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- <buildCommand>
- <name>org.eclipse.pde.ManifestBuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- <buildCommand>
- <name>org.eclipse.pde.SchemaBuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- </buildSpec>
- <natures>
- <nature>org.eclipse.pde.PluginNature</nature>
- <nature>org.eclipse.jdt.core.javanature</nature>
- </natures>
-</projectDescription>
diff --git a/plugins/org.eclipse.actf.core/META-INF/MANIFEST.MF b/plugins/org.eclipse.actf.core/META-INF/MANIFEST.MF
deleted file mode 100644
index c92f76c..0000000
--- a/plugins/org.eclipse.actf.core/META-INF/MANIFEST.MF
+++ /dev/null
@@ -1,22 +0,0 @@
-Manifest-Version: 1.0
-Bundle-ManifestVersion: 2
-Bundle-Name: %pluginName
-Bundle-SymbolicName: org.eclipse.actf.core;singleton:=true
-Bundle-Version: 0.3.0.qualifier
-Bundle-Vendor: %providerName
-Bundle-Localization: plugin
-Require-Bundle: org.eclipse.core.runtime
-Bundle-Activator: org.eclipse.actf.core.ActfCorePlugin
-Eclipse-LazyStart: true
-Bundle-ClassPath: .
-Export-Package: org.eclipse.actf.core,
- org.eclipse.actf.core.adapt,
- org.eclipse.actf.core.config,
- org.eclipse.actf.core.runtime,
- org.eclipse.actf.util,
- org.eclipse.actf.util.command,
- org.eclipse.actf.util.jar,
- org.eclipse.actf.util.logging,
- org.eclipse.actf.util.resources,
- org.eclipse.actf.util.thread
-
diff --git a/plugins/org.eclipse.actf.core/about.html b/plugins/org.eclipse.actf.core/about.html
deleted file mode 100644
index 138214a..0000000
--- a/plugins/org.eclipse.actf.core/about.html
+++ /dev/null
@@ -1,33 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
-
-<html>
-<head>
- <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
- <title>About this Content</title>
-</head>
-
-<body>
-<h2>About This Content</h2>
-<p>November, 2007</p>
-
-<h3>License</h3>
-
-<p>The Eclipse Foundation makes available all content in this plug-in ("Content").
-Unless otherwise indicated below, the Content is provided to you under the terms and
-conditions of the Eclipse Public License Version 1.0 ("EPL").</p>
-
-<p>A copy of the EPL is available at <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>.
-For purposes of the EPL, "Program" will mean the Content.</p>
-
-<p>If you did not receive this Content directly from the Eclipse Foundation,
-the Content is being redistributed by another party ("Redistributor")
-and different terms and conditions may apply to your use of any object code in the Content.
-Check the Redistributor's license that was provided with the Content.
-If no such license exists, contact the Redistributor.
-Unless otherwise indicated below, the terms and conditions of the EPL still apply
-to any source code in the Content and such source code may be obtained at
-<a href="http://www.eclipse.org">http://www.eclipse.org</a>.
-</p>
-
-</body>
-</html>
\ No newline at end of file
diff --git a/plugins/org.eclipse.actf.core/build.properties b/plugins/org.eclipse.actf.core/build.properties
deleted file mode 100644
index 3378933..0000000
--- a/plugins/org.eclipse.actf.core/build.properties
+++ /dev/null
@@ -1,7 +0,0 @@
-source.. = src/
-output.. = bin/
-bin.includes = META-INF/,\
- .,\
- about.html,\
- plugin.properties
-jars.compile.order = .
diff --git a/plugins/org.eclipse.actf.core/plugin.properties b/plugins/org.eclipse.actf.core/plugin.properties
deleted file mode 100644
index 38817c4..0000000
--- a/plugins/org.eclipse.actf.core/plugin.properties
+++ /dev/null
@@ -1,7 +0,0 @@
-pluginName=ACTF Core Plug-in (Incubation)
-providerName=Eclipse.org
-aboutText=\n\nAccessibility Tools Framework (ACTF) Core Plug-in\n\
-Version: 0.3.0\n\
-Build: {0}\n\
-\n\
-(c) Copyright IBM 2007. All rights reserved.\n\
diff --git a/plugins/org.eclipse.actf.core/resources/.emptydir b/plugins/org.eclipse.actf.core/resources/.emptydir
deleted file mode 100644
index 60b8188..0000000
--- a/plugins/org.eclipse.actf.core/resources/.emptydir
+++ /dev/null
@@ -1 +0,0 @@
-TODO needed to avoid failure of Java App with ACTF Validation; see org.eclipse.actf.validation.javapp.ui.preferences.ModelJavaPreferenceInitializer.getResourcePath(String[])
\ No newline at end of file
diff --git a/plugins/org.eclipse.actf.core/src/org/eclipse/actf/core/ActfCorePlugin.java b/plugins/org.eclipse.actf.core/src/org/eclipse/actf/core/ActfCorePlugin.java
deleted file mode 100644
index b1844fb..0000000
--- a/plugins/org.eclipse.actf.core/src/org/eclipse/actf/core/ActfCorePlugin.java
+++ /dev/null
@@ -1,305 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2007 IBM Corporation.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Mike Squillace - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.actf.core;
-
-import java.io.File;
-import java.io.InputStream;
-
-import org.eclipse.actf.core.config.IConfiguration;
-import org.eclipse.actf.core.runtime.IRuntimeContext;
-import org.eclipse.actf.core.runtime.RuntimeContextFactory;
-import org.eclipse.actf.util.Utils;
-import org.eclipse.actf.util.logging.AbstractReporter;
-import org.eclipse.actf.util.logging.IReporter;
-import org.eclipse.actf.util.resources.ClassLoaderCache;
-import org.eclipse.actf.util.resources.EclipseResourceLocator;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IExtension;
-import org.eclipse.core.runtime.IExtensionPoint;
-import org.eclipse.core.runtime.IExtensionRegistry;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.core.runtime.Plugin;
-import org.eclipse.core.runtime.Status;
-import org.osgi.framework.BundleContext;
-
-
-public class ActfCorePlugin extends Plugin
- implements ITracingService, ILoggingService
-{
-
- public static final String ACTF_CORE_JAR = "actf-core.jar";
- public static final String ACTFCORE_PLUGIN_ID = "org.eclipse.actf.core";
- public static final String MODEL_PLUGIN_ID = "org.eclipse.actf.model";
- public static final String DEBUG_OPTION_ID = "debug";
- public static final String LOG_OPTION_ID = "log";
- public static final String TRACE_OPTION_ID = "trace";
- public static final String TRACESTREAM_OPTION_ID = "stream";
- public static final String TRACELEVEL_OPTION_ID = "level";
-
- protected IRuntimeContext runtimeContext;
- protected IConfiguration configuration;
- protected ClassLoaderCache clCache = ClassLoaderCache.getDefault();
- protected String traceStream;
- protected int traceLevel = IReporter.WARNING;
-
- protected IExtensionRegistry registry;
-
- private ActfRegistryChangeListener registryListener;
-
- protected String getPluginId () {
- return ACTFCORE_PLUGIN_ID;
- }
-
- protected String getTraceOptionId () {
- return getDebugOptionId() + "/" + TRACE_OPTION_ID;
- }
-
- protected String getDebugOptionId () {
- return getPluginId() + "/" + DEBUG_OPTION_ID;
- }
-
- protected String getLogOptionId () {
- return getDebugOptionId() + "/" + LOG_OPTION_ID ;
- }
-
- // The shared instance.
- private static ActfCorePlugin plugin;
-
- /**
- * Returns the shared instance.
- *
- * @return plugin
- */
- public static ActfCorePlugin getDefault () {
- if (plugin == null) {
- plugin = new ActfCorePlugin();
- }
- return plugin;
- }
-
- protected String getDefaultTraceFilename () {
- return getPluginId() + "_" + TRACE_OPTION_ID + ".log";
- }
-
- /**
- * The constructor.
- */
- public ActfCorePlugin () {
- super();
- }
-
- /**
- * This method is called upon plug-in activation
- *
- * @param context
- * bundle context
- * @throws Exception
- */
- public void start (BundleContext context) throws Exception {
- super.start(context);
-
- runtimeContext = RuntimeContextFactory.getInstance().getRuntimeContext();
- EclipseResourceLocator locator = (EclipseResourceLocator) runtimeContext.getResourceLocator();
-
- registry = Platform.getExtensionRegistry();
- registryListener = new ActfRegistryChangeListener();
- if (registry != null && (getPluginId().equals(ACTFCORE_PLUGIN_ID))) {
- registry.addRegistryChangeListener(registryListener);
- }
-
-
- // provide a way for retrieving classes and resources from all bundles
- locator.registerBundleName(getPluginId());
- clCache.put(getPluginId(), getClass().getClassLoader());
- //first add the config data provided by our own actf.xml files
- try {
- configuration = runtimeContext.getConfiguration();
- if (!getPluginId().equals(ACTFCORE_PLUGIN_ID)) {
- InputStream configStream = locator.getResourceAsStream(IConfiguration.ACTF_ID, null, "xml", getPluginId());
- if (configStream != null) {
- configuration.addConfigurationData(configStream);
- configStream.close();
- }
- }
-
- //Not sure why this is necessary, but it is.
- //The registry change listener is apparently set to late to catch all of the
- //extension point additions so it seems common practice to set the listener
- // and then add the extension points manually
- // then add the data provided by extension points
-
- IExtensionPoint [] exps = registry.getExtensionPoints(MODEL_PLUGIN_ID);
- for (int i=0;i<exps.length;i++){
- IExtension[] extensions = exps[i].getExtensions();
- for (int j=0; j< extensions.length; j++){
- configuration.addConfigurationData(extensions[j]);
- }
-
- }
- } catch (Exception e) {
- throw new CoreException(new Status(IStatus.ERROR, getPluginId(), 0, "Error initializing configuration object", e));
- }
- String debug = Platform.getDebugOption(getDebugOptionId());
- setDebugging(debug != null && debug.equalsIgnoreCase("true"));
- if (isDebugging()) {
- prepareTraceFacility();
- if (configuration.getSymbolPoolContents(IConfiguration.ACTF_ID) != null) {
- configuration.setSymbolPool(IConfiguration.ACTF_ID);
- configuration.setParameter(IConfiguration.TRACE_STREAM_KEY,
- traceStream);
- configuration.setParameter(IConfiguration.TRACE_LEVEL_KEY,
- traceLevel);
- }
- }
-
- trace(getClass().getName() + " started");
- trace("configuration:" + configuration);
- }
-
- protected IReporter getTracer () {
- return Utils.getTracer();
- }
-
- public IRuntimeContext getRuntimeContext () {
- return runtimeContext;
- }
-
- protected void prepareTraceFacility () {
- String trace = Platform.getDebugOption(getTraceOptionId());
- if (trace != null && trace.equalsIgnoreCase("true")) {
- traceStream = Platform.getDebugOption(getTraceOptionId() + "/" + TRACESTREAM_OPTION_ID);
- String levelStr = Platform.getDebugOption(getTraceOptionId() + "/" + TRACELEVEL_OPTION_ID);
-
- if (traceStream == null) {
- traceStream = setupDefaultTraceStream();
- if (traceStream == null) {
- traceStream = "stdout";
- }
- }
-
- if (levelStr == null) {
- levelStr = new Integer(IReporter.WARNING).toString();
- }
- try {
- traceLevel = Integer.parseInt(levelStr);
- }catch (NumberFormatException e) {
- traceLevel = IReporter.WARNING;
- }
-
- Utils.setTracer(AbstractReporter.getReporter(traceLevel, traceStream));
- Utils.getTracer().setSourceID(IReporter.TRACE);
- }
- }
-
- public void stop (BundleContext context) throws Exception {
- trace(getClass().getName() + " stopped");
- if (getPluginId().equals(ACTFCORE_PLUGIN_ID)) {
- if (registry != null && registryListener != null) {
- registry.removeRegistryChangeListener(registryListener);
- }
- }
- super.stop(context);
- }
-
- public void log (String option, int sev, int code,
- String message, Throwable t) {
- if (message == null) {
- message = "<no message>";
- }
- if (isDebugging(option)) {
- Status status = new Status(sev, getPluginId(), code, message, t);
- getLog().log(status);
- }
- }
-
- public void logInfo (String message) {
- log(getLogOptionId(), IStatus.INFO, 0, message, (Throwable) null);
- }
-
- public void logError (String message) {
- log(getLogOptionId(), IStatus.ERROR, 0, message, (Throwable) null);
- }
-
- public void logException (String message, Throwable t) {
- String tname = t.getClass().getName();
- String msg = t.getMessage();
- msg = msg != null && msg.length() > 0 ? tname + " - " + msg : tname;
- log(getLogOptionId(), IStatus.ERROR, 1, message != null ? message : "<No message>", t);
- }
-
- public void logException (Throwable t) {
- String msg = t.getMessage();
- logException(msg != null && msg.length() > 0 ? msg : "<no message>", t);
- }
-
- public boolean isDebugging (String option) {
- String value = Platform.getDebugOption(option);
- return super.isDebugging() && value != null && "true".equalsIgnoreCase(value);
- }
-
- public void trace (String option, String message) {
- if (isDebugging(option)) {
- getTracer().report(IReporter.INFO, message);
- }
- }
-
- public void trace (String message) {
- trace(getTraceOptionId(), message);
- }
-
- public void trace (int level, String msg) {
- if (isDebugging(getTraceOptionId())) {
- getTracer().report(level, msg);
- }
- }
-
- public void trace (Object source, String message) {
- trace(getTraceOptionId(), source.getClass().getName() + ": " + message);
- }
-
- public void trace (String message, Throwable t) {
- if (isDebugging(getTraceOptionId())) {
- getTracer().report(IReporter.ERROR, message, t);
- }
- }
-
- public void trace (Throwable t) {
- String msg = t != null ? t.getMessage() : "<no message>";
- trace(msg != null && msg.length() > 0 ? msg : "<no message>", t);
- }
-
- protected String setupDefaultTraceStream () {
- boolean success = true;
- String traceFile = null;
- String traceDir = System.getProperty("java.io.tmpdir") + IConfiguration.ACTF_ID;
- File traceDirFile = new File(traceDir);
-
- if (!traceDirFile.exists()) {
- try {
- success = traceDirFile.mkdir();
- }catch (Exception e) {
- logException("Could not create default trace file directory" + traceDir, e);
- success = false;
- }
- }
-
- if (success) {
- traceFile = traceDir + File.separator + getDefaultTraceFilename();
- }else {
- traceFile = System.getProperty("java.io.tmpdir") + getDefaultTraceFilename();
- }
-
- return traceFile;
- }
-
-}
\ No newline at end of file
diff --git a/plugins/org.eclipse.actf.core/src/org/eclipse/actf/core/ActfRegistryChangeListener.java b/plugins/org.eclipse.actf.core/src/org/eclipse/actf/core/ActfRegistryChangeListener.java
deleted file mode 100644
index b8083ac..0000000
--- a/plugins/org.eclipse.actf.core/src/org/eclipse/actf/core/ActfRegistryChangeListener.java
+++ /dev/null
@@ -1,56 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2008 IBM Corporation.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Ann Ford - initial API and implementation
- *******************************************************************************/
-package org.eclipse.actf.core;
-
-import org.eclipse.actf.core.config.ConfigurationException;
-import org.eclipse.actf.core.config.IConfiguration;
-import org.eclipse.actf.core.runtime.IRuntimeContext;
-import org.eclipse.actf.util.Utils;
-import org.eclipse.actf.util.logging.IReporter;
-import org.eclipse.core.runtime.IExtension;
-import org.eclipse.core.runtime.IExtensionDelta;
-import org.eclipse.core.runtime.IExtensionPoint;
-import org.eclipse.core.runtime.IRegistryChangeEvent;
-import org.eclipse.core.runtime.IRegistryChangeListener;
-
-public class ActfRegistryChangeListener implements IRegistryChangeListener {
-
- protected IConfiguration configuration;
- protected IRuntimeContext runtimeContext;
- public static final String namespace = ActfCorePlugin.ACTFCORE_PLUGIN_ID;
- public static final String MODEL_TYPES_EXTENSION_POINT = "modelTypes";
- public static final String NODE_FILTERS_EXTENSION_POINT = "nodeFilters";
-
- public ActfRegistryChangeListener() {
- super();
- }
-
- public void registryChanged(IRegistryChangeEvent event) {
- IExtensionDelta[] deltas = event.getExtensionDeltas(namespace);
- for (int i = 0; i < deltas.length; i++) {
- IExtensionPoint point = deltas[i].getExtensionPoint();
- if (point.getSimpleIdentifier().equals(MODEL_TYPES_EXTENSION_POINT)
- || point.getSimpleIdentifier().equals(
- NODE_FILTERS_EXTENSION_POINT)) {
-
- IExtension[] extensions = point.getExtensions();
- for (int j = 0; j < extensions.length; j++) {
- try {
- configuration.addConfigurationData(extensions[j]);
- } catch (ConfigurationException e) {
- Utils.println(IReporter.SYSTEM_NONFATAL,"ConfigurationException" +e.getMessage());
- }
- }
- }
- }
- }
-
-}
diff --git a/plugins/org.eclipse.actf.core/src/org/eclipse/actf/core/ILoggingService.java b/plugins/org.eclipse.actf.core/src/org/eclipse/actf/core/ILoggingService.java
deleted file mode 100644
index 3bf3718..0000000
--- a/plugins/org.eclipse.actf.core/src/org/eclipse/actf/core/ILoggingService.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/*******************************************************************************
-* Copyright (c) 2004, 2007 IBM Corporation.
-* All rights reserved. This program and the accompanying materials
-* are made available under the terms of the Eclipse Public License v1.0
-* which accompanies this distribution, and is available at
-* http://www.eclipse.org/legal/epl-v10.html
-*
-* Contributors:
-* barryf - initial API and implementation
-*******************************************************************************/
-
-package org.eclipse.actf.core;
-
-/**
- * @author barryf
- *
- */
-public interface ILoggingService
-{
-
- public void log (String option, int sev, int code, String message,
- Throwable t);
-
- public void logInfo (String message);
-
- public void logError (String message);
-
- public void logException (String message, Throwable t);
-
- public void logException (Throwable t);
-
- public boolean isDebugging (String option);
-}
diff --git a/plugins/org.eclipse.actf.core/src/org/eclipse/actf/core/ITracingService.java b/plugins/org.eclipse.actf.core/src/org/eclipse/actf/core/ITracingService.java
deleted file mode 100644
index 283b39a..0000000
--- a/plugins/org.eclipse.actf.core/src/org/eclipse/actf/core/ITracingService.java
+++ /dev/null
@@ -1,30 +0,0 @@
-/*******************************************************************************
-* Copyright (c) 2004, 2007 IBM Corporation.
-* All rights reserved. This program and the accompanying materials
-* are made available under the terms of the Eclipse Public License v1.0
-* which accompanies this distribution, and is available at
-* http://www.eclipse.org/legal/epl-v10.html
-*
-* Contributors:
-* barryf - initial API and implementation
-*******************************************************************************/
-
-package org.eclipse.actf.core;
-
-/**
- * @author barryf
- *
- */
-public interface ITracingService
-{
-
- public void trace (String option, String message);
-
- public void trace (String message);
-
- public void trace (Object source, String message);
-
- public void trace (String message, Throwable t);
-
- public void trace (Throwable t);
-}
diff --git a/plugins/org.eclipse.actf.core/src/org/eclipse/actf/core/adapt/DefaultAdaptorFactory.java b/plugins/org.eclipse.actf.core/src/org/eclipse/actf/core/adapt/DefaultAdaptorFactory.java
deleted file mode 100644
index 5127f86..0000000
--- a/plugins/org.eclipse.actf.core/src/org/eclipse/actf/core/adapt/DefaultAdaptorFactory.java
+++ /dev/null
@@ -1,103 +0,0 @@
-/*******************************************************************************
-* Copyright (c) 2004, 2007 IBM Corporation.
-* All rights reserved. This program and the accompanying materials
-* are made available under the terms of the Eclipse Public License v1.0
-* which accompanies this distribution, and is available at
-* http://www.eclipse.org/legal/epl-v10.html
-*
-* Contributors:
-* Mike Squillace - initial API and implementation
-*******************************************************************************/
-
-package org.eclipse.actf.core.adapt;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.HashMap;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Map;
-
-import org.eclipse.actf.util.resources.ClassLoaderCache;
-
-
-/**
- * default implementation for creating adaptors in ACTF. Clients should subclass this implementation rather than
- * implementing <code>IAdaptorFactory</code>.
- *
- * @author Mike Squillace
- *
- */
-public class DefaultAdaptorFactory implements IAdaptorFactory
-{
-
- protected static final ClassLoaderCache _clCache = ClassLoaderCache.getDefault();
-
- private static DefaultAdaptorFactory factoryInstance;
-
- private Map _adaptorMap = new HashMap();
-
- /**
- * create a default adaptor factory
- *
- */
- protected DefaultAdaptorFactory () {
- }
-
- public static DefaultAdaptorFactory getInstance() {
- if (factoryInstance == null) {
- factoryInstance = new DefaultAdaptorFactory();
- }
- return factoryInstance;
- }
-
- /** {@inheritDoc} */
- public void registerAdaptor (Class type, IAdaptor adaptor) {
- String typeName = type.getName();
- List adaptors = (List) _adaptorMap.get(typeName);
- if (adaptors == null) {
- adaptors = new LinkedList();
- _adaptorMap.put(typeName, adaptors);
- }
- adaptors.add(adaptor);
- }
-
- /** {@inheritDoc} */
- public IAdaptor[] getAdaptors (Class type) {
- return getAdaptors(type.getName());
- }
-
- /** {@inheritDoc} */
- public IAdaptor[] getAdaptors (String className) {
- List l = (List) _adaptorMap.get(className);
- return l == null ? new IAdaptor[0]
- : (IAdaptor[]) l.toArray(new IAdaptor[l.size()]);
- }
-
- /** {@inheritDoc} */
- public IAdaptor[] getAllAdaptors (Class targetType) {
- Class[] ints = targetType.getInterfaces();
- List adaptorList = new ArrayList();
- // check original target type and all of its supertypes
- do {
- List adaptors = (List) _adaptorMap.get(targetType.getName());
- if (adaptors != null && !adaptors.isEmpty()) {
- adaptorList.addAll(adaptors);
- }
- }while ((targetType = targetType.getSuperclass()) != null);
- // now check all of the target type's interfaces, checking each interface's
- // supertypes along the way
- for (int i = 0; i < ints.length; ++i) {
- List adaptors = (List) _adaptorMap.get(ints[i].getName());
- if (adaptors != null && !adaptors.isEmpty()) {
- adaptorList.addAll(adaptors);
- }
- List adaptors2 = Arrays.asList(getAllAdaptors(ints[i]));
- if (adaptors2 != null && !adaptors2.isEmpty()) {
- adaptorList.addAll(adaptors2);
- }
- }
- return adaptorList.isEmpty() ? new IAdaptor[0]
- : (IAdaptor[]) adaptorList.toArray(new IAdaptor[adaptorList.size()]);
- }
-}
diff --git a/plugins/org.eclipse.actf.core/src/org/eclipse/actf/core/adapt/IAdaptor.java b/plugins/org.eclipse.actf.core/src/org/eclipse/actf/core/adapt/IAdaptor.java
deleted file mode 100644
index 024d100..0000000
--- a/plugins/org.eclipse.actf.core/src/org/eclipse/actf/core/adapt/IAdaptor.java
+++ /dev/null
@@ -1,66 +0,0 @@
-/*******************************************************************************
-* Copyright (c) 2004, 2007 IBM Corporation.
-* All rights reserved. This program and the accompanying materials
-* are made available under the terms of the Eclipse Public License v1.0
-* which accompanies this distribution, and is available at
-* http://www.eclipse.org/legal/epl-v10.html
-*
-* Contributors:
-* Mike Squillace - initial API and implementation
-*******************************************************************************/
-
-package org.eclipse.actf.core.adapt;
-
-/**
- * provides a way to transform or "morph" objects of one type to another type. The simplest form of
- * adaptation is a simple cast, which, of course, could be done without this interface. More interesting uses
- * of this interface provide a way to capture a subset of properties of the adaptable object or to convertthe an adaptable object to a class
- * that is similar to the original class of the object but has a different public interface (e.g. the <code>java.io.File</code> class
- * and <code>org.eclipse.core.runtime.IPath</code> interface).
- *
- * @author Mike Squillace
- *
- */
-public interface IAdaptor
-{
-
- /**
- * returns the types to which given objects may be adapted by this adaptor. One of these types
- * should be used when calling the <code>adapt</code> method.
- *
- * @return list of types to which objects can be adapted by this adaptor
- * @see #adapt(Object, Class)
- */
- public Class[] getSupportedTypes ();
-
- /**
- * adapts the object to the given type. This method is responsible for casting or transforming
- * or somehow producing an object of the specified type that represents a set of properties of or directly corresponds to
- * the specified object. The type to which the object is to be adapted should be one
- * of those returned by <code>getSupportedTypes</code>.
- *
- * <p>All attempts should be made to insure that this method is symmetric. That is, if
- * object <code>o</code> is of type <code>B</code>, then:
- *
- * <p><pre>
- * adapt(adapt(o, A.class), B.class) = o
- * </pre>
- *
- * <p>Also note that both types <code>A</code> and <code>B</code> should be returned
- * by <code>getSupportedTypes</code>.
- *
- * @param o - object to be adapted
- * @param newType - the type to which the object is to be adapted
- * @return an instance of the specified type or <code>null</code> if the
- * object could not be adapted to the given type
- * @throws Exception
- * @see #getSupportedTypes()
- */
- public Object adapt (Object o, Class newType) throws Exception;
- /**
- * Retrieves the appropriate NodeSynchronizer for the given adaptor
- *
- * @return node synchronizer for the given adapter or <code>null</code> if not implemented
- */
- //public NodeSynchronizer getNodeSynchronizer ();
-}
diff --git a/plugins/org.eclipse.actf.core/src/org/eclipse/actf/core/adapt/IAdaptorFactory.java b/plugins/org.eclipse.actf.core/src/org/eclipse/actf/core/adapt/IAdaptorFactory.java
deleted file mode 100644
index e1cbece..0000000
--- a/plugins/org.eclipse.actf.core/src/org/eclipse/actf/core/adapt/IAdaptorFactory.java
+++ /dev/null
@@ -1,72 +0,0 @@
-/*******************************************************************************
-* Copyright (c) 2004, 2007 IBM Corporation.
-* All rights reserved. This program and the accompanying materials
-* are made available under the terms of the Eclipse Public License v1.0
-* which accompanies this distribution, and is available at
-* http://www.eclipse.org/legal/epl-v10.html
-*
-* Contributors:
-* Mike Squillace - initial API and implementation
-*******************************************************************************/
-
-package org.eclipse.actf.core.adapt;
-
-/**
- * a factory for creating adaptors. Factories are typically used for specific models using the
- * <code>Configuration.MODEL_ADAPTOR_FACTORY</code> key. A factory instance, once obtained, can be used
- * to find adaptors for a given type.
- *
- * @author Mike Squillace
- *
- */
-public interface IAdaptorFactory
-{
-
- /**
- * registers an adaptor for the given type. This type should be returned
- * by the adaptor's <code>getSupportedTypes</code> method.
- *
- * @param type - type for which adaptor is being registered
- * @param adaptor
- * @see IAdaptor#getSupportedTypes()
- */
- public void registerAdaptor (Class type, IAdaptor adaptor);
-
- /**
- * retrieves the adaptors for the given type. The adaptors are those that were
- * registered via the <code>registerAdaptor</code> method.
- *
- * @param type - type for which adaptors are desired
- * @return registered adaptors for the given type or an empty array if
- * no adaptors were registered for the given type
- */
- public IAdaptor[] getAdaptors (Class type);
-
- /**
- * retrieves the adaptors for the class name. The adaptors are those that were
- * registered via the <code>registerAdaptor</code> method.
- *
- * @param className - class name for which adaptors are desired
- * @return registered adaptors for the class name or an empty array if
- * no adaptors were registered for the given name
- */
- public IAdaptor[] getAdaptors (String className);
-
- /**
- * retrieves the adaptors not only for the given type but for all types of
- * which this class is assignable. This method differs from <code>getAdaptors</code>
- * in that <code>getAdaptors</code> returns those Adaptors only for that type
- * while this method also tries to determine whether the
- * class type argument is a subclass of a class type registered. For instance,
- * a class type of <code>org.eclipse.swt.widgets.Composite</code> may not have
- * any adaptors registered for it but it is a subclass of <code>org.eclipse.swt.widgets.Control</code>,
- * which may have adaptors registered for it. In any case,
- * all of the adaptors returned are those that were registered via the <code>registerAdaptor</code>
- * method.
- *
- * @param type - type for which adaptors are desired
- * @return registered adaptors for the given type or any of it's super types, or
- * an empty array if no adaptors were registered for the given type or any of its super types
- */
- public IAdaptor[] getAllAdaptors (Class type);
-}
diff --git a/plugins/org.eclipse.actf.core/src/org/eclipse/actf/core/config/AbstractConfiguration.java b/plugins/org.eclipse.actf.core/src/org/eclipse/actf/core/config/AbstractConfiguration.java
deleted file mode 100644
index dd2d2ee..0000000
--- a/plugins/org.eclipse.actf.core/src/org/eclipse/actf/core/config/AbstractConfiguration.java
+++ /dev/null
@@ -1,263 +0,0 @@
-/*******************************************************************************
-* Copyright (c) 2004, 2007 IBM Corporation.
-* All rights reserved. This program and the accompanying materials
-* are made available under the terms of the Eclipse Public License v1.0
-* which accompanies this distribution, and is available at
-* http://www.eclipse.org/legal/epl-v10.html
-*
-* Contributors:
-* Randy Horwitz - initial API and implementation
-*******************************************************************************/
-
-package org.eclipse.actf.core.config;
-
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.Map;
-
-import org.eclipse.actf.util.Utils;
-import org.eclipse.actf.util.logging.IReporter;
-import org.eclipse.actf.util.resources.ClassLoaderCache;
-
-
-/**
- * serves as a general-purpose implementation of the
- * Configuration interface. In particular, this class manages the overall
- * pool of ids and the key-value pairs (parameters) to which each id
- * corresponds.
- *
- * <p><b>Note</b>: Clients should extend this class rather than implementing <code>Configuration</code>
- * to avoid API modifications.
- *
- * @author Randy Horwitz
- */
-public class AbstractConfiguration implements IConfiguration
-{
-
- static final long serialVersionUID = -1301837737929422833L;
-
- public Map _configMap;
-
- protected String _curPool;
-
- /**
- * create a Configuration. Configuration objects are managed by the engine and should not
- * be created by clients. Use a RuntimeContextFactory instance to create and access
- * active configurations.
- *
- * @see org.eclipse.actf.core.runtime.RuntimeContextFactory
- */
- public AbstractConfiguration () {
- _configMap = new HashMap();
- _curPool = "";
- }
-
- /** {@inheritDoc} */
- public Map getSymbolPoolContents (String poolID) {
- return (Map) _configMap.get(poolID);
- }
-
-
- /** {@inheritDoc} */
- public void setSymbolPool (String id) {
- if (id == null || !_configMap.containsKey(id)) {
- throw new IllegalArgumentException("No pool with id "+ id);
- }
- _curPool = id;
- }
-
- protected void createSymbolPool (String id) {
- if (id == null || _configMap.containsKey(id)) {
- throw new IllegalArgumentException("Pool with id " + id + " already exists");
- }
- _configMap.put(id, new HashMap());
- setSymbolPool(id);
- }
-
-
- /** {@inheritDoc} */
- public String getSymbolPool () {
- return _curPool;
- }
-
- /** {@inheritDoc} */
- public String[] getSymbolPools () {
- return (String[]) _configMap.keySet().toArray(new String[0]);
- }
-
- /** {@inheritDoc} */
- public String[] getModelTypes () {
- setSymbolPool(IConfiguration.MODEL_ID);
- return getParameterNames();
- }
-
- /** {@inheritDoc} */
- public void setParameter (String key, Object value) {
- if (value != null) {
- getSymbolPoolContents(_curPool).put(key, value);
- }
- }
-
- /** {@inheritDoc} */
- public void setParameter (String key, String value) {
- getSymbolPoolContents(_curPool).put(key, value);
- }
-
- /** {@inheritDoc} */
- public void setParameter (String key, int value) {
- getSymbolPoolContents(_curPool).put(key, new Integer(value));
- }
-
- /** {@inheritDoc} */
- public void setParameter (String key, double value) {
- getSymbolPoolContents(_curPool).put(key, new Double(value));
- }
-
- /** {@inheritDoc} */
- public void setParameter (String key, boolean value) {
- getSymbolPoolContents(_curPool).put(key, Boolean.valueOf(value));
- }
-
- /** {@inheritDoc} */
- public void setParameter (String key, Class value) {
- getSymbolPoolContents(_curPool).put(key, value);
- }
-
- /**
- * convenience method to set any parameter in the configuration. The current
- * symbol pool id is saved and then restored after the set operation is
- * complete.
- *
- * @param poolID -
- * id of symbol pool in which set is to occur
- * @param name -
- * name or id of parameter to set
- * @param val -
- * value of parameter
- */
- public void setParameter (String poolID, String name, Object val) {
- String curID = getSymbolPool();
- setSymbolPool(poolID);
- getSymbolPoolContents(_curPool).put(name, val);
- setSymbolPool(curID);
- }
-
- /** {@inheritDoc} */
- public Object getParameter (String key) {
- return getSymbolPoolContents(_curPool).get(key);
- }
-
- /** {@inheritDoc} */
- public String getStringParameter (String key) {
- String res = (String) getSymbolPoolContents(_curPool).get(key);
- return res == null ? "" : res;
- }
-
- /** {@inheritDoc} */
- public int getIntParameter (String key) {
- Object obj = getSymbolPoolContents(_curPool).get(key);
- int res = Integer.MIN_VALUE;
- if (obj instanceof Integer) {
- res = ((Integer) obj).intValue();
- }else if (obj instanceof String) {
- try {
- res = Integer.parseInt((String) obj);
- }catch (NumberFormatException e) {
- }
- }
- return res;
- }
-
- /** {@inheritDoc} */
- public double getDoubleParameter (String key) {
- Object obj = getSymbolPoolContents(_curPool).get(key);
- double res = Double.MIN_VALUE;
- if (obj instanceof Double) {
- res = ((Double) obj).doubleValue();
- }else if (obj instanceof String) {
- try {
- res = Double.parseDouble((String) obj);
- }catch (NumberFormatException e) {
- }
- }
- return res;
- }
-
- /** {@inheritDoc} */
- public boolean getBooleanParameter (String key) {
- Object obj = getSymbolPoolContents(_curPool).get(key);
- boolean res = false;
- if (obj instanceof Boolean) {
- res = ((Boolean) obj).booleanValue();
- }else if (obj instanceof String) {
- try {
- res = Boolean.valueOf((String) obj).booleanValue();
- }catch (NumberFormatException e) {
- }
- }
- return res;
- }
-
- /** {@inheritDoc} */
- public Class getClassParameter (String key) {
- Object o = getSymbolPoolContents(_curPool).get(key);
- Class res = null;
-
- if (o instanceof Class) {
- res = (Class) o;
- }else if (o instanceof String) {
- try {
- res = ClassLoaderCache.getDefault().classForName((String) o);
- }catch (Exception e) {
- Utils.println(IReporter.SYSTEM_FATAL,e);
- }
- }
-
- return res;
- }
-
- /** {@inheritDoc} */
- public String getParameterAsString (String key) {
- return getSymbolPoolContents(_curPool).get(key).toString();
- }
-
- /**
- * default implementation for this method attempts to treat the data object as a map
- * and simply adds it to the existing configuration map.
- *
- * @param data configuration data
- * @throws ConfigurationException
- */
- public void addConfigurationData (Object data)
- throws ConfigurationException {
- if (data != null && data instanceof Map) {
- _configMap.putAll((Map) data);
- }
- }
-
- /** {@inheritDoc} */
- public String[] getParameterNames () {
- return (String[]) getSymbolPoolContents(_curPool).keySet().toArray(
- new String[0]);
- }
-
- public String toString () {
- StringBuffer sb = new StringBuffer();
- String[] pools = getSymbolPools();
- for (int p = 0; p < pools.length; ++p) {
- sb.append("Pool: " + pools[p]);
- sb.append('\n');
- Map symbols = getSymbolPoolContents(pools[p]);
- if (symbols != null && !symbols.isEmpty()) {
- for (Iterator iter = symbols.keySet().iterator(); iter.hasNext();) {
- String key = (String) iter.next();
- sb.append(key);
- sb.append('=');
- sb.append(symbols.get(key).toString());
- sb.append('\n');
- }
- }
- }
- return sb.toString();
- }
-} // AbstractConfiguration
diff --git a/plugins/org.eclipse.actf.core/src/org/eclipse/actf/core/config/ConfigurationException.java b/plugins/org.eclipse.actf.core/src/org/eclipse/actf/core/config/ConfigurationException.java
deleted file mode 100644
index 1148169..0000000
--- a/plugins/org.eclipse.actf.core/src/org/eclipse/actf/core/config/ConfigurationException.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/*******************************************************************************
-* Copyright (c) 2004, 2007 IBM Corporation.
-* All rights reserved. This program and the accompanying materials
-* are made available under the terms of the Eclipse Public License v1.0
-* which accompanies this distribution, and is available at
-* http://www.eclipse.org/legal/epl-v10.html
-*
-* Contributors:
-* Randy Horwitz - initial API and implementation
-*******************************************************************************/
-
-package org.eclipse.actf.core.config;
-
-/**
- * This class is used to report errors with ACTF's configuration
- * @author Randy Horwitz
- *
- */
-public class ConfigurationException extends Exception
-{
-
- public ConfigurationException () {
- super();
- }
-
- public ConfigurationException (String message) {
- super(message);
- }
-
- public ConfigurationException (Throwable cause) {
- super(cause);
- }
-
- public ConfigurationException (String message, Throwable cause) {
- super(message, cause);
- }
-}
diff --git a/plugins/org.eclipse.actf.core/src/org/eclipse/actf/core/config/EclipseConfiguration.java b/plugins/org.eclipse.actf.core/src/org/eclipse/actf/core/config/EclipseConfiguration.java
deleted file mode 100644
index b2914cb..0000000
--- a/plugins/org.eclipse.actf.core/src/org/eclipse/actf/core/config/EclipseConfiguration.java
+++ /dev/null
@@ -1,175 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2008 IBM Corporation.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Ann Ford - initial API and implementation
- *******************************************************************************/
-package org.eclipse.actf.core.config;
-
-import java.util.HashMap;
-import java.util.Map;
-import java.util.Stack;
-
-import org.eclipse.core.runtime.IConfigurationElement;
-import org.eclipse.core.runtime.IExtension;
-
-public class EclipseConfiguration extends AbstractConfiguration {
-
- /**
- *
- */
- static final long serialVersionUID = 7981371198710093969L;
- public static final String MODEL_NAME_ATTRIBUTE = "name";
- public static final String ALIAS_ID = "alias";
-
- transient private HashMap modelMap;
- transient private HashMap filterMap;
- transient private HashMap pluginMap;
- transient private HashMap attributeMap;
- private Stack elementStack = new Stack();
- private String pluginId;
-
- /**
- * create a Configuration from extension point information
- *
- *
- * @throws ConfigurationException
- */
- public EclipseConfiguration() throws ConfigurationException {
- super();
- }
-
- /**
- * treats data object as an
- * <code>IConfigurationElement (or IExtension??)</code>.
- *
- * @param data
- * configuration data in the form of a
- * <code>IConfigurationElement (or IExtension??)</code>
- * @throws ConfigurationException
- */
- public void addConfigurationData(Object data) throws ConfigurationException {
- if (data instanceof IConfigurationElement) {
- IConfigurationElement element = (IConfigurationElement) data;
- pluginId = element.getNamespaceIdentifier();
- addElement(element);
- } else if (data instanceof IExtension) {
- IExtension extension = (IExtension) data;
- pluginId = extension.getNamespaceIdentifier();
- IConfigurationElement[] configElements = extension
- .getConfigurationElements();
- for (int i = 0; i < configElements.length; i++) {
- addElement(configElements[i]);
- }
- }
-
- }
-
- private void addElement(IConfigurationElement element)
- throws ConfigurationException {
- /*
- * our extension points are currently either model types, or nodeFilters
- * This version is based on just to get it working for now, then make it more generic to
- * accommodate later additions and be more efficient
- */
- String elementName = element.getName();
- if (elementName.equals(MODEL_ID)) {
- // create the model symbol pool if it doesn't exist and then select
- // it
- if (_configMap.containsKey(elementName)) {
- setSymbolPool(elementName);
- modelMap = (HashMap) _configMap.get(elementName);
- } else {
- createSymbolPool(elementName);
- modelMap = new HashMap();
- _configMap.put(elementName, modelMap);
- }
- // get model attributes and add the model to the model pool
- String[] attrNames = element.getAttributeNames();
- attributeMap = new HashMap();
- for (int i = 0; i < attrNames.length; i++) {
- String attrValue = element.getAttribute(attrNames[i]);
- attributeMap.put(attrNames[i], attrValue);
- }
- String modelName = (String) attributeMap.get(MODEL_NAME_ATTRIBUTE);
- modelMap.put(modelName, attributeMap);
-
- // then get all of its children and process them too
- IConfigurationElement[] children = element.getChildren();
- if (children.length > 0) {
- elementStack.push(modelName);
- for (int i = 0; i < children.length; i++) {
- addElement(children[i]);
- }
- elementStack.pop();
- }
- } else if (elementName.equals(IConfiguration.FILTER_ID)) {
- // create the filter symbol pool if it doesn't exist and then select
- // it
- if (_configMap.containsKey(elementName)) {
- setSymbolPool(elementName);
- filterMap = (HashMap) _configMap.get(elementName);
- } else {
- createSymbolPool(elementName);
- filterMap = new HashMap();
- _configMap.put(elementName, filterMap);
- }
- // get filter attributes and add the filter to the filter pool
- String[] attrNames = element.getAttributeNames();
- attributeMap = new HashMap();
- for (int i = 0; i < attrNames.length; i++) {
- String attrValue = element.getAttribute(attrNames[i]);
- attributeMap.put(attrNames[i], attrValue);
- }
- String filterModel = (String) attributeMap
- .get(IConfiguration.FILTER_MODEL_ATTRIBUTE);
- filterMap.put(filterModel, attributeMap);
-
- } else if (elementName.equals(IConfiguration.ALIASES_ID)) {
- // aliases are children of the model element
- String model = (String) elementStack.peek();
- // create pool with id <model-name>_aliases and add the aliases
- String poolName = model + MODEL_POOL_ID_DELIMITER
- + IConfiguration.ALIASES_ID;
- if (_configMap.containsKey(poolName)) {
- setSymbolPool(poolName);
- } else {
- createSymbolPool(poolName);
- }
- // then get all of its children and process them too
- IConfigurationElement[] children = element.getChildren();
- if (children.length > 0) {
- for (int i = 0; i < children.length; i++) {
- addElement(children[i]);
- }
- }
- } else if (elementName.equals(ALIAS_ID)) {
- // get the attributes and add this element to
- // the current model alias pool - <model_name>_aliases)
- String key = element.getAttribute("name");
- String value = element.getAttribute("value");
- setParameter(key, value);
- } else {
- throw new ConfigurationException("addElement - unknown element "
- + elementName);
- }
- }
-
- /*
- * Adaptor method to handle the fact that we have two different
- * Configurations adding data to the configMap. This ensures that they both
- * add it to the same map
- */
- //TODO AKF - remove this if u can get class var solution working
- protected Map addConfigurationData(Object data, Map configMap)
- throws ConfigurationException {
- _configMap = configMap;
- addConfigurationData(data);
- return _configMap;
- }
-
-}
diff --git a/plugins/org.eclipse.actf.core/src/org/eclipse/actf/core/config/HybridConfiguraton.java b/plugins/org.eclipse.actf.core/src/org/eclipse/actf/core/config/HybridConfiguraton.java
deleted file mode 100644
index c0677d1..0000000
--- a/plugins/org.eclipse.actf.core/src/org/eclipse/actf/core/config/HybridConfiguraton.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*******************************************************************************
-* Copyright (c) 2004, 2008 IBM Corporation.
-* All rights reserved. This program and the accompanying materials
-* are made available under the terms of the Eclipse Public License v1.0
-* which accompanies this distribution, and is available at
-* http://www.eclipse.org/legal/epl-v10.html
-*
-* Contributors:
-* Ann Ford - initial API and implementation
-*******************************************************************************/ package org.eclipse.actf.core.config;
-
-import java.io.InputStream;
-
-public class HybridConfiguraton extends AbstractConfiguration {
-
- /**
- * a Configuration which can handle both XML files which contain ACTF's
- * default values and Eclipse IConfigurationElement or IExtension data
- *
- * @author Ann Ford
- */
- /**
- *
- */
- private static final long serialVersionUID = -6926451284721623066L;
-
- private XmlConfiguration xmlConfig;
- private EclipseConfiguration eclipseConfiguration;
-
- public HybridConfiguraton() throws ConfigurationException {
- super();
- xmlConfig = new XmlConfiguration();
- eclipseConfiguration = new EclipseConfiguration();
- }
-
- @Override
- public void addConfigurationData(Object data) throws ConfigurationException {
- // determine if data is input stream or IConfigurationElement
- // call appropriate delegate to load the configuration
- // pass the _configMap along so that they are both using the same copy
- if (data instanceof InputStream) {
- _configMap = xmlConfig.addConfigurationData(data, _configMap);
- // xmlConfig.addConfigurationData(data);
- } else {
- _configMap = eclipseConfiguration.addConfigurationData(data,
- _configMap);
- //eclipseConfiguration.addConfigurationData(data);
- }
- }
-
-}
diff --git a/plugins/org.eclipse.actf.core/src/org/eclipse/actf/core/config/IConfiguration.java b/plugins/org.eclipse.actf.core/src/org/eclipse/actf/core/config/IConfiguration.java
deleted file mode 100644
index 8a30d23..0000000
--- a/plugins/org.eclipse.actf.core/src/org/eclipse/actf/core/config/IConfiguration.java
+++ /dev/null
@@ -1,326 +0,0 @@
-/*******************************************************************************
-* Copyright (c) 2004, 2007 IBM Corporation.
-* All rights reserved. This program and the accompanying materials
-* are made available under the terms of the Eclipse Public License v1.0
-* which accompanies this distribution, and is available at
-* http://www.eclipse.org/legal/epl-v10.html
-*
-* Contributors:
-* Mike Squillace - initial API and implementation
-*******************************************************************************/
-
-package org.eclipse.actf.core.config;
-
-import java.io.Serializable;
-import java.util.Map;
-
-/**
- * interface to embody overall settings and parameters for the validation process. Implementations of this interface will
- * build configuration objects from a variety of sources such as files on the file system, serialized data, database queries, and the like.
- *
- * <p>ACTF configuration instances consist of symbol pools, each pool containing a set of symbols and their
- * corresponding values. There are two types of symbol pools:
- *
- * <p><ul>
- * <li>general symbol pools that specify parameters to the validation engine or UI componentry or other
- * componentry built upon the core rules engine
- * <li>model-specific pools that contain symbols and values for specific model
- * contributed to the engine. These pools are noted below as 'model pools' and are
- * specified with the noted 'model pool ids'.
- * </ul>
- *
- * <p><b>Note</b>: Clients who wish to form configuration instances from other sources than the default source (i.e. xml files) should extend
- * <code>AbstractConfiguration</code> rather than implementing this interface. Also, the <code>RuntimeContextFactory</code>
- * should always be used to instantiate configuration objects.
- *
- * <p><b>Important</b>: The current implementations packaged with ACTF are <i>not</i> thread-safe.
- *
- * @see AbstractConfiguration
- * @see XmlConfiguration
- * @see see org.eclipse.actf.core.runtime.RuntimeContextFactory
- * @author Mike Squillace
- */
-public interface IConfiguration extends Serializable
-{
-
- static final long serialVersionUID = -3661241965923991487L;
-
- /**
- * model pool ids are denoted with the model name followed by this
- * delimiter followed by the actual pool id
- */
- public static final char MODEL_POOL_ID_DELIMITER = '_';
-
- /**
- * pool id and model pool id for models - value is 'model'
- */
- public static final String MODEL_ID = "model";
-
- /**
- * pool id for main actf pool - value is 'actf'
- */
- public static final String ACTF_ID = "actf";
-
- public static final String WORKING_DIR_KEY = "actf.working.dir";
- public static final String TRACE_LEVEL_KEY = "actf.trace.level";
- public static final String TRACE_STREAM_KEY = "actf.trace.stream";
-
- public static final String MODEL_LOCATORIDS_POOL = "locator";
- public static final String MODEL_ADAPTOR_FACTORY = "adaptor.factory";
- public static final String MODEL_IGNORENODENAMES = "ignore.names";
- public static final String MODEL_IGNOREIDS = "ignore.ids";
- public static final String MODEL_LOCATOR = "locator";
- public static final String MODEL_BASE_TYPE = "basetype";
-
- public static final String SHOW_INVISIBLE_KEY = "show.hidden";
- public static final String SHOW_ITEMS_KEY = "show.items";
-
- public static final String FILTER_ID = "filter";
- public static final String FILTER_MODEL_ATTRIBUTE = "model";
- public static final String FILTER_CLASSNAME_ATTRIBUTE ="class";
- public static final String FILTER_NODENAMES_ATTRIBUTE ="nodenames";
- public static final String FILTER_NODEIDS_ATTRIBUTE ="nodeids";
-
- public static final String ALIASES_ID = "aliases";
-
-
-
- /**
- * set the symbol pool to be used in subsequent set/getParameter calls. A
- * symbol pool embodies a purpose or role in the ACTF engine. Instances of
- * this interface might represent a particular symbol pool by a .properties
- * file, data base table, or XML document.
- *
- * <p>Symbol pool ids can have two forms:
- *
- * <p><ul>
- * <li>generic pool ids which are alphanumeric in nature
- * <li>model pool ids, which have the form:
- *
- * <p>
- * <modelName><code>MODEL_POOL_ID_DELIMITER</code><poolId>
- *
- * <p>The symbol pool is the pool that is queried for all get/setXXXParameter methods. Thus,
- * this method should always be called prior to a set/getXXXParameter method to insure that the correct
- * pool is being accessed.
- *
- * @param id -
- * id of symbol pool
- *
- */
- public void setSymbolPool (String id);
-
- /**
- * get the current symbol pool. The returned value is the id of the
- * pool that is currently be accessed by any get/setXXXParameter methods.
- *
- * @return current symbol pool id
- * @see #setSymbolPool(String)
- */
- public String getSymbolPool ();
-
- /**
- * get all available symbol pools.
- *
- * @return array of ids for all available symbol pools or empty array if no
- * pools have been created other than the default pool
- * @see #setSymbolPool(String)
- */
- public String[] getSymbolPools ();
-
- /**
- * get the contents of the specified symbol pool
- *
- * @param poolID -
- * id of symbol pool
- * @return map containing contents of pool or <code>null</code> if pool
- * does not exist
- * @see #setSymbolPool(String)
- */
- public Map getSymbolPoolContents (String poolID);
-
- /**
- * retrieve a string parameter from the current symbol pool
- *
- * @param key -
- * name or key of parameter
- * @return string parameter with the given name or <code>null</code> if no
- * such key exists
- * @see #setSymbolPool(String)
- */
- public String getStringParameter (String key);
-
- /**
- * set a string parameter in the current symbol pool
- *
- * @param key -
- * name of parameter
- * @param val -
- * string value corresponding to this key
- * @see #setSymbolPool(String)
- */
- public void setParameter (String key, String val);
-
- /**
- * retrieve an int parameter from the current symbol pool
- *
- * @param key -
- * name or key of parameter
- * @return int parameter with the given name or <code>null</code> if no
- * such key exists
- * @see #setSymbolPool(String)
- */
- public int getIntParameter (String key);
-
- /**
- * set an int parameter in the current symbol pool
- *
- * @param key -
- * name of parameter
- * @param val -
- * int value corresponding to this key
- * @see #setSymbolPool(String)
- */
- public void setParameter (String key, int val);
-
- /**
- * retrieve a double parameter from the current symbol pool
- *
- * @param key -
- * name or key of parameter
- * @return double parameter with the given name or <code>null</code> if no
- * such key exists
- * @see #setSymbolPool(String)
- */
- public double getDoubleParameter (String key);
-
- /**
- * set a double parameter in the current symbol pool
- *
- * @param key -
- * name of parameter
- * @param val -
- * double value corresponding to this key
- * @see #setSymbolPool(String)
- */
- public void setParameter (String key, double val);
-
- /**
- * retrieve a boolean parameter from the current symbol pool
- *
- * @param key -
- * name or key of parameter
- * @return boolean parameter with the given name or <code>null</code> if
- * no such key exists
- * @see #setSymbolPool(String)
- */
- public boolean getBooleanParameter (String key);
-
- /**
- * set a boolean parameter in the current symbol pool
- *
- * @param key -
- * name of parameter
- * @param val -
- * boolean value corresponding to this key
- * @see #setSymbolPool(String)
- */
- public void setParameter (String key, boolean val);
-
- /**
- * retrieve a class parameter from the current symbol pool
- *
- * @param key -
- * name or key of parameter
- * @return class parameter with the given name or <code>null</code> if no
- * such key exists
- * @see #setSymbolPool(String)
- */
- public Class getClassParameter (String key);
-
- /**
- * set a class parameter in the current symbol pool
- *
- * @param key -
- * name of parameter
- * @param val -
- * Class object corresponding to this key
- * @see #setSymbolPool(String)
- */
- public void setParameter (String key, Class val);
-
- /**
- * set a parameter of an undetermined type in the current symbol pool
- *
- * @param key -
- * name of parameter
- * @param val -
- * object corresponding to this key
- * @see #setSymbolPool(String)
- */
- public void setParameter (String key, Object val);
-
- /**
- * get a parameter of an undetermined type in the current symbol pool
- *
- * @param key -
- * name of parameter to retrieve
- * @return desired parameter
- * @see #setSymbolPool(String)
- */
- public Object getParameter (String key);
-
- /**
- * retrieve list of parameters from the current symbol pool
- *
- * @return list of parameters or empty array if no
- * parameters exist
- * @see #setSymbolPool(String)
- */
- public String[] getParameterNames ();
-
- /**
- * get the parameter with the given key as a string
- *
- * @param key -
- * key of desired parameter
- * @return string representation of parameter or <code>null</code> if
- * parameter is not found
- * @see #setSymbolPool(String)
- */
- public String getParameterAsString (String key);
-
- /**
- * returns the model supported within this configuration object. ACTF is packaged with
- * support for the following model:
- *
- * <p><ul>
- * <li>Java Swing
- * <li>Eclipse SWT
- * <li>W3C Document Object Model (DOM)
- * <li>Mozilla browser
- * </ul>
- *
- * <p>Models are always introduced in the main symbol pool, <code>ACTF_ID</code> and
- * should be retrieved via the <code>MODEL_ID</code> symbol pool. Indeed, this method will usually be short-hand for:
- *
- * <p><pre>
- * setSymbolPool(MODEL_ID);
- * return getParameterNames();
- * </pre></p>
- *
- * @return names of supported model
- * @see #getParameterNames()
- * @see #setSymbolPool(String)
- */
- public String[] getModelTypes ();
-
- /**
- * add data to this configuration object
- *
- * @param data the data to be added
- * @throws ConfigurationException
- */
- public void addConfigurationData (Object data)
- throws ConfigurationException;
-} // Configuration
diff --git a/plugins/org.eclipse.actf.core/src/org/eclipse/actf/core/config/Version.java b/plugins/org.eclipse.actf.core/src/org/eclipse/actf/core/config/Version.java
deleted file mode 100644
index 7cfb6f0..0000000
--- a/plugins/org.eclipse.actf.core/src/org/eclipse/actf/core/config/Version.java
+++ /dev/null
@@ -1,80 +0,0 @@
-/*******************************************************************************
-* Copyright (c) 2004, 2007 IBM Corporation.
-* All rights reserved. This program and the accompanying materials
-* are made available under the terms of the Eclipse Public License v1.0
-* which accompanies this distribution, and is available at
-* http://www.eclipse.org/legal/epl-v10.html
-*
-* Contributors:
-* Mike Squillace - initial API and implementation
-*******************************************************************************/
-
-package org.eclipse.actf.core.config;
-
-import java.util.StringTokenizer;
-
-public class Version
-{
-
- public static final String bundleVersionKey = "Bundle-Version";
-
- private int major;
-
- private int minor;
-
- private int micro;
-
- public Version (int major, int minor, int micro) {
- this.major = major;
- this.minor = minor;
- this.micro = micro;
- }
-
- public Version (String version) {
- StringTokenizer st = new StringTokenizer(version, ".", false);
- if (st.hasMoreTokens()) {
- major = Integer.valueOf(st.nextToken()).intValue();
- if (st.hasMoreTokens()) {
- minor = Integer.valueOf(st.nextToken()).intValue();
- if (st.hasMoreTokens()) {
- micro = Integer.valueOf(st.nextToken()).intValue();
- }
- }
- }
- }
-
- public String toString () {
- return major + "." + minor + "." + micro;
- }
-
- /**
- * @param args
- */
- public static void main (String[] args) {
- // TODO Auto-generated method stub
- }
-
- public int getMajor () {
- return major;
- }
-
- public void setMajor (int major) {
- this.major = major;
- }
-
- public int getMicro () {
- return micro;
- }
-
- public void setMicro (int micro) {
- this.micro = micro;
- }
-
- public int getMinor () {
- return minor;
- }
-
- public void setMinor (int minor) {
- this.minor = minor;
- }
-}
diff --git a/plugins/org.eclipse.actf.core/src/org/eclipse/actf/core/config/XmlConfiguration.java b/plugins/org.eclipse.actf.core/src/org/eclipse/actf/core/config/XmlConfiguration.java
deleted file mode 100644
index 81d4688..0000000
--- a/plugins/org.eclipse.actf.core/src/org/eclipse/actf/core/config/XmlConfiguration.java
+++ /dev/null
@@ -1,419 +0,0 @@
-/*******************************************************************************
-* Copyright (c) 2004, 2007 IBM Corporation.
-* All rights reserved. This program and the accompanying materials
-* are made available under the terms of the Eclipse Public License v1.0
-* which accompanies this distribution, and is available at
-* http://www.eclipse.org/legal/epl-v10.html
-*
-* Contributors:
-* Mike Squillace, Randy Horwitz - initial API and implementation
-*******************************************************************************/
-
-package org.eclipse.actf.core.config;
-
-import java.io.InputStream;
-import java.util.Arrays;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.Map;
-import java.util.Set;
-import java.util.Stack;
-
-import javax.xml.parsers.SAXParser;
-import javax.xml.parsers.SAXParserFactory;
-
-import org.eclipse.actf.core.runtime.IRuntimeContext;
-import org.eclipse.actf.core.runtime.RuntimeContextFactory;
-import org.eclipse.actf.util.Utils;
-import org.eclipse.actf.util.logging.IReporter;
-import org.eclipse.actf.util.resources.ClassLoaderCache;
-import org.xml.sax.Attributes;
-import org.xml.sax.Locator;
-import org.xml.sax.SAXException;
-import org.xml.sax.SAXParseException;
-import org.xml.sax.helpers.DefaultHandler;
-
-
-/**
- * a Configuration based on XML files which contain ACTF's default
- * values.
- *
- * @author Mike Squillace, Randy Horwitz
- */
-public class XmlConfiguration extends AbstractConfiguration
-{
-
- static final long serialVersionUID = -6983580695767275023L;
-
- private static final char PATH_SEPARATOR = '.';
-
- private static final String ROOT_ELEMENT_NAME = "configuration";
-
- private static final String POOL_ELEMENT = "pool"; // Title of pool element
-
- private static final String ATTR_PROPERTY_NAME = "name";
-
- private static final String ATTR_CONTENT_TYPE = "type";
-
- private static final String TEXT_CONTENT = ".textContent.";
-
- private static final String PROPERTY_ELEMENT = "property";
-
- private static final String POOL_ID = "id";
-
- private static final String ACTF_XML_PREFIX = "actf";
-
- transient private String _currentXmlFilePrefix;
-
- transient private HashMap _attributeMap = new HashMap();
-
- /**
- * create a Configuration from the .xml files found in the resources
- * directory or, if specified, using System Properties.
- *
- * @throws ConfigurationException
- */
- public XmlConfiguration () throws ConfigurationException {
- super();
- } // main ctor
-
- /**
- * treats data object as an <code>InputStream</code>. The contents of the
- * stream are assumed to be syntactically correct XML and valid markup
- * within a actf.xml file for the ACTF engine. All model-specific
- * configuration .xml files will be processed based on the contents of the
- * 'model' pool.
- *
- *@param data configuration data in the form of an <code>InputStream</code>
- * @throws ConfigurationException
- */
- public void addConfigurationData (Object data)
- throws ConfigurationException {
- if (data instanceof InputStream) {
- InputStream dataStream = (InputStream) data;
- Set currentModels = new HashSet();
- if (!_configMap.isEmpty()) {
- currentModels.addAll(Arrays.asList(getModelTypes()));
- }
- parseXml(dataStream);
-
- String[] models = getModelTypes();
- // Go through all of the model specific XML files, and parse them
- for (int i = 0; i < models.length; i++) {
- if (!currentModels.contains(models[i])) {
- _currentXmlFilePrefix = models[i];
- parseXml(models[i]);
- }
- }
- _currentXmlFilePrefix = null;
- //Don't automatically set this
- //setSymbolPool(IConfiguration.ACTF_ID);
- }else {
- super.addConfigurationData(data);
- }
- }
-
- protected Map addConfigurationData(Object data, Map configMap)
- throws ConfigurationException {
- _configMap=configMap;
- addConfigurationData(data);
- return _configMap;
-
- }
- /**
- * This method returns an attributes map, keyed by all of the elements in
- * the current pool. The values are maps, holding the attributes and their
- * values in key value form.
- *
- * @return the attribute map
- */
- public Map getAttributeMap () {
- return (Map) _attributeMap.get(getSymbolPool());
- }
-
- /**
- * parse the xml file represented by the stream
- *
- * @param stream -
- * InputStream representing the XML file to be parsed.
- */
- private void parseXml (InputStream stream)
- throws ConfigurationException {
- // If we actually have an input stream, parse the file.
- if (stream != null) {
- try {
- SAXParserFactory factory = SAXParserFactory.newInstance();
- SAXParser parser = factory.newSAXParser();
- parser.parse(stream, new ParserHandler());
- }catch (Exception e) {
- Utils.println(
- IReporter.SYSTEM_FATAL,
- "SAXParseException caught while parsing file."
- + e.getMessage(), e);
- throw new ConfigurationException("Exception caught while trying to parse file."
- + e.getMessage());
- }
- }
- }
-
- /**
- * parse the xml file denoted by the prefix passed in
- *
- * @param xmlFilePrefix -
- * prefix of the XML file passed in. I.E. awt is the prefix for
- * awt.xml.
- */
- private void parseXml (String xmlFilePrefix) throws ConfigurationException {
- IRuntimeContext context = RuntimeContextFactory.getInstance().getRuntimeContext();
- InputStream inputStream = context.getResourceLocator().getResourceAsStream(xmlFilePrefix, null, "xml", null);
- if (inputStream != null) {
- parseXml(inputStream);
- }
- }
-
- protected class ParserHandler extends DefaultHandler
- {
- private Locator _locator;
- private Stack _elementStack = new Stack();
- private boolean _readChars;
- private String _key;
- private String _poolName;
- private HashMap _elemAttributeMap;
-
- public void setDocumentLocator (Locator locator) {
- _locator = locator;
- }
-
- public void characters (char[] ch, int start, int length)
- throws SAXException {
- // The only time we care about characters is if we are within an
- // element,
- // nested within a pool element
- // Any other characters will be things such as white space,
- // which we don't care about
- if (_readChars) {
- // We are not guaranteed that the data for this element will be
- // read in
- // in one chunk. So, append the latest set of characters to our
- // element data.
- HashMap elemAttrs = (HashMap) _elemAttributeMap.get(computeCurrentPath());
- StringBuffer elementData = (StringBuffer) elemAttrs.get(TEXT_CONTENT);
- elementData.append(new String(ch, start, length).trim());
- }
- }
-
- public void startElement (String namespaceURI, String localName,
- String qName, Attributes atts)
- throws SAXException {
- // The first thing to do is figure out whether we have encountered
- // a pool element.
- // MAS: want to expand this to accept any child element of
- // <configuration> as a pool
- if (qName.equals(POOL_ELEMENT)) {
- // OK, we have encountered a pool element. Initialize
- // necessary variables, and then set the pool id for use
- // in setting the map for this pool into the config map.
- _poolName = getPoolName(atts.getValue(POOL_ID));
- if (_configMap.containsKey(_poolName)) {
- setSymbolPool(_poolName);
- _elemAttributeMap = (HashMap) _attributeMap.get(_poolName);
- }else {
- createSymbolPool(_poolName);
- _elemAttributeMap = new HashMap();
- _attributeMap.put(_poolName, _elemAttributeMap);
- }
- }else if (!qName.equals(ROOT_ELEMENT_NAME)) {
- // start definition of symbol in pool
- _readChars = true;
- // Check the elementname. If this is a property element, the key
- // is going
- // to be the name attribute of that property.
- if (qName.equals(PROPERTY_ELEMENT)) {
- _key = atts.getValue(ATTR_PROPERTY_NAME);
- if (_key == null || _key.length() == 0) {
- throw new SAXException("No name defined for property in pool " + _poolName);
- }
- _elementStack.push(PATH_SEPARATOR + PROPERTY_ELEMENT);
- HashMap attributeMap = new HashMap();
- // holds the text content for the current element
- attributeMap.put(TEXT_CONTENT, new StringBuffer());
- _elemAttributeMap.put(computeCurrentPath(), attributeMap);
- }else {
- // If this element has any of them, build a map of the
- // attributes,
- // and place it into the XmlConfiguration attribute
- // map,
- // keyed by poolName
- _elementStack.push(qName);
- String path = computeCurrentPath();
- HashMap attributeMap = (HashMap) _elemAttributeMap.get(path);
- if (attributeMap == null) {
- attributeMap = new HashMap();
- // holds the text content for the current element
- attributeMap.put(TEXT_CONTENT, new StringBuffer());
- _elemAttributeMap.put(path, attributeMap);
- }
- if (atts.getLength() > 0) {
- for (int i = 0; i < atts.getLength(); i++) {
- attributeMap.put(atts.getQName(i), atts.getValue(i));
- }
- } // element has attributes
- } // is not property element
- } // is not a pool element
- }
-
- public void endElement (String namespaceURI, String localName,
- String qName) throws SAXException {
- // Are we closing a pool element?
- if (qName.equals(POOL_ELEMENT)) {
- _attributeMap.put(_poolName, _elemAttributeMap);
- _readChars = false;
- }else if (!qName.equals(ROOT_ELEMENT_NAME)) {
- HashMap elemAttrs = (HashMap) _elemAttributeMap.get(computeCurrentPath());
- String val = ((StringBuffer) elemAttrs.get(TEXT_CONTENT)).toString();
- String type = (String) elemAttrs.get(ATTR_CONTENT_TYPE);
- mapAndSetParameter(val, type);
- // clear the text content since its a StringBuffer
- // and we do not want to append to old data if the element has the same name
- ((StringBuffer) elemAttrs.get(TEXT_CONTENT)).setLength(0);
- _elementStack.pop();
- _readChars = !_elementStack.empty();
- }
- }
-
- public void error (SAXParseException e) throws SAXException {
- Utils.println(
- IReporter.SYSTEM_FATAL, "SAX parse exception -- line: "
- + _locator.getLineNumber() + ", column: "
- + _locator.getColumnNumber(), e);
- throw e;
- }
-
- public void warning (SAXParseException e) throws SAXException {
- Utils.println(
- IReporter.SYSTEM_NONFATAL, "SAX parse exception -- line: "
- + _locator.getLineNumber() + ", column: "
- + _locator.getColumnNumber(), e);
- }
-
- public void fatalError (SAXParseException e) throws SAXException {
- Utils.println(
- IReporter.SYSTEM_FATAL, "SAX parse exception -- line: "
- + _locator.getLineNumber() + ", column: "
- + _locator.getColumnNumber(), e);
- throw e;
- }
-
- private String computeCurrentPath () {
- StringBuffer sb = new StringBuffer();
- for (Iterator iter = _elementStack.iterator(); iter.hasNext();) {
- sb.append((String) iter.next());
- if (iter.hasNext()) {
- sb.append(PATH_SEPARATOR);
- }
- }
- return sb.toString();
- }
-
- /**
- * This method builds the name of the pool, based on the kind of XML
- * file we are reading.
- *
- * @param xmlId -
- * id attribute of pool passed in
- * @return the name of the pool
- */
- private String getPoolName (String xmlId) throws SAXException {
- String returnValue; // value to be returned
- if (xmlId == null || xmlId.length() == 0) {
- throw new SAXException("No id defined for pool");
- }
-
- // This test is pretty simple. One of the model based pools,
- // such as one residing in swt.xml, needs to have swt prepended to
- // the pool name in order
- // to stay with our current convention. I.E. swt.xml contains a pool
- // with an id of aliases,
- // but our conventions expect swt_aliases for the pool name.
- // MAS: note that the test assumes that all pools are defined in
- // either actf.xml or in
- // a model configuration file
- if (_currentXmlFilePrefix == null
- || _currentXmlFilePrefix.equals(ACTF_XML_PREFIX)) {
- returnValue = xmlId;
- }else {
- returnValue = _currentXmlFilePrefix
- + MODEL_POOL_ID_DELIMITER + xmlId;
- }
- return returnValue;
- }
-
- private void mapAndSetParameter (String val, String type) {
- String path = computeCurrentPath();
- if (val == null) {
- val = "";
- }
- if (path.equals(PATH_SEPARATOR + PROPERTY_ELEMENT)) {
- path = _key;
- }
- if (type == null || type.equals(String.class.getName())) {
- setParameter(path, val);
- }else if (type.equals(Class.class.getName())) {
- Class cls = ClassLoaderCache.getDefault().classForName(val);
- if (cls != null) {
- setParameter(path, cls.getName());
- } else {
- Utils.println(IReporter.SYSTEM_NONFATAL, "Could not find class for value " + val);
- }
- }else if (type.equals(Integer.TYPE.getName())
- || type.equals(Integer.class.getName())) {
- try {
- setParameter(path, Integer.parseInt(val));
- }catch (NumberFormatException e) {
- Utils.println(
- IReporter.SYSTEM_NONFATAL,
- "Error parsing value for symbol " + path);
- }
- }else if (type.equals(Double.TYPE.getName())
- || type.equals(Double.class.getName())) {
- try {
- setParameter(path, Double.parseDouble(val));
- }catch (NumberFormatException e) {
- Utils.println(
- IReporter.SYSTEM_NONFATAL,
- "Error parsing value for symbol " + path);
- }
- }else if (type.equals(Long.TYPE.getName())
- || type.equals(Long.class.getName())) {
- try {
- setParameter(path, Long.parseLong(val));
- }catch (NumberFormatException e) {
- Utils.println(
- IReporter.SYSTEM_NONFATAL,
- "Error parsing value for symbol " + path);
- }
- }else if (type.equals(Float.TYPE.getName())
- || type.equals(Float.class.getName())) {
- try {
- setParameter(path, Float.parseFloat(val));
- }catch (NumberFormatException e) {
- Utils.println(
- IReporter.SYSTEM_NONFATAL,
- "Error parsing value for symbol " + path);
- }
- }else if (type.equals(Boolean.TYPE.getName())
- || type.equals(Boolean.class.getName())) {
- try {
- setParameter(path, Boolean.valueOf(val).booleanValue());
- }catch (NumberFormatException e) {
- Utils.println(
- IReporter.SYSTEM_NONFATAL,
- "Error parsing value for symbol " + path);
- }
- }else {
- setParameter(path, val.toString());
- }
- }
- } // end inner class ParserHandler
-} // XmlConfiguration
diff --git a/plugins/org.eclipse.actf.core/src/org/eclipse/actf/core/runtime/AbstractRuntimeContext.java b/plugins/org.eclipse.actf.core/src/org/eclipse/actf/core/runtime/AbstractRuntimeContext.java
deleted file mode 100644
index 019603c..0000000
--- a/plugins/org.eclipse.actf.core/src/org/eclipse/actf/core/runtime/AbstractRuntimeContext.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/*******************************************************************************
-* Copyright (c) 2004, 2007 IBM Corporation.
-* All rights reserved. This program and the accompanying materials
-* are made available under the terms of the Eclipse Public License v1.0
-* which accompanies this distribution, and is available at
-* http://www.eclipse.org/legal/epl-v10.html
-*
-* Contributors:
-* <a href="mailto:masquill@us.ibm.com>Mike Squillace</a> - initial API and implementation
-*******************************************************************************/
-
-
-package org.eclipse.actf.core.runtime;
-
-import org.eclipse.actf.core.config.IConfiguration;
-import org.eclipse.actf.util.logging.IErrorLogger;
-import org.eclipse.actf.util.resources.IResourceLocator;
-
-
-/**
- * @author <a href="mailto:masquill@us.ibm.com>Mike Squillace</a>
- *
- */
-public abstract class AbstractRuntimeContext implements IRuntimeContext
-{
-
- protected IErrorLogger errorLogger;
- protected IConfiguration configuration;
- protected IResourceLocator resourceLocator;
-
- /** {@inheritDoc} */
- public IResourceLocator getResourceLocator() {
- return resourceLocator;
- }
-
- /** {@inheritDoc} */
- public IErrorLogger getErrorLogger() {
- return errorLogger;
- }
-
-}
diff --git a/plugins/org.eclipse.actf.core/src/org/eclipse/actf/core/runtime/EclipseRuntimeContext.java b/plugins/org.eclipse.actf.core/src/org/eclipse/actf/core/runtime/EclipseRuntimeContext.java
deleted file mode 100644
index f4277ce..0000000
--- a/plugins/org.eclipse.actf.core/src/org/eclipse/actf/core/runtime/EclipseRuntimeContext.java
+++ /dev/null
@@ -1,84 +0,0 @@
-/*******************************************************************************
-* Copyright (c) 2004, 2007 IBM Corporation.
-* All rights reserved. This program and the accompanying materials
-* are made available under the terms of the Eclipse Public License v1.0
-* which accompanies this distribution, and is available at
-* http://www.eclipse.org/legal/epl-v10.html
-*
-* Contributors:
-* <a href="mailto:masquill@us.ibm.com>Mike Squillace</a> - initial API and implementation
-*******************************************************************************/
-
-
-package org.eclipse.actf.core.runtime;
-
-import java.io.IOException;
-import java.io.InputStream;
-
-import org.eclipse.actf.core.config.ConfigurationException;
-import org.eclipse.actf.core.config.HybridConfiguraton;
-import org.eclipse.actf.core.config.IConfiguration;
-import org.eclipse.actf.util.logging.EclipseErrorLogger;
-import org.eclipse.actf.util.resources.EclipseResourceLocator;
-import org.eclipse.actf.util.resources.IResourceLocator;
-
-
-/**
- * @author <a href="mailto:masquill@us.ibm.com>Mike Squillace</a>
- *
- */
-public class EclipseRuntimeContext extends AbstractRuntimeContext
-{
-
- public EclipseRuntimeContext() {
- super();
- errorLogger = new EclipseErrorLogger();
- resourceLocator = new EclipseResourceLocator();
- }
-
- public IConfiguration getConfiguration() throws ConfigurationException {
- // Old XML based configuration
- /*
- * if (configuration == null) { InputStream configFileStream =
- * resourceLocator.getResourceAsStream( IConfiguration.ACTF_ID,
- * IResourceLocator.DEFAULT_ACTF_RESOURCES_DIR, "xml", null );
- *
- * configuration = new XmlConfiguration(); if (configFileStream != null) {
- * configuration.addConfigurationData(configFileStream); try {
- * configFileStream.close(); } catch (IOException e) {
- * e.printStackTrace(); } } }
- */
-
- // New EclipseConfiguration based on extensions
- /*
- * if (configuration == null) {
- *
- * configuration = new EclipseConfiguration();
- *
- * configuration.addConfigurationData(IExtension or
- * IConfigurationElement);
- *
- * }
- */
- // temporary HybridConfiguration which handles both styles
- if (configuration == null) {
- InputStream configFileStream = resourceLocator.getResourceAsStream(
- IConfiguration.ACTF_ID, IResourceLocator.DEFAULT_ACTF_RESOURCES_DIR,
- "xml", null
- );
-
- configuration = new HybridConfiguraton();
- if (configFileStream != null) {
- configuration.addConfigurationData(configFileStream);
- try {
- configFileStream.close();
- } catch (IOException e) {
- e.printStackTrace();
- }
- }
- }
-
- return configuration;
- }
-
-}
diff --git a/plugins/org.eclipse.actf.core/src/org/eclipse/actf/core/runtime/IRuntimeContext.java b/plugins/org.eclipse.actf.core/src/org/eclipse/actf/core/runtime/IRuntimeContext.java
deleted file mode 100644
index 636b290..0000000
--- a/plugins/org.eclipse.actf.core/src/org/eclipse/actf/core/runtime/IRuntimeContext.java
+++ /dev/null
@@ -1,28 +0,0 @@
-/*******************************************************************************
-* Copyright (c) 2004, 2007 IBM Corporation.
-* All rights reserved. This program and the accompanying materials
-* are made available under the terms of the Eclipse Public License v1.0
-* which accompanies this distribution, and is available at
-* http://www.eclipse.org/legal/epl-v10.html
-*
-* Contributors:
-* Mike Squillace - initial API and implementation
-*******************************************************************************/
-
-
-package org.eclipse.actf.core.runtime;
-
-import org.eclipse.actf.core.config.ConfigurationException;
-import org.eclipse.actf.core.config.IConfiguration;
-import org.eclipse.actf.util.logging.IErrorLogger;
-import org.eclipse.actf.util.resources.IResourceLocator;
-
-
-public interface IRuntimeContext
-{
-
- public IConfiguration getConfiguration () throws ConfigurationException;
- public IResourceLocator getResourceLocator ();
- public IErrorLogger getErrorLogger ();
-
-}
diff --git a/plugins/org.eclipse.actf.core/src/org/eclipse/actf/core/runtime/RuntimeContextFactory.java b/plugins/org.eclipse.actf.core/src/org/eclipse/actf/core/runtime/RuntimeContextFactory.java
deleted file mode 100644
index 14270c9..0000000
--- a/plugins/org.eclipse.actf.core/src/org/eclipse/actf/core/runtime/RuntimeContextFactory.java
+++ /dev/null
@@ -1,73 +0,0 @@
-/*******************************************************************************
-* Copyright (c) 2004, 2007 IBM Corporation.
-* All rights reserved. This program and the accompanying materials
-* are made available under the terms of the Eclipse Public License v1.0
-* which accompanies this distribution, and is available at
-* http://www.eclipse.org/legal/epl-v10.html
-*
-* Contributors:
-* Mike Squillace - initial API and implementation
-*******************************************************************************/
-
-
-package org.eclipse.actf.core.runtime;
-
-import java.lang.reflect.Method;
-
-public class RuntimeContextFactory
-{
-
- public static final String RUNTIME_CONTEXT_CLASSNAME_KEY = "org.eclipse.actf.core.runtimeContext";
-
- private static RuntimeContextFactory factoryInstance;
-
- private IRuntimeContext contextInstance;
-
- protected RuntimeContextFactory () {
- }
-
- public static RuntimeContextFactory getInstance () {
- if (factoryInstance == null) {
- factoryInstance = new RuntimeContextFactory();
- }
- return factoryInstance;
- }
-
- public IRuntimeContext getRuntimeContext() {
- if (contextInstance == null) {
- contextInstance = createRuntimeContext();
- }
- return contextInstance;
- }
-
- private IRuntimeContext createRuntimeContext () {
- String clsName = "org.eclipse.actf.core.runtime.StandaloneRuntimeContext";
- String contextProp = System.getProperty(RUNTIME_CONTEXT_CLASSNAME_KEY);
- IRuntimeContext context = null;
-
- if (contextProp != null && contextProp.length() > 0) {
- clsName = contextProp;
- } else {
- try {
- Class platformCls = Class.forName("org.eclipse.core.runtime.Platform");
- Method isRunning = platformCls.getMethod("isRunning", (Class[]) null);
- if (isRunning != null) {
- boolean inEclipse = ((Boolean) isRunning.invoke(null, (Object[]) null)).booleanValue();
- if (inEclipse) {
- clsName = "org.eclipse.actf.core.runtime.EclipseRuntimeContext";
- }
- }
- } catch (Exception e) {
- // not in Eclipse so assume stand-alone
- }
- }
-
- try {
- context = (IRuntimeContext) Class.forName(clsName).newInstance();
- } catch (Exception e) {
- throw new RuntimeException(e);
- }
-
- return context;
- }
-}
diff --git a/plugins/org.eclipse.actf.core/src/org/eclipse/actf/core/runtime/StandaloneRuntimeContext.java b/plugins/org.eclipse.actf.core/src/org/eclipse/actf/core/runtime/StandaloneRuntimeContext.java
deleted file mode 100644
index 5f95bce..0000000
--- a/plugins/org.eclipse.actf.core/src/org/eclipse/actf/core/runtime/StandaloneRuntimeContext.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/*******************************************************************************
-* Copyright (c) 2004, 2007 IBM Corporation.
-* All rights reserved. This program and the accompanying materials
-* are made available under the terms of the Eclipse Public License v1.0
-* which accompanies this distribution, and is available at
-* http://www.eclipse.org/legal/epl-v10.html
-*
-* Contributors:
-* Mike Squillace - initial API and implementation
-*******************************************************************************/
-
-
-package org.eclipse.actf.core.runtime;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.net.URL;
-
-import org.eclipse.actf.core.config.ConfigurationException;
-import org.eclipse.actf.core.config.IConfiguration;
-import org.eclipse.actf.core.config.XmlConfiguration;
-import org.eclipse.actf.util.logging.StreamErrorLogger;
-import org.eclipse.actf.util.resources.DefaultResourceLocator;
-
-
-public class StandaloneRuntimeContext extends AbstractRuntimeContext
-{
-
- public StandaloneRuntimeContext() {
- super();
- errorLogger = new StreamErrorLogger(System.err);
- resourceLocator = new DefaultResourceLocator();
- }
-
- public IConfiguration getConfiguration () throws ConfigurationException {
- if (configuration == null) {
- URL[] urls = resourceLocator.getResources(IConfiguration.ACTF_ID + ".xml");
- configuration = new XmlConfiguration();
- for (int p = 0; p < urls.length; ++p) {
- try {
- InputStream configFileStream = urls[p].openStream();
- //System.err.println("url="+urls[p]+"; "+urls[p].toExternalForm()+"; "+configFileStream);
- if (configFileStream != null) {
- configuration.addConfigurationData(configFileStream);
- }
- configFileStream.close();
- } catch (IOException e) {
- }
- }
- }
-
- return configuration;
- }
-
-}
diff --git a/plugins/org.eclipse.actf.core/src/org/eclipse/actf/util/.cvsignore b/plugins/org.eclipse.actf.core/src/org/eclipse/actf/util/.cvsignore
deleted file mode 100644
index a24dff9..0000000
--- a/plugins/org.eclipse.actf.core/src/org/eclipse/actf/util/.cvsignore
+++ /dev/null
@@ -1 +0,0 @@
-TestFileUtils.java
diff --git a/plugins/org.eclipse.actf.core/src/org/eclipse/actf/util/FileUtils.java b/plugins/org.eclipse.actf.core/src/org/eclipse/actf/util/FileUtils.java
deleted file mode 100644
index bedc883..0000000
--- a/plugins/org.eclipse.actf.core/src/org/eclipse/actf/util/FileUtils.java
+++ /dev/null
@@ -1,192 +0,0 @@
-/*******************************************************************************
-* Copyright (c) 2004, 2007 IBM Corporation.
-* All rights reserved. This program and the accompanying materials
-* are made available under the terms of the Eclipse Public License v1.0
-* which accompanies this distribution, and is available at
-* http://www.eclipse.org/legal/epl-v10.html
-*
-* Contributors:
-* Mike Squillace - initial API and implementation
-*******************************************************************************/
-
-package org.eclipse.actf.util;
-
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileOutputStream;
-import java.io.FilenameFilter;
-import java.io.IOException;
-import java.util.Arrays;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.regex.Pattern;
-
-public class FileUtils
-{
-
- private static FilenameFilter dirFilter = new FilenameFilter() {
-
- public boolean accept (File path, String name) {
- return new File(path, name).isDirectory();
- }
- };
-
- // FormFilter
- private static FilenameFilter formFilter (final String fileDesc) {
- final String PUNCS = ".-%^$!~";
- StringBuffer descBuff = new StringBuffer(fileDesc);
- for (int c = 0; c < descBuff.length(); ++c) {
- if (descBuff.charAt(c) == '*') {
- descBuff.insert(c, '.');
- ++c;
- }else if (descBuff.charAt(c) == '?') {
- descBuff.insert(c, '.');
- ++c;
- }else if (PUNCS.indexOf(descBuff.charAt(c)) >= 0) {
- descBuff.insert(c, '\\');
- ++c;
- }
- }
- final Pattern descPatt = Pattern.compile(descBuff.toString());
- FilenameFilter filter = new FilenameFilter() {
-
- public boolean accept (File parent, String name) {
- return descPatt.matcher(name).matches();
- }
- };
- return filter;
- } // formFilter
-
- /**
- * Constructor
- *
- * a no argument protected constructor
- *
- */
- protected FileUtils () {
- }
-
- /**
- * delete files or directories matching a specified pattern
- *
- * @param baseDir -
- * root directory from which to start - must be existing
- * directory
- * @param pattern -
- * the pattern of file names to erase
- */
- public static void deleteFiles (File baseDir, String pattern) {
- FilenameFilter nameFilter = formFilter(pattern);
- File[] files = baseDir.listFiles(nameFilter);
- File[] directories = baseDir.listFiles(dirFilter);
- for (int cf = 0; files != null && cf < files.length; ++cf) {
- new File(baseDir, files[cf].getName()).delete();
- }
- for (int d = 0; directories != null && d < directories.length; ++d) {
- File dir = new File(baseDir, directories[d].getName());
- deleteFiles(dir, pattern);
- if (!dir.delete()) {
- Utils.println(
- Utils.WARNINGS, "Could not delete directory " + dir);
- // _launchEvent.addMessage(LaunchEvent.IO_STATUS_KEY, "Could not
- // delete directory " + dir);
- }
- }
- }
-
- /**
- * Copy files matching a certain pattern from one directory to another
- * @param baseDir -
- * the directory to copy from - must be existing
- * @param newParent -
- * the directory to copy to - must be existing
- * @param pattern -
- * the pattern of files to copy
- */
- public static void copyFiles (File baseDir, File newParent, String pattern) {
- FilenameFilter nameFilter = formFilter(pattern);
- File[] files = baseDir.listFiles(nameFilter);
- File[] directories = baseDir.listFiles(dirFilter);
- for (int f = 0; files != null && f < files.length; ++f) {
- try {
- FileInputStream fis = new FileInputStream(files[f]);
- FileOutputStream fos = new FileOutputStream(new File(newParent, files[f].getName()));
- copyFile(fis, fos);
- }catch (IOException e) {
- Utils.println(Utils.WARNINGS, "Could not copy file "
- + files[f].getName());
- // _launchEvent.addMessage(LaunchEvent.IO_STATUS_KEY, "Could not
- // copy file " + classFiles[cf].getName());
- }
- }
- for (int d = 0; directories != null && d < directories.length; ++d) {
- File newDir = new File(newParent, directories[d].getName());
- if (newDir.mkdir() || newDir.exists()) {
- copyFiles(directories[d], newDir, pattern);
- }else {
- Utils.println(
- Utils.WARNINGS, "Could not create directory "
- + newDir.getName());
- // _launchEvent.addMessage(LaunchEvent.IO_STATUS_KEY, "Could not
- // create directory " + newDir.getName());
- }
- }
- } // copyFile
-
- /**
- * Find files matching a specified pattern in a specified location
- *
- * @param fileDesc -
- * the filename pattern you are searching for
- * @param baseDir -
- * the directory to search - must be existing
- * @return array of files
- */
- public static File[] findFiles (String fileDesc, File baseDir) {
- List fileList = new LinkedList();
- findFiles(formFilter(fileDesc), baseDir, fileList);
- return (File[]) fileList.toArray(new File[fileList.size()]);
- }
-
- /**
- * Find files matching a specified pattern in a specified location
- *
- * @param filter -
- * filename filter of matching pattern
- * @param baseDir -
- * the directory from which to start the search
- * @param fileList -
- * a Linked List where the found files will be returned
- */
- public static void findFiles (FilenameFilter filter, File baseDir,
- List fileList) {
- File[] directories = baseDir.listFiles(dirFilter);
- File[] files = baseDir.listFiles(filter);
- if (files != null && files.length > 0) {
- fileList.addAll(Arrays.asList(files));
- }
- for (int d = 0; directories != null && d < directories.length; ++d) {
- File dir = new File(baseDir, directories[d].getName());
- findFiles(filter, dir, fileList);
- }
- } // findFiles
-
- /**
- * copy a file
- *
- * @param source -
- * the source file input stream
- * @param dest -
- * the destination file output stream
- * @throws IOException
- */
- public static void copyFile (FileInputStream source, FileOutputStream dest)
- throws IOException {
- int b = -1;
- while ((b = source.read()) != -1) {
- dest.write(b);
- }
- source.close();
- dest.close();
- } // copyFile
-}
diff --git a/plugins/org.eclipse.actf.core/src/org/eclipse/actf/util/Utils.java b/plugins/org.eclipse.actf.core/src/org/eclipse/actf/util/Utils.java
deleted file mode 100644
index 4185356..0000000
--- a/plugins/org.eclipse.actf.core/src/org/eclipse/actf/util/Utils.java
+++ /dev/null
@@ -1,322 +0,0 @@
-/*******************************************************************************
-* Copyright (c) 2004, 2007 IBM Corporation.
-* All rights reserved. This program and the accompanying materials
-* are made available under the terms of the Eclipse Public License v1.0
-* which accompanies this distribution, and is available at
-* http://www.eclipse.org/legal/epl-v10.html
-*
-* Contributors:
-* Mike Squillace - initial API and implementation
-*******************************************************************************/
-
-package org.eclipse.actf.util;
-
-import org.eclipse.actf.util.logging.AbstractReporter;
-import org.eclipse.actf.util.logging.IReporter;
-import org.eclipse.actf.util.logging.PrintWriterReporter;
-
-/**
- * A set of static methods utilized by the IBM Reflexive GUI Builder.
- * All parameters for the trace stream and level are also set
- * and maintaned by this class
- *
- * @author Mike Squillace
- */
-public final class Utils
-{
-
- /** only fatal errors and exception messages are printed */
- public static final int NONE = IReporter.SEVERE;
-
- /** only fatal errors and exception messages are printed */
- public static final int FATAL = IReporter.SEVERE;
-
- /** only errors are printed */
- public static final int ERRORS = IReporter.ERROR;
-
- /** warnings and errors only */
- public static final int WARNINGS = IReporter.WARNING;
-
- /** information regarding the GUI construction and validation process
- * including nodes being built and object instantiations
- */
- public static final int PROCESS_INFO = IReporter.INFO;
-
- /** information reported at previous levels + information about executable
- *code and more details about the algorithm of construction
- */
- public static final int PROCESS_ALL = IReporter.DETAIL;
-
- /**
- * Highest trace level: all information regarding process of GUI construction and
- * execution and validation; includes:
- *
- * <p><ul>
- * <li>warnings and errors from interpreter engine and validator (if present and active)
- * <li>information regarding GUI construction (e.g. steps of algorithm,
- * nodes being built)
- * <li>level 2 information + execution of code blocks and
- * notices about instantiations of objects
- * <li>all level 3 information + constructors and methods being
- * considered and arguments to chosen constructors and methods
- * </ul>
- */
- public static final int ALL = IReporter.CONFIG;
-
- private static IReporter _tracer = AbstractReporter.getReporter(
- IReporter.ERROR, "stdout");
- static {
- _tracer.setSourceID(IReporter.TRACE);
- }
-
- protected Utils () {
- }
-
- /**
- * set the tracer using the given level and stream.
- * The stream may be one of "stderr", "stdout", or a filename and
- * the level parameter should be one of the public static field members of
- * <code>org.eclipse.actf.core.logging.Reporter</code>. The trace is always an instance of
- * <code>org.eclipse.actf.core.logging.PrintWriterReporter</code>.
- *
- * @param traceLevel -- a level between <code>NONE</code> and <code>ALL</code>
- * @param traceStream -- one of stdout, stderr, or filename
- */
- public static void setTracer (int traceLevel, String traceStream) {
- _tracer = AbstractReporter.getReporter(traceLevel, traceStream);
- if (_tracer instanceof PrintWriterReporter) {
- ((PrintWriterReporter) _tracer).setDefaultOutputLevel(traceLevel);
- }
- _tracer.setSourceID(IReporter.TRACE);
- _tracer.open();
- } // setTracer
-
- /**
- * set the trcer with the given reporter
- *
- * @param reporter -- reporter to be used as tracer
- */
- public static void setTracer (IReporter reporter) {
- _tracer = reporter;
- _tracer.setSourceID(IReporter.TRACE);
- }
-
- /**
- * returns the active tracer
- *
- * @return active tracer
- */
- public static IReporter getTracer () {
- return _tracer;
- }
-
- /**
- * get the current trace level
- *
- * @return current trace level
- */
- public static int getTraceLevel () {
- return _tracer.getDefaultOutputLevel();
- }
-
- /**
- * alert tracer that a new process is beginning.
- * A new process will be indicated in the trace stream with the given id appearing
- * in square brackets ([...]) before any message.
- *
- * @param id -- process id
- */
- public static void startSubprocess (String id) {
- if (_tracer != null) {
- _tracer.startCategory(id);
- }
- }
-
- /**
- * alert tracer that a process is ending.
- * Processes are maintaned on a stack so that the last process initiated with
- * the startSubprocess method will be terminated.
- *
- * @see #startSubprocess
- */
- public static void endSubprocess () {
- if (_tracer != null) {
- _tracer.endCategory();
- }
- }
-
- /**
- * print the given information according to the given level.
- * All information associated with a level greater than or
- *equal to the set trace level will be printed
- *
- * @param level -- level of given information
- * @param str -- information to be printed
- */
- public static void println (int level, String str) {
- _tracer.report(level, str);
- }
-
- /**
- * output an error. The underlying reporter/tracer will
- * use the appropriate error logger to display the error and, if desired, the stack trace.
- *
- * @param errorKey - error key as defined by public fields in <code>org.eclipse.actf.core.logging.Reporter</code>
- * @param msg - message
- * @see org.eclipse.actf.core.logging.IReporter#setSourceID(String)
- */
- public static void println (String errorKey, String msg) {
- println(errorKey, msg, null);
- }
-
- /**
- * output an error. The underlying reporter/tracer will
- * use the appropriate error logger to display the error and, if desired, the stack trace.
- *
- * @param errorKey - error key as defined by public fields in <code>org.eclipse.actf.core.logging.Reporter</code>
- * @param t - Throwable
- * @see org.eclipse.actf.core.logging.IReporter#setSourceID(String)
- */
- public static void println (String errorKey, Throwable t) {
- println(errorKey, null, t);
- }
-
- /**
- * output an error. The underlying reporter/tracer will
- * use the appropriate error logger to display the error and, if desired, the stack trace.
- *
- * @param errorKey - error key as defined by public fields in <code>org.eclipse.actf.core.logging.Reporter</code>
- * @param msg -message
- * @param t - Throwable
- * @see org.eclipse.actf.core.logging.IReporter#setSourceID(String)
- */
- public static void println (String errorKey, String msg, Throwable t) {
- String oldSource = _tracer.getSourceID();
- _tracer.setSourceID(errorKey);
- if (t != null) {
- _tracer.report(IReporter.ERROR, msg, t);
- }else {
- _tracer.report(IReporter.ERROR, msg);
- }
- _tracer.setSourceID(oldSource);
- }
-
- /**
- * print the members of the given array.
- * This method is typically used in the trace by methods that wish to
- * output the list of parameters given to a constructor
- * or method.
- *
- * @param level -- level at which to print
- * @param params -- parameters to be printed
- */
- public static void printParams (int level, Object[] params) {
- if (_tracer != null) {
- _tracer.report(level, "With parameters:");
- if (_tracer.getDefaultOutputLevel() <= level) {
- for (int p = 0; params != null && p < params.length; ++p) {
- _tracer.report(level, (params[p] == null ? ""
- : params[p].getClass().getName())
- + ":"
- + params[p]
- + (p < params.length - 1 ? ", " : ""));
- }
- }
- }
- } // printParams
-
- private static int findClosingSymbol (String argStr, int start,
- char openingSymbol) {
- int open = 1, index;
- char closingSymbol;
- if (openingSymbol == '(') {
- closingSymbol = ')';
- }else if (openingSymbol == '[') {
- closingSymbol = ']';
- }else if (openingSymbol == '{') {
- closingSymbol = '}';
- }else {
- closingSymbol = openingSymbol;
- }
- for (index = start; index < argStr.length() & open != 0; ++index) {
- if (argStr.charAt(index) == openingSymbol) {
- ++open;
- }else if (argStr.charAt(index) == closingSymbol) {
- --open;
- }
- }
- if (open != 0) {
- println(ERRORS, "Mismatched symbol " + openingSymbol
- + " in argument string: " + argStr);
- index = -1;
- }
- return index;
- } // findClosingSymbol
-
- /**
- * converts the first character of the given string to uppper case
- *
- * @param str -- a string
- * @return str with its first character converted to upper case
- */
- public static String firstCharToUpper (String str) {
- return Character.toUpperCase(str.charAt(0)) + str.substring(1);
- }
-
- public static String arrayAsString (String[] str) {
- StringBuffer sb = new StringBuffer();
- for (int a = 0; a < str.length; ++a) {
- sb.append(str[a]);
- if (a < str.length - 1) {
- sb.append('\n');
- }
- }
- return sb.toString();
- }
-
- /**
- * retreave the root exception of the given Throwable
- * @param t - throwable
- * @return root exception of t or t if t has no cause
- */
- public static Throwable getRootException (Throwable t) {
- Throwable root = t;
- while ((t = t.getCause()) != null) {
- root = t;
- }
- return root;
- }
-
- /**
- * Replace XML specific characters with entities.
- * @param s text to fix
- */
- public static String escape (String s) {
- StringBuffer sb = new StringBuffer();
- for (int i = 0; i < s.length(); i++) {
- char c = s.charAt(i);
- if (c == '\"') {
- sb.append(""e;");
- }else if (c == '\'') {
- sb.append("'");
- }else if (c == '&') {
- sb.append("&");
- }else if (c == '<') {
- sb.append("<");
- }else if (c == '>') {
- sb.append(">");
- }else if (c < ' ' || c > 0x7E) {
- sb.append("&#");
- String xi = Integer.toHexString(c);
- if (xi.length() % 2 != 0) {
- sb.append("0");
- }
- sb.append(xi);
- sb.append(";");
- }else {
- sb.append(c);
- }
- }
- return sb.toString();
- }
-} // Utils
diff --git a/plugins/org.eclipse.actf.core/src/org/eclipse/actf/util/command/CLArgumentException.java b/plugins/org.eclipse.actf.core/src/org/eclipse/actf/util/command/CLArgumentException.java
deleted file mode 100644
index 36cc180..0000000
--- a/plugins/org.eclipse.actf.core/src/org/eclipse/actf/util/command/CLArgumentException.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*******************************************************************************
-* Copyright (c) 2004, 2007 IBM Corporation.
-* All rights reserved. This program and the accompanying materials
-* are made available under the terms of the Eclipse Public License v1.0
-* which accompanies this distribution, and is available at
-* http://www.eclipse.org/legal/epl-v10.html
-*
-* Contributors:
-* Mike Squillace - initial API and implementation
-*******************************************************************************/
-
-package org.eclipse.actf.util.command;
-
-public class CLArgumentException extends Exception
-{
-
- /**
- *
- */
- public CLArgumentException () {
- super();
- }
-
- /**
- * @param message
- */
- public CLArgumentException (String message) {
- super(message);
- }
-
- /**
- * @param message
- * @param cause
- */
- public CLArgumentException (String message, Throwable cause) {
- super(message, cause);
- }
-
- /**
- * @param cause
- */
- public CLArgumentException (Throwable cause) {
- super(cause);
- }
-} // CLArgumentException
diff --git a/plugins/org.eclipse.actf.core/src/org/eclipse/actf/util/command/CLArgumentProcessor.java b/plugins/org.eclipse.actf.core/src/org/eclipse/actf/util/command/CLArgumentProcessor.java
deleted file mode 100644
index 79ef3c0..0000000
--- a/plugins/org.eclipse.actf.core/src/org/eclipse/actf/util/command/CLArgumentProcessor.java
+++ /dev/null
@@ -1,438 +0,0 @@
-/*******************************************************************************
-* Copyright (c) 2004, 2007 IBM Corporation.
-* All rights reserved. This program and the accompanying materials
-* are made available under the terms of the Eclipse Public License v1.0
-* which accompanies this distribution, and is available at
-* http://www.eclipse.org/legal/epl-v10.html
-*
-* Contributors:
-* Mike Squillace - initial API and implementation
-*******************************************************************************/
-
-package org.eclipse.actf.util.command;
-
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.Map;
-
-/**
- * The CLArgumentProcessor can be used to process arguments on the command line for
- * any application. A set of CLSwitches are associated with the processor upon its
- * instantiation and the resolved values of these switches can be obtained via the set of
- * <code>getXXXArgument</code> methods of this class. The type of the value to which the
- * argument for a given switch is resolved is determined by the <code>IArgumentResolver</code> for that switch.
- *
- *@see org.eclipse.actf.util.command.CLSwitch
- * @author Mike Squillace
- */
-public class CLArgumentProcessor
-{
-
- private Map _switchMap;
-
- private String _preUsage, _postUsage;
-
- private boolean _preserveCase = false; // true - preserves case of arguments, false - converts arguments to lower case
-
- /**
- * construct a new command line argument processor with no switches associated with it
- */
- public CLArgumentProcessor () {
- this(new CLSwitch[0]);
- }
-
- /**
- * construct a new command line argument processor with the given switches.
- *
- * @param switches - valid switches for this processor
- */
- public CLArgumentProcessor (CLSwitch[] switches) {
- setSwitches(switches);
- }
-
- /**
- * construct a new command line argument processor with no switches associated with it
- * @param preserveCase
- */
- public CLArgumentProcessor (boolean preserveCase) {
- this(new CLSwitch[0]);
- _preserveCase = preserveCase;
- }
-
- /**
- * construct a new command line argument processor with the given switches.
- *
- * @param switches - valid switches for this processor
- * @param preserveCase - boolean to process arguments as case sensitive or not
- */
- public CLArgumentProcessor (CLSwitch[] switches, boolean preserveCase) {
- _preserveCase = preserveCase;
- setSwitches(switches);
- }
-
- /**
- * return the command line switch with the given name
- *
- * @param name - name of desired switch (Without prefix)
- * @return the desired switch
- */
- public CLSwitch getSwitch (String name) {
- if (_preserveCase) {
- return (CLSwitch) _switchMap.get(name);
- }else {
- return (CLSwitch) _switchMap.get(name.toLowerCase());
- }
- }
-
- /**
- * return the switches that are currently being handled by this processor
- *
- * @return switches which are currently being processed
- */
- public CLSwitch[] getSwitches () {
- return (CLSwitch[]) _switchMap.values().toArray(
- new CLSwitch[_switchMap.size()]);
- }
-
- /**
- * set the command line switches to be associated with this command line processor. This
- * method will automatically clear any previous switches associated with this processor.
- *
- * @param switches - valid switches for this command line argument processor
- */
- public void setSwitches (CLSwitch[] switches) {
- if (_switchMap == null) {
- _switchMap = new HashMap();
- }else {
- _switchMap.clear();
- }
- for (int s = 0; switches != null && s < switches.length; ++s) {
- if (_preserveCase) {
- _switchMap.put(switches[s].getName(), switches[s]);
- }else {
- _switchMap.put(switches[s].getName().toLowerCase(), switches[s]);
- }
- }
- }
-
- /**
- * add a switch to the set of switches processed by this processor
- *
- * @param s - switch to be added
- */
- public void addSwitch (CLSwitch s) {
- if (_preserveCase) {
- _switchMap.put(s.getName(), s);
- }else {
- _switchMap.put(s.getName().toLowerCase(), s);
- }
- }
-
- /**
- * remove the switch with the given name from this processor
- *
- * @param name - name of switch to be removed
- * @return command line switch that was removed
- */
- public CLSwitch removeSwitch (String name) {
- if (_preserveCase) {
- return (CLSwitch) _switchMap.remove(name);
- }else {
- return (CLSwitch) _switchMap.remove(name.toLowerCase());
- }
- }
-
- /**
- * process the given arguments from the command line. Resolved arguments
- * can be retreaved with one of the <code>getXXXArgument</code> methods of this class.
- *
- * <p>If the argument array is empty, the <code>printAUsage()</code> method
- * is invoked. Usage for a switch consists of the name of
- * that switch along with its description.
- *
- *@param args - arguments from command line
- *@throws CLArgumentException
- */
- public void processArguments (String[] args) throws CLArgumentException {
- if (args.length == 0) {
- printUsage();
- System.exit(0);
- }
- for (int arg = 0; arg < args.length; ++arg) {
- String name = nameIfValidSwitch(args[arg]);
- if (name == null) {
- System.err.println("Unknown switch: " + args[arg]);
- }else {
- CLSwitch clSwitch = getSwitch(name);
- if (clSwitch.getValueType().equals(Boolean.class)
- || clSwitch.getValueType().equals(Boolean.TYPE)) {
- clSwitch.setValue("__true__");
- continue;
- }
- // concatenate all arguments for this switch
- StringBuffer argBuff = new StringBuffer();
- int start = arg;
- int numArgs = clSwitch.getExpectedNumberOfArgs();
- while (++arg < args.length && arg - start <= numArgs
- & nameIfValidSwitch(args[arg]) == null) {
- argBuff.append(args[arg]);
- argBuff.append(' ');
- }
- if (arg < args.length && arg - start > numArgs
- && nameIfValidSwitch(args[arg]) == null) {
- do {
- System.err.println("Ignoring argument: "
- + args[arg]
- + " - beyond expected number of args for switch "
- + clSwitch.getName());
- if (!Character.isLetter(args[arg].charAt(0))) {
- System.err.println("May be unknown switch: "
- + args[arg]);
- }
- ++arg;
- }while (arg < args.length
- && nameIfValidSwitch(args[arg]) == null);
- }
- try {
- clSwitch.resolveValue(argBuff.toString().trim());
- }catch (Exception e) {
- System.err.println("Warning: could not resolve argument "
- + argBuff.toString() + " for switch "
- + clSwitch.getName() + " to type "
- + clSwitch.getValueType().getName());
- --arg;
- continue;
- }
- --arg;
- }
- } // next argument
- Iterator iter = _switchMap.values().iterator();
- while (iter.hasNext()) {
- CLSwitch cls = (CLSwitch) iter.next();
- if (cls.isRequired() && cls.getResolvedValue() == null) { throw new CLArgumentException("Switch "
- + cls.getName() + " is required and has not been set"); }
- }
- } // processArguments
-
- /**
- * get the int argument value of the switch with the given name
- *
- * @param name - name of switch for which value is desired
- * @return value of desired switch or -1 if switch is not found
- * @throws CLArgumentException - if switch value is not of appropriate type
- */
- public int getIntArgument (String name) throws CLArgumentException {
- CLSwitch clSwitch = getSwitch(name);
- int val = -1;
- if (clSwitch != null) {
- if (clSwitch.getResolvedValue() != null
- && (Integer.class.isAssignableFrom(clSwitch.getValueType()) || clSwitch.getValueType().equals(
- Integer.TYPE))) {
- val = ((Integer) clSwitch.getResolvedValue()).intValue();
- }else {
- throw new CLArgumentException("Switch " + clSwitch.getName()
- + " does not have an associated value of type int");
- }
- }
- return val;
- } // getIntArgument
-
- /**
- * get the long argument value of the switch with the given name
- *
- * @param name - name of switch for which value is desired
- * @return value of desired switch or -1 if switch is not found
- * @throws CLArgumentException - if switch value is not of appropriate type
- */
- public long getLongArgument (String name) throws CLArgumentException {
- CLSwitch clSwitch = getSwitch(name);
- long val = -1;
- if (clSwitch != null) {
- if (clSwitch.getResolvedValue() != null
- && (Long.class.isAssignableFrom(clSwitch.getValueType()) || clSwitch.getValueType().equals(
- Long.TYPE))) {
- val = ((Long) clSwitch.getResolvedValue()).longValue();
- }else {
- throw new CLArgumentException("Switch " + clSwitch.getName()
- + " does not have an associated value of type long");
- }
- }
- return val;
- } // getLongArgument
-
- /**
- * get the float argument value of the switch with the given name
- *
- * @param name - name of switch for which value is desired
- * @return value of desired switch or -1 if switch is not found
- * @throws CLArgumentException - if switch value is not of appropriate type
- */
- public float getFloatArgument (String name) throws CLArgumentException {
- CLSwitch clSwitch = getSwitch(name);
- float val = -1;
- if (clSwitch != null) {
- if (clSwitch.getResolvedValue() != null
- && (Float.class.isAssignableFrom(clSwitch.getValueType()) || clSwitch.getValueType().equals(
- Float.TYPE))) {
- val = ((Float) clSwitch.getResolvedValue()).floatValue();
- }else {
- throw new CLArgumentException("Switch " + clSwitch.getName()
- + " does not have an associated value of type float");
- }
- }
- return val;
- } // getFloatArgument
-
- /**
- * get the double argument value of the switch with the given name
- *
- * @param name - name of switch for which value is desired
- * @return value of desired switch or -1 if switch is not found
- * @throws CLArgumentException - if switch value is not of appropriate type
- */
- public double getDoubleArgument (String name) throws CLArgumentException {
- CLSwitch clSwitch = getSwitch(name);
- double val = -1;
- if (clSwitch != null) {
- if (clSwitch.getResolvedValue() != null
- && (Double.class.isAssignableFrom(clSwitch.getValueType()) || clSwitch.getValueType().equals(
- Double.TYPE))) {
- val = ((Number) clSwitch.getResolvedValue()).doubleValue();
- }else {
- throw new CLArgumentException("Switch " + clSwitch.getName()
- + " does not have an associated value of type double");
- }
- }
- return val;
- } // getDoubleArgument
-
- /**
- * get the boolean argument value of the switch with the given name
- *
- * @param name - name of switch for which value is desired
- * @return value of desired switch or -1 if switch is not found
- * @throws CLArgumentException - if switch value is not of appropriate type
- */
- public boolean getBooleanArgument (String name) throws CLArgumentException {
- CLSwitch clSwitch = getSwitch(name);
- boolean val = false;
- if (clSwitch != null) {
- if (Boolean.class.isAssignableFrom(clSwitch.getValueType())
- || clSwitch.getValueType().equals(Boolean.TYPE)) {
- val = clSwitch.getResolvedValue() != null
- && ((Boolean) clSwitch.getResolvedValue()).booleanValue();
- }else {
- throw new CLArgumentException("Switch " + clSwitch.getName()
- + " does not have an associated value of type bool");
- }
- }
- return val;
- } // getBooleanArgument
-
- /**
- * get the resolved argument for the switch with the given name
- *
- * @param name - name of switch for which argument is desired
- * @return - the resolved value of that switch or <code>null</code>
- * if switch with the given name is not found
- */
- public Object getArgument (String name) {
- CLSwitch s = getSwitch(name);
- return s == null ? null : s.getResolvedValue();
- }
-
- /**
- * determines whether or not the given string is a valid switch. The proposed
- * switch will be valid if it contains a switch name recognized by this processor
- * and is preceded by the prefix associated with that switch. If the
- * proposed string is a valid switch, its name is returned.
- *
- * @param sw - string to examine for validity
- * @return name of the switch if valid or <code>null</code> if not
- */
- public String nameIfValidSwitch (String sw) {
- int index = 0;
- String prefix, name;
- CLSwitch clSwitch;
- String res = null;
- while (index < sw.length() && !Character.isLetter(sw.charAt(index++))) {
- ;
- }
- prefix = sw.substring(0, index - 1);
- name = sw.substring(index - 1);
- clSwitch = getSwitch(name);
- if (clSwitch != null) {
- if (_preserveCase
- && clSwitch.getFullSwitchName().equals(prefix + name)) {
- res = name;
- }else if (!_preserveCase
- && clSwitch.getFullSwitchName().equalsIgnoreCase(
- prefix + name)) {
- res = name;
- }
- }
- return res;
- } // isValidSwitch
-
- /**
- * prepend the given string to the usage statement. This will be printed first
- * when the <code>printUsage</code> method is called.
- *
- * @param pre - first message to be printed for usage
- */
- public void prependToUsage (String pre) {
- _preUsage = pre;
- }
-
- /**
- * append the given string to the usage. After switch names and descriptions
- * are printed, this message will be output.
- *
- * @param post - to be printed after the usage
- */
- public void appendToUsage (String post) {
- _postUsage = post;
- }
-
- protected void printUsage () {
- Iterator iter = _switchMap.values().iterator();
- System.out.println(_preUsage == null ? "" : _preUsage);
- System.out.println();
- System.out.println("Options:");
- System.out.println();
- while (iter.hasNext()) {
- CLSwitch clSwitch = (CLSwitch) iter.next();
- System.out.print(clSwitch.getFullSwitchName() + " "
- + clSwitch.getDescription());
- System.out.print(clSwitch.isRequired() ? " [required] " : " ");
- System.out.println(clSwitch.getDefaultValue() != null ? " {default="
- + clSwitch.getDefaultValue() + "}"
- : "");
- }
- System.out.println();
- System.out.println(_postUsage == null ? "" : _postUsage);
- } // printUsage
-
- public String toString () {
- StringBuffer sb = new StringBuffer(getClass().getName());
- Iterator iter = _switchMap.values().iterator();
- sb.append(":\n");
- while (iter.hasNext()) {
- CLSwitch s = (CLSwitch) iter.next();
- Object val = s.getResolvedValue();
- sb.append(s.getFullSwitchName());
- sb.append('[');
- sb.append("arg:" + s.getValue());
- sb.append(',');
- sb.append("resolved:");
- sb.append(val == null ? "<unresolved>" : val.toString());
- if (val != null) {
- sb.append(',');
- sb.append("type:" + s.getResolvedValue().getClass().getName());
- }
- sb.append(']');
- sb.append('\n');
- }
- return sb.toString();
- } // toString
-} // CLArgumentProcessor
diff --git a/plugins/org.eclipse.actf.core/src/org/eclipse/actf/util/command/CLSwitch.java b/plugins/org.eclipse.actf.core/src/org/eclipse/actf/util/command/CLSwitch.java
deleted file mode 100644
index 0e5004e..0000000
--- a/plugins/org.eclipse.actf.core/src/org/eclipse/actf/util/command/CLSwitch.java
+++ /dev/null
@@ -1,327 +0,0 @@
-/*******************************************************************************
-* Copyright (c) 2004, 2007 IBM Corporation.
-* All rights reserved. This program and the accompanying materials
-* are made available under the terms of the Eclipse Public License v1.0
-* which accompanies this distribution, and is available at
-* http://www.eclipse.org/legal/epl-v10.html
-*
-* Contributors:
-* Mike Squillace - initial API and implementation
-*******************************************************************************/
-
-package org.eclipse.actf.util.command;
-
-/**
- * The CLSwitch class is used in conjuction with the CLArgumentProcessor to embody a
- * single command line switch. An implementation of <code>IArgumentResolver</code>
- * should be associated with any <code>CLSwitch</code>.
- *
- *
- *@see org.eclipse.actf.util.command.CLArgumentProcessor
- * @author Mike Squillace
- */
-public class CLSwitch
-{
-
- private String _name;
-
- private String _prefix = "-";
-
- private String _description = "";
-
- private String _value;
-
- private Object _resolvedValue;
-
- private String _defaultValue = "";
-
- private Class _type = Object.class;
-
- private boolean _required = false;
-
- private int _expectedArgs = 1;
-
- private IArgumentResolver _resolver;
-
- /**
- * create a command line switch with the given name and type. By default, the
- * switch is not required.
- *
- * @param name -switch name (denoted with a hypthen (-) on the command line)
- * @param desc - switch description or usage
- * @param type - type of resolved value
- */
- public CLSwitch (String name, String desc, Class type) {
- this(name, desc, type, false);
- }
-
- /**
- * create a command line switch with the given name and type. By default, the
- * switch is not required. Type resoltuion is left to the specified resolver.
- *
- * @param name -switch name
- * @param desc - switch description or usage
- * @param resolver - argument resolver
- */
- public CLSwitch (String name, String desc, IArgumentResolver resolver) {
- this(name, null, null, false, resolver);
- }
-
- /**
- * create a command line switch with the given name and type. By default, the
- * <code>org.eclipse.actf.util.command.DefaultArgumentResolver</code> is used to resolve switch values.
- *
- * @param name -switch name
- * @param desc - switch description or usage
- * @param type - type of resolved value
- * @param required - whether or not this switch is required on the command line
- * @see org.eclipse.actf.util.command.DefaultArgumentResolver
- */
- public CLSwitch (String name, String desc, Class type, boolean required) {
- this(name, desc, type, required, null);
- }
-
- /**
- * create a command line switch with the given name and type. The argument or value
- * passed to this switch is resolved via the specified implementation of the
- * Argument<code>Resolver</code> interface.
- *
- * @param name -switch name
- * @param desc - switch description or usage
- * @param type - type of resolved value
- * @param required - whether or not this switch is required on the command line
- * @param resolver - argument resolver
- */
- public CLSwitch (String name, String desc, Class type, boolean required,
- IArgumentResolver resolver) {
- setName(name);
- setDescription(desc);
- setValueType(type);
- setRequired(required);
- setArgumentResolver(resolver);
- }
-
- /**
- * @return Returns the switch name.
- */
- public String getName () {
- return _name;
- }
-
- /**
- * set the name of the switch. This name will also be used to refer
- * to the switch on the command line when preceded by a hyphen (-).
- *
- * @param name - The switch name
- */
- public void setName (String name) {
- if (name == null) {
- throw new IllegalArgumentException("Switch names may not be null");
- }else if (!Character.isLetter(name.charAt(0))) {
- throw new IllegalArgumentException("Switch names must begin with a letter: "
- + name);
- }else {
- for (int c = 1; c < name.length(); ++c) {
- if (!Character.isLetter(name.charAt(c))
- && !Character.isDigit(name.charAt(c))) { throw new IllegalArgumentException("Switch names must be alpha-numeric: "
- + name); }
- }
- }
- _name = name;
- }
-
- /**
- * @return returns the switch prefix as it should be used on the command line
- */
- public String getPrefix () {
- return _prefix;
- }
-
- /**
- * set the command line switch's prefix. The switch must ocur on the command line
- * preceded with this prefix. The default prefix is '0'.
- *
- * @param prefix - prefix for switch
- */
- public void setPrefix (String prefix) {
- _prefix = prefix == null ? "-" : prefix;
- }
-
- /**
- * returns the full switch name which is composed of its prefix
- * followed by its name.
- *
- * @return full switch name including prefix
- */
- public String getFullSwitchName () {
- return _prefix + _name;
- }
-
- /**
- * @return Returns the description or help for the switch.
- */
- public String getDescription () {
- return _description;
- }
-
- /**
- * @param description the help or description of the switch (appears in the usage message)
- */
- public void setDescription (String description) {
- _description = description == null ? "" : description;
- }
-
- /**
- *
- * @return expected number of arguments for this switch
- * @see #setExpectedNumberOfArgs(int)
- */
- public int getExpectedNumberOfArgs () {
- return _expectedArgs;
- }
-
- /**
- * set the number of arguments expected by this switch. This value determines
- * the number of arguments from the original command line argument array as received by the <code>main(String[])</code>
- * method will be used for this switch. Supplying fewer than the number of expected
- * number of arguments on the command line is acceptable and additional arguments beyond the number of expected arguments
- * will be flagged.
- *
- * @param args - expected number of arguments (default is 1)
- */
- public void setExpectedNumberOfArgs (int args) {
- _expectedArgs = args >= 0 ? args : 1;
- }
-
- /**
- * @return Returns whether or not this switch is required
- */
- public boolean isRequired () {
- return _required;
- }
-
- /**
- * set to <code>true</code> if the switch and its corresponding value are required
- * for the application.
- *
- * @param required <code>true</code> if the switch is required, <code>false</code> otherwise
- */
- public void setRequired (boolean required) {
- _required = required;
- }
-
- /**
- * returns the desired type of the value or agument corresponding to the swithh. An implementation of
- * <code>IArgumentResolver</coe> is responsible for resolving the value or argument to this type.
- *
- * @return Returns the type of the value/argument of the switch
- */
- public Class getValueType () {
- return _type;
- }
-
- /**
- * set the type of the value or argument to this switch.
- *
- * @param type the type to which the argument to this switch is to be resolved
- * @see #getValueType()
- */
- public void setValueType (Class type) {
- _type = type;
- }
-
- /**
- * returns the unresolved value or argument passed to the switch on the command line.
- *
- * @return Returns the unresolved argument or value passed to this switch
- */
- public String getValue () {
- return _value;
- }
-
- /**
- * @param value The argument or value given to the switch on the command line
- */
- public void setValue (String value) {
- _value = value;
- }
-
- /**
- * resolve the value passed from the command line. The value will be resolved via
- * this switch's IArgumentResolver and be of the type with which this switch
- * was defined.
- *
- * @param arg - command line argument for this switch
- * @return returns the resolved value for the argument
- * @throws Exception
- */
- public Object resolveValue (String arg) throws Exception {
- if (_resolvedValue == null) {
- setValue(arg);
- if (_type.equals(Boolean.class) || _type.equals(Boolean.TYPE)) {
- _resolvedValue = Boolean.valueOf(_value != null
- && _value.equals("__true__"));
- }else {
- _resolvedValue = _resolver.resolve(_value, _type);
- }
- }
- return _resolvedValue;
- }
-
- /**
- * @return Returns the default value (if any) for this switch.
- */
- public String getDefaultValue () {
- return _defaultValue;
- }
-
- /**
- * @param value The default value for this switch if no value is given
- */
- public void setDefaultValue (String value) {
- _defaultValue = _value = value;
- }
-
- /**
- * set the switch to its default value
- *
- */
- public void setToDefaultValue () {
- _value = _defaultValue;
- }
-
- /**
- * returns the resolved value of the argument passed to the switch. The resolved
- * value is of the type specified during the creation of the switch or via
- * the <code>setType(Class)</code> method.
- *
- * @return the resolved value of the switch
- */
- public Object getResolvedValue () {
- Object result = _resolvedValue;
- if (_resolvedValue == null) {
- try {
- result = resolveValue(_value);
- }catch (Exception e) {
- System.err.println("Could not resolve " + _value
- + " for switch named " + _name);
- e.printStackTrace();
- }
- }
- return result;
- }
-
- /**
- * @return Returns the argument resolver.
- */
- public IArgumentResolver getArgumentResolver () {
- return _resolver;
- }
-
- /**
- * @param resolver the argument resolved to be used
- */
- public void setArgumentResolver (IArgumentResolver resolver) {
- _resolver = resolver == null ? new DefaultArgumentResolver() : resolver;
- }
-} // CLSwitch
diff --git a/plugins/org.eclipse.actf.core/src/org/eclipse/actf/util/command/DefaultArgumentResolver.java b/plugins/org.eclipse.actf.core/src/org/eclipse/actf/util/command/DefaultArgumentResolver.java
deleted file mode 100644
index 383e8cd..0000000
--- a/plugins/org.eclipse.actf.core/src/org/eclipse/actf/util/command/DefaultArgumentResolver.java
+++ /dev/null
@@ -1,77 +0,0 @@
-/*******************************************************************************
-* Copyright (c) 2004, 2007 IBM Corporation.
-* All rights reserved. This program and the accompanying materials
-* are made available under the terms of the Eclipse Public License v1.0
-* which accompanies this distribution, and is available at
-* http://www.eclipse.org/legal/epl-v10.html
-*
-* Contributors:
-* Mike Squillace - initial API and implementation
-*******************************************************************************/
-
-package org.eclipse.actf.util.command;
-
-import java.lang.reflect.Array;
-import java.util.StringTokenizer;
-
-/**
- * This default implementation resolves arguments to primitive values, instances of wrappers of
- * primitive types, <code>String</code> instances, and <code>Class</code> instances. It
- * will also resolve single-dimensional arrays of primitives, strings, and Class objects.
- *
- * @author Mike Squillace
- */
-public class DefaultArgumentResolver implements IArgumentResolver
-{
-
- /**
- * create a default implementation for resolving arguments to switches on the
- * command line.
- */
- public DefaultArgumentResolver () {
- }
-
- /** {@inheritDoc} */
- public Object resolve (String arg, Class type) throws Exception {
- Object result = null;
- if (arg != null) {
- if (type.isArray()) {
- result = resolveArray(arg, type.getComponentType());
- }else if (type.equals(String.class)) {
- result = arg;
- }else if (type.equals(Class.class)) {
- try {
- result = Class.forName(arg);
- }catch (Exception e) {
- throw new IllegalArgumentException("Illegal class name for switch:"
- + arg + " - " + e);
- }
- }else if (type.equals(Short.TYPE) || type.equals(Short.class)) {
- result = Short.valueOf(arg);
- }else if (type.equals(Integer.TYPE) || type.equals(Integer.class)) {
- result = Integer.valueOf(arg);
- }else if (type.equals(Long.TYPE) || type.equals(Long.class)) {
- result = Long.valueOf(arg);
- }else if (type.equals(Float.TYPE) || type.equals(Float.class)) {
- result = Float.valueOf(arg);
- }else if (type.equals(Double.TYPE) || type.equals(Double.class)) {
- result = Double.valueOf(arg);
- }else if (type.equals(Character.TYPE)
- || type.equals(Character.class)) {
- result = new Character(arg.charAt(0));
- }
- }
- return result;
- } // resolve
-
- protected Object resolveArray (String arg, Class compType) throws Exception {
- if (compType.isArray()) { throw new IllegalArgumentException("Default impl of argument resolver does not support multi-dimensional arrays"); }
- StringTokenizer st = new StringTokenizer(arg);
- Object array = Array.newInstance(compType, st.countTokens());
- int index = 0;
- while (st.hasMoreTokens()) {
- Array.set(array, index++, resolve(st.nextToken(), compType));
- }
- return array;
- }
-} // DefaultArgumentResolver
diff --git a/plugins/org.eclipse.actf.core/src/org/eclipse/actf/util/command/IArgumentResolver.java b/plugins/org.eclipse.actf.core/src/org/eclipse/actf/util/command/IArgumentResolver.java
deleted file mode 100644
index 52386f6..0000000
--- a/plugins/org.eclipse.actf.core/src/org/eclipse/actf/util/command/IArgumentResolver.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/*******************************************************************************
-* Copyright (c) 2004, 2007 IBM Corporation.
-* All rights reserved. This program and the accompanying materials
-* are made available under the terms of the Eclipse Public License v1.0
-* which accompanies this distribution, and is available at
-* http://www.eclipse.org/legal/epl-v10.html
-*
-* Contributors:
-* Mike Squillace - initial API and implementation
-*******************************************************************************/
-
-package org.eclipse.actf.util.command;
-
-/**
- * An IArgumentResolver is used to resolve arguments passed to switches on the
- * command line. A default resolver is packaged with ACTF that resolves
- * arguments to the primitive types, primitive wrappers, Strings, and Class types.
- *
- * @author Mike Squillace
- */
-public interface IArgumentResolver
-{
-
- /**
- * resolve the given argument or value to the given type
- *
- * @param arg - argument or value from command line switch
- * @param type - type to which argument is to be resolved
- * @return result of resolving argument to class
- * @throws Exception if argument cannot be resolved to the specified type
- */
- public Object resolve (String arg, Class type) throws Exception;
-} // IArgumentResolver
diff --git a/plugins/org.eclipse.actf.core/src/org/eclipse/actf/util/jar/InstallJars.java b/plugins/org.eclipse.actf.core/src/org/eclipse/actf/util/jar/InstallJars.java
deleted file mode 100644
index 0b6cbfd..0000000
--- a/plugins/org.eclipse.actf.core/src/org/eclipse/actf/util/jar/InstallJars.java
+++ /dev/null
@@ -1,818 +0,0 @@
-/*******************************************************************************
-* Copyright (c) 2004, 2007 IBM Corporation.
-* All rights reserved. This program and the accompanying materials
-* are made available under the terms of the Eclipse Public License v1.0
-* which accompanies this distribution, and is available at
-* http://www.eclipse.org/legal/epl-v10.html
-*
-* Contributors:
-* Barry Feigenbaum, Ph.D. * - initial API and implementation
-*******************************************************************************/
-
-package org.eclipse.actf.util.jar;
-
-import java.io.BufferedInputStream;
-import java.io.BufferedOutputStream;
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.net.URL;
-import java.net.URLConnection;
-import java.util.Iterator;
-import java.util.Properties;
-import java.util.StringTokenizer;
-import java.util.zip.GZIPInputStream;
-import java.util.zip.ZipEntry;
-import java.util.zip.ZipInputStream;
-
-/****************************************************************************
- * *
- * InstallJars - a utility to download and install files, Jars and Zips. *
- * *
- * @author Barry Feigenbaum, Ph.D. *
- ***************************************************************************/
-public class InstallJars
-{
-
- public static final int BLOCK_SIZE = 512;
-
- public static final int BLOCK_COUNT = 20;
-
- // *** must be a multiple of BLOCK_SIZE ***
- public static int bufferSize = 128 * (2 * BLOCK_SIZE);
-
- // *** need to NLS enable all user messages ***
- /**
- * Constructor. Expand, run and verbose output requested.
- */
- public InstallJars () {
- this(true, true, true, "InstallJars.properties", "cmd /c java");
- }
-
- /**
- * Contstructor.
- * @param expand <code>true</code> if the archive is t be expanded in the target
- * @param verbose <code>true</code> if messages are to be generated
- * @param run <code>true</code> if file is to be executed
- * @param propName properties file with items to install
- * @param javaParams java parameters
- */
- public InstallJars (boolean expand, boolean verbose, boolean run,
- String propName, String javaParams) {
- setExpand(expand);
- setVerbose(verbose);
- setRunMode(run);
- setPropFilename(propName);
- setJavaParams(javaParams);
- }
-
- protected boolean verbose;
-
- /**
- * Get the verbose mode state.
- * @return is in verbose mode
- */
- public boolean getVerbose () {
- return verbose;
- }
-
- /**
- * Set the verbose mode state.
- * @param f value
- */
- public void setVerbose (boolean f) {
- verbose = f;
- }
-
- protected boolean run;
-
- /**
- * Get the run mode state.
- * @return is in run mode
- */
- public boolean getRunMode () {
- return run;
- }
-
- /**
- * Set the run mode state.
- * @param f value
- */
- public void setRunMode (boolean f) {
- run = f;
- }
-
- protected boolean expand;
-
- /**
- * Get the expand mode state.
- * @return is expanded
- */
- public boolean getExpand () {
- return expand;
- }
-
- /**
- * Set the expand mode state.
- * @param f value
- */
- public void setExpand (boolean f) {
- expand = f;
- }
-
- protected String propFilename;
-
- /**
- * Get the propFilename mode state.
- * @return prooperty file name
- */
- public String getPropFilename () {
- return propFilename;
- }
-
- /**
- * Set the propFilename mode state.
- * @param name
- */
- public void setPropFilename (String name) {
- propFilename = name;
- }
-
- protected String javaParams = "cmd /c java";
-
- /**
- * Get the JavaParams mode state.
- * @return java parameters
- */
- public String getJavaParams () {
- return javaParams;
- }
-
- /**
- * Set the JavaParams mode state.
- * @param p value
- */
- public void setJavaParams (String p) {
- javaParams = p;
- }
-
- protected void print (String s) {
- if (verbose) {
- System.out.print(s);
- }
- }
-
- protected void println (String s) {
- if (verbose) {
- System.out.println(s);
- }
- }
-
- protected void println () {
- println("");
- }
-
- /**
- * Install based on a properties file<br>
- * @return recommended classpath
- * @exception IOException Thrown if a JAR file access error occurs
- **/
- public String install () throws IOException {
- StringBuffer classpath = new StringBuffer();
- Properties prop = new Properties();
- prop.load(new BufferedInputStream(new FileInputStream(propFilename)));
- for (Iterator i = prop.keySet().iterator(); i.hasNext();) {
- String key = (String) i.next();
- String value = prop.getProperty(key);
- String xurl = null;
- String xdir = null;
- String xcp = null;
- boolean xexpand = expand, xrun = run;
- if (value != null) {
- value = value.trim();
- if (value.length() > 0) {
- String delim = value.substring(0, 1);
- StringTokenizer st = new StringTokenizer(value.substring(1), delim);
- xurl = st.nextToken();
- xdir = (st.hasMoreTokens() ? st.nextToken() : ".").trim();
- if (xdir.length() == 0) {
- xdir = ".";
- }
- xcp = (st.hasMoreTokens() ? st.nextToken() : xdir).trim();
- if (xcp.length() == 0) {
- xcp = xdir;
- }
- classpath.append(xcp);
- classpath.append(";");
- while (st.hasMoreTokens()) {
- String xoption = st.nextToken().trim();
- if (xoption.equalsIgnoreCase("expand")) {
- xexpand = true;
- }else if (xoption.equalsIgnoreCase("noexpand")) {
- xexpand = false;
- }else if (xoption.equalsIgnoreCase("run")) {
- xrun = true;
- }else if (xoption.equalsIgnoreCase("norun")) {
- xrun = false;
- }else {
- throw new IllegalArgumentException("invalid install property - "
- + key + "=" + value);
- }
- }
- }
- }
- if (xurl == null || xurl.length() == 0) { throw new IllegalArgumentException("missing install property - "
- + key + "=" + value); }
- System.out.print("\nInstalling " + key);
- if (verbose) {
- System.out.print(" using URL=" + xurl + "; target=" + xdir
- + "; classpath=" + xcp + "; "
- + (xexpand ? "expand" : "noexpand") + "; "
- + (xrun ? "run" : "norun"));
- }
- System.out.println("...");
- installFile(xurl, xdir, xexpand, xrun);
- }
- return classpath.toString();
- }
-
- /**
- * Install a Zip/Jar file.
- *
- * @param fileUrl The file/zip/jar file
- * @param targetPath root of directory or file to install into
- * @param doExpand
- * @param doRun
- * @exception IOException Thrown if a JAR file access error occurs
- */
- public void installFile (String fileUrl, String targetPath,
- boolean doExpand, boolean doRun)
- throws IOException {
- String targetFilename = new File(targetPath).getCanonicalPath().replace(
- '\\', '/');
- println("Installing in " + targetFilename);
- URL url = new URL(fileUrl);
- URLConnection conn = url.openConnection();
- //System.out.println("Conn = " + conn);
- String ctype = conn.getContentType();
- println("Content type is " + ctype);
- String extension = getExtension(fileUrl);
- if (extension.equals("class")) {
- installClass(conn, targetFilename, doExpand, doRun);
- //println("Installed class file " + fileUrl + "; please run");
- }else if (extension.equalsIgnoreCase("zip")) {
- installZip(conn, targetFilename, doExpand, doRun);
- //println("Installed ZIP file " + fileUrl + "; ZIP expanded");
- }else if (extension.equalsIgnoreCase("gz")) {
- installGZip(conn, targetFilename, doExpand, doRun);
- //println("Installed GZIP file " + fileUrl + "; ZIP expanded");
- }else if (extension.equalsIgnoreCase("jar")) {
- installJar(conn, targetFilename, doExpand, doRun);
- //System.out.println("Installed JAR file " + fileUrl + "; please add to CLASSPATH");
- }else {
- throw new IllegalArgumentException("Unknown extension - "
- + extension);
- }
- }
-
- public void installClass (URLConnection conn, String target,
- boolean doExpand, boolean doRun)
- throws IOException {
- // doExpand not used on htis type
- print("Installing class file " + target + " from "
- + conn.getURL().toExternalForm());
- copyStream(conn, target);
- println();
- if (doRun) {
- runTarget(target, false);
- }
- }
-
- protected void runTarget (String target, boolean isJar) throws IOException {
- // *** add run code ***
- if (isJar) {
- System.out.println("runTarget(" + target + "," + isJar
- + ") not currently implemented");
- }else {
- try {
- String name = removeExtension(getFile(target));
- String cp = "-cp " + removeFile(target);
- String command = javaParams + " " + cp + " " + name + " >"
- + name + ".out 2>" + name + ".err";
- //String command = javaParams + " " + cp + " " + name;
- System.out.println("Running " + command + "...");
- Process p = Runtime.getRuntime().exec(command);
- int rc = p.waitFor();
- System.out.println("Return code=" + rc);
- }catch (Exception e) {
- System.out.println("Exception - " + e.getMessage());
- }
- }
- }
-
- public void installJar (URLConnection conn, String target,
- boolean doExpand, boolean doRun) throws IOException {
- if (doExpand) {
- println("Expanding JAR file " + target + " from "
- + conn.getURL().toExternalForm());
- // *** may need to specialize for JAR format ***
- ZipInputStream zis = new ZipInputStream(new BufferedInputStream(conn.getInputStream(), BLOCK_SIZE
- * BLOCK_COUNT));
- int count = 0;
- prepDirs(target, true);
- try {
- while (zis.available() > 0) {
- ZipEntry ze = zis.getNextEntry();
- copyEntry(target, zis, ze);
- count++;
- }
- }finally {
- try {
- zis.close();
- }catch (IOException ioe) {
- }
- }
- println("Installed " + count + " files/directories");
- }else {
- print("Installing JAR file " + target + " from "
- + conn.getURL().toExternalForm());
- copyStream(conn, target);
- println();
- if (doRun) {
- runTarget(target, true);
- }
- }
- }
-
- public void installZip (URLConnection conn, String target,
- boolean doExpand, boolean doRun) throws IOException {
- // doRun not used on htis type
- if (doExpand) {
- String ctype = conn.getContentType();
- if (!ctype.equals("application/zip")) { throw new IllegalArgumentException("Unkexpected content type - "
- + ctype); }
- println("Expanding ZIP file to " + target + " from "
- + conn.getURL().toExternalForm());
- ZipInputStream zis = new ZipInputStream(new BufferedInputStream(conn.getInputStream(), BLOCK_SIZE
- * BLOCK_COUNT));
- int count = 0;
- prepDirs(target, true);
- try {
- for (ZipEntry ze = zis.getNextEntry(); ze != null; ze = zis.getNextEntry()) {
- copyEntry(target, zis, ze);
- //zis.closeEntry();
- count++;
- }
- }finally {
- try {
- zis.close();
- }catch (IOException ioe) {
- }
- }
- println("Installed " + count + " files/directories");
- }else {
- print("Installing ZIP file " + target + " from "
- + conn.getURL().toExternalForm());
- copyStream(conn, target);
- println();
- }
- }
-
- public void installGZip (URLConnection conn, String target,
- boolean doExpand, boolean doRun)
- throws IOException {
- // doRun not used on htis type
- if (doExpand) {
- String ctype = conn.getContentType();
- if (!ctype.equals("application/x-tar")) { throw new IllegalArgumentException("Unkexpected content type - "
- + ctype); }
- print("Expanding GZIP file to " + target + " from "
- + conn.getURL().toExternalForm());
- prepDirs(target, false);
- GZIPInputStream zis = new GZIPInputStream(new BufferedInputStream(conn.getInputStream(), BLOCK_SIZE
- * BLOCK_COUNT));
- try {
- //BufferedOutputStream os = new BufferedOutputStream(new FileOutputStream(target), BLOCK_SIZE * BLOCK_COUNT);
- //try {
- // byte[] buf = new byte[bufferSize];
- // for (int size = zis.read(buf, 0, buf.length), count = 0;
- // size >= 0;
- // size = zis.read(buf, 0, buf.length), count++) {
- // //if (count % 4 == 0) print(".");
- // os.write(buf, 0, size);
- // }
- //}
- //finally {
- // try { os.flush(); os.close(); } catch (IOException ioe) {}
- //}
- pumpGZip(target, zis);
- }finally {
- try {
- zis.close();
- }catch (IOException ioe) {
- }
- }
- println();
- }else {
- print("Installing GZIP file " + target + " from "
- + conn.getURL().toExternalForm());
- copyStream(conn, target);
- println();
- }
- }
-
- /** Copy a zip entry. */
- protected void copyEntry (String target, ZipInputStream zis, ZipEntry ze)
- throws IOException {
- String name = ze.getName();
- boolean isDir = false;
- if (name.endsWith("/")) {
- name = name.substring(0, name.length() - 1);
- isDir = true;
- }
- String path = target + File.separator + name;
- path = path.replace('\\', '/');
- String mod = ze.getSize() > 0 ? ("[" + ze.getCompressedSize() + ":"
- + ze.getSize() + "]") : "";
- print("Expanding " + ze + mod + " to " + path);
- prepDirs(path, isDir);
- if (!isDir) {
- BufferedOutputStream os = new BufferedOutputStream(new FileOutputStream(path), BLOCK_SIZE
- * BLOCK_COUNT);
- try {
- byte[] buf = new byte[bufferSize];
- for (int size = zis.read(buf, 0, buf.length), count = 0; size >= 0; size = zis.read(
- buf, 0, buf.length), count++) {
- //if (count % 4 == 0) print(".");
- os.write(buf, 0, size);
- }
- }finally {
- try {
- os.flush();
- os.close();
- }catch (IOException ioe) {
- }
- }
- }
- println();
- }
-
- public void copyStream (URLConnection conn, String target)
- throws IOException {
- prepDirs(target, false);
- BufferedInputStream is = new BufferedInputStream(conn.getInputStream(), BLOCK_SIZE
- * BLOCK_COUNT);
- BufferedOutputStream os = new BufferedOutputStream(new FileOutputStream(target), BLOCK_SIZE
- * BLOCK_COUNT);
- byte[] buf = new byte[bufferSize];
- for (int size = is.read(buf), count = 0; size >= 0; size = is.read(buf), count++) {
- //if (count % 4 == 0) print(".");
- os.write(buf, 0, size);
- }
- os.flush();
- os.close();
- is.close();
- }
-
- protected static final int OFFSET_NAME = 0;
-
- protected static final int OFFSET_MODE = OFFSET_NAME + 100;
-
- protected static final int OFFSET_UID = OFFSET_MODE + 8;
-
- protected static final int OFFSET_GID = OFFSET_UID + 8;
-
- protected static final int OFFSET_SIZE = OFFSET_GID + 8;
-
- protected static final int OFFSET_MTIME = OFFSET_SIZE + 12;
-
- protected static final int OFFSET_CHKSUM = OFFSET_MTIME + 12;
-
- protected static final int OFFSET_TYPE = OFFSET_CHKSUM + 8;
-
- protected static final int OFFSET_LINKNAME = OFFSET_TYPE + 1;
-
- protected static final int OFFSET_MAGIC = OFFSET_LINKNAME + 100;
-
- protected static final int OFFSET_VERSION = OFFSET_MAGIC + 6;
-
- protected static final int OFFSET_UNAME = OFFSET_VERSION + 2;
-
- protected static final int OFFSET_GNAME = OFFSET_UNAME + 32;
-
- protected static final int OFFSET_DEVMAJOR = OFFSET_GNAME + 32;
-
- protected static final int OFFSET_DEVMINOR = OFFSET_DEVMAJOR + 8;
-
- protected static final int OFFSET_PREFIX = OFFSET_DEVMINOR + 8;
-
- protected static final int OFFSET_END = OFFSET_PREFIX + 155;
-
- protected static final String MAGIC = "USTAR";
-
- protected void pumpGZip (String target, GZIPInputStream zis)
- throws IOException {
- String curName = null;
- long curSize = 0, remainingSize = 0;
- char curType = 0;
- int curMajor = 0, curMinor = 0;
- boolean inFile = false;
- BufferedOutputStream curOs = null;
- int instFiles = 0, instDirs = 0;
- byte[] buf = new byte[bufferSize];
- top: while (true) {
- int loaded = loadBytes(buf, zis);
- if (loaded < 0) {
- break;
- }
- //System.out.println("pumpGZip: loaded=" + loaded);
- // process each buffer of data
- for (int index = 0; index < loaded; index += BLOCK_SIZE) {
- //System.out.println("pumpGZip: infile=" + inFile + ", remaining=" + remainingSize);
- if (inFile && remainingSize > 0) { // process body part
- int xsize = Math.min((int) remainingSize, BLOCK_SIZE);
- if (curOs != null) {
- curOs.write(buf, index, xsize);
- }
- remainingSize -= xsize;
- }else { // process header block
- if (inFile) {
- inFile = false;
- if (curOs != null) {
- try {
- curOs.flush();
- curOs.close();
- }catch (IOException ioe) {
- }
- println();
- }
- }
- if (isEmptyBlock(buf, index)) { // check logical end of archive
- break top;
- }
- //System.out.println("pumpGZip: header=" + (new String(buf, 0, index, 512)));
- curName = extractString(buf, index + OFFSET_NAME, 100);
- curType = extractChar(buf, index + OFFSET_TYPE);
- curSize = extractLong(buf, index + OFFSET_SIZE, 12);
- remainingSize = curSize;
- if (remainingSize > Integer.MAX_VALUE) { throw new IOException("entry size too large - "
- + remainingSize); }
- String mod = "";
- String magic = extractString(buf, index + OFFSET_MAGIC, 6);
- if (magic.equals(MAGIC)) {
- curName = extractString(buf, index + OFFSET_PREFIX, 155)
- + curName;
- extractInt(buf, index + OFFSET_VERSION, 2);
- curMajor = extractInt(buf, index + OFFSET_DEVMAJOR, 8);
- curMinor = extractInt(buf, index + OFFSET_DEVMINOR, 8);
- if (curMajor > 0 || curMinor > 0) {
- mod = "[" + curMajor + '.' + curMinor + "]";
- }
- }
- //System.out.println("pumpGZip: " +
- // magic + "," +
- // curName + "," +
- // curType + "," +
- // curSize + "," +
- // curVersion + "," +
- // curMajor + "," +
- // curMinor);
- String path = target + File.separator + curName;
- path = path.replace('\\', '/');
- curOs = null;
- if (curType == 0 || curType == '0') { // a file
- print("Copying " + curName + mod + " to " + path);
- prepDirs(path, false);
- curOs = new BufferedOutputStream(new FileOutputStream(path), BLOCK_SIZE
- * BLOCK_COUNT);
- inFile = true;
- instFiles++;
- }else if (curType == '1' || curType == '2') { // a link
- if (curSize > 0) { throw new IOException("link entries cannot have content - "
- + curSize); }
- println("Link ignored - " + curName + mod);
- }else if (curType == '5') { // a directory
- if (path.endsWith("/")) {
- path = path.substring(0, path.length() - 1);
- }
- println("Mkdir " + curName + mod + " to " + path);
- prepDirs(path, true);
- instDirs++;
- }else {
- if (curSize > 0) {
- //throw new IOException("entry type " + curType + " cannot have a content - size=" + curSize);
- inFile = true;
- }
- print("Entry type " + curType + " ignored - " + curName
- + mod);
- }
- }
- }
- }
- println("Installed " + instFiles + " files and " + instDirs
- + " directories");
- }
-
- protected int loadBytes (byte[] buf, GZIPInputStream zis)
- throws IOException {
- int loaded = -1;
- for (int size = zis.read(buf, 0, buf.length), count = 0; size > 0; size = zis.read(
- buf, loaded, buf.length - loaded), count++) {
- //if (count % 4 == 0) print(".");
- //System.out.println("loadBytes: loaded=" + loaded);
- if (loaded < 0) {
- loaded = 0;
- }
- loaded += size;
- }
- return loaded;
- }
-
- protected boolean isEmptyBlock (byte[] buf, int index) {
- boolean r = true;
- for (int i = 0; r && i < BLOCK_SIZE; i++) {
- r = buf[index++] == 0;
- }
- //System.out.println("isEmptyBlock: " + r);
- return r;
- }
-
- protected char extractChar (byte[] buf, int index) throws IOException {
- return (char) buf[index];
- }
-
- protected int extractInt (byte[] buf, int index, int length)
- throws IOException {
- return (int) extractLong(buf, index, length);
- }
-
- protected long extractLong (byte[] buf, int index, int length)
- throws IOException {
- String xsize = extractString(buf, index, length);
- long v = 0;
- for (int i = 0; i < xsize.length(); i++) {
- char c = xsize.charAt(i);
- if (c != ' ') {
- if (c < '0' || c > '7') { throw new IOException("non-octal digit found - "
- + c); }
- v = v * 8 + (c - '0');
- }
- }
- return v;
- }
-
- protected String extractString (byte[] buf, int index, int length)
- throws IOException {
- StringBuffer sb = new StringBuffer();
- for (int i = 0, xindex = index; i < length; i++, xindex++) {
- int c = buf[xindex];
- if (c == 0) {
- break;
- }
- sb.append((char) c);
- }
- //System.out.println("extractString(" + index + "," + length + "): " + sb.toString());
- return sb.toString();
- }
-
- protected String getFile (String name) {
- int posn = name.lastIndexOf("/");
- return posn > 0 ? name.substring(posn + 1) : name;
- }
-
- protected String removeFile (String name) {
- int posn = name.lastIndexOf("/");
- return posn > 0 ? name.substring(0, posn) : name;
- }
-
- protected String removeExtension (String name) {
- int posn1 = name.lastIndexOf("/");
- int posn2 = name.lastIndexOf(".");
- return (posn2 > 0 && posn2 > posn1) ? name.substring(0, posn2) : name;
- }
-
- protected String extraceFile (String name) {
- int posn = name.lastIndexOf(File.separator);
- return posn >= 0 ? name.substring(posn + 1) : null;
- }
-
- protected String getExtension (String name) {
- int posn = name.lastIndexOf('.');
- return posn >= 0 ? name.substring(posn + 1) : "";
- }
-
- protected void prepDirs (String name) {
- prepDirs(name, expand);
- }
-
- protected void prepDirs (String name, boolean includeLast) {
- File f = new File(includeLast ? name : removeFile(name));
- //System.out.print("(Making " + f + ")");
- f.mkdirs();
- }
-
- protected void printUsage () {
- println("Effective command: " + getClass().getName() + " "
- + propFilename + (expand ? " -expand" : " -noexpand")
- + (run ? " -run" : " -norun") + " -java \"" + javaParams + "\""
- + (verbose ? " -verbose" : " -quiet "));
- }
-
- /** Print command help text. */
- protected static void printHelp () {
- System.out.println();
- System.out.println("Usage: java "
- + InstallJars.class.getName()
- + " {propFilename} {-expand | -noexpand} {-run | -norun} {-quiet | -verbose} {-java <params>}");
- System.out.println("Where:");
- System.out.println(" propFilename path to properties file (default=InstallJars.properties)");
- System.out.println(" -expand expand any top level JAR/ZIP/GZIP (default)");
- System.out.println(" -noexpand do not expand any top level JAR/ZIP/GZIP");
- System.out.println(" -run run class or JAR files (default)");
- System.out.println(" -norun do not run class or JAR files");
- System.out.println(" -verbose output progress messages (default)");
- System.out.println(" -quiet suppress most messages");
- System.out.println(" -java sets java runtime paramters");
- System.out.println();
- System.out.println("Properties file entry format: name=!url{!target{!classpath{!option}...}}");
- System.out.println("Where:");
- System.out.println(" name name displayed while installing");
- System.out.println(" url source of items to download and install");
- System.out.println(" target root of install directory or file (default=.)");
- System.out.println(" classpath class path entry to use for this directrory or file (default=target}");
- System.out.println(" option one of the following options: expand, noexpand, run, norun");
- System.out.println(" if omitted, the command line default is used");
- System.out.println("! is a delimiter, the first non-whitespace character is used.");
- System.out.println("Options expand and run may not apply to all types of files.");
- }
-
- /**
- * Main command line entry point.
- * @param args
- */
- public static void main (final String[] args) {
- if (args.length == 0) {
- printHelp();
- System.exit(0);
- }
- String propName = null;
- boolean expand = true;
- boolean verbose = true;
- boolean run = true;
- String params = "cmd /c java";
- // process arguments
- for (int i = 0; i < args.length; i++) {
- String arg = args[i];
- if (arg.charAt(0) == '-') { // switch
- arg = arg.substring(1);
- if (arg.equalsIgnoreCase("quiet")) {
- verbose = false;
- }else if (arg.equalsIgnoreCase("verbose")) {
- verbose = true;
- }else if (arg.equalsIgnoreCase("expand")) {
- expand = true;
- }else if (arg.equalsIgnoreCase("noexpand")) {
- expand = false;
- }else if (arg.equalsIgnoreCase("run")) {
- run = true;
- }else if (arg.equalsIgnoreCase("norun")) {
- run = false;
- }else if (arg.equalsIgnoreCase("java")) {
- run = false;
- if (i < args.length - 1) {
- params = args[++i];
- }
- }else {
- System.err.println("Invalid switch - " + arg);
- System.exit(1);
- }
- }else {
- if (propName == null) {
- propName = arg;
- }else {
- System.err.println("Too many parameters - " + arg);
- System.exit(1);
- }
- }
- }
- if (propName == null) {
- propName = "InstallJars.properties";
- }
- // do the install
- try {
- InstallJars ij = new InstallJars(expand, verbose, run, propName, params);
- ij.printUsage();
- String cp = ij.install();
- System.out.println("\nRecomended additions to your classpath - "
- + cp);
- }catch (Exception e) {
- System.err.println("\n" + e.getClass().getName() + ": "
- + e.getMessage());
- if (verbose) {
- e.printStackTrace(); // *** debug ***
- }
- System.exit(2);
- }
- }
-}
diff --git a/plugins/org.eclipse.actf.core/src/org/eclipse/actf/util/jar/ZipExploder.java b/plugins/org.eclipse.actf.core/src/org/eclipse/actf/util/jar/ZipExploder.java
deleted file mode 100644
index 6d3119b..0000000
--- a/plugins/org.eclipse.actf.core/src/org/eclipse/actf/util/jar/ZipExploder.java
+++ /dev/null
@@ -1,380 +0,0 @@
-/*******************************************************************************
-* Copyright (c) 2004, 2007 IBM Corporation.
-* All rights reserved. This program and the accompanying materials
-* are made available under the terms of the Eclipse Public License v1.0
-* which accompanies this distribution, and is available at
-* http://www.eclipse.org/legal/epl-v10.html
-*
-* Contributors:
-* Mike Squillace - initial API and implementation
-*******************************************************************************/
-
-package org.eclipse.actf.util.jar;
-
-import java.io.BufferedInputStream;
-import java.io.DataInputStream;
-import java.io.File;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Enumeration;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.zip.ZipEntry;
-import java.util.zip.ZipFile;
-
-import org.eclipse.actf.util.Utils;
-
-
-/**
- * class for exploding jar/zip files onto the file system
- *
- *@author Barry Feigenbaum
- */
-public class ZipExploder
-{
-
- /**
- *create a zip exploder for unpacking .jar/.zip files
- */
- public ZipExploder () {
- this(false);
- }
-
- /**
- * create a zip exploder for unpacking .jar/.zip files onto the file system
- *
- * @param verbose - set to <code>true</code> for verbose mode
- */
- public ZipExploder (boolean verbose) {
- setVerbose(verbose);
- }
-
- /**
- * create a zip exploder for unpacking .jar/.zip files onto the file system
- *
- * @param verbose - set to <code>true</code> for verbose mode
- * @param sorted - set to <code>true</code> for sorted file mode
- */
- public ZipExploder (boolean verbose, boolean sorted) {
- this(verbose);
- setSortNames(sorted);
- }
-
- protected boolean verbose;
-
- /**
- * Get the verbose mode state.
- *
- * @return verbosity
- */
- public boolean getVerbose () {
- return verbose;
- }
-
- /**
- * set the verbose mode state
- *
- * @param f - verbosity
- */
- public void setVerbose (boolean f) {
- verbose = f;
- }
-
- protected boolean sortNames;
-
- /**
- * @return Returns the sortNames.
- */
- public boolean getSortNames () {
- return sortNames;
- }
-
- /**
- * @param sortNames The sortNames to set.
- */
- public void setSortNames (boolean sortNames) {
- this.sortNames = sortNames;
- }
-
- /**
- * Explode source JAR and/or ZIP files into a target directory
- * @param zipNames names of source files
- * @param jarNames names of source files
- * @param destDir target directory name (should already exist)
- * @exception IOException error creating a target file
- */
- public void process (String[] zipNames, String[] jarNames, String destDir)
- throws IOException {
- processZips(zipNames, destDir);
- processJars(jarNames, destDir);
- }
-
- /**
- * Explode source JAR files into a target directory
- * @param jarNames names of source files
- * @param destDir target directory name (should already exist)
- * @exception IOException error creating a target file
- */
- public void processJars (String[] jarNames, String destDir)
- throws IOException {
- for (int i = 0; i < jarNames.length; i++) {
- processFile(jarNames[i], destDir);
- }
- }
-
- /**
- * Explode source ZIP files into a target directory
- * @param zipNames names of source files
- * @param destDir target directory name (should already exist)
- * @exception IOException error creating a target file
- */
- public void processZips (String[] zipNames, String destDir)
- throws IOException {
- for (int i = 0; i < zipNames.length; i++) {
- processFile(zipNames[i], destDir);
- }
- }
-
- /**
- * Explode source ZIP or JAR file into a target directory
- * @param zipName names of source file
- * @param destDir target directory name (should already exist)
- * @exception IOException error creating a target file
- */
- public void processFile (String zipName, String destDir) throws IOException {
- String source = new File(zipName).getCanonicalPath();
- String dest = new File(destDir).getCanonicalPath();
- if (verbose) {
- Utils.println(Utils.PROCESS_ALL, "\n**** Exploding "
- + source + " to " + dest);
- }
- ZipFile f = null;
- try {
- f = new ZipFile(source);
- Map fEntries = getEntries(f);
- String[] names = (String[]) fEntries.keySet().toArray(
- new String[] {});
- if (sortNames) {
- Arrays.sort(names);
- }
- // copy all files
- for (int i = 0; i < names.length; i++) {
- String name = names[i];
- ZipEntry e = (ZipEntry) fEntries.get(name);
- copyFileEntry(dest, f, e);
- }
- }catch (IOException ioe) {
- String msg = ioe.getMessage();
- if (msg.indexOf(zipName) < 0) {
- msg += " - " + zipName;
- }
- throw new IOException(msg);
- }finally {
- if (f != null) {
- try {
- f.close();
- }catch (IOException ioe) {
- }
- }
- }
- }
-
- /** Get all the entries in a ZIP file. */
- protected Map getEntries (ZipFile zf) {
- Enumeration e = zf.entries();
- Map m = new HashMap();
- while (e.hasMoreElements()) {
- ZipEntry ze = (ZipEntry) e.nextElement();
- m.put(ze.getName(), ze);
- }
- return m;
- }
-
- /**
- * copy a single entry from the archive
- *
- * @param destDir
- * @param zf
- * @param ze
- * @throws IOException
- */
- public void copyFileEntry (String destDir, ZipFile zf, ZipEntry ze)
- throws IOException {
- DataInputStream dis = new DataInputStream(new BufferedInputStream(zf.getInputStream(ze)));
- try {
- copyFileEntry(destDir, ze.isDirectory(), ze.getName(), dis);
- }finally {
- try {
- dis.close();
- }catch (IOException ioe) {
- }
- }
- }
-
- protected void copyFileEntry (String destDir, boolean destIsDir,
- String destFile, DataInputStream dis)
- throws IOException {
- byte[] bytes = readAllBytes(dis);
- Utils.println(Utils.ALL, "Writing " + bytes.length
- + " bytes...");
- File file = new File(destFile);
- String parent = file.getParent();
- if (parent != null && parent.length() > 0) {
- File dir = new File(destDir, parent);
- if (dir != null) {
- Utils.println(Utils.ALL, "Creating directory path "
- + dir.getAbsolutePath());
- dir.mkdirs();
- Utils.println(Utils.ALL, "Created directory path "
- + dir.getAbsolutePath());
- }
- }
- File outFile = new File(destDir, destFile);
- if (destIsDir) {
- Utils.println(Utils.ALL, "Creating directory "
- + outFile.getAbsolutePath());
- outFile.mkdir();
- Utils.println(Utils.ALL, "Created directory "
- + outFile.getAbsolutePath());
- }else {
- Utils.println(Utils.ALL, "Creating file "
- + outFile.getAbsolutePath());
- FileOutputStream fos = new FileOutputStream(outFile);
- try {
- fos.write(bytes, 0, bytes.length);
- if (verbose) {
- Utils.println(Utils.ALL, "Copied file "
- + outFile.getAbsolutePath());
- }
- }finally {
- try {
- fos.close();
- }catch (IOException ioe) {
- }
- }
- }
- }
-
- // *** below may be slow for large files ***
- /** Read all the bytes in a ZIPed file */
- protected byte[] readAllBytes (DataInputStream is) throws IOException {
- byte[] bytes = new byte[0];
- for (int len = is.available(); len > 0; len = is.available()) {
- byte[] xbytes = new byte[len];
- int count = is.read(xbytes);
- Utils.println(Utils.ALL, "readAllBytes: " + len + " vs. "
- + count);
- if (count > 0) {
- byte[] nbytes = new byte[bytes.length + count];
- System.arraycopy(bytes, 0, nbytes, 0, bytes.length);
- System.arraycopy(xbytes, 0, nbytes, bytes.length, count);
- bytes = nbytes;
- }else if (count < 0) {
- // accommodate apparent bug in IBM JVM where
- // available() always returns positive value on some files
- break;
- }
- }
- return bytes;
- }
-
- protected void print (String s) {
- System.out.print(s);
- }
-
- /** Print command help text. */
- protected static void printHelp () {
- System.out.println();
- System.out.println("Usage: java "
- + ZipExploder.class.getName()
- + " (-jar jarFilename... | -zip zipFilename...)... -dir destDir {-verbose}");
- System.out.println("Where:");
- System.out.println(" jarFilename path to source jar, may repeat");
- System.out.println(" zipFilename path to source zip, may repeat");
- System.out.println(" destDir path to target directory; should exist");
- System.out.println("Note: one -jar or -zip is required; switch case or order is not important");
- }
-
- protected static void reportError (String msg) {
- System.err.println(msg);
- //printHelp();
- System.exit(1);
- }
-
- /**
- * Main command line entry point.
- * @param args
- */
- public static void main (final String[] args) {
- if (args.length == 0) {
- printHelp();
- System.exit(0);
- }
- List zipNames = new ArrayList();
- List jarNames = new ArrayList();
- String destDir = null;
- boolean jarActive = false, zipActive = false, destDirActive = false;
- boolean verbose = false;
- // process arguments
- for (int i = 0; i < args.length; i++) {
- String arg = args[i];
- if (arg.charAt(0) == '-') { // switch
- arg = arg.substring(1);
- if (arg.equalsIgnoreCase("jar")) {
- jarActive = true;
- zipActive = false;
- destDirActive = false;
- }else if (arg.equalsIgnoreCase("zip")) {
- zipActive = true;
- jarActive = false;
- destDirActive = false;
- }else if (arg.equalsIgnoreCase("dir")) {
- jarActive = false;
- zipActive = false;
- destDirActive = true;
- }else if (arg.equalsIgnoreCase("verbose")) {
- verbose = true;
- }else {
- reportError("Invalid switch - " + arg);
- }
- }else {
- if (jarActive) {
- jarNames.add(arg);
- }else if (zipActive) {
- zipNames.add(arg);
- }else if (destDirActive) {
- if (destDir != null) {
- reportError("duplicate argument - " + "-destDir");
- }
- destDir = arg;
- }else {
- reportError("Too many parameters - " + arg);
- }
- }
- }
- if (destDir == null || (zipNames.size() + jarNames.size()) == 0) {
- reportError("Missing parameters");
- }
- if (verbose) {
- System.out.println("Effective command: "
- + ZipExploder.class.getName() + " "
- + (jarNames.size() > 0 ? "-jars " + jarNames + " " : "")
- + (zipNames.size() > 0 ? "-zips " + zipNames + " " : "")
- + "-dir " + destDir);
- }
- try {
- ZipExploder ze = new ZipExploder(verbose);
- ze.process(
- (String[]) zipNames.toArray(new String[zipNames.size()]),
- (String[]) jarNames.toArray(new String[jarNames.size()]),
- destDir);
- }catch (IOException ioe) {
- System.err.println("Exception - " + ioe.getMessage());
- ioe.printStackTrace(); // *** debug ***
- System.exit(2);
- }
- }
-}
diff --git a/plugins/org.eclipse.actf.core/src/org/eclipse/actf/util/jar/ZipImploder.java b/plugins/org.eclipse.actf.core/src/org/eclipse/actf/util/jar/ZipImploder.java
deleted file mode 100644
index ccfd0f9..0000000
--- a/plugins/org.eclipse.actf.core/src/org/eclipse/actf/util/jar/ZipImploder.java
+++ /dev/null
@@ -1,583 +0,0 @@
-/*******************************************************************************
-* Copyright (c) 2004, 2007 IBM Corporation.
-* All rights reserved. This program and the accompanying materials
-* are made available under the terms of the Eclipse Public License v1.0
-* which accompanies this distribution, and is available at
-* http://www.eclipse.org/legal/epl-v10.html
-*
-* Contributors:
-* Barry Feigenbaum - initial API and implementation
-*******************************************************************************/
-
-package org.eclipse.actf.util.jar;
-
-import java.io.BufferedInputStream;
-import java.io.BufferedOutputStream;
-import java.io.DataInputStream;
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.util.jar.JarOutputStream;
-import java.util.jar.Manifest;
-import java.util.zip.ZipEntry;
-import java.util.zip.ZipOutputStream;
-
-import org.eclipse.actf.util.Utils;
-
-
-/**
- * @author Barry Feigenbaum
- */
-public class ZipImploder
-{
-
- protected int dirCount, fileCount;
-
- /**
- * @return Returns the dirCount.
- */
- public int getDirCount () {
- return dirCount;
- }
-
- /**
- * @return Returns the fileCount.
- */
- public int getFileCount () {
- return fileCount;
- }
-
- /**
- * create a new imploder with no verbosity
- *
- */
- public ZipImploder () {
- this(false);
- }
-
- /**
- * create a new imploder with the specified verbosity state
- *
- * @param verbose - verbosity state
- */
- public ZipImploder (boolean verbose) {
- setVerbose(verbose);
- }
-
- protected boolean verbose;
-
- /**
- * get the verbose mode
- *
- * @return verbosity mode
- */
- public boolean getVerbose () {
- return verbose;
- }
-
- /**
- * set the verbosity mode
- *
- * @param f verbosity state
- */
- public void setVerbose (boolean f) {
- verbose = f;
- }
-
- protected String baseDir;
-
- /**
- * @return Returns the baseDir.
- */
- public String getBaseDir () {
- return baseDir;
- }
-
- /**
- * @param baseDir The baseDir to set.
- * @throws IOException
- */
- public void setBaseDir (String baseDir) throws IOException {
- if (baseDir != null) {
- baseDir = new File(baseDir).getCanonicalPath();
- baseDir = baseDir.replace('\\', '/');
- }
- this.baseDir = baseDir;
- }
-
- protected Manifest manifest;
-
- /**
- * @return Returns the manifest
- */
- public Manifest getManifest () {
- return manifest;
- }
-
- /**
- * @param manifest The manifest to set.
- */
- public void setManifest (Manifest manifest) {
- this.manifest = manifest;
- }
-
- protected boolean includeDirs;
-
- /**
- * returns whether or not path information is included in .zip
- *
- * @return <code>true</code> if path information is included, <code>false</code> otherwise
- */
- public boolean getIncludeDirs () {
- return includeDirs;
- }
-
- /**
- * set whether or not path information is included in .zip files
- *
- * @param includeDirs include path inforamtion in .zip file
- */
- public void setIncludeDirs (boolean includeDirs) {
- this.includeDirs = includeDirs;
- }
-
- /**
- * implode source directory into .jar/.zip file
- * @param zipName name of target file
- * @param jarName name of target file
- * @param sourceDir source directory name
- * @exception IOException error creating a target file
- */
- public void process (String zipName, String jarName, String sourceDir)
- throws IOException {
- dirCount = 0;
- fileCount = 0;
- if (zipName != null) {
- processZip(zipName, sourceDir);
- }
- if (jarName != null) {
- processJar(jarName, sourceDir);
- }
- }
-
- /**
- * Implode target JAR file from a source directory
- * @param jarName name of target file
- * @param sourceDir source directory name
- * @exception IOException error creating a target file
- */
- public void processJar (String jarName, String sourceDir)
- throws IOException {
- processJar(jarName, sourceDir, null);
- }
-
- /**
- * Implode target JAR file from a source directory
- * @param jarName name of target file
- * @param sourceDir source directory name (
- * @param comment
- * @exception IOException error creating a target file
- */
- public void processJar (String jarName, String sourceDir, String comment)
- throws IOException {
- processJar(jarName, sourceDir, comment, -1, -1);
- }
-
- /**
- * Implode target JAR file from a source directory
- *
- * @param jarName - name of target .jar
- * @param sourceDir - source directory
- * @param comment - comment for .jar file
- * @param method
- * @param level
- * @throws IOException
- */
- public void processJar (String jarName, String sourceDir, String comment,
- int method, int level) throws IOException {
- String dest = setup(jarName, sourceDir);
- Manifest man = getManifest();
- JarOutputStream jos = man != null ? new JarOutputStream(new BufferedOutputStream(new FileOutputStream(dest)), man)
- : new JarOutputStream(new BufferedOutputStream(new FileOutputStream(dest)));
- configure(jos, comment, method, level);
- process(jos, new File(sourceDir));
- }
-
- /**
- * Implode target JAR file from a source directory
- * @param zipName name of target file
- * @param sourceDir source directory name (
- * @exception IOException error creating a target file
- */
- public void processZip (String zipName, String sourceDir)
- throws IOException {
- processZip(zipName, sourceDir, null);
- }
-
- /**
- * Implode target zip file from a source directory
- *
- * @param zipName
- * @param sourceDir
- * @param comment
- * @throws IOException
- */
- public void processZip (String zipName, String sourceDir, String comment)
- throws IOException {
- processZip(zipName, sourceDir, comment, -1, -1);
- }
-
- /**
- * Implode target zip file from a source directory
- *
- * @param zipName
- * @param sourceDir
- * @param comment
- * @param method
- * @param level
- * @throws IOException
- */
- public void processZip (String zipName, String sourceDir, String comment,
- int method, int level) throws IOException {
- String dest = setup(zipName, sourceDir);
- ZipOutputStream zos = new ZipOutputStream(new BufferedOutputStream(new FileOutputStream(dest)));
- configure(zos, comment, method, level);
- process(zos, new File(sourceDir));
- }
-
- protected void configure (ZipOutputStream zos, String comment, int method,
- int level) {
- if (comment != null) {
- zos.setComment(comment);
- }
- if (method >= 0) {
- zos.setMethod(method);
- }
- if (level >= 0) {
- zos.setLevel(level);
- }
- }
-
- protected String setup (String zipName, String sourceDir)
- throws IOException {
- File dir = new File(sourceDir);
- if (!dir.exists() && !dir.isDirectory()) { throw new IOException("source must exist and be a directory: "
- + dir); }
- String source = dir.getCanonicalPath();
- String dest = new File(zipName).getCanonicalPath();
- if (verbose) {
- Utils.println(Utils.PROCESS_ALL, "\n**** Imploding "
- + source + " to " + dest);
- }
- return dest;
- }
-
- protected void process (ZipOutputStream zos, File dir) throws IOException {
- try {
- processDir(zos, dir);
- }finally {
- zos.close();
- }
- }
-
- protected String removeDrive (String path) {
- return path.length() >= 2 && path.charAt(1) == ':' ? path.substring(2)
- : path;
- }
-
- protected String removeLead (String path) {
- if (baseDir != null && path.startsWith(baseDir)) {
- path = path.substring(baseDir.length());
- if (path.length() >= 1) {
- if (path.charAt(0) == '/' || path.charAt(0) == '\\') {
- path = path.substring(1); // drop leading /
- }
- }
- }
- return path;
- }
-
- public void processDir (ZipOutputStream zos, File dir) throws IOException {
- String path = dir.getCanonicalPath();
- path = path.replace('\\', '/');
- if (includeDirs) {
- if (baseDir == null || path.length() > baseDir.length()) {
- String xpath = removeDrive(removeLead(path));
- if (xpath.length() > 0) {
- xpath += '/';
- if (verbose) {
- Utils.println(
- Utils.PROCESS_ALL, "\nProcessing directory "
- + path + " to " + xpath);
- }
- ZipEntry ze = new ZipEntry(xpath);
- zos.putNextEntry(ze);
- }else {
- if (verbose) {
- Utils.println(
- Utils.PROCESS_ALL, "\nSkipping empty path");
- }
- }
- }else {
- if (verbose) {
- Utils.println(Utils.PROCESS_ALL, "\nDropping "
- + path);
- }
- }
- }else {
- if (verbose) {
- Utils.println(Utils.PROCESS_ALL, "\nSkipping " + path);
- }
- }
- dirCount++;
- String[] files = dir.list();
- for (int i = 0; i < files.length; i++) {
- String file = files[i];
- File f = new File(dir, file);
- if (f.isDirectory()) {
- processDir(zos, f);
- }else {
- processFile(zos, f);
- }
- }
- }
-
- /**
- * process a single file for a .zip file
- *
- * @param zos
- * @param f
- * @throws IOException
- */
- public void processFile (ZipOutputStream zos, File f) throws IOException {
- String path = f.getCanonicalPath();
- path = path.replace('\\', '/');
- String xpath = removeDrive(removeLead(path));
- if (verbose) {
- Utils.println(Utils.PROCESS_ALL, "Processing file "
- + path + " to " + xpath);
- }
- ZipEntry ze = new ZipEntry(xpath);
- ze.setTime(f.lastModified());
- ze.setSize(f.length());
- zos.putNextEntry(ze);
- fileCount++;
- try {
- copyFileEntry(zos, f);
- }finally {
- zos.closeEntry();
- }
- }
-
- protected void copyFileEntry (ZipOutputStream zos, File f)
- throws IOException {
- DataInputStream dis = new DataInputStream(new BufferedInputStream(new FileInputStream(f)));
- try {
- copyFileEntry(zos, dis);
- }finally {
- try {
- dis.close();
- }catch (IOException ioe) {
- }
- }
- }
-
- protected void copyFileEntry (ZipOutputStream zos, DataInputStream dis)
- throws IOException {
- byte[] bytes = readAllBytes(dis);
- Utils.println(Utils.ALL, "Writing " + bytes.length
- + " bytes...");
- zos.write(bytes, 0, bytes.length);
- }
-
- // *** below may be slow for large files ***
- /** Read all the bytes in a stream */
- protected byte[] readAllBytes (DataInputStream is) throws IOException {
- byte[] bytes = new byte[0];
- for (int len = is.available(); len > 0; len = is.available()) {
- byte[] xbytes = new byte[len];
- int count = is.read(xbytes);
- Utils.println(Utils.ALL, "readAllBytes: " + len + " vs. "
- + count);
- if (count > 0) {
- byte[] nbytes = new byte[bytes.length + count];
- System.arraycopy(bytes, 0, nbytes, 0, bytes.length);
- System.arraycopy(xbytes, 0, nbytes, bytes.length, count);
- bytes = nbytes;
- }
- }
- return bytes;
- }
-
- protected void print (String s) {
- System.out.print(s);
- }
-
- /** Print command help text. */
- public static void printHelp () {
- System.out.println();
- System.out.println("Usage: java " + ZipImploder.class.getName());
- System.out.println(" (-jar <jarName> {-manifest <manfile>} | -zip <zipName>)");
- System.out.println(" -dir <sourceDir> {-lead <leadDir>} {-doDirs} {-verbose}");
- System.out.println("Where:");
- System.out.println(" <jarName> path to target jar");
- System.out.println(" <zipName> path to target zip");
- System.out.println(" <manfile> path to manifest file");
- System.out.println(" <sourceDir> path to source directory; must exist");
- System.out.println(" <leadDir> partial lead path to remove from stored entries; default: <sourceDir>");
- System.out.println(" <noDirs> skip output of directory entries");
- System.out.println(" <verbose> output progress information");
- System.out.println("Note: switch case or order is not important");
- }
-
- protected static void reportError (String msg) {
- System.err.println(msg);
- //printHelp();
- System.exit(1);
- }
-
- /**
- * Main command line entry point.
- * @param args
- */
- public static void main (final String[] args) {
- if (args.length == 0) {
- printHelp();
- System.exit(0);
- }
- String zipName = null;
- String jarName = null;
- String manName = null;
- String sourceDir = null;
- String leadDir = null;
- boolean jarActive = false, manActive = false, zipActive = false, sourceDirActive = false, leadDirActive = false;
- boolean verbose = false;
- boolean noDirs = false;
- // process arguments
- for (int i = 0; i < args.length; i++) {
- String arg = args[i];
- if (arg.charAt(0) == '-') { // switch
- arg = arg.substring(1);
- if (arg.equalsIgnoreCase("jar")) {
- jarActive = true;
- manActive = false;
- zipActive = false;
- sourceDirActive = false;
- leadDirActive = false;
- }else if (arg.equalsIgnoreCase("manifest")) {
- jarActive = false;
- manActive = true;
- zipActive = false;
- sourceDirActive = false;
- leadDirActive = false;
- }else if (arg.equalsIgnoreCase("zip")) {
- zipActive = true;
- manActive = false;
- jarActive = false;
- sourceDirActive = false;
- leadDirActive = false;
- }else if (arg.equalsIgnoreCase("dir")) {
- jarActive = false;
- manActive = false;
- zipActive = false;
- sourceDirActive = true;
- leadDirActive = false;
- }else if (arg.equalsIgnoreCase("lead")) {
- jarActive = false;
- manActive = false;
- zipActive = false;
- sourceDirActive = false;
- leadDirActive = true;
- }else if (arg.equalsIgnoreCase("noDirs")) {
- noDirs = true;
- jarActive = false;
- manActive = false;
- zipActive = false;
- sourceDirActive = false;
- leadDirActive = false;
- }else if (arg.equalsIgnoreCase("verbose")) {
- verbose = true;
- jarActive = false;
- manActive = false;
- zipActive = false;
- sourceDirActive = false;
- leadDirActive = false;
- }else {
- reportError("Invalid switch - " + arg);
- }
- }else {
- if (jarActive) {
- if (jarName != null) {
- reportError("Duplicate value - " + arg);
- }
- jarName = arg;
- }else if (manActive) {
- if (manName != null) {
- reportError("Duplicate value - " + arg);
- }
- manName = arg;
- }else if (zipActive) {
- if (zipName != null) {
- reportError("Duplicate value - " + arg);
- }
- zipName = arg;
- }else if (sourceDirActive) {
- if (sourceDir != null) {
- reportError("Duplicate value - " + arg);
- }
- sourceDir = arg;
- }else if (leadDirActive) {
- if (leadDir != null) {
- reportError("Duplicate value - " + arg);
- }
- leadDir = arg;
- }else {
- reportError("Too many parameters - " + arg);
- }
- }
- }
- if (sourceDir == null || (zipName == null && jarName == null)) {
- reportError("Missing parameters");
- }
- if (manName != null && zipName != null) {
- reportError("Manifests not supported on ZIP files");
- }
- if (leadDir == null) {
- leadDir = new File(sourceDir).getAbsolutePath().replace('\\', '/') + '/';
- }
- if (verbose) {
- System.out.println("Effective command: "
- + ZipImploder.class.getName()
- + (jarName != null ? " -jar " + jarName
- + (manName != null ? " -manifest " + manName : "")
- : "") + (zipName != null ? " -zip " + zipName : "")
- + " -dir " + sourceDir + " -lead " + leadDir
- + (noDirs ? " -noDirs" : "") + (verbose ? " -verbose" : ""));
- }
- try {
- ZipImploder zi = new ZipImploder(verbose);
- if (leadDir != null) {
- zi.setBaseDir(leadDir);
- }
- if (manName != null) {
- BufferedInputStream bis = new BufferedInputStream(new FileInputStream(manName));
- try {
- zi.setManifest(new Manifest(bis));
- }finally {
- bis.close();
- }
- }
- zi.setIncludeDirs(!noDirs);
- zi.process(zipName, jarName, sourceDir);
- if (verbose) {
- System.out.println("\nDone Directories=" + zi.getDirCount()
- + " Files=" + zi.getFileCount());
- }
- }catch (IOException ioe) {
- System.err.println("Exception - " + ioe.getMessage());
- //ioe.printStackTrace(); // *** debug ***
- System.exit(2);
- }
- }
-}
diff --git a/plugins/org.eclipse.actf.core/src/org/eclipse/actf/util/logging/AbstractErrorLogger.java b/plugins/org.eclipse.actf.core/src/org/eclipse/actf/util/logging/AbstractErrorLogger.java
deleted file mode 100644
index c322110..0000000
--- a/plugins/org.eclipse.actf.core/src/org/eclipse/actf/util/logging/AbstractErrorLogger.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/*******************************************************************************
-* Copyright (c) 2004, 2007 IBM Corporation.
-* All rights reserved. This program and the accompanying materials
-* are made available under the terms of the Eclipse Public License v1.0
-* which accompanies this distribution, and is available at
-* http://www.eclipse.org/legal/epl-v10.html
-*
-* Contributors:
-* Mike Squillace - initial API and implementation
-*******************************************************************************/
-
-package org.eclipse.actf.util.logging;
-
-
-/**
- * a base from which error loggers can be built. Extending this class, clients need only
- * implement <code>logError(String, Throwable)</code>.
- *
- * @author Mike Squillace
- */
-public abstract class AbstractErrorLogger implements IErrorLogger
-{
-
- /** {@inheritDoc} */
- public void logError (Throwable t) {
- logError(t.getMessage() != null ? t.getMessage() : "<no message>", t);
- }
-
- /** {@inheritDoc} */
- public void logError (String msg) {
- logError(msg, null);
- }
-}
diff --git a/plugins/org.eclipse.actf.core/src/org/eclipse/actf/util/logging/AbstractReporter.java b/plugins/org.eclipse.actf.core/src/org/eclipse/actf/util/logging/AbstractReporter.java
deleted file mode 100644
index 94dfe6c..0000000
--- a/plugins/org.eclipse.actf.core/src/org/eclipse/actf/util/logging/AbstractReporter.java
+++ /dev/null
@@ -1,286 +0,0 @@
-/*******************************************************************************
-* Copyright (c) 2004, 2007 IBM Corporation.
-* All rights reserved. This program and the accompanying materials
-* are made available under the terms of the Eclipse Public License v1.0
-* which accompanies this distribution, and is available at
-* http://www.eclipse.org/legal/epl-v10.html
-*
-* Contributors:
-* Mike Squillace - initial API and implementation
-*******************************************************************************/
-
-package org.eclipse.actf.util.logging;
-
-import java.io.FileWriter;
-import java.io.IOException;
-import java.io.PrintWriter;
-import java.text.MessageFormat;
-import java.util.HashMap;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Map;
-import java.util.ResourceBundle;
-import java.util.Stack;
-
-import org.eclipse.actf.core.runtime.RuntimeContextFactory;
-
-
-
-/**
- * base implementation of a Reporter. This class provides default
- * behaviors for the <code>org.eclipse.actf.core.logging.Reporter</code> interface, which
- * adds functionality for identifying the source of reported messages and for
- * rerouting errors and exceptions using the error-logging features added to ACTF.
- *
- *<p><b>Note</b>: Clients should subclass this class rather than implementing <code>Reporter</code> to avoid
- *API incompatibilities and to insure appropriate behavior.
- *
- * @see org.eclipse.actf.core.logging.IReporter
- * @author Mike Squillace
- */
-public abstract class AbstractReporter implements IReporter
-{
-
- /**
- * formatter for forming category id strings. The default format is:
- *
- * <pre>
- * <nodeName>[<nodeDescription>][@id=<nodeId>]
- * </pre>
- *
- * <p>where:
- * <p><ul>
- * <li><code>nodeName</code> is the node name of the node as returned by IModel.getNodeName
- * <li><code>nodeDescription</code> is the node description of the node as returned by IModel.getNodeLocator.describe
- * <li><code>nodeId</code> is the unique node id of the node as returned by IModel.getNodeId
- * </ul></p>
- *
- * <p>The category formatter can be changed using the <code>setCategoryFormatter(messageFormat)</code> method.
- *
- * @see #setCategoryFormatter(MessageFormat)
- * @see org.eclipse.actf.model.IModel#getNodeName(Object)
- * @see org.eclipse.actf.model.IModel#getNodeId(Object)
- * @see org.eclipse.actf.model.locate.INodeLocator#describe(Object)
- */
- public static final MessageFormat CATEGORY_FORMATTER = new MessageFormat("{0}[{1}][@id={2}]");
-
- protected static final Map SOURCE_ID_MAP = new HashMap();
- static {
- SOURCE_ID_MAP.put(VALIDATION, "Validator");
- SOURCE_ID_MAP.put(SYSTEM_FATAL, "System");
- SOURCE_ID_MAP.put(SYSTEM_NONFATAL, "Nonfatal");
- SOURCE_ID_MAP.put(USER, "User");
- SOURCE_ID_MAP.put(TRACE, "Tracer");
- SOURCE_ID_MAP.put(CONFIGURATION, "Configuration");
- }
-
- protected int defaultOutputLevel = UNKNOWN;
- protected Stack categories = new Stack();
- protected MessageFormat categoryFormatter = CATEGORY_FORMATTER;
- protected String sourceID;
- protected ResourceBundle bundle;
- protected List errorLoggers = new LinkedList();
-
- public AbstractReporter () {
- registerErrorLogger(RuntimeContextFactory.getInstance().getRuntimeContext().getErrorLogger());
- }
-
- /**
- * add an error logger to the list of loggers to receive requests to report errors
- * from this reporter.
- *
- * @param logger - error logger for reporting errors
- */
- public void registerErrorLogger (IErrorLogger logger) {
- errorLoggers.add(logger);
- }
-
- /**
- * remove an error logger from the list of loggers to receive errors
- *
- * @param logger - error logger to be removed
- */
- public void unregisterErrorLogger (IErrorLogger logger) {
- errorLoggers.add(logger);
- }
-
- /**
- * get the underlying resource bundle
- *
- * @return bundle
- */
- public ResourceBundle getResourceBundle () {
- return bundle;
- }
-
- /**
- * set the resource bundle
- *
- * @param bundle
- */
- public void setResourceBundle (ResourceBundle bundle) {
- this.bundle = bundle;
- }
-
- public void setCategoryFormatter (MessageFormat formatter) {
- categoryFormatter = formatter;
- }
-
- /** {@inheritDoc} */
- public MessageFormat getCategoryFormatter () {
- return categoryFormatter;
- }
-
- /** {@inheritDoc} */
- public void setSourceID (String id) {
- sourceID = id;
- }
-
- /** {@inheritDoc} */
- public String getSourceID () {
- return sourceID;
- }
-
- /**
- * get the source id string associated with the given key. This method will return
- * <code>null</code> if one of the pre-defined symbolic constants in the <code>Reporter</code> interface
- * are not used.
- *
- * @param id
- * @return id associated with given key
- */
- public String getSourceIDString (String id) {
- return (String) SOURCE_ID_MAP.get(sourceID);
- }
-
- /** {@inheritDoc} */
- public void setDefaultOutputLevel (int level) {
- if (level < MIN_LEVEL || level > MAX_LEVEL) { throw new IllegalArgumentException("invalid level: "
- + level); }
- defaultOutputLevel = level;
- }
-
- /** {@inheritDoc} */
- public int getDefaultOutputLevel () {
- return defaultOutputLevel;
- }
-
- /** {@inheritDoc} */
- public void report (String message) {
- report(DEFAULT_LEVEL, message, (Object[]) null);
- }
-
- /** {@inheritDoc} */
- public void report (String message, Object[] values) {
- report(DEFAULT_LEVEL, message, values);
- }
-
- /** {@inheritDoc} */
- public void report (int level, String message) {
- report(level, message, (Object[]) null);
- }
-
- /** {@inheritDoc} */
- public void report (Throwable t) {
- report(IReporter.ERROR, "", t);
- }
-
- /** {@inheritDoc} */
- public void report (int level, Throwable t) {
- report(level, "", t);
- }
-
- /** {@inheritDoc} */
- public void report (int level, String msg, Throwable t) {
- for (int l = 0; l < errorLoggers.size(); ++l) {
- IErrorLogger logger = (IErrorLogger) errorLoggers.get(l);
- logger.logError(msg, t);
- }
- StringBuffer sb = new StringBuffer(msg == null ? "" : msg);
- sb.append('\n');
- while (t != null) {
- String type = t.getClass().getName();
- String m = t.getMessage() == null ? type : type + ": "
- + t.getMessage();
- StackTraceElement[] elements = t.getStackTrace();
- sb.append(m);
- sb.append('\n');
- for (int s = 0; s < elements.length; ++s) {
- sb.append("at ");
- sb.append(elements[s].toString());
- sb.append('\n');
- }
- t = t.getCause();
- if (t != null) {
- sb.append('\n');
- sb.append("Caused by: ");
- }
- }
- String s = sb.toString();
- if (s.trim().length() > 0) {
- report(level, s);
- }
- }
-
- /** {@inheritDoc} */
- public String getCategory () {
- return categories.isEmpty() ? null : (String) categories.peek();
- }
-
- /** {@inheritDoc} */
- public void startCategory (String id) {
- categories.push(id);
- }
-
- /** {@inheritDoc} */
- public void endCategory () {
- endCategory(null);
- }
-
- /** {@inheritDoc} */
- public void endCategory (String id) {
- if (categories.isEmpty()) { throw new IllegalStateException("no active categories"); }
- if (id != null && !id.equals(categories.peek())) { throw new IllegalStateException("category does not match: "
- + id); }
- categories.pop();
- }
-
- /**
- * utility method to construct reporters
- *
- * @param traceLevel - level at which to report
- * @param traceStream - stream to which report is sent (either a file, 'stderr', or 'stdout')
- * @return PrintWriterReporter that reports to the given stream
- */
- public static IReporter getReporter (int traceLevel, String traceStream) {
- int level = traceLevel > IReporter.MAX_LEVEL || traceLevel < IReporter.MIN_LEVEL
- ? IReporter.ERROR : traceLevel;
- PrintWriter pw = null;
- IReporter tracer = null;
-
- if (traceStream == null || traceStream.equalsIgnoreCase("stderr")) {
- pw = new PrintWriter(System.err, true);
- }else if (traceStream.equalsIgnoreCase("stdout")) {
- pw = new PrintWriter(System.out, true);
- }else {
- try {
- pw = new PrintWriter(new FileWriter(traceStream), true);
- } catch (IOException e) {
- System.err.println("Could not create reporter using trace stream: " + traceStream + "; logging to System.err");
- pw = new PrintWriter(System.err, true);
- }
- }
-
- tracer = new PrintWriterReporter(pw);
- tracer.setDefaultOutputLevel(level);
- tracer.open();
-
- return tracer;
- } // getReporter
-
- /** {@inheritDoc} */
- public void reset () {
- categories.clear();
- }
-
-} // AbstractReporter
diff --git a/plugins/org.eclipse.actf.core/src/org/eclipse/actf/util/logging/ConsoleErrorLogger.java b/plugins/org.eclipse.actf.core/src/org/eclipse/actf/util/logging/ConsoleErrorLogger.java
deleted file mode 100644
index c7971e5..0000000
--- a/plugins/org.eclipse.actf.core/src/org/eclipse/actf/util/logging/ConsoleErrorLogger.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/*******************************************************************************
-* Copyright (c) 2004, 2007 IBM Corporation.
-* All rights reserved. This program and the accompanying materials
-* are made available under the terms of the Eclipse Public License v1.0
-* which accompanies this distribution, and is available at
-* http://www.eclipse.org/legal/epl-v10.html
-*
-* Contributors:
-* Mike Squillace - initial API and implementation
-*******************************************************************************/
-
-package org.eclipse.actf.util.logging;
-
-import java.io.PrintStream;
-
-
-/**
- * general logger for writing to the console
- *
- * @author Mike Squillace
- */
-public class ConsoleErrorLogger extends AbstractErrorLogger
-{
-
- private PrintStream _stream;
-
- /**
- * create a console error logger that writes to <code>System.err</code>
- *
- *
- */
- public ConsoleErrorLogger () {
- this(System.err);
- }
-
- /**
- * create an error logger for writing to the console
- *
- * @param stream either <code>System.out</code> or <code>System.err</code>
- */
- public ConsoleErrorLogger (PrintStream stream) {
- _stream = stream;
- }
-
- /** {@inheritDoc} */
- public void logError (String msg, Throwable t) {
- if (msg != null) {
- _stream.println(msg);
- }
- if (t != null) {
- _stream.println(t.getClass().getName() + " - " + t.toString());
- t.printStackTrace(_stream);
- while ((t = t.getCause()) != null) {
- _stream.println(t.getClass().getName() + " - " + t.toString());
- t.printStackTrace(_stream);
- }
- }
- }
-
-}
diff --git a/plugins/org.eclipse.actf.core/src/org/eclipse/actf/util/logging/EclipseErrorLogger.java b/plugins/org.eclipse.actf.core/src/org/eclipse/actf/util/logging/EclipseErrorLogger.java
deleted file mode 100644
index 3963266..0000000
--- a/plugins/org.eclipse.actf.core/src/org/eclipse/actf/util/logging/EclipseErrorLogger.java
+++ /dev/null
@@ -1,27 +0,0 @@
-/*******************************************************************************
-* Copyright (c) 2004, 2007 IBM Corporation.
-* All rights reserved. This program and the accompanying materials
-* are made available under the terms of the Eclipse Public License v1.0
-* which accompanies this distribution, and is available at
-* http://www.eclipse.org/legal/epl-v10.html
-*
-* Contributors:
-* Mike Squillace - initial API and implementation
-*******************************************************************************/
-
-package org.eclipse.actf.util.logging;
-
-import org.eclipse.actf.core.ActfCorePlugin;
-
-/**
- * @author Mike Squillace
- */
-public class EclipseErrorLogger extends AbstractErrorLogger
-{
-
- /** {@inheritDoc} */
- public void logError (String msg, Throwable t) {
- ActfCorePlugin.getDefault().logException(msg, t);
- }
-
-}
diff --git a/plugins/org.eclipse.actf.core/src/org/eclipse/actf/util/logging/IErrorLogger.java b/plugins/org.eclipse.actf.core/src/org/eclipse/actf/util/logging/IErrorLogger.java
deleted file mode 100644
index b9a60e3..0000000
--- a/plugins/org.eclipse.actf.core/src/org/eclipse/actf/util/logging/IErrorLogger.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*******************************************************************************
-* Copyright (c) 2004, 2007 IBM Corporation.
-* All rights reserved. This program and the accompanying materials
-* are made available under the terms of the Eclipse Public License v1.0
-* which accompanies this distribution, and is available at
-* http://www.eclipse.org/legal/epl-v10.html
-*
-* Contributors:
-* Mike Squillace - initial API and implementation
-*******************************************************************************/
-
-package org.eclipse.actf.util.logging;
-
-/**
- * used to log errors to different destinations such as files, streams, or GUI components. The
- * <code>ErrorLoggerFactory</code> interface should be implemented to return instances of this interface appropriate to different
- * contexts.
- *
- * @see org.eclipse.actf.util.error.ErrorLoggerFactory
- * @author Mike Squillace
- */
-public interface IErrorLogger
-{
-
- /**
- * log a Throwable
- *
- * @param t - Throwable to log
- */
- public void logError (Throwable t);
-
- /**
- * log an error message
- *
- * @param msg - error message
- */
- public void logError (String msg);
-
- /**
- * log an error message along with its corresponding Throwable. If no message
- * is specified, the class and <code>toString()</code> of the
- * Throwable should be logged.
- *
- * @param msg - error message
- * @param t - Throwable being logged
- */
- public void logError (String msg, Throwable t);
-}
diff --git a/plugins/org.eclipse.actf.core/src/org/eclipse/actf/util/logging/IReporter.java b/plugins/org.eclipse.actf.core/src/org/eclipse/actf/util/logging/IReporter.java
deleted file mode 100644
index e2fbd4c..0000000
--- a/plugins/org.eclipse.actf.core/src/org/eclipse/actf/util/logging/IReporter.java
+++ /dev/null
@@ -1,262 +0,0 @@
-/*******************************************************************************
-* Copyright (c) 2004, 2007 IBM Corporation.
-* All rights reserved. This program and the accompanying materials
-* are made available under the terms of the Eclipse Public License v1.0
-* which accompanies this distribution, and is available at
-* http://www.eclipse.org/legal/epl-v10.html
-*
-* Contributors:
-* Barry Feigenbaum - initial API and implementation
-*******************************************************************************/
-
-package org.eclipse.actf.util.logging;
-
-
-/**
- * interface to be implemented in order to generate reports for tracing or validation during the execution of
- * the ACTF application. Typically, reports are configured with a stream or socket but see the
- * <code>RecordReporter</code>, which can be used to store generated reports for later organization.
- *
- * @author Barry Feigenbaum
- */
-public interface IReporter
-{
-
- int SEVERE = 5;
- int ERROR = 4;
- int WARNING = 3;
- int INFO = 2;
- int DETAIL = 1;
- int CONFIG = 0;
-
- int UNKNOWN = -1;
- int DEFAULT_LEVEL = ERROR;
- int MAX_LEVEL = SEVERE;
- int MIN_LEVEL = CONFIG;
-
- final String[] KEYS = {
- "level.CONFIG", "level.DETAIL", "level.INFO", "level.WARNING",
- "level.ERROR", "level.SEVERE"
- };
-
- public static final String VALIDATION = "validation";
- public static final String SYSTEM_FATAL = "system";
- public static final String SYSTEM_NONFATAL = "nonfatal";
- public static final String USER = "user";
- public static final String TRACE = "trace";
- public static final String CONFIGURATION = "configuration";
-
- /**
- * set the default output level. This level determines the messages that are to be
- * printed or logged. Messages reported at levels equal to or greater than this level
- * are printed or logged whereas messages reported at levels lower than
- * this default level are ignored by this reporter.
- *
- *@param level - default output level
- */
- public void setDefaultOutputLevel (int level);
-
- /**
- * get the default output level.
- *
- *@return default output level
- *@see #setDefaultOutputLevel(int)
- */
- public int getDefaultOutputLevel ();
-
- /**
- * Open for processing
- */
- public void open ();
-
- /**
- * returns whether or not this reporter is open
- *
- * @return <code>true</code> if has been opened, <code>false</code> otherwise
- * @see #open()
- */
- public boolean isOpen ();
-
- /**
- * close processing
- */
- public void close ();
-
- /**
- * Flush any pending output
- */
- void flush ();
-
- /**
- * report the message
- *
- * @param message -- message to be written
- */
- public void report (String message);
-
- /**
- * report an information message using the substitution values
- *
- * @param message -- message to be reported
- * @param values -- substitution values
- */
- public void report (String message, Object[] values);
-
- /**
- * report the message at the given level.
- * Messages are reported if the given level is greater than or equal to
- * the set or default level.
- *
- * @param level -- level of message
- * @param message -- message to be reported
- */
- public void report (int level, String message);
-
- /**
- * report the message at the given level with the given substitution values
- *
- * @param level
- * @param message
- * @param values
- * @see #report(int, String)
- */
- public void report (int level, String message, Object[] values);
-
- /**
- * get the last reported message
- *
- * @return last reported message
- */
- public String getLastReport ();
-
- /**
- * get the category id string of current reporting
- *
- * @return current category id
- */
- public String getCategory ();
-
- /**
- * start a new category with the given id.
- *
- * @param id -- new category id
- */
- public void startCategory (String id);
-
- /**
- * end the current reporting category
- */
- public void endCategory ();
-
- /**
- * end the category with the given id
- *
- * @param id -- id of category to end
- */
- public void endCategory (String id);
-
- /**
- * add an error logger to the list of loggers to receive requests to report errors
- * from this reporter.
- *
- * @param logger - error logger for reporting errors
- */
- public void registerErrorLogger (IErrorLogger logger);
-
- /**
- * remove an error logger from the list of loggers to receive errors
- *
- * @param logger - error logger to be removed
- */
- public void unregisterErrorLogger (IErrorLogger logger);
-
- /**
- * set the source id for future reports.
- * If no id is set, the word 'level' precedes
- * the level of the violation.
- *
- * <p>The id can be one of the following:
- * <p><ul>
- * <li><code>VALIDATION</code> - validation violation
- *<li><code>USER</code> - user error (i.e. can be remedied by user)
- * <li><code>SYSTEM_FATAL</code> - fatal system error (e.g. resource not found)
- * <li><code>SYSTEM_NONFATAL</code> - nonfatal system error (i.e. process can continue but results are suspect)
- * <li><code>TRACE</code> - message related to tracing or debugging
- * <li><code>CONFIGURATION</code> - message related to configuration
- * </ul></p>
- *
- * @param name - name or id of this reporter
- */
- public void setSourceID (String name);
-
- /**
- * gets the id or name of this reporter
- *
- * @return name or id of this reporter
- * @see #setSourceID(String)
- */
- public String getSourceID ();
-
- /**
- * reports an exception or error. This method can be used to direct the stack trace
- * of the given throwable to the appropriate output for this reporter (e.g. a GUI text area
- * or stream).
- *
- * <p>The default level of this report message is <code>Reporter.SEVERE</code>.
- *
- * @param t - Throwable being reported
- */
- public void report (Throwable t);
-
- /**
- * reports an exception or error. This method can be used to direct the stack trace
- * of the given throwable to the appropriate output for this reporter (e.g. a GUI text area
- * or stream). The level of the throwable is determined by the
- * specified level parameter.
- *
- * @param level - level of exception or error
- * @param t - Throwable being reported
- */
- public void report (int level, Throwable t);
-
- /**
- * reports an exception or error. This method can be used to direct the stack trace
- * of the given throwable to the appropriate output for this reporter (e.g. a GUI text area
- * or stream). The level of the throwable is determined by the
- * specified level parameter.
- *
- * @param level - level of exception or error
- * @param msg - optional message
- * @param t - Throwable being reported
- */
- public void report (int level, String msg, Throwable t);
-
- /**
- * start a new report. Every call of this method must be matched with a
- * corresponding <code>endReport</code> call.
- *
- * @param comp - root component for which report is being generated
- */
- public void startReport (Object comp);
-
- /**
- * ends a report started with <code>startReport</code>. Once this method is called, the <code>getLastReport</code>
- * method can be called in order to supply the report generated betwen the <code>startReport</code> call and
- * this call.
- */
- public void endReport ();
-
- /**
- * set the last report on this reporter. This method is only used in <code>ValidationLauncher.DISTINCT_JVM</code>
- * after the launcher gets an indication that a report has completed.
- *
- * @param reportText - last report generated
- */
- public void setLastReport (String reportText);
-
- /**
- * reset the reporter. This method should clear all categories and all remaining
- * buffers and report records.
- */
- public void reset ();
-} // Reporter
diff --git a/plugins/org.eclipse.actf.core/src/org/eclipse/actf/util/logging/PrintWriterReporter.java b/plugins/org.eclipse.actf.core/src/org/eclipse/actf/util/logging/PrintWriterReporter.java
deleted file mode 100644
index 5d151da..0000000
--- a/plugins/org.eclipse.actf.core/src/org/eclipse/actf/util/logging/PrintWriterReporter.java
+++ /dev/null
@@ -1,320 +0,0 @@
-/*******************************************************************************
-* Copyright (c) 2004, 2007 IBM Corporation.
-* All rights reserved. This program and the accompanying materials
-* are made available under the terms of the Eclipse Public License v1.0
-* which accompanies this distribution, and is available at
-* http://www.eclipse.org/legal/epl-v10.html
-*
-* Contributors:
-* Barry Feigenbaum - initial API and implementation
-*******************************************************************************/
-
-package org.eclipse.actf.util.logging;
-
-import java.io.BufferedReader;
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-import java.io.InputStreamReader;
-import java.io.PrintWriter;
-import java.text.MessageFormat;
-import java.util.Date;
-import java.util.List;
-import java.util.MissingResourceException;
-import java.util.ResourceBundle;
-
-/**
- * implementation to generate report records to the specified <code>PrintWriter</code> object.
- *
- * @author Barry Feigenbaum
- */
-public class PrintWriterReporter extends AbstractReporter
-{
-
- // The following two variables are used to add the Class name, method and line
- // number into the trace buffer.
- // _addClassAndMethod turns on/off the addition of the this info to the trace.
- private boolean _addClassAndMethod = false;
-
- // _stackDepth determines how far into the stack to go to get the calling
- // method. This is an approximation as to where the trace statement actually
- // is in the source code. Some paths through the system may be deeper.
- private int _stackDepth = 6;
-
- /** {@inheritDoc} */
- public void reset () {
- super.reset();
- formatBuffer = new StringBuffer();
- }
-
- protected PrintWriter writer;
-
- /**
- * get the PrintWriter being used by this Reporter
- *
- * @return underlying PrintWriter
- */
- public PrintWriter getPrintWriter () {
- return writer;
- }
-
- protected int[] levelCount = new int[MAX_LEVEL - MIN_LEVEL + 1];
-
- /**
- * return the number of errors reported thus far by this reporter.
- *
- * @return number of errors reported
- */
- public int getErrorCount () {
- return levelCount[IReporter.ERROR];
- }
-
- /**
- * return the number of warnings reported thus far by this reporter.
- *
- * @return number of warnings reported
- */
- public int getWarningCount () {
- return levelCount[IReporter.WARNING];
- }
-
- /**
- * return the number of messages at the given level reported thus far by this reporter.
- *
- * @param level - level of messages to be counted
- * @return number of messages at the given level reported
- */
- public int getLevelCount (int level) {
- return level >= MIN_LEVEL && level <= MAX_LEVEL ? levelCount[level] : 0;
- }
-
- /**
- * reset the counts to 0.
- */
- public void resetCount () {
- for (int l = 0; l < (MAX_LEVEL - MIN_LEVEL + 1); ++l) {
- levelCount[l] = 0;
- }
- }
-
- /**
- * create a new reporter using the given PrintWriter
- *
- * @param writer -- underlying PrintWriter
- */
- public PrintWriterReporter (PrintWriter writer) {
- super();
- this.writer = writer;
- this.defaultOutputLevel = UNKNOWN;
- }
-
- /**
- * create a new reporter using the given PrintWriter
- *
- * @param writer -- underlying PrintWriter
- * @param format -- message formatter
- * @param bundle
- */
- public PrintWriterReporter (PrintWriter writer, ResourceBundle bundle) {
- this(writer);
- this.bundle = bundle;
- }
-
- /** {@inheritDoc} */
- public String getLastReport () {
- return formatBuffer.toString();
- }
-
- public String toString () {
- StringBuffer sb = new StringBuffer(getClass().getName());
- sb.append('[');
- sb.append(sourceID == null ? "<None>" : sourceID);
- sb.append(isOpen() ? "open" : "closed");
- sb.append(",\"");
- sb.append(getLastReport());
- sb.append("\",\"");
- sb.append("\"]");
- return sb.toString();
- }
-
- protected boolean open;
-
- /** {@inheritDoc} */
- public void open () {
- open = true;
- }
-
- /** {@inheritDoc} */
- public boolean isOpen () {
- return open;
- }
-
- /** {@inheritDoc} */
- public void close () {
- if (isOpen()) {
- flush();
- if (!categories.isEmpty()) { throw new IllegalStateException("categories active: "
- + categories.size()); }
- open = false;
- }
- }
-
- protected StringBuffer formatBuffer = new StringBuffer();
-
- protected StringBuffer lastReportBuffer;
-
- protected boolean reportStarted;
-
- /** {@inheritDoc} */
- public void report (int level, String message, Object[] values) {
- synchronized (this) {
- if (!isOpen()) { throw new IllegalStateException("not open"); }
- if (defaultOutputLevel == UNKNOWN || level >= defaultOutputLevel) {
- formatBuffer.setLength(0);
- if (bundle != null) {
- try {
- message = bundle.getString(message);
- }catch (MissingResourceException mre) {
- // do nothing
- }
- }
- if (level != UNKNOWN) {
- if (level < MIN_LEVEL || level > MAX_LEVEL) { throw new IllegalArgumentException("invalid level: "
- + level); }
- int lastDot = IReporter.KEYS[level].lastIndexOf('.');
- String prefix = sourceID == null ? IReporter.KEYS[level].substring(
- 0, lastDot) : sourceID;
- String levelStr = bundle != null ? bundle.getString(IReporter.KEYS[level])
- : IReporter.KEYS[level].substring(lastDot + 1);
- formatBuffer.append(prefix + "." + levelStr);
- formatBuffer.append(": ");
- }
- if (!categories.isEmpty()) {
- formatBuffer.append("[" + categories.peek() + "]");
- formatBuffer.append(" ");
- }
- if (getSourceID().equals(IReporter.TRACE)) {
- formatBuffer.append("\t["
- + new Date(System.currentTimeMillis()) + "], ");
- formatBuffer.append("\t" + getThreadInfo());
- if (_addClassAndMethod) {
- formatBuffer.append("\n\t" + getMethodNameFromStack()
- + " \n\t");
- }
- }
- if (values != null && values.length > 0) {
- if (message != null && message.length() > 0) {
- formatBuffer.append(MessageFormat.format(message, values));
- }
- }else {
- if (message != null && message.length() > 0) {
- formatBuffer.append(message);
- }
- }
- writer.println(formatBuffer.toString());
- if (reportStarted) {
- lastReportBuffer.append(formatBuffer.toString());
- lastReportBuffer.append('\n');
- }
- ++levelCount[level];
- }
- }
- } // report
-
- /** {@inheritDoc} */
- public void flush () {
- if (!isOpen()) { throw new IllegalStateException("not open"); }
- writer.flush();
- }
-
- public boolean isReportStarted () {
- return reportStarted;
- }
-
- /** {@inheritDoc} */
- public void startReport (Object comp) {
- if (!reportStarted) {
- reportStarted = true;
- lastReportBuffer = new StringBuffer();
- }
- }
-
- /** {@inheritDoc} */
- public void endReport () {
- if (!reportStarted) { throw new IllegalStateException("Report has not been started on this reporter"); }
- reportStarted = false;
- }
-
- /** {@inheritDoc} */
- public void setLastReport (String reportText) {
- lastReportBuffer = new StringBuffer(reportText);
- }
-
- /**
- * Get info about the calling Thread.
- *
- * @return String the id and name of the Thread.
- */
- public String getThreadInfo () {
- Thread t = Thread.currentThread();
- //Use this code in JDK 1.5
- //return "[Thread id - " + t.getId() + ", name - " + t.getName() + "]";
- //Use this code in JDK 1.4
- return "[Thread name - " + t.getName() + "]";
- }
-
- /**
- * Get the class and method name that called PrintUtils.println(). In order
- * to get the caller to PrintUtils.println() we need to go 6 deep into the
- * stack.
- *
- * @return String the class and method name.
- */
- public String getMethodNameFromStack () {
- return getMethodNameFromStack(_stackDepth);
- }
-
- /**
- * Returns the class and method name from a line in the stack.
- *
- * @param numLinesToIgnore number of lines in the stack trace to ignore
- * @return String the class and method name from the specific line in the stack trace.
- */
- public String getMethodNameFromStack (int numLinesToIgnore) {
- // Create a Throwable to get the stack infomation.
- Throwable t = new Throwable();
- // Print the stack into a byte array.
- ByteArrayOutputStream baos = new ByteArrayOutputStream();
- t.printStackTrace(new PrintWriter(baos, true));
- byte[] stackTraceBytes = baos.toByteArray();
- String line = null;
- // Read each line of the byte array until we hit the line we're interested in.
- try {
- ByteArrayInputStream bais = new ByteArrayInputStream(stackTraceBytes);
- BufferedReader in = new BufferedReader(new InputStreamReader(bais));
- // Skip the specified number of lines in the stack trace until we reach the
- // line that contains the info for our calling method.
- in.readLine(); // always ignore the first line
- for (int i = 0; i < numLinesToIgnore - 1; i++) {
- in.readLine(); // clear lines that we don't need
- }
- line = in.readLine();
- in.close();
- }catch (IOException e) {
- return "Unknown method";
- }
- // Trim the stack trace line to eliminate the "at " at the beginning.
- String methodName = line.substring(4, line.length());
- return methodName;
- }
-
- /** {@inheritDoc} */
- public void addReportRecords (List records) {
- // TODO need to refactor this.
- // This method is necessary because the Reporter interface requires it.
- // However, it doesn't make sense here because there are no report
- // records for this implementation.
- // It may be better to refactor the AbstractReporter to have the list
- // of report records.
- }
-}
diff --git a/plugins/org.eclipse.actf.core/src/org/eclipse/actf/util/logging/StreamErrorLogger.java b/plugins/org.eclipse.actf.core/src/org/eclipse/actf/util/logging/StreamErrorLogger.java
deleted file mode 100644
index 2440e0b..0000000
--- a/plugins/org.eclipse.actf.core/src/org/eclipse/actf/util/logging/StreamErrorLogger.java
+++ /dev/null
@@ -1,84 +0,0 @@
-/*******************************************************************************
-* Copyright (c) 2004, 2007 IBM Corporation.
-* All rights reserved. This program and the accompanying materials
-* are made available under the terms of the Eclipse Public License v1.0
-* which accompanies this distribution, and is available at
-* http://www.eclipse.org/legal/epl-v10.html
-*
-* Contributors:
-* Mike Squillace - initial API and implementation
-*******************************************************************************/
-
-package org.eclipse.actf.util.logging;
-
-import java.io.OutputStream;
-import java.io.OutputStreamWriter;
-import java.io.PrintWriter;
-
-
-/**
- * an error logger for logging errors to an <code>java.io.OutputStream</code>
- *
- * @author Mike Squillace
- */
-public class StreamErrorLogger extends AbstractErrorLogger
-{
-
- private PrintWriter _writer;
-
- private String _filename;
-
- /**
- * create an error logger for writing to a stream
- *
- * @param stream - stream to which errors are to be logged
- */
- public StreamErrorLogger (OutputStream stream) {
- _writer = new PrintWriter(new OutputStreamWriter(stream), true);
- }
-
- /** {@inheritDoc} */
- public void logError (String msg, Throwable t) {
- if (msg != null) {
- _writer.println(msg);
- }
- if (t != null) {
- _writer.println(t.getClass().getName() + " - " + t.toString());
- t.printStackTrace();
- while ((t = t.getCause()) != null) {
- _writer.println(t.toString());
- t.printStackTrace();
- }
- }
- }
-
- /**
- * return the filename associated with the stream
- *
- * @return filename associated with stream or <code>null</code> if
- * a filename was not set
- * @see #setFilename(String)
- */
- public String getFilename () {
- return _filename;
- }
-
- /**
- * asociate a filename with the underlying stream with which this
- * error logger was instantiated
- *
- * @param name - filename
- */
- public void setFilename (String name) {
- _filename = name;
- }
-
- protected void finalize () throws Throwable {
- _writer.close();
- }
-
- public String toString () {
- return getClass().getName() + "["
- + (_filename == null ? "" : _filename) + "]";
- }
-}
diff --git a/plugins/org.eclipse.actf.core/src/org/eclipse/actf/util/resources/ClassLoaderCache.java b/plugins/org.eclipse.actf.core/src/org/eclipse/actf/util/resources/ClassLoaderCache.java
deleted file mode 100644
index d93c650..0000000
--- a/plugins/org.eclipse.actf.core/src/org/eclipse/actf/util/resources/ClassLoaderCache.java
+++ /dev/null
@@ -1,262 +0,0 @@
-/*******************************************************************************
-* Copyright (c) 2004, 2007 IBM Corporation.
-* All rights reserved. This program and the accompanying materials
-* are made available under the terms of the Eclipse Public License v1.0
-* which accompanies this distribution, and is available at
-* http://www.eclipse.org/legal/epl-v10.html
-*
-* Contributors:
-* Mike Squillace - initial API and implementation
-*******************************************************************************/
-
-package org.eclipse.actf.util.resources;
-
-import java.io.IOException;
-import java.net.URL;
-import java.util.Collections;
-import java.util.Enumeration;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.Map;
-
-/**
- * cache for class loaders used during pre-instrumentation or transformation
- * processes. The ACTF AOP engine uses the bootstrap classpath to perform .class
- * file transformations and entries on this classpath cannot simultaneously
- * occur on the standard classpath. Hence, any need for a <code>Class</code>
- * object fo the former set of classes must be retreaved via this class. This
- * cache should also be used to perform all class-comparison operations such as
- * <code>instanceof</code> and <code>isAssignableFrom</code>.
- *
- * @author Mike Squillace
- */
-public class ClassLoaderCache
-{
-
- private static ClassLoaderCache _clc;
-
- private Map _cache = Collections.synchronizedMap(new HashMap());
-
- protected ClassLoaderCache () {
- }
-
- /**
- * get the default cache or create one if one has not already been created
- *
- * @return default cache
- */
- public static ClassLoaderCache getDefault () {
- if (_clc == null) {
- _clc = new ClassLoaderCache();
- }
- return _clc;
- }
-
- /**
- * get a <code>java.net.URL</code> object representing the named resource
- *
- * @param resourceName -
- * name of desired resource
- * @return <code>java.net.URL</code> object or <code>null</code> if
- * name cannot be resolved
- */
- public URL getResource (String name) {
- URL result = getClass().getClassLoader().getResource(name);
-
- // if we can't find the resource - loop through the classloaders and try them
- if ( result == null ) {
- synchronized (_cache) {
- Iterator iter = _cache.values().iterator();
- while (iter.hasNext() && result == null ) {
- ClassLoader loader = (ClassLoader) iter.next();
- if ( loader != null ) {
- result = loader.getResource( name );
- }
- }
- }
- }
-
- return result;
- }
-
- /**
- * get a <code>java.util.Enumeration</code> representing the named resources
- *
- * @param resourceName -
- * name of desired resource
- * @return <code>java.util.Enumeration</code> object or <code>null</code> if
- * name cannot be resolved
- */
- public Enumeration getResources (String name) throws IOException {
- Enumeration result = getClass().getClassLoader().getResources(name);
-
- // if we can't find the resource - loop through the classloaders and try them
- if ( result == null ) {
- synchronized (_cache) {
- Iterator iter = _cache.values().iterator();
- while (iter.hasNext() && result == null ) {
- ClassLoader loader = (ClassLoader) iter.next();
- if ( loader != null ) {
- result = loader.getResources( name );
- }
- }
- }
- }
-
- return result;
- }
-
-
-
- /**
- * get a <code>java.lang.Class</code> object representing the named class
- *
- * @param className -
- * name of desired class
- * @return <code>java.lang.Class</code> object or <code>null</code> if
- * name cannot be resolved
- */
- public Class classForName (String className) {
- Class cls = null;
- try {
- cls = Class.forName(className, true, getClassLoaderFor(className));
- } catch (ClassNotFoundException e) {
- } catch (NoClassDefFoundError e) {
- }
- return cls;
- }
-
- /**
- * get the <code>java.lang.ClassLoader</code> reference for the named
- * class. The algorithm used by this method is as follows:
- *
- * <p>
- * <ul>
- * <li>1. look for the ClassLoader used to load the named class
- * <li>2. look for the ClassLoader that loaded the package of the named
- * class
- * <li>3. repeat step 2 for each parent package until the named class is
- * found or until the default package is reached
- * </ul>
- *
- * <p>
- * Note: This method is used by all other methods in this class to resolve
- * class names.
- *
- * @param className
- * name of class
- * @return <code>ClassLoader</code> object for the class named or
- * <code>null</code> if the name cannot be resolved
- */
- public ClassLoader getClassLoaderFor (String className) {
- ClassLoader cl = (ClassLoader) _cache.get(className);
- int dot = className.lastIndexOf('.');
- String packPrefix = dot == -1 ? "" : className.substring(0, dot);
-
- while (cl == null & packPrefix.length() > 0) {
- synchronized (_cache) {
- Iterator iter = _cache.keySet().iterator();
- while (iter.hasNext() & cl == null) {
- String key = (String) iter.next();
- if (key.indexOf(packPrefix) >= 0) {
- cl = (ClassLoader) _cache.get(key);
- }
- }
- }
-
- dot = packPrefix.lastIndexOf('.');
- packPrefix = dot == -1 ? "" : packPrefix.substring(0, dot);
- }
-
- return cl != null ? cl : getClass().getClassLoader();
- }
-
- /**
- * add a class name with its corresponding class loader to the cache
- *
- * @param className -
- * name of class
- * @param cl -
- * class loader
- */
- public void put (String className, ClassLoader cl) {
- if (_cache.containsKey(className)) { throw new IllegalArgumentException("Duplicate entries in cache"); }
- _cache.put(className, cl);
- }
-
- /**
- * test whether or not the given class is assignable to the specified class
- * name.
- *
- * @param className
- * name of class to which target is to be assigned
- * @param testCls
- * class to be tested
- * @return <code>true</code> if and only if the test class is equal to or
- * a subclass of the class name, <code>false</code> otherwise
- * @see java.lang.Class#isAssignableFrom(java.lang.Class)
- */
- public boolean isAssignableFrom (String className, Class testCls) {
- Class cls = null;
- boolean result = false;
- try {
- cls = Class.forName(className, true, getClassLoaderFor(className));
- result = cls.isAssignableFrom(testCls);
- }catch (ClassNotFoundException e) {
- }
- return result;
- }
-
- /**
- * test whether or not the specified object is an instance of the class with
- * the given name.
- *
- * @param className -
- * name of class
- * @param o -
- * object to be tested
- * @return <code>true</code> if and only if the object is an instance of
- * hte class named by the className, <code>false</code> otherwise
- */
- public boolean isInstanceOf (String className, Object o) {
- return isAssignableFrom(className, o.getClass());
- }
-
- /**
- * returns whether or not this class name names a class that cannot be
- * instrumented in ACTF. Classes that cannot be instrumented include classes
- * in the ACTF packages, the AOP engine classes, classes that comprise the
- * XML parsing engines, etc.
- *
- * @param classname
- * name of class to be tested
- * @return <code>true</code> if class named by this class name can be
- * instrumented, <code>false</code> otherwise
- */
- public boolean isNonAdvisableClassName (String classname) {
- return classname.startsWith("org.jboss.aop")
- || classname.startsWith("org.aspectj")
- || classname.endsWith("$aop")
- || classname.startsWith("javassist")
- || classname.startsWith("org.jboss.util.")
- || classname.startsWith("gnu.trove.")
- || classname.startsWith("EDU.oswego.cs.dl.util.concurrent.")
- || classname.startsWith("org.apache.crimson")
- || classname.startsWith("org.apache.bsf")
- || classname.startsWith("org.apache.xalan")
- || classname.startsWith("org.apache.xml")
- || classname.startsWith("org.apache.xpath")
- || classname.startsWith("org.ietf.")
- || classname.startsWith("org.omg.")
- //|| classname.startsWith("org.w3c.")
- || classname.startsWith("org.xml.sax.")
- || classname.startsWith("sunw.")
- || classname.startsWith("sun.")
- || (classname.startsWith("java.") && !classname.startsWith("java.awt."))
- || (classname.startsWith("javax.") && !classname.startsWith("javax.swing."))
- || classname.startsWith("com.sun.")
- || classname.startsWith("com.ibm.sns.")
- || classname.startsWith("org.eclipse.actf.");
-
- }
-} // ClassLoaderCache
diff --git a/plugins/org.eclipse.actf.core/src/org/eclipse/actf/util/resources/DefaultResourceLocator.java b/plugins/org.eclipse.actf.core/src/org/eclipse/actf/util/resources/DefaultResourceLocator.java
deleted file mode 100644
index ed37d23..0000000
--- a/plugins/org.eclipse.actf.core/src/org/eclipse/actf/util/resources/DefaultResourceLocator.java
+++ /dev/null
@@ -1,130 +0,0 @@
-/*******************************************************************************
-* Copyright (c) 2004, 2007 IBM Corporation.
-* All rights reserved. This program and the accompanying materials
-* are made available under the terms of the Eclipse Public License v1.0
-* which accompanies this distribution, and is available at
-* http://www.eclipse.org/legal/epl-v10.html
-*
-* Contributors:
-* Barry Feigenbaum - initial API and implementation
-*******************************************************************************/
-
-package org.eclipse.actf.util.resources;
-
-import java.io.BufferedInputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.net.URL;
-import java.util.Enumeration;
-import java.util.LinkedList;
-import java.util.List;
-
-/**
- * a default implementation of the IResourceLocator interface for ACTF. Subclasses add special functionality
- * for locating resources (e.g. .properties files) in particular environments.
- *
- * @author Barry Feigenbaum
- */
-public class DefaultResourceLocator implements IResourceLocator
-{
-
- /** {@inheritDoc} */
- public InputStream getResourceAsStream (String id) {
- return getResourceAsStream(id, getClass().getClassLoader());
- }
-
- /** {@inheritDoc} */
- public InputStream getResourceAsStream (String id, ClassLoader loader) {
- String name = System.getProperty(id);
- return getResourceAsBufferedStream(name != null ? name : id, loader);
- }
-
- /** {@inheritDoc} */
- public InputStream getResourceAsStream (String id, String base,
- String ext, ClassLoader loader) {
- String name = System.getProperty(id);
- return getResourceAsBufferedStream(
- name != null ? name : id, base, ext, loader);
- }
-
- protected InputStream makeBufferedStream (InputStream is) {
- if (is != null) {
- if (!(is instanceof BufferedInputStream)) {
- is = new BufferedInputStream(is);
- }
- }
- return is;
- }
-
- protected InputStream getResourceAsBufferedStream (String id, ClassLoader loader) {
- if (loader == null) {
- loader = ClassLoader.getSystemClassLoader();
- }
- return makeBufferedStream(loader.getResourceAsStream(id));
- }
-
- protected InputStream getResourceAsBufferedStream (String id, String base,
- String ext, ClassLoader loader) {
- if (loader == null) {
- loader = ClassLoader.getSystemClassLoader();
- }
- String path = id;
- if (base != null) {
- path = base + "/" + path;
- }
- if (ext != null) {
- path = path + "." + ext;
- }
- return makeBufferedStream(loader.getResourceAsStream(path));
- }
-
- public URL getResource (String name) {
- return ClassLoaderCache.getDefault().getResource( name );
- }
-
- public URL[] getResources (String name) {
- List urls = new LinkedList();
- Enumeration en = null;
-
- try {
- en = ClassLoaderCache.getDefault().getResources(name);
- } catch (IOException e) {
- }
-
- while (en != null && en.hasMoreElements()) {
- urls.add((URL) en.nextElement());
- }
-
- return (URL[]) urls.toArray(new URL[urls.size()]);
- }
-
- public String getPath ( String name ) {
- String result = null;
-
- URL url = getResource( name );
-
- if ( url != null ) {
- result = url.toString();
- }
-
- return result;
- }
-
- public String[] getPaths( String name ) {
- String[] result = null;
-
- URL[] urls = getResources( name );
-
- if ( urls != null ) {
- result = new String[urls.length];
-
- for( int i=0; i < urls.length; i++ ) {
- if ( urls[i] != null ) {
- result[i] = urls[i].toString();
- }
- }
- }
-
- return result;
- }
-}
diff --git a/plugins/org.eclipse.actf.core/src/org/eclipse/actf/util/resources/EclipseResourceLocator.java b/plugins/org.eclipse.actf.core/src/org/eclipse/actf/util/resources/EclipseResourceLocator.java
deleted file mode 100644
index 456dd67..0000000
--- a/plugins/org.eclipse.actf.core/src/org/eclipse/actf/util/resources/EclipseResourceLocator.java
+++ /dev/null
@@ -1,336 +0,0 @@
-/*******************************************************************************
-* Copyright (c) 2004, 2007 IBM Corporation.
-* All rights reserved. This program and the accompanying materials
-* are made available under the terms of the Eclipse Public License v1.0
-* which accompanies this distribution, and is available at
-* http://www.eclipse.org/legal/epl-v10.html
-*
-* Contributors:
-* <a href="mailto:masquill@us.ibm.com>Mike Squillace</a> - initial API and implementation
-*******************************************************************************/
-
-package org.eclipse.actf.util.resources;
-
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileNotFoundException;
-import java.io.IOException;
-import java.io.InputStream;
-import java.net.MalformedURLException;
-import java.net.URL;
-import java.util.Dictionary;
-import java.util.Iterator;
-import java.util.LinkedList;
-import java.util.List;
-
-import org.eclipse.actf.core.config.Version;
-import org.eclipse.actf.util.Utils;
-import org.eclipse.actf.util.logging.IReporter;
-import org.eclipse.core.runtime.FileLocator;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.Path;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.osgi.service.datalocation.Location;
-import org.osgi.framework.Bundle;
-
-
-/**
- * an implementation for locating resources within the Eclipse framework.
- *
- * @author <a href="mailto:masquill@us.ibm.com>Mike Squillace</a>
- *
- */
-public class EclipseResourceLocator extends DefaultResourceLocator
-{
-
-
- private List _bundles = new LinkedList();
-
- /**
- * used to identify the bundles in which resources are to be found. Each bundle in
- * Eclipse has its own class loader and we leave it to the platform to choose the class loader to be used. Thus, calling this method means that a <code>ClassLoader</code>
- * should not be passed to <code>getResourceAsStream</code>. Also, not all methods for finding resources in bundles
- * use <code>ClassLoader</code> objects.
- *
- * @param bundle - the name of the bundle (i.e. plug-in) that is to be searched for a resource
- */
- public void registerBundleName (String bundle) {
- _bundles.add(bundle);
- }
-
- /**
- * {@inheritDoc}
- * Note that resources are located in the context of bundles in Eclipse.
- * @see #setBundle(String)
- */
- public InputStream getResourceAsStream (String id, ClassLoader loader) {
- return getResourceAsStream(id, null, null, loader);
- }
-
- public InputStream getResourceAsStream (String id, String base,
- String ext, ClassLoader loader) {
- return loader != null
- ? super.getResourceAsStream(id, base, ext, loader)
- : getResourceAsStream(id, base, ext);
- }
-
- private InputStream getResourceAsStream (String id, String base, String ext) {
- InputStream stream = null;
-
- for (Iterator iter = _bundles.listIterator(); iter.hasNext() & stream == null; ){
- String bundleName = (String) iter.next();
- stream = getResourceAsStream(id, base, ext, bundleName);
- }
-
- return stream;
- }
-
- public InputStream getResourceAsStream (String id, String base,
- String ext, String bundleName) {
- InputStream stream = null; //Stream to be returned.
- String relativePath = getRelativePath(base, id, ext);
- IPath pathToFile = null;
-
- if (bundleName != null) {
- pathToFile = getPathToFile(bundleName, relativePath);
- }
- if (pathToFile != null) {
- try {
- stream = new FileInputStream(pathToFile.toFile());
- Utils.println(Utils.ALL, "Created stream for file - " + relativePath + " using bundle " + bundleName);
- }catch (FileNotFoundException e) {
- //Don't need to report anything in this catch , the result of the call to
- //getPathToFile will have already made sure that this file exists.
- }
- } else {
- Utils.println(Utils.ALL, "unable to create stream for file - " + relativePath + " using bundle " + bundleName);
- }
-
- return stream;
- }
-
- private String getRelativePath (String base, String fileName, String ext) {
- String relativePath = null;
-
- //First, build the relative file path that we want to look for.
- if (base == null) {
- //If we have a base of null, default to using the resources directory
- base = IResourceLocator.DEFAULT_ACTF_RESOURCES_DIR;
- }
-
- if (ext != null) {
- //The passed extension is not null, use it.
- relativePath = base + File.separator + fileName + "." + ext;
- }else {
- //Null for an extension means we default to using .properties
- relativePath = base + File.separator + fileName + ".properties";
- }
-
- return relativePath;
- }
-
- /**
- * {@inheritDoc}
- * <p>Search Algorithm is:</p>
- * <p><ol>
- * <li>Search through the registered ClassLoaders for the resource
- * <li>Search through the registered Bundles for the resource
- * <li>Test if the name is actually a Bundle
- * </ol></p>
- */
- public URL getResource (String name) {
- URL result = super.getResource(name);
-
- // If we didn't find the resource in any of the registered ClassLoaders
- // Search through the bundle list to see if the resource is in a bundle
- if ( result == null ) {
- IPath ipath = null;
-
- for (Iterator iter = _bundles.listIterator(); iter.hasNext() & ipath == null; ){
- String bundleName = (String) iter.next();
- if ( bundleName.equals(name)) {
- ipath = getPathToBundle( name );
- } else {
- ipath = getPathToFile(bundleName, name);
- }
- }
-
- // If the resource was not in any of the registered bundles
- // Check to see if the resource is a bundle name
- if ( ipath == null ) {
- ipath = getPathToBundle( name );
- }
-
- // If we found the resource then create a URL to return
- if ( ipath != null ) {
- try {
- result = ipath.toFile().toURL();
- } catch (MalformedURLException e) {
- }
- }
- }
-
- return result;
- }
-
- /**
- * {@inheritDoc}
- * Note: You may also pass a bundle name to this method to obtain a bundle path
- */
- public String getPath ( String name ) {
- String result = null;
-
- URL url = getResource( name );
-
- result = convertToFileURL( url );
-
- return result;
- }
-
- /**
- * {@inheritDoc}
- */
- public String[] getPaths( String name ) {
- String[] result = null;
-
- URL[] urls = getResources( name );
-
- if ( urls != null ) {
- result = new String[urls.length];
-
- for( int i=0; i < urls.length; i++ ) {
- result[i] = convertToFileURL( urls[i]);
- }
- }
-
- return result;
- }
-
- private String convertToFileURL( URL url ) {
- String result = null;
-
- if ( url != null ) {
- try {
- URL fileUrl = FileLocator.toFileURL(url);
- result = fileUrl.getFile().substring(1); // remove "file:/"
- } catch( IOException e) {
- result = null;
- }
- }
- return result;
- }
-
- public IPath getPathToFile (String bundleName, String relativePath) {
- Path absolutePath = null;
-
- if (bundleName != null && bundleName.length() > 0) {
- Bundle bundle = Platform.getBundle(bundleName);
- if (bundle != null) {
- Path relativeFilePath = new Path(relativePath);
- URL pathUrl = Platform.find(bundle, relativeFilePath);
-
- if (pathUrl == null) {
- // look in resources directory
- relativeFilePath = new Path(DEFAULT_ACTF_RESOURCES_DIR + "/" + relativePath);
- pathUrl = Platform.find(bundle, relativeFilePath);
- }
-
- if (pathUrl != null) {
- try {
- pathUrl = Platform.resolve(pathUrl);
- absolutePath = new Path(new File(pathUrl.getFile()).getAbsolutePath());
- Utils.println(IReporter.DETAIL,
- "getPathToFile(), absolute path to " + relativePath + " = " + absolutePath.toString());
- }catch (IOException ioe) {
- Utils.println(IReporter.SYSTEM_NONFATAL, ioe);
- }
- }
- }
- }
-
- return absolutePath;
- }
-
- private IPath getPathToBundle (String bundleName) {
- IPath absolutePath = null;
- if (bundleName == null || bundleName.length() == 0) { return absolutePath; }
- Version eclipseVersion = getEclipseVersion();
- Bundle bundle = Platform.getBundle(bundleName);
- if (bundle != null) {
- // In Eclipse 3.1 the bundle location is always relative. To get the
- // absolute path we
- // need start with the path of the Eclipse installation, append the
- // relative path
- // to the bundle and let the Path class resolve the path segments to
- // for the canonical
- // path.
- // In Eclipse 3.0 the bundle locations are always absolute.
- if ((eclipseVersion.getMajor() == 3)
- && (eclipseVersion.getMinor() == 0)) {
- absolutePath = new Path("");
- }else {
- absolutePath = new Path(getEclipseInstallPath());
- }
- // The bundle location always begins with "update@" and ends with
- // the relative bundle location.
- // We have to strip off the "update@" before we append it to the
- // path.
- String[] bundlePaths = bundle.getLocation().split("@");
- absolutePath = absolutePath.append(bundlePaths[1]);
- if ((eclipseVersion.getMajor() == 3)
- && (eclipseVersion.getMinor() == 0)) {
- IPath path = absolutePath.makeAbsolute();
- // String [] segments = path.segments();
- // for ( int i=0; i<path.segmentCount(); i++) {
- // ConfigUtils.logDebug("\tsegment [" + i + "] - " +
- // segments[i]);
- // }
- File file = path.toFile();
- absolutePath = new Path(file.getPath());
- }
- Utils.println(
- IReporter.DETAIL,
- "getPathToBundle(), path to bundle "
- + bundleName + " = " + absolutePath.toString());
- }
- return absolutePath;
- }
-
- private Version getEclipseVersion () {
- Version eclipseVersion = null;
- Bundle platformBundle = Platform.getBundle("org.eclipse.platform");
- Dictionary platformDict = platformBundle.getHeaders();
- if (!platformDict.isEmpty()) {
- String version = (String) platformDict.get(Version.bundleVersionKey);
- eclipseVersion = new Version(version);
- }else {
- eclipseVersion = new Version("0.0.0");
- }
- Utils.println(
- IReporter.DETAIL,
- "getEclipseVersion(), Eclipse version - "
- + eclipseVersion.toString());
- return eclipseVersion;
- }
-
- private String getEclipseInstallPath () {
- String filePath = "";
- try {
- // The following code returns the Eclipse installation path.
- // The URL.getPath() method returns the path in the form of
- // /d:/eclipse.
- // We want to strip off the preceeding "/" and an easy way to do it
- // is to convert it to a Path and return the string representation.
- Location installLocation = Platform.getInstallLocation();
- URL url = installLocation.getURL();
- Path absolutePath = new Path(new File(url.getFile()).getAbsolutePath());
- filePath = absolutePath.toString();
- }catch (Exception e) {
- Utils.println(IReporter.SYSTEM_NONFATAL, e.getMessage(), e);
- }
- Utils.println(
- IReporter.DETAIL,
- "getEclipseInstallPath(), Eclipse installation path - " + filePath);
- return filePath;
- }
-}
\ No newline at end of file
diff --git a/plugins/org.eclipse.actf.core/src/org/eclipse/actf/util/resources/IResourceLocator.java b/plugins/org.eclipse.actf.core/src/org/eclipse/actf/util/resources/IResourceLocator.java
deleted file mode 100644
index 103840d..0000000
--- a/plugins/org.eclipse.actf.core/src/org/eclipse/actf/util/resources/IResourceLocator.java
+++ /dev/null
@@ -1,108 +0,0 @@
-/*******************************************************************************
-* Copyright (c) 2004, 2007 IBM Corporation.
-* All rights reserved. This program and the accompanying materials
-* are made available under the terms of the Eclipse Public License v1.0
-* which accompanies this distribution, and is available at
-* http://www.eclipse.org/legal/epl-v10.html
-*
-* Contributors:
-* Barry Feigenbaum - initial API and implementation
-*******************************************************************************/
-
-package org.eclipse.actf.util.resources;
-
-import java.io.InputStream;
-import java.net.URL;
-
-/**
- * A IResourceLocator is used to retreave streams for named resources. It is meant to enhance
- * the normal functionality of <code>ClassLoader.getResourceAsStream()</code> in contexts in which classpaths can be difficult to resolve
- * or are unknown.
- *
- * @author Barry Feigenbaum
- */
-public interface IResourceLocator
-{
-
-
-
- public static final String DEFAULT_ACTF_RESOURCES_DIR = "resources";
- public static final String ACTF_RESOURCES_PATHS_KEY = "org.eclipse.actf.core.resourcesPaths";
-
- /**
- * get the resource with the given id as a stream and using the
- * class loader that loaded this IResourceLocator instance.
- *
- * @param id - id of resource
- * @return input stream
- */
- public InputStream getResourceAsStream (String id);
-
- /**
- * get the resource corresponding to the given id as a stream using the specified class loader.
- *
- * @param id - id of resource
- * @param loader -- class loader to use
- * @return input stream
- */
- public InputStream getResourceAsStream (String id, ClassLoader loader);
-
- /**
- * get the resource corresponding to the given id as a stream using the specified class loader. The base path
- * and extention of the file resource are also specified.
- *
- * @param id - id of resource
- * @param loader -- class loader to use
- * @param base - base path
- * @param ext -extentio
- * @return input streamn
- */
- public InputStream getResourceAsStream (String id, String base,
- String ext, ClassLoader loader);
-
- /**
- * find the resource with the given name. The name is a /-separated path
- * describing the relative path to the resource.
- *
- * @param name - name of resource
- * @return URL of a resource with the given name or <code>null</code> if
- * no resources with the given name could be found
- * @see java.lang.ClassLoader#getResource(String)
- */
- public URL getResource (String name);
-
-
- /**
- * find the resources with the given name. The name is a /-separated path
- * describing the relative path to the resource.
- *
- * @param name - name of resource
- * @return URL of all resources with the given name or <code>null</code> if
- * no resources with the given name could be found
- * @see java.lang.ClassLoader#getResources(String)
- */
-public URL[] getResources (String name);
-
-/**
- * find the Path with the given name. The name is a /-separated path
- * describing the relative path to the resource.
- *
- * @param name - name of resource
- * @return String file representation of the URL returned from getResources or <code>null</code> if
- * no resources with the given name could be found
- * @see java.lang.ClassLoader#getResource(String)
- */
-public String getPath (String name);
-
-
-/**
- * find the paths with the given name. The name is a /-separated path
- * describing the relative path to the resource.
- *
- * @param name - name of resource
- * @return String[] file representation of the URL[] returned from getResources or <code>null</code> if
- * no resources with the given name could be found
- * @see java.lang.ClassLoader#getResources(String)
- */
-public String[] getPaths (String name);
-}
diff --git a/plugins/org.eclipse.actf.core/src/org/eclipse/actf/util/thread/ThreadUtils.java b/plugins/org.eclipse.actf.core/src/org/eclipse/actf/util/thread/ThreadUtils.java
deleted file mode 100644
index 0151f0b..0000000
--- a/plugins/org.eclipse.actf.core/src/org/eclipse/actf/util/thread/ThreadUtils.java
+++ /dev/null
@@ -1,134 +0,0 @@
-/*******************************************************************************
-* Copyright (c) 2004, 2007 IBM Corporation.
-* All rights reserved. This program and the accompanying materials
-* are made available under the terms of the Eclipse Public License v1.0
-* which accompanies this distribution, and is available at
-* http://www.eclipse.org/legal/epl-v10.html
-*
-* Contributors:
-* Mike Squillace - initial API and implementation
-*******************************************************************************/
-
-package org.eclipse.actf.util.thread;
-
-/*
- * The following imports are specific to JDK 5.0 and need to be commented
- * out for JDK 1.4 compatibility.
- */
-//import java.lang.management.ManagementFactory;
-//import java.lang.management.ThreadInfo;
-//import java.lang.management.ThreadMXBean;
-public class ThreadUtils
-{
-
- // TODO
- // The THREAD_DEBUG constant should be used to conditionally compile code
- // that enables thread debugging. The implementation here is also using
- // the thread management beans from jdk 1.5 and this class will ncompile
- // compile nor run under jdk 1.4 or lower. The imports are particularly hard
- // to conditionally compile. In this case the real solution is to create a
- // wrapper class that can instantiate either version of the thread code and
- // conditionally compile it.
- //
- public static final boolean THREAD_DEBUG = false;
-
- private static Object _synchLock = new Object();
-
- /**
- * @param args
- */
- public static void main (String[] args) {
- // TODO Auto-generated method stub
- }
-
- public static void dumpThreadState () {
- dumpThreadState("");
- }
-
- public static void dumpThreadState (String msg) {
- /*
- * The following code is commented out because the dependent the mbean
- * Thread classes are unique to JDK 5.0.
- */
- /*****
- synchronized(_synchLock) {
- System.out.println("\n\n");
- if (msg.length() > 0 )
- System.out.println(msg);
- System.out.println("\n\nDumping Thread state at [" + new Date(System.currentTimeMillis()) + "]");
-
- System.out.println("Current Thread - " + Thread.currentThread().getId() + ", " + Thread.currentThread().getName());
- ThreadMXBean mbean = ManagementFactory.getThreadMXBean();
- long[] ids = mbean.getAllThreadIds();
- for( int i=0; i<ids.length; i++) {
- ThreadInfo ti = mbean.getThreadInfo(ids[i],Integer.MAX_VALUE);
- if (ti != null) {
- System.out.println("\n\tThreadInfo for thread id - [" + ti.getThreadId() + "], name - [" + ti.getThreadName() + "]");
- System.out.println("\t\tLock name - " + ti.getLockName());
- System.out.println("\t\tLock owner id - " + ti.getLockOwnerId());
- System.out.println("\t\tLock owner name - " + ti.getLockOwnerName());
- System.out.println("\t\tisSuspended() - " + ti.isSuspended());
- System.out.println("\t\tisInNative() - " + ti.isInNative());
- System.out.println("\t\tThread.State - " + ti.getThreadState());
- if(ti.getThreadState() == Thread.State.BLOCKED) {
- System.out.println("\t\t\tStackTrace for this thread:");
- StackTraceElement[] ste = ti.getStackTrace();
- for (int j=0; j < ste.length; j++){
- System.out.println("\t\t\t" + ste[j]);
- }
- }
- }
- else {
- System.out.println("\n\tNull thread returned from ThreadMXBean.getThreadInfo(), continuing.");
- }
- }
- System.out.flush();
- }
- *****/
- }
-
- public static StringBuffer getThreadState () {
- return getThreadState("");
- }
-
- public static StringBuffer getThreadState (String msg) {
- StringBuffer sb = new StringBuffer();
- /*
- * The following code is commented out because the dependent Thread classes
- * are unique to JDK 5.0.
- */
- /*****
- synchronized(_synchLock){
- sb.append("\n\n)");
- sb.append(msg);
- sb.append("Dumping Thread state at [" + new Date(System.currentTimeMillis()) + "]");
- sb.append("Current Thread - " + Thread.currentThread().getId() + ", " + Thread.currentThread().getName());
- ThreadMXBean mbean = ManagementFactory.getThreadMXBean();
- long[] ids = mbean.getAllThreadIds();
- for( int i=0; i<ids.length; i++) {
- ThreadInfo ti = mbean.getThreadInfo(ids[i],Integer.MAX_VALUE);
- if (ti != null) {
- sb.append("\n\tThreadInfo for thread id - [" + ti.getThreadId() + "], name - [" + ti.getThreadName() + "]");
- sb.append("\t\tLock name - " + ti.getLockName());
- sb.append("\t\tLock owner id - " + ti.getLockOwnerId());
- sb.append("\t\tLock owner name - " + ti.getLockOwnerName());
- sb.append("\t\tisSuspended() - " + ti.isSuspended());
- sb.append("\t\tisInNative() - " + ti.isInNative());
- sb.append("\t\tThread.State - " + ti.getThreadState());
- if(ti.getThreadState() == Thread.State.BLOCKED) {
- sb.append("\t\t\tStackTrace for this thread:");
- StackTraceElement[] ste = ti.getStackTrace();
- for (int j=0; j < ste.length; j++){
- sb.append("\t\t\t" + ste[j]);
- }
- }
- }
- else {
- System.out.println("\n\tNull thread returned from ThreadMXBean.getThreadInfo(), continuing.");
- }
- }
- }
- *****/
- return sb;
- }
-}
\ No newline at end of file
diff --git a/plugins/org.eclipse.actf.ui/.classpath b/plugins/org.eclipse.actf.ui/.classpath
deleted file mode 100644
index 751c8f2..0000000
--- a/plugins/org.eclipse.actf.ui/.classpath
+++ /dev/null
@@ -1,7 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<classpath>
- <classpathentry kind="src" path="src"/>
- <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
- <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
- <classpathentry kind="output" path="bin"/>
-</classpath>
diff --git a/plugins/org.eclipse.actf.ui/.cvsignore b/plugins/org.eclipse.actf.ui/.cvsignore
deleted file mode 100644
index cb00e1f..0000000
--- a/plugins/org.eclipse.actf.ui/.cvsignore
+++ /dev/null
@@ -1,7 +0,0 @@
-*.jar
-*.args
-build.xml
-bin
-log.folder
-temp.folder
-@dot
diff --git a/plugins/org.eclipse.actf.ui/.project b/plugins/org.eclipse.actf.ui/.project
deleted file mode 100644
index abc7b20..0000000
--- a/plugins/org.eclipse.actf.ui/.project
+++ /dev/null
@@ -1,28 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<projectDescription>
- <name>org.eclipse.actf.ui</name>
- <comment></comment>
- <projects>
- </projects>
- <buildSpec>
- <buildCommand>
- <name>org.eclipse.jdt.core.javabuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- <buildCommand>
- <name>org.eclipse.pde.ManifestBuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- <buildCommand>
- <name>org.eclipse.pde.SchemaBuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- </buildSpec>
- <natures>
- <nature>org.eclipse.pde.PluginNature</nature>
- <nature>org.eclipse.jdt.core.javanature</nature>
- </natures>
-</projectDescription>
diff --git a/plugins/org.eclipse.actf.ui/META-INF/MANIFEST.MF b/plugins/org.eclipse.actf.ui/META-INF/MANIFEST.MF
deleted file mode 100644
index c4d82f6..0000000
--- a/plugins/org.eclipse.actf.ui/META-INF/MANIFEST.MF
+++ /dev/null
@@ -1,17 +0,0 @@
-Manifest-Version: 1.0
-Bundle-ManifestVersion: 2
-Bundle-Name: %pluginName
-Bundle-SymbolicName: org.eclipse.actf.ui; singleton:=true
-Bundle-Version: 0.3.0.qualifier
-Bundle-Activator: org.eclipse.actf.ui.ActfUIPlugin
-Bundle-Vendor: %providerName
-Bundle-Localization: plugin
-Require-Bundle: org.eclipse.actf.model,
- org.eclipse.actf.core,
- org.eclipse.jdt.core,
- org.eclipse.ui,
- org.eclipse.core.runtime
-Eclipse-LazyStart: true
-Export-Package: org.eclipse.actf.ui,
- org.eclipse.actf.ui.preferences
-Bundle-ClassPath: .
diff --git a/plugins/org.eclipse.actf.ui/build.properties b/plugins/org.eclipse.actf.ui/build.properties
deleted file mode 100644
index e9863e2..0000000
--- a/plugins/org.eclipse.actf.ui/build.properties
+++ /dev/null
@@ -1,5 +0,0 @@
-source.. = src/
-output.. = bin/
-bin.includes = META-INF/,\
- .,\
- plugin.xml
diff --git a/plugins/org.eclipse.actf.ui/plugin.properties b/plugins/org.eclipse.actf.ui/plugin.properties
deleted file mode 100644
index 5bf880b..0000000
--- a/plugins/org.eclipse.actf.ui/plugin.properties
+++ /dev/null
@@ -1,7 +0,0 @@
-pluginName=ACTF UI Plug-in (Incubation)
-providerName=Eclipse.org
-aboutText=\n\nACTF UI Plug-in (Incubation)\n\
-Version: 0.3.0\n\
-Build: {0}\n\
-\n\
-(c) Copyright IBM 2007. All rights reserved.\n\
diff --git a/plugins/org.eclipse.actf.ui/plugin.xml b/plugins/org.eclipse.actf.ui/plugin.xml
deleted file mode 100644
index b71ac5b..0000000
--- a/plugins/org.eclipse.actf.ui/plugin.xml
+++ /dev/null
@@ -1,26 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<?eclipse version="3.2"?>
-<plugin>
-
- <extension point="org.eclipse.ui.popupMenus">
- <objectContribution
- objectClass="org.eclipse.jdt.core.IJavaElement"
- id="org.eclipse.actf.validation.javapp.ui.JavaPopupContribution">
- <menu
- label="Accessibility Tools"
- path="additions"
- id="org.eclipse.actf.ui.actfContextMenu">
- <groupMarker name="actf"/>
- </menu>
- </objectContribution>
- </extension>
- <extension point="org.eclipse.ui.preferencePages">
- <page
- name="ACTF"
- class="org.eclipse.actf.ui.preferences.RootPreferencePage"
- id="org.eclipse.actf.ui.preferences.RootPreferencePage">
- </page>
-
- </extension>
-</plugin>
diff --git a/plugins/org.eclipse.actf.ui/src/org/eclipse/actf/ui/ActfUIPlugin.java b/plugins/org.eclipse.actf.ui/src/org/eclipse/actf/ui/ActfUIPlugin.java
deleted file mode 100644
index 5a522fb..0000000
--- a/plugins/org.eclipse.actf.ui/src/org/eclipse/actf/ui/ActfUIPlugin.java
+++ /dev/null
@@ -1,54 +0,0 @@
-package org.eclipse.actf.ui;
-
-import org.eclipse.ui.plugin.AbstractUIPlugin;
-import org.osgi.framework.BundleContext;
-
-/**
- * The activator class controls the plug-in life cycle
- */
-public class ActfUIPlugin extends AbstractUIPlugin {
-
- // The plug-in ID
- public static final String ACTF_PLUGIN_ID = "org.eclipse.actf.ui";
-
- public static final String ACCESSIBILITY_TOOLS_MENU = "org.eclipse.actf.ui.actfContextMenu";
-
- public static final String ROOT_PREFRENCE_PAGE_ID = "org.eclipse.actf.ui.preferences.RootPreferencePage";
-
- // The shared instance
- private static ActfUIPlugin plugin;
-
- /**
- * The constructor
- */
- public ActfUIPlugin() {
- }
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.core.runtime.Plugins#start(org.osgi.framework.BundleContext)
- */
- public void start(BundleContext context) throws Exception {
- super.start(context);
- plugin = this;
- }
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.core.runtime.Plugin#stop(org.osgi.framework.BundleContext)
- */
- public void stop(BundleContext context) throws Exception {
- plugin = null;
- super.stop(context);
- }
-
- /**
- * Returns the shared instance
- *
- * @return the shared instance
- */
- public static ActfUIPlugin getDefault() {
- return plugin;
- }
-
-}
diff --git a/plugins/org.eclipse.actf.ui/src/org/eclipse/actf/ui/preferences/AbstractBasePreferencePage.java b/plugins/org.eclipse.actf.ui/src/org/eclipse/actf/ui/preferences/AbstractBasePreferencePage.java
deleted file mode 100644
index 9d1cee4..0000000
--- a/plugins/org.eclipse.actf.ui/src/org/eclipse/actf/ui/preferences/AbstractBasePreferencePage.java
+++ /dev/null
@@ -1,81 +0,0 @@
-/*******************************************************************************
-* Copyright (c) 2004, 2007 IBM Corporation.
-* All rights reserved. This program and the accompanying materials
-* are made available under the terms of the Eclipse Public License v1.0
-* which accompanies this distribution, and is available at
-* http://www.eclipse.org/legal/epl-v10.html
-*
-* Contributors:
-* Mike Squillace - initial API and implementation
-*******************************************************************************/
-
-package org.eclipse.actf.ui.preferences;
-
-import org.eclipse.jface.preference.FieldEditor;
-import org.eclipse.jface.preference.IPreferenceStore;
-import org.eclipse.jface.preference.PreferencePage;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Label;
-
-public abstract class AbstractBasePreferencePage extends PreferencePage
-{
-
- /**
- * The field editors, or <code>null</code> if not created yet.
- */
- // uses child's createContents implemented method
- protected abstract Control createContents (Composite parent);
-
- public Composite createStandardLayout (Composite parent, int numCols) {
- Composite stdComposite = new Composite(parent, SWT.NONE);
- GridLayout layout = new GridLayout();
- // if numCols == 0 this just skip this step altogether
- if (numCols != 0) {
- layout.numColumns = numCols;
- }
- layout.marginHeight = 0;
- layout.marginWidth = 0;
- stdComposite.setLayout(layout);
- GridData gd = null;
- gd = new GridData();
- gd.grabExcessHorizontalSpace = true;
- gd.grabExcessVerticalSpace = true;
- gd.horizontalAlignment = SWT.BEGINNING;
- gd.verticalAlignment = SWT.BEGINNING;
- stdComposite.setLayoutData(gd);
- return stdComposite;
- } // end--createStandardLayout
-
- public Composite createExceptionLayout (Composite parent) {
- Composite exComposite = new Composite(parent, SWT.NONE);
- GridLayout exLayout = new GridLayout(2, false);
- exComposite.setLayout(exLayout);
- GridData gd = new GridData(GridData.HORIZONTAL_ALIGN_FILL
- | GridData.GRAB_HORIZONTAL);
- gd.horizontalSpan = 3;
- exComposite.setLayoutData(gd);
- return exComposite;
- } // end--createExceptionLayout
-
- public void initializeEditor (PreferencePage prefPage, FieldEditor editor,
- IPreferenceStore preferenceStore) {
- // TODO
- // The following line is a Eclipse 3.1 API only. It is commented out because it breaks Eclipse 3.0.
- // When we no longer support Eclipse 3.0 we should uncomment this line.
- //editor.setPage(prefPage);
- editor.setPreferenceStore(preferenceStore);
- editor.load();
- } // end--initializeEditor
-
- public void createLineSeparator (Composite parent) {
- // create a line
- Label s0 = new Label(parent, SWT.SEPARATOR | SWT.HORIZONTAL);
- GridData gd0 = new GridData(GridData.FILL_HORIZONTAL);
- gd0.horizontalSpan = 2;
- s0.setLayoutData(gd0);
- } // end--createLineSeparator
-} // end--AbstractBasePreferencePage
diff --git a/plugins/org.eclipse.actf.ui/src/org/eclipse/actf/ui/preferences/AbstractUIPreferenceInitializer.java b/plugins/org.eclipse.actf.ui/src/org/eclipse/actf/ui/preferences/AbstractUIPreferenceInitializer.java
deleted file mode 100644
index a049da4..0000000
--- a/plugins/org.eclipse.actf.ui/src/org/eclipse/actf/ui/preferences/AbstractUIPreferenceInitializer.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/*******************************************************************************
-* Copyright (c) 2004, 2007 IBM Corporation.
-* All rights reserved. This program and the accompanying materials
-* are made available under the terms of the Eclipse Public License v1.0
-* which accompanies this distribution, and is available at
-* http://www.eclipse.org/legal/epl-v10.html
-*
-* Contributors:
-* Mike Squillace - initial API and implementation
-*******************************************************************************/
-
-package org.eclipse.actf.ui.preferences;
-
-import org.eclipse.actf.core.config.IConfiguration;
-import org.eclipse.actf.util.logging.IReporter;
-import org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer;
-
-
-public abstract class AbstractUIPreferenceInitializer extends AbstractPreferenceInitializer
-{
-
- public static final String V_NONE = "SEVERE";
- public static final String V_ERROR = "ERROR";
- public static final String V_WARNING = "WARNING";
- public static final String V_INFO = "INFO";
- public static final String V_ALL = "DETAIL";
-
- public static final String P_MODELS = IConfiguration.MODEL_ID;
- public static final String P_ALIASES = "aliases";
-
- public static final int NONE = IReporter.SEVERE;
- public static final int ERRORS = IReporter.ERROR;
- public static final int WARNINGS = IReporter.WARNING;
- public static final int PROCESS_INFO = IReporter.INFO;
- public static final int PROCESS_ALL = IReporter.CONFIG;
-
- @Override
- public void initializeDefaultPreferences() {
- // TODO Auto-generated method stub
-
- }
-}
\ No newline at end of file
diff --git a/plugins/org.eclipse.actf.ui/src/org/eclipse/actf/ui/preferences/RootPreferencePage.java b/plugins/org.eclipse.actf.ui/src/org/eclipse/actf/ui/preferences/RootPreferencePage.java
deleted file mode 100644
index 14d199e..0000000
--- a/plugins/org.eclipse.actf.ui/src/org/eclipse/actf/ui/preferences/RootPreferencePage.java
+++ /dev/null
@@ -1,110 +0,0 @@
-/*******************************************************************************
-* Copyright (c) 2004, 2007 IBM Corporation.
-* All rights reserved. This program and the accompanying materials
-* are made available under the terms of the Eclipse Public License v1.0
-* which accompanies this distribution, and is available at
-* http://www.eclipse.org/legal/epl-v10.html
-*
-* Contributors:
-* Mike Squillace - initial API and implementation
-*******************************************************************************/
-
-package org.eclipse.actf.ui.preferences;
-
-import java.util.Map;
-
-import org.eclipse.actf.ui.ActfUIPlugin;
-//import org.eclipse.actf.validation.ui.preferences.ValidationPreferenceInitializer;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Text;
-import org.eclipse.ui.IWorkbench;
-import org.eclipse.ui.IWorkbenchPreferencePage;
-
-
-/**
- * This class represents a preference page that
- * is contravenuted to the Preferences dialog. By
- * subclassing <samp>FieldEditorPreferencePage</samp>, we
- * can use the field support built into JFace that allows
- * us to create a page that is small and knows how to
- * save, restore and apply itself.
- * <p>
- * This page is used to modify preferences only. They
- * are stored in the preference store that belongs to
- * the main plug-in class. That way, preferences can
- * be accessed directly via the preference store.
- */
-public class RootPreferencePage extends AbstractBasePreferencePage
- implements IWorkbenchPreferencePage
-{
-
- //This string contains the ACTF title
- private static final String ACTF_TITLE_STRING = "IBM Accessibility Tools Framework (ACTF).\r\n\r\n";
-
- // Text Control to hold ACTF information.
- private static Text actfDescription;
-
- public static int mapToLevel (String levelKey) {
- int level = AbstractUIPreferenceInitializer.WARNINGS;
- if (levelKey.equals(AbstractUIPreferenceInitializer.V_ALL)) {
- level = AbstractUIPreferenceInitializer.PROCESS_ALL;
- }else if (levelKey.equals(AbstractUIPreferenceInitializer.V_INFO)) {
- level = AbstractUIPreferenceInitializer.PROCESS_INFO;
- }else if (levelKey.equals(AbstractUIPreferenceInitializer.V_WARNING)) {
- level = AbstractUIPreferenceInitializer.WARNINGS;
- }else if (levelKey.equals(AbstractUIPreferenceInitializer.V_ERROR)) {
- level = AbstractUIPreferenceInitializer.ERRORS;
- }else if (levelKey.equals(AbstractUIPreferenceInitializer.V_NONE)) {
- level = AbstractUIPreferenceInitializer.NONE;
- }
- return level;
- }
-
- public static boolean isListProperty (String p) {
- return p.equals(AbstractUIPreferenceInitializer.P_MODELS)
- || p.endsWith(AbstractUIPreferenceInitializer.P_ALIASES);
- }
-
- public RootPreferencePage () {
- super();
- noDefaultAndApplyButton();
- setPreferenceStore(ActfUIPlugin.getDefault().getPreferenceStore());
- }
-
- protected Control createContents (Composite parent) {
- Composite descComposite = new Composite(parent, SWT.NONE);
- GridLayout descLayout = new GridLayout(2, false);
- descComposite.setLayout(descLayout);
- GridData labelGd = new GridData(SWT.BEGINNING, SWT.BEGINNING, false, false);
- Label descriptionLabel = new Label(descComposite, SWT.LEFT);
- descriptionLabel.setText("ACTF Information");
- descriptionLabel.setLayoutData(labelGd);
- actfDescription = new Text(descComposite, (SWT.READ_ONLY | SWT.WRAP | SWT.MULTI));
- String actfDescriptionString = ACTF_TITLE_STRING;
- actfDescription.setText(actfDescriptionString);
- GridData descriptionGd = new GridData();
- actfDescription.setLayoutData(descriptionGd);
- return (parent);
- }
-
- public static Map getPreferences () {
- return null;
- }
-
- /**
- * Creates the field editors. Field editors are abstractions of
- * the common GUI blocks needed to manipulate various types
- * of preferences. Each field editor knows how to save and
- * restore itself.
- */
- public void createFieldEditors () {
- }
-
- public void init (IWorkbench workbench) {
- }
-}