You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cactus-dev@jakarta.apache.org by jr...@apache.org on 2003/03/21 17:38:11 UTC
cvs commit: jakarta-cactus/integration/eclipse/org.apache.cactus.eclipse.runner/src/java/org/apache/cactus/eclipse/runner/containers IContainerManager.java
jruaux 2003/03/21 08:38:11
Modified: integration/eclipse/org.apache.cactus.eclipse.runner/src/java/org/apache/cactus/eclipse/runner/containers/ant
EclipseRunTests.java
integration/eclipse/org.apache.cactus.eclipse.runner/src/java/org/apache/cactus/eclipse/runner/launcher
CactusLaunchShortcut.java
integration/eclipse/org.apache.cactus.eclipse.runner/src/java/org/apache/cactus/eclipse/runner/ui
CactusPlugin.java ContainersPreferencePage.java
CactusPreferences.java
Added: integration/eclipse/org.apache.cactus.eclipse.runner/src/java/org/apache/cactus/eclipse/runner/containers/ant
AntContainerManager.java AntContainerProvider.java
integration/eclipse/org.apache.cactus.eclipse.runner/src/java/org/apache/cactus/eclipse/runner/containers
IContainerManager.java
Removed: integration/eclipse/org.apache.cactus.eclipse.runner/src/java/org/apache/cactus/eclipse/runner/containers/ant
ContainerHome.java GenericAntProvider.java
Log:
Refactored provider mechanism
Revision Changes Path
1.2 +3 -3 jakarta-cactus/integration/eclipse/org.apache.cactus.eclipse.runner/src/java/org/apache/cactus/eclipse/runner/containers/ant/EclipseRunTests.java
Index: EclipseRunTests.java
===================================================================
RCS file: /home/cvs/jakarta-cactus/integration/eclipse/org.apache.cactus.eclipse.runner/src/java/org/apache/cactus/eclipse/runner/containers/ant/EclipseRunTests.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- EclipseRunTests.java 12 Mar 2003 18:04:26 -0000 1.1
+++ EclipseRunTests.java 21 Mar 2003 16:38:11 -0000 1.2
@@ -111,8 +111,8 @@
{
CactusLaunchShortcut launchShortcut =
CactusPlugin.getDefault().getCactusLaunchShortcut();
- GenericAntProvider antProvider =
- (GenericAntProvider) launchShortcut.getContainerProvider();
+ AntContainerProvider antProvider =
+ (AntContainerProvider) launchShortcut.getContainerProvider();
antProvider.setEclipseRunner(this);
launchShortcut.launchJunitTests();
}
1.1 jakarta-cactus/integration/eclipse/org.apache.cactus.eclipse.runner/src/java/org/apache/cactus/eclipse/runner/containers/ant/AntContainerManager.java
Index: AntContainerManager.java
===================================================================
/*
* ====================================================================
*
* The Apache Software License, Version 1.1
*
* Copyright (c) 2001-2003 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution, if
* any, must include the following acknowlegement:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowlegement may appear in the software itself,
* if and wherever such third-party acknowlegements normally appear.
*
* 4. The names "The Jakarta Project", "Cactus" and "Apache Software
* Foundation" must not be used to endorse or promote products
* derived from this software without prior written permission. For
* written permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache"
* nor may "Apache" appear in their names without prior written
* permission of the Apache Group.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*
*/
package org.apache.cactus.eclipse.runner.containers.ant;
import java.io.File;
import java.net.URL;
import java.util.Hashtable;
import java.util.Vector;
import org.apache.cactus.eclipse.runner.containers.IContainerManager;
import org.apache.cactus.eclipse.runner.containers.IContainerProvider;
import org.apache.cactus.eclipse.runner.ui.CactusPlugin;
import org.eclipse.ant.core.AntRunner;
import org.eclipse.core.boot.BootLoader;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.Path;
/**
* Implementation of IContainerManager based on Ant.
*
* @author <a href="mailto:jruaux@octo.com">Julien Ruaux</a>
*
* @version $Id: AntContainerManager.java,v 1.1 2003/03/21 16:38:11 jruaux Exp $
*/
public class AntContainerManager implements IContainerManager
{
/**
* Table containing all the information needed
* (key = target mask & value = container home directory)
* to call the scripts
*/
private Hashtable containerHomes;
/**
* Ant arguments common to all container providers
*/
private Vector antArguments = new Vector();
/**
* Path to the Ant build file for the manager
*/
private String buildFilePath;
/**
* Constructor.
* @param theBuildFilePath path to the Ant build file for this manager
* @param thePort the port that will be used when setting up the containers
* @param theTargetDir temporary directory to use for
* containers configuration
* @param theHomes ContainerHome array for container config
* @throws CoreException if an argument is invalid
*/
public AntContainerManager(
String theBuildFilePath,
int thePort,
String theTargetDir,
Hashtable theHomes)
throws CoreException
{
this.buildFilePath = theBuildFilePath;
if (thePort <= 0)
{
throw CactusPlugin.createCoreException(
"CactusLaunch.message.invalidproperty.port",
null);
}
if (theTargetDir.equalsIgnoreCase(""))
{
throw CactusPlugin.createCoreException(
"CactusLaunch.message.invalidproperty.tempdir",
null);
}
if (theHomes.size() == 0)
{
throw CactusPlugin.createCoreException(
"CactusLaunch.message.invalidproperty.containers",
null);
}
this.containerHomes = theHomes;
antArguments.add("-Dcactus.port=" + thePort);
antArguments.add("-Dcactus.target.dir=" + theTargetDir);
// Avoid Ant console popups on win32 platforms
if (BootLoader.getOS().equals(BootLoader.OS_WIN32))
{
antArguments.add("-Dcactus.jvm=javaw");
}
}
/**
* @see org.apache.cactus.eclipse.runner.containers.IContainerManager#getContainerProvider()
*/
public IContainerProvider[] getContainerProviders()
{
String[] ids =
(String[]) containerHomes.keySet().toArray(
new String[containerHomes.size()]);
IContainerProvider[] providers = new IContainerProvider[ids.length];
for (int i = 0; i < providers.length; i++)
{
providers[i] =
new AntContainerProvider(
this,
ids[i],
(String) containerHomes.get(ids[i]));
}
return providers;
}
/**
* returns an AntRunner for a container provider.
* @param theTarget the ant target to be called (in that order)
* @param theProviderArguments the Ant arguments specific for
* the container provider
* @return the AntRunner for the script
* @throws CoreException if an AntRunner cannot be created
*/
public AntRunner createAntRunner(
String[] theProviderArguments,
String theTarget)
throws CoreException
{
AntRunner runner = new AntRunner();
CactusPlugin thePlugin = CactusPlugin.getDefault();
URL buildFileURL = thePlugin.find(new Path(buildFilePath));
if (buildFileURL == null)
{
throw CactusPlugin.createCoreException(
"CactusLaunch.message.prepare.error.plugin.file",
" : " + buildFilePath,
null);
}
File buildFileLocation = new File(buildFileURL.getPath());
runner.setBuildFileLocation(buildFileLocation.getAbsolutePath());
runner.setArguments(getAllAntArguments(theProviderArguments));
runner.setExecutionTargets(new String[] {theTarget});
return runner;
}
/**
* @param theProviderArguments the container provider specific arguments
* @return an array of arguments for the container build
*/
private String[] getAllAntArguments(String[] theProviderArguments)
{
String[] managerArguments =
(String[]) antArguments.toArray(new String[antArguments.size()]);
String[] allArguments =
new String[theProviderArguments.length + managerArguments.length];
System.arraycopy(
theProviderArguments,
0,
allArguments,
0,
theProviderArguments.length);
System.arraycopy(
managerArguments,
0,
allArguments,
theProviderArguments.length,
managerArguments.length);
return allArguments;
}
}
1.1 jakarta-cactus/integration/eclipse/org.apache.cactus.eclipse.runner/src/java/org/apache/cactus/eclipse/runner/containers/ant/AntContainerProvider.java
Index: AntContainerProvider.java
===================================================================
/*
* ====================================================================
*
* The Apache Software License, Version 1.1
*
* Copyright (c) 2001-2003 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution, if
* any, must include the following acknowlegement:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowlegement may appear in the software itself,
* if and wherever such third-party acknowlegements normally appear.
*
* 4. The names "The Jakarta Project", "Cactus" and "Apache Software
* Foundation" must not be used to endorse or promote products
* derived from this software without prior written permission. For
* written permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache"
* nor may "Apache" appear in their names without prior written
* permission of the Apache Group.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*
*/
package org.apache.cactus.eclipse.runner.containers.ant;
import java.net.URL;
import java.util.Vector;
import org.apache.cactus.eclipse.runner.containers.ContainerInfo;
import org.apache.cactus.eclipse.runner.containers.Credential;
import org.apache.cactus.eclipse.runner.containers.IContainerProvider;
import org.apache.cactus.eclipse.runner.ui.CactusMessages;
import org.eclipse.ant.core.AntRunner;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.SubProgressMonitor;
/**
* Implementation of IContainerProvider that uses ant scripts to set up
* and launch containers.
*
* @author <a href="mailto:jruaux@octo.com">Julien Ruaux</a>
*
* @version $Id: AntContainerProvider.java,v 1.1 2003/03/21 16:38:11 jruaux Exp $
*/
public class AntContainerProvider implements IContainerProvider
{
/**
* the manager of this provider
*/
private AntContainerManager manager;
/**
* the Ant arguments specific to this provider
*/
private Vector antArguments = new Vector();
/**
* A boolean indicating if the container is running.
*/
private boolean serverStopped;
/**
* The Eclipse runner associated to the Ant container provider.
*/
private EclipseRunTests eclipseRunner;
/**
* The home directory of this provider.
*/
private String home;
/**
* The Ant target mask for this provider, for example "tomcat4x".
*/
private String targetMask;
/**
* @param theManager the manager of this provider
* @param theTargetMask target mask for this provider
* @param theHome home directory for this provider's container
*/
public AntContainerProvider(
AntContainerManager theManager,
String theTargetMask,
String theHome)
{
this.targetMask = theTargetMask;
this.home = theHome;
this.manager = theManager;
}
/**
* @see IContainerProvider#deploy(String, URL, Credential)
*/
public void deploy(
String theContextPath,
URL theDeployableObject,
Credential theCredentials,
IProgressMonitor thePM)
throws CoreException
{
thePM.subTask(CactusMessages.getString("CactusLaunch.message.deploy"));
String warPath = theDeployableObject.getPath();
antArguments.add("-Dcactus.war=" + warPath);
antArguments.add("-Dcactus.context=" + theContextPath);
}
/**
* @see IContainerProvider#start(ContainerInfo)
*/
public void start(ContainerInfo theContainerInfo, IProgressMonitor thePM)
throws CoreException
{
thePM.subTask(CactusMessages.getString("CactusLaunch.message.start"));
String target = getTarget("cactus.run.");
antArguments.add("-Dcactus.home." + this.targetMask + "=" + home);
String[] arguments =
(String[]) antArguments.toArray(new String[antArguments.size()]);
AntRunner runner = this.manager.createAntRunner(arguments, target);
serverStopped = false;
runner.run(new SubProgressMonitor(thePM, 8));
serverStopped = true;
}
/**
* @see IContainerProvider#stop(ContainerInfo)
*/
public void stop(ContainerInfo theContainerInfo, IProgressMonitor thePM)
throws CoreException
{
thePM.subTask(CactusMessages.getString("CactusLaunch.message.stop"));
if (eclipseRunner != null)
{
eclipseRunner.finish();
thePM.worked(30);
while (!serverStopped)
{
try
{
Thread.sleep(300);
thePM.worked(7);
}
catch (InterruptedException e)
{
// Do nothing
}
}
}
}
/**
* @see IContainerProvider#undeploy (String, Credential)
*/
public void undeploy(
String theContextPath,
Credential theCredentials,
IProgressMonitor thePM)
throws CoreException
{
thePM.subTask(
CactusMessages.getString("CactusLaunch.message.undeploy"));
String antTarget = getTarget("cactus.clean.");
String[] arguments =
(String[]) antArguments.toArray(new String[antArguments.size()]);
AntRunner runner = this.manager.createAntRunner(arguments, antTarget);
runner.run(
new SubProgressMonitor(thePM, 50));
}
/**
* @param theEclipseRunner the EclipseRunTests instance to associate with
* this container provider, which will be notified of test run end.
*/
public void setEclipseRunner(EclipseRunTests theEclipseRunner)
{
this.eclipseRunner = theEclipseRunner;
}
/**
* Returns the concatenated String of the prefix and the provider target.
* @param thePrefix prefix to append to the provider target
* @return String the concatenated string
*/
private String getTarget(String thePrefix)
{
return thePrefix + this.targetMask;
}
}
1.7 +5 -3 jakarta-cactus/integration/eclipse/org.apache.cactus.eclipse.runner/src/java/org/apache/cactus/eclipse/runner/launcher/CactusLaunchShortcut.java
Index: CactusLaunchShortcut.java
===================================================================
RCS file: /home/cvs/jakarta-cactus/integration/eclipse/org.apache.cactus.eclipse.runner/src/java/org/apache/cactus/eclipse/runner/launcher/CactusLaunchShortcut.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- CactusLaunchShortcut.java 18 Mar 2003 17:23:17 -0000 1.6
+++ CactusLaunchShortcut.java 21 Mar 2003 16:38:11 -0000 1.7
@@ -61,6 +61,7 @@
import java.net.MalformedURLException;
import java.net.URL;
+import org.apache.cactus.eclipse.runner.containers.IContainerManager;
import org.apache.cactus.eclipse.runner.containers.IContainerProvider;
import org.apache.cactus.eclipse.runner.ui.CactusMessages;
import org.apache.cactus.eclipse.runner.ui.CactusPlugin;
@@ -104,7 +105,7 @@
private File war;
/**
- * The provider to use for container setup.
+ * The container provider that is used in this launch.
*/
private IContainerProvider provider;
@@ -317,7 +318,8 @@
thePM.beginTask(
CactusMessages.getString("CactusLaunch.message.prepare"),
10);
- this.provider = CactusPlugin.getContainerProvider();
+ IContainerManager manager = CactusPlugin.getContainerManager();
+ this.provider = manager.getContainerProviders()[0];
try
{
WarBuilder newWar = new WarBuilder(theJavaProject);
1.2 +79 -13 jakarta-cactus/integration/eclipse/org.apache.cactus.eclipse.runner/src/java/org/apache/cactus/eclipse/runner/ui/CactusPlugin.java
Index: CactusPlugin.java
===================================================================
RCS file: /home/cvs/jakarta-cactus/integration/eclipse/org.apache.cactus.eclipse.runner/src/java/org/apache/cactus/eclipse/runner/ui/CactusPlugin.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- CactusPlugin.java 12 Mar 2003 18:04:27 -0000 1.1
+++ CactusPlugin.java 21 Mar 2003 16:38:11 -0000 1.2
@@ -56,12 +56,18 @@
*/
package org.apache.cactus.eclipse.runner.ui;
-import org.apache.cactus.eclipse.runner.containers.IContainerProvider;
-import org.apache.cactus.eclipse.runner.containers.ant.GenericAntProvider;
+import java.io.File;
+import java.io.FilenameFilter;
+import java.net.URL;
+import java.util.Vector;
+
+import org.apache.cactus.eclipse.runner.containers.IContainerManager;
+import org.apache.cactus.eclipse.runner.containers.ant.AntContainerManager;
import org.apache.cactus.eclipse.runner.launcher.CactusLaunchShortcut;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IPluginDescriptor;
import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Path;
import org.eclipse.core.runtime.Status;
import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.jface.preference.IPreferenceStore;
@@ -90,6 +96,21 @@
private CactusLaunchShortcut launchShortcut;
/**
+ * Plug-in relative path to the Ant build file.
+ */
+ private static final String BUILD_FILE_PATH = "./ant/eclipse/build.xml";
+
+ /**
+ * Plug-in relative path to the Ant container build files.
+ */
+ private static final String CONTAINER_BUILD_FILES_PATH = "./ant/scripts";
+
+ /**
+ * Prefix of container build files.
+ */
+ private static final String CONTAINER_BUILD_FILES_PREFIX = "build-tests-";
+
+ /**
* @see org.eclipse.core.runtime.Plugin#Plugin(IPluginDescriptor)
*/
public CactusPlugin(IPluginDescriptor theDescription)
@@ -235,24 +256,17 @@
* @return IContainerProvider a container provider to use for Cactus tests.
* @throws CoreException if the container provider can't be contructed
*/
- public static IContainerProvider getContainerProvider()
+ public static IContainerManager getContainerManager()
throws CoreException
{
- return new GenericAntProvider(
+ return new AntContainerManager(
+ BUILD_FILE_PATH,
CactusPreferences.getContextURLPort(),
CactusPreferences.getTempDir(),
CactusPreferences.getContainerHomes());
}
/**
- * @return an array of identifiers of supported containers
- */
- public static String[] getContainers()
- {
- return GenericAntProvider.getContainers();
- }
-
- /**
* Displays an error dialog.
* @param theTitle title of the dialog
* @param theMessage message to display in the dialog
@@ -344,4 +358,56 @@
{
this.launchShortcut = theCactusLaunchShortcut;
}
+
+ /**
+ * Filter for container script files.
+ * i.e. accepts files like 'build-tests-mycontainer3.1.xml'
+ *
+ * @author <a href="mailto:jruaux@octo.com">Julien Ruaux</a>
+ *
+ * @version $Id$
+ */
+ private static class BuildFilenameFilter implements FilenameFilter
+ {
+ /**
+ * @see java.io.FilenameFilter#accept(java.io.File, java.lang.String)
+ */
+ public boolean accept(File theDir, String theFilename)
+ {
+ return (
+ theFilename.substring(
+ 0,
+ CONTAINER_BUILD_FILES_PREFIX.length()).equals(
+ CONTAINER_BUILD_FILES_PREFIX));
+ }
+ }
+ /**
+ * @see org.apache.cactus.eclipse.runner.containers.IContainerManager#getContainerIds()
+ */
+ public static String[] getContainerIds()
+ {
+ Vector containers = new Vector();
+ URL containerDirURL =
+ CactusPlugin.getDefault().find(
+ new Path(CONTAINER_BUILD_FILES_PATH));
+ if (containerDirURL == null)
+ {
+ // No container available
+ return new String[0];
+ }
+ Path containerDir = new Path(containerDirURL.getPath());
+ File dir = containerDir.toFile();
+ String[] containerFiles = dir.list(new BuildFilenameFilter());
+ for (int i = 0; i < containerFiles.length; i++)
+ {
+ String currentFileName = containerFiles[i];
+ String currentId =
+ currentFileName.substring(
+ CONTAINER_BUILD_FILES_PREFIX.length(),
+ currentFileName.lastIndexOf("."));
+ containers.add(currentId);
+ }
+ return (String[]) containers.toArray(new String[containers.size()]);
+ }
+
}
1.2 +2 -2 jakarta-cactus/integration/eclipse/org.apache.cactus.eclipse.runner/src/java/org/apache/cactus/eclipse/runner/ui/ContainersPreferencePage.java
Index: ContainersPreferencePage.java
===================================================================
RCS file: /home/cvs/jakarta-cactus/integration/eclipse/org.apache.cactus.eclipse.runner/src/java/org/apache/cactus/eclipse/runner/ui/ContainersPreferencePage.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- ContainersPreferencePage.java 12 Mar 2003 18:04:27 -0000 1.1
+++ ContainersPreferencePage.java 21 Mar 2003 16:38:11 -0000 1.2
@@ -119,7 +119,7 @@
*/
public void init(IWorkbench theWorkbench)
{
- containerIds = CactusPlugin.getContainers();
+ containerIds = CactusPlugin.getContainerIds();
}
1.2 +8 -14 jakarta-cactus/integration/eclipse/org.apache.cactus.eclipse.runner/src/java/org/apache/cactus/eclipse/runner/ui/CactusPreferences.java
Index: CactusPreferences.java
===================================================================
RCS file: /home/cvs/jakarta-cactus/integration/eclipse/org.apache.cactus.eclipse.runner/src/java/org/apache/cactus/eclipse/runner/ui/CactusPreferences.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- CactusPreferences.java 12 Mar 2003 18:04:27 -0000 1.1
+++ CactusPreferences.java 21 Mar 2003 16:38:11 -0000 1.2
@@ -56,9 +56,8 @@
*/
package org.apache.cactus.eclipse.runner.ui;
-import java.util.Vector;
+import java.util.Hashtable;
-import org.apache.cactus.eclipse.runner.containers.ant.ContainerHome;
import org.eclipse.jface.preference.IPreferenceStore;
/**
@@ -219,11 +218,10 @@
* Returns the ContainerHome array.
* @return String
*/
- public static ContainerHome[] getContainerHomes()
+ public static Hashtable getContainerHomes()
{
- Vector containerHomes = new Vector();
- String[] containerIds =
- CactusPlugin.getContainers();
+ Hashtable containerHomes = new Hashtable();
+ String[] containerIds = CactusPlugin.getContainerIds();
for (int i = 0; i < containerIds.length; i++)
{
@@ -231,16 +229,12 @@
String currentContainerDir = getContainerDir(currentId);
if (!currentContainerDir.equals(""))
{
- containerHomes.addElement(
- new ContainerHome(currentId, currentContainerDir));
+ containerHomes.put(currentId, currentContainerDir);
}
}
-
- ContainerHome[] result =
- (ContainerHome[]) containerHomes.toArray(new ContainerHome[0]);
CactusPlugin.log(
- "Cactus preference : ContainerHomes = [" + result + "]");
- return result;
+ "Cactus preference : ContainerHomes = [" + containerHomes + "]");
+ return containerHomes;
}
}
1.1 jakarta-cactus/integration/eclipse/org.apache.cactus.eclipse.runner/src/java/org/apache/cactus/eclipse/runner/containers/IContainerManager.java
Index: IContainerManager.java
===================================================================
/*
* ====================================================================
*
* The Apache Software License, Version 1.1
*
* Copyright (c) 2001-2003 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution, if
* any, must include the following acknowlegement:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowlegement may appear in the software itself,
* if and wherever such third-party acknowlegements normally appear.
*
* 4. The names "The Jakarta Project", "Cactus" and "Apache Software
* Foundation" must not be used to endorse or promote products
* derived from this software without prior written permission. For
* written permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache"
* nor may "Apache" appear in their names without prior written
* permission of the Apache Group.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*
*/
package org.apache.cactus.eclipse.runner.containers;
/**
* Interface for container providers management.
*
* @author <a href="mailto:jruaux@octo.com">Julien Ruaux</a>
*
* @version $Id: IContainerManager.java,v 1.1 2003/03/21 16:38:11 jruaux Exp $
*/
public interface IContainerManager
{
/**
* @return array of supported container providers
*/
IContainerProvider[] getContainerProviders();
}
---------------------------------------------------------------------
To unsubscribe, e-mail: cactus-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: cactus-dev-help@jakarta.apache.org