CVS structure renamed. org.eclipse.wtp.* has been moved to org.eclipse.*
diff --git a/plugins/org.eclipse.jst.server.core/.classpath b/plugins/org.eclipse.jst.server.core/.classpath
new file mode 100644
index 0000000..a74595e
--- /dev/null
+++ b/plugins/org.eclipse.jst.server.core/.classpath
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="src" path="sjavacore/"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/plugins/org.eclipse.jst.server.core/.cvsignore b/plugins/org.eclipse.jst.server.core/.cvsignore
new file mode 100644
index 0000000..ba077a4
--- /dev/null
+++ b/plugins/org.eclipse.jst.server.core/.cvsignore
@@ -0,0 +1 @@
+bin
diff --git a/plugins/org.eclipse.jst.server.core/.project b/plugins/org.eclipse.jst.server.core/.project
new file mode 100644
index 0000000..3062b1a
--- /dev/null
+++ b/plugins/org.eclipse.jst.server.core/.project
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.jst.server.core</name>
+ <comment></comment>
+ <projects>
+ <project>org.eclipse.wst.server.core</project>
+ </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.jdt.core.javanature</nature>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ </natures>
+</projectDescription>
diff --git a/plugins/org.eclipse.jst.server.core/build.properties b/plugins/org.eclipse.jst.server.core/build.properties
new file mode 100644
index 0000000..6064725
--- /dev/null
+++ b/plugins/org.eclipse.jst.server.core/build.properties
@@ -0,0 +1,9 @@
+bin.includes = plugin.xml,\
+ *.jar,\
+ plugin.properties,\
+ sjavacore.jar
+jars.compile.order =
+src.includes = schema/,\
+ build.properties
+output.sjavacore.jar = bin/
+source.sjavacore.jar = sjavacore/
diff --git a/plugins/org.eclipse.jst.server.core/plugin.properties b/plugins/org.eclipse.jst.server.core/plugin.properties
new file mode 100644
index 0000000..ed9a8a8
--- /dev/null
+++ b/plugins/org.eclipse.jst.server.core/plugin.properties
@@ -0,0 +1,38 @@
+pluginName=Java Server Support
+providerName=IBM
+
+# Commands
+commandSetVMArguments=set VM arguments
+commandSetVMArgumentsDescription=Set the Java VM arguments
+commandSetPath=set system path
+commandSetPathDescription=Set the system path
+commandSetPathType=set system path option
+commandSetPathTypeDescription=Set the system path option
+commandAddSystemProperty=add system property
+commandAddSystemPropertyDescription=Add a system property
+commandModifySystemProperty=modify system property
+commandModifySystemPropertyDescription=Modify the system property
+commandRemoveSystemProperty=remove system property
+commandRemoveSystemPropertyDescription=Remove a system property
+commandAddToClasspath=add to class path
+commandAddToClasspathDescription=Add to the class path
+commandEditClasspath=edit class path
+commandEditClasspathDescription=Edit the class path
+commandReorderClasspath=reorder class path
+commandReorderClasspathDescrption=Reorder the class path
+commandRemoveFromClasspath=remove from class path
+commandRemoveFromClasspathDescription=Remove from the class path
+
+classpathContainerDescription=Server Classpath Container
+
+runtimeTypeName=J2EE Runtime Library
+runtimeTypeDescription=A runtime that represents a set of J2EE runtime libraries.
+
+errorName=Invalid name.
+errorLocation=Invalid location.
+errorJRE=Invalid JRE.
+errorDuplicateRuntimeName=Name is already in use.
+
+moduleTypeJ2EEWebName=J2EE Web module
+moduleTypeJ2EEEJBName=J2EE EJB module
+moduleTypeJ2EEEARName=J2EE Enterprise application
diff --git a/plugins/org.eclipse.jst.server.core/plugin.xml b/plugins/org.eclipse.jst.server.core/plugin.xml
new file mode 100644
index 0000000..ca0c03d
--- /dev/null
+++ b/plugins/org.eclipse.jst.server.core/plugin.xml
@@ -0,0 +1,67 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.0"?>
+
+<plugin id="org.eclipse.jst.server.core"
+ name="%pluginName"
+ version="3.0.0"
+ provider-name="%providerName"
+ class="org.eclipse.jst.server.internal.core.JavaServerPlugin">
+
+ <requires>
+ <import plugin="org.eclipse.core.runtime" version="3.0.0" match="equivalent"/>
+ <import plugin="org.eclipse.core.resources" version="3.0.0" match="equivalent"/>
+ <import plugin="org.eclipse.debug.core" version="3.0.0" match="equivalent"/>
+ <import plugin="org.eclipse.wst.server.core" version="3.0.0" match="equivalent"/>
+ <import plugin="org.eclipse.jdt.core" version="3.0.0" match="equivalent"/>
+ <import plugin="org.eclipse.jdt.launching" version="3.0.0" match="equivalent"/>
+ </requires>
+
+ <runtime>
+ <library name="sjavacore.jar">
+ <export name="*"/>
+ <packages prefixes="org.eclipse.jst.server.j2ee,org.eclipse.jst.server.core"/>
+ </library>
+ </runtime>
+
+ <extension point="org.eclipse.jdt.core.classpathContainerInitializer">
+ <classpathContainerInitializer
+ id="org.eclipse.jst.server.core.container"
+ class="org.eclipse.jst.server.internal.core.RuntimeClasspathContainerInitializer"/>
+ </extension>
+
+ <extension point="org.eclipse.wst.server.core.moduleKinds">
+ <moduleKind
+ id="j2ee.web"
+ name="%moduleTypeJ2EEWebName"/>
+ <moduleKind
+ id="j2ee.ejb"
+ name="%moduleTypeJ2EEEJBName"/>
+ <moduleKind
+ id="j2ee.ear"
+ name="%moduleTypeJ2EEEARName"/>
+ </extension>
+
+ <extension point="org.eclipse.wst.server.core.runtimeTypes">
+ <runtimeType
+ id="org.eclipse.jst.server.core.runtimeType"
+ name="%runtimeTypeName"
+ description="%runtimeTypeDescription"
+ class="org.eclipse.jst.server.internal.core.GenericRuntime"
+ workingCopyClass="org.eclipse.jst.server.internal.core.GenericRuntimeWorkingCopy">
+ <moduleType
+ types="j2ee"
+ versions="*"/>
+ <moduleType
+ types="utility"
+ versions="*"/>
+ </runtimeType>
+ </extension>
+
+ <extension point="org.eclipse.wst.server.core.runtimeTargetHandlers">
+ <runtimeTargetHandler
+ id="org.eclipse.jst.server.core.runtimeTarget"
+ runtimeTypeIds="org.eclipse.jst.server.core.runtimeType"
+ class="org.eclipse.jst.server.internal.core.GenericRuntimeTargetHandler"/>
+ </extension>
+
+</plugin>
\ No newline at end of file
diff --git a/plugins/org.eclipse.jst.server.core/sjavacore/org/eclipse/jst/server/core/ClasspathRuntimeTargetHandler.java b/plugins/org.eclipse.jst.server.core/sjavacore/org/eclipse/jst/server/core/ClasspathRuntimeTargetHandler.java
new file mode 100644
index 0000000..4c6fd55
--- /dev/null
+++ b/plugins/org.eclipse.jst.server.core/sjavacore/org/eclipse/jst/server/core/ClasspathRuntimeTargetHandler.java
@@ -0,0 +1,288 @@
+/**********************************************************************
+ * Copyright (c) 2003 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * IBM - Initial API and implementation
+ **********************************************************************/
+package org.eclipse.jst.server.core;
+
+import java.io.File;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.*;
+import org.eclipse.jdt.core.IClasspathContainer;
+import org.eclipse.jdt.core.IClasspathEntry;
+import org.eclipse.jdt.core.IJavaProject;
+import org.eclipse.jdt.core.JavaCore;
+import org.eclipse.jst.server.internal.core.JavaServerPlugin;
+import org.eclipse.jst.server.internal.core.RuntimeClasspathContainer;
+import org.eclipse.jst.server.internal.core.Trace;
+import org.eclipse.wst.server.core.IRuntime;
+import org.eclipse.wst.server.core.model.IRuntimeTargetHandlerDelegate;
+
+/**
+ *
+ */
+public abstract class ClasspathRuntimeTargetHandler implements IRuntimeTargetHandlerDelegate {
+ /* (non-Javadoc)
+ * @see org.eclipse.wst.server.core.model.IRuntimeTargetDelegate#setRuntimeTarget(org.eclipse.core.resources.IProject, org.eclipse.wst.server.core.IRuntime)
+ */
+ public void setRuntimeTarget(IProject project, IRuntime runtime, IProgressMonitor monitor) throws CoreException {
+ if (project == null || runtime == null)
+ return;
+
+ IJavaProject javaProject = null;
+ try {
+ javaProject = (IJavaProject) project.getNature(JavaCore.NATURE_ID);
+ } catch (Exception e) { }
+
+ if (javaProject == null)
+ return;
+
+ try {
+ List list = new ArrayList();
+ IClasspathEntry[] cp = javaProject.getRawClasspath();
+ int size = cp.length;
+ for (int i = 0; i < size; i++) {
+ if (cp[i].getEntryKind() != IClasspathEntry.CPE_CONTAINER ||
+ !cp[i].getPath().segment(0).equals(RuntimeClasspathContainer.SERVER_CONTAINER)) {
+ list.add(cp[i]);
+ }
+ }
+
+ List add = new ArrayList();
+ IClasspathEntry[] entries = getDelegateClasspathEntries(runtime);
+ if (entries != null) {
+ size = entries.length;
+ for (int i = 0; i < size; i++)
+ add.add(entries[i]);
+ }
+
+ String[] ids = getClasspathEntryIds(runtime);
+ if (ids != null) {
+ size = ids.length;
+ for (int i = 0; i < size; i++) {
+ IPath path = new Path(RuntimeClasspathContainer.SERVER_CONTAINER).append(getId()).append(runtime.getId());
+ if (ids[i] != null)
+ add.add(JavaCore.newContainerEntry(path.append(ids[i])));
+ else
+ add.add(JavaCore.newContainerEntry(path));
+ }
+ }
+
+ // clean up duplicates
+ cleanupDuplicateClasspath(javaProject, list, add);
+
+ Iterator iterator = add.iterator();
+ while (iterator.hasNext()) {
+ list.add(iterator.next());
+ }
+
+ cp = new IClasspathEntry[list.size()];
+ list.toArray(cp);
+ javaProject.setRawClasspath(cp, monitor);
+ } catch (Exception e) {
+ Trace.trace(Trace.WARNING, "Error setting runtime target", e);
+ throw new CoreException(new Status(IStatus.ERROR, JavaServerPlugin.PLUGIN_ID, 0, e.getLocalizedMessage(), e));
+ }
+ }
+
+ protected void cleanupDuplicateClasspath(IJavaProject project, List current, List add) {
+ // check if we even have to bother
+ boolean sourceOnly = true;
+ Iterator iterator = current.iterator();
+ while (iterator.hasNext()) {
+ IClasspathEntry entry = (IClasspathEntry) iterator.next();
+ if (entry.getEntryKind() != IClasspathEntry.CPE_SOURCE)
+ sourceOnly = false;
+ }
+ if (sourceOnly)
+ return;
+
+ // expand the "add" list
+ List addExpanded = new ArrayList();
+ iterator = add.iterator();
+ while (iterator.hasNext()) {
+ IClasspathEntry entry = (IClasspathEntry) iterator.next();
+ if (entry.getEntryKind() == IClasspathEntry.CPE_CONTAINER) {
+ try {
+ IClasspathContainer container = JavaCore.getClasspathContainer(entry.getPath(), project);
+ IClasspathEntry[] entries = container.getClasspathEntries();
+ int size = entries.length;
+ for (int i = 0; i < size; i++) {
+ if (entries[i] != null)
+ addExpanded.add(entries[i]);
+ }
+ } catch (Exception e) {
+ Trace.trace(Trace.FINEST, "Error resolving classpath container", e);
+ }
+ } else if (entry.getEntryKind() == IClasspathEntry.CPE_VARIABLE) {
+ entry = JavaCore.getResolvedClasspathEntry(entry);
+ if (entry != null)
+ addExpanded.add(entry);
+ } else
+ addExpanded.add(entry);
+ }
+
+ // check for duplicates by also expanding the current list
+ List remove = new ArrayList();
+ iterator = current.iterator();
+ while (iterator.hasNext()) {
+ IClasspathEntry entry = (IClasspathEntry) iterator.next();
+
+ List currentExpanded = new ArrayList();
+ if (entry.getEntryKind() == IClasspathEntry.CPE_CONTAINER) {
+ try {
+ IClasspathContainer container = JavaCore.getClasspathContainer(entry.getPath(), project);
+ IClasspathEntry[] entries = container.getClasspathEntries();
+ int size = entries.length;
+ for (int i = 0; i < size; i++) {
+ if (entries[i] != null)
+ currentExpanded.add(entries[i]);
+ }
+ } catch (Exception e) {
+ Trace.trace(Trace.FINEST, "Error resolving classpath container", e);
+ }
+ } else if (entry.getEntryKind() == IClasspathEntry.CPE_VARIABLE) {
+ entry = JavaCore.getResolvedClasspathEntry(entry);
+ if (entry != null)
+ currentExpanded.add(entry);
+ } else
+ currentExpanded.add(entry);
+
+ // loop over all of the expanded entries of this current entry
+ boolean dup = false;
+ Iterator iterator2 = currentExpanded.iterator();
+ while (!dup && iterator2.hasNext()) {
+ IClasspathEntry entry2 = (IClasspathEntry) iterator2.next();
+ Iterator iterator3 = addExpanded.iterator();
+ while (iterator3.hasNext()) {
+ IClasspathEntry entry3 = (IClasspathEntry) iterator3.next();
+ if (entry3.getPath().equals(entry2.getPath()))
+ dup = true;
+ }
+ }
+ if (dup)
+ remove.add(entry);
+ }
+
+ // remove duplicates
+ iterator = remove.iterator();
+ while (iterator.hasNext()) {
+ current.remove(iterator.next());
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.wst.server.core.model.IRuntimeTargetDelegate#removeRuntimeTarget(org.eclipse.core.resources.IProject, org.eclipse.wst.server.core.IRuntime)
+ */
+ public void removeRuntimeTarget(IProject project, IRuntime runtime, IProgressMonitor monitor) {
+ Trace.trace(Trace.FINEST, "Removing runtime target");
+ if (project == null || runtime == null)
+ return;
+
+ IJavaProject javaProject = null;
+ try {
+ javaProject = (IJavaProject) project.getNature(JavaCore.NATURE_ID);
+ } catch (Exception e) { }
+
+ if (javaProject == null)
+ return;
+
+ try {
+ IClasspathEntry[] delegates = getDelegateClasspathEntries(runtime);
+ int delegateSize = 0;
+ if (delegates != null)
+ delegateSize = delegates.length;
+
+ List list = new ArrayList();
+ IClasspathEntry[] cp = javaProject.getRawClasspath();
+ int size = cp.length;
+ for (int i = 0; i < size; i++) {
+ boolean remove = false;
+
+ if (cp[i].getPath().segment(0).equals(RuntimeClasspathContainer.SERVER_CONTAINER))
+ remove = true;
+
+ for (int j = 0; j < delegateSize; j++) {
+ if (cp[i].equals(delegates[j]))
+ remove = true;
+ }
+ if (!remove)
+ list.add(cp[i]);
+ }
+
+ cp = new IClasspathEntry[list.size()];
+ list.toArray(cp);
+ javaProject.setRawClasspath(cp, monitor);
+ } catch (Exception e) {
+ Trace.trace(Trace.WARNING, "Error removing runtime target", e);
+ }
+ }
+
+ protected static void addJarFiles(File dir, List list, boolean includeSubdirectories) {
+ int depth = 0;
+ if (includeSubdirectories)
+ depth = 2;
+ addJarFiles(dir, list, depth);
+ }
+
+ private static void addJarFiles(File dir, List list, int depth) {
+ File[] files = dir.listFiles();
+ if (files != null) {
+ int size = files.length;
+ for (int i = 0; i < size; i++) {
+ if (files[i].isDirectory() && depth > 0) {
+ addJarFiles(files[i], list, depth - 1);
+ } else if (files[i].getAbsolutePath().endsWith(".jar") || files[i].getAbsolutePath().endsWith(".zip")) {
+ IPath path = new Path(files[i].getAbsolutePath());
+ list.add(JavaCore.newLibraryEntry(path, null, null));
+ }
+ }
+ }
+ }
+
+ protected static void addLibraryEntries(List list, File dir, boolean includeSubdirectories) {
+ addJarFiles(dir, list, includeSubdirectories);
+ }
+
+ protected static void addLibraryEntry(List list, File dir) {
+ IPath path = new Path(dir.getAbsolutePath());
+ list.add(JavaCore.newLibraryEntry(path, null, null));
+ }
+
+ protected static void addLibraryEntry(List list, IPath path) {
+ list.add(JavaCore.newLibraryEntry(path, null, null));
+ }
+
+ protected static void addLibraryEntry(List list, IPath path, IPath source, IPath root) {
+ list.add(JavaCore.newLibraryEntry(path, source, root));
+ }
+
+ protected static IClasspathEntry[] resolveList(List list) {
+ IClasspathEntry[] entries = new IClasspathEntry[list.size()];
+ list.toArray(entries);
+ return entries;
+ }
+
+ public abstract String getId();
+
+ public IClasspathEntry[] getDelegateClasspathEntries(IRuntime runtime) {
+ return null;
+ }
+
+ public String[] getClasspathEntryIds(IRuntime runtime) {
+ return null;
+ }
+
+ public abstract String getClasspathContainerLabel(IRuntime runtime, String id);
+
+ public abstract IClasspathEntry[] resolveClasspathContainer(IRuntime runtime, String id);
+}
\ No newline at end of file
diff --git a/plugins/org.eclipse.jst.server.core/sjavacore/org/eclipse/jst/server/core/GenericRuntimeUtil.java b/plugins/org.eclipse.jst.server.core/sjavacore/org/eclipse/jst/server/core/GenericRuntimeUtil.java
new file mode 100644
index 0000000..42cac9b
--- /dev/null
+++ b/plugins/org.eclipse.jst.server.core/sjavacore/org/eclipse/jst/server/core/GenericRuntimeUtil.java
@@ -0,0 +1,24 @@
+/**********************************************************************
+ * Copyright (c) 2003 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * IBM - Initial API and implementation
+ **********************************************************************/
+package org.eclipse.jst.server.core;
+
+import org.eclipse.wst.server.core.IRuntime;
+/**
+ * Utility methods for the generic J2EE runtime.
+ */
+public class GenericRuntimeUtil {
+ protected static final String RUNTIME_TYPE_ID = "org.eclipse.jst.server.core.runtimeType";
+
+ public static boolean isGenericJ2EERuntime(IRuntime runtime) {
+ return (runtime != null && runtime.getRuntimeType() != null &&
+ runtime.getRuntimeType().getId().startsWith(RUNTIME_TYPE_ID));
+ }
+}
\ No newline at end of file
diff --git a/plugins/org.eclipse.jst.server.core/sjavacore/org/eclipse/jst/server/core/IGenericRuntime.java b/plugins/org.eclipse.jst.server.core/sjavacore/org/eclipse/jst/server/core/IGenericRuntime.java
new file mode 100644
index 0000000..60b3041
--- /dev/null
+++ b/plugins/org.eclipse.jst.server.core/sjavacore/org/eclipse/jst/server/core/IGenericRuntime.java
@@ -0,0 +1,28 @@
+/**********************************************************************
+ * Copyright (c) 2003 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * IBM - Initial API and implementation
+ **********************************************************************/
+package org.eclipse.jst.server.core;
+
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.jdt.launching.IVMInstall;
+
+import org.eclipse.wst.server.core.model.IRuntimeDelegate;
+/**
+ *
+ */
+public interface IGenericRuntime extends IRuntimeDelegate {
+ public String getVMInstallTypeId();
+
+ public String getVMInstallId();
+
+ public IVMInstall getVMInstall();
+
+ public IStatus validate();
+}
\ No newline at end of file
diff --git a/plugins/org.eclipse.jst.server.core/sjavacore/org/eclipse/jst/server/core/IGenericRuntimeWorkingCopy.java b/plugins/org.eclipse.jst.server.core/sjavacore/org/eclipse/jst/server/core/IGenericRuntimeWorkingCopy.java
new file mode 100644
index 0000000..8182e0f
--- /dev/null
+++ b/plugins/org.eclipse.jst.server.core/sjavacore/org/eclipse/jst/server/core/IGenericRuntimeWorkingCopy.java
@@ -0,0 +1,19 @@
+/**********************************************************************
+ * Copyright (c) 2003 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * IBM - Initial API and implementation
+ **********************************************************************/
+package org.eclipse.jst.server.core;
+
+import org.eclipse.wst.server.core.model.IRuntimeWorkingCopyDelegate;
+/**
+ *
+ */
+public interface IGenericRuntimeWorkingCopy extends IGenericRuntime, IRuntimeWorkingCopyDelegate {
+ public void setVMInstall(String typeId, String id);
+}
\ No newline at end of file
diff --git a/plugins/org.eclipse.jst.server.core/sjavacore/org/eclipse/jst/server/core/JavaResources.java b/plugins/org.eclipse.jst.server.core/sjavacore/org/eclipse/jst/server/core/JavaResources.java
new file mode 100644
index 0000000..aceb6b9
--- /dev/null
+++ b/plugins/org.eclipse.jst.server.core/sjavacore/org/eclipse/jst/server/core/JavaResources.java
@@ -0,0 +1,39 @@
+/**********************************************************************
+ * Copyright (c) 2003 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * IBM - Initial API and implementation
+ **********************************************************************/
+package org.eclipse.jst.server.core;
+
+import org.eclipse.jst.server.internal.core.JavaServerPlugin;
+/**
+ *
+ */
+public class JavaResources {
+ /**
+ * Returns the translated String found with the given key.
+ *
+ * @param key java.lang.String
+ * @return java.lang.String
+ */
+ public static String getResource(String key) {
+ return JavaServerPlugin.getResource(key);
+ }
+
+ /**
+ * Returns the translated String found with the given key,
+ * and formatted with the given arguments using java.text.MessageFormat.
+ *
+ * @param key java.lang.String
+ * @param arguments java.lang.Object[]
+ * @return java.lang.String
+ */
+ public static String getResource(String key, Object[] arguments) {
+ return JavaServerPlugin.getResource(key, arguments);
+ }
+}
\ No newline at end of file
diff --git a/plugins/org.eclipse.jst.server.core/sjavacore/org/eclipse/jst/server/core/LaunchConfigurationUtil.java b/plugins/org.eclipse.jst.server.core/sjavacore/org/eclipse/jst/server/core/LaunchConfigurationUtil.java
new file mode 100644
index 0000000..97d04d9
--- /dev/null
+++ b/plugins/org.eclipse.jst.server.core/sjavacore/org/eclipse/jst/server/core/LaunchConfigurationUtil.java
@@ -0,0 +1,67 @@
+/**********************************************************************
+ * Copyright (c) 2003 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * IBM - Initial API and implementation
+ **********************************************************************/
+package org.eclipse.jst.server.core;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.debug.core.ILaunchConfiguration;
+import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
+import org.eclipse.jdt.launching.IJavaLaunchConfigurationConstants;
+import org.eclipse.jdt.launching.IRuntimeClasspathEntry;
+import org.eclipse.jdt.launching.JavaRuntime;
+
+import org.eclipse.wst.server.core.IServer;
+/**
+ *
+ */
+public class LaunchConfigurationUtil {
+ /**
+ * Gets the classpath from the launch configuration of the given server.
+ * If create is false, it will return null if there is no launch configuration
+ * (i.e. the server has not been run before) If create is true, it will create
+ * a launch configuration if one does not exist.
+ *
+ * @param server
+ * @param create
+ * @return
+ * @throws CoreException
+ */
+ public static IRuntimeClasspathEntry[] getClasspath(IServer server, boolean create) throws CoreException {
+ ILaunchConfiguration config = server.getLaunchConfiguration(create);
+ if (config == null)
+ return null;
+
+ return JavaRuntime.computeUnresolvedRuntimeClasspath(config);
+ }
+
+ /**
+ * Sets the classpath on the given server's launch configuration.
+ *
+ * @param server
+ * @param classpath
+ * @throws CoreException
+ */
+ public static void setClasspath(IServer server, IRuntimeClasspathEntry[] classpath) throws CoreException {
+ ILaunchConfiguration config = server.getLaunchConfiguration(true);
+ ILaunchConfigurationWorkingCopy wc = config.getWorkingCopy();
+ wc.setAttribute(IJavaLaunchConfigurationConstants.ATTR_DEFAULT_CLASSPATH, false);
+
+ List mementos = new ArrayList(classpath.length);
+ for (int i = 0; i < classpath.length; i++) {
+ IRuntimeClasspathEntry entry = classpath[i];
+ mementos.add(entry.getMemento());
+ }
+ wc.setAttribute(IJavaLaunchConfigurationConstants.ATTR_CLASSPATH, mementos);
+ wc.doSave();
+ }
+}
\ No newline at end of file
diff --git a/plugins/org.eclipse.jst.server.core/sjavacore/org/eclipse/jst/server/core/SystemProperty.java b/plugins/org.eclipse.jst.server.core/sjavacore/org/eclipse/jst/server/core/SystemProperty.java
new file mode 100644
index 0000000..c884c30
--- /dev/null
+++ b/plugins/org.eclipse.jst.server.core/sjavacore/org/eclipse/jst/server/core/SystemProperty.java
@@ -0,0 +1,61 @@
+/**********************************************************************
+ * Copyright (c) 2003 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * IBM - Initial API and implementation
+ **********************************************************************/
+package org.eclipse.jst.server.core;
+/**
+ * A system property name/value pair.
+ */
+public class SystemProperty {
+ protected String name;
+ protected String value;
+
+ /**
+ * SystemProperty constructor comment.
+ */
+ public SystemProperty(String name, String value) {
+ super();
+ this.name = name;
+ this.value = value;
+ }
+
+ /**
+ * Returns true if the object is a SystemProperty and has
+ * the same name and value.
+ *
+ * @param obj java.lang.Object
+ * @return boolean
+ */
+ public boolean equals(Object obj) {
+ if (!(obj instanceof SystemProperty))
+ return false;
+
+ SystemProperty sp = (SystemProperty) obj;
+ return (name != null && name.equals(sp.getName()) &&
+ value != null && value.equals(sp.getValue()));
+ }
+
+ /**
+ * Returns the property name.
+ *
+ * @return java.lang.String
+ */
+ public String getName() {
+ return name;
+ }
+
+ /**
+ * Returns the property value.
+ *
+ * @return java.lang.String
+ */
+ public String getValue() {
+ return value;
+ }
+}
\ No newline at end of file
diff --git a/plugins/org.eclipse.jst.server.core/sjavacore/org/eclipse/jst/server/core/Util.java b/plugins/org.eclipse.jst.server.core/sjavacore/org/eclipse/jst/server/core/Util.java
new file mode 100644
index 0000000..9534967
--- /dev/null
+++ b/plugins/org.eclipse.jst.server.core/sjavacore/org/eclipse/jst/server/core/Util.java
@@ -0,0 +1,119 @@
+/**********************************************************************
+ * Copyright (c) 2003 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * IBM - Initial API and implementation
+ **********************************************************************/
+package org.eclipse.jst.server.core;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.jdt.core.*;
+
+import org.eclipse.wst.server.core.internal.Trace;
+/**
+ *
+ */
+public class Util {
+ /**
+ * Returns the types contained within this java element.
+ * @param element org.eclipse.jdt.core.api.IJavaElement
+ * @return org.eclipse.jdt.core.api.IType[]
+ */
+ private static IType[] getTypes(IJavaElement element) {
+ try {
+ if (element.getElementType() != IJavaElement.COMPILATION_UNIT)
+ return null;
+
+ return ((ICompilationUnit) element).getAllTypes();
+ } catch (Exception e) {
+ return null;
+ }
+ }
+
+ /**
+ * If this resource is a servlet, return the class name.
+ * If not, return null.
+ * @param resource
+ * @return java.lang.String
+ */
+ public static String getServletClassName(IResource resource) {
+ if (resource == null)
+ return null;
+
+ try {
+ IProject project = resource.getProject();
+ IPath path = resource.getFullPath();
+ if (!project.hasNature(JavaCore.NATURE_ID) || path == null)
+ return null;
+
+ IJavaProject javaProject = (IJavaProject) project.getNature(JavaCore.NATURE_ID);
+ if (!javaProject.isOpen())
+ javaProject.open(new NullProgressMonitor());
+
+ // output location may not be on classpath
+ IPath outputPath = javaProject.getOutputLocation();
+ if (outputPath != null && "class".equals(path.getFileExtension()) && outputPath.isPrefixOf(path)) {
+ int count = outputPath.segmentCount();
+ path = path.removeFirstSegments(count);
+ }
+
+ // remove initial part of classpath
+ IClasspathEntry[] classPathEntry = javaProject.getResolvedClasspath(true);
+ if (classPathEntry != null) {
+ int size = classPathEntry.length;
+ for (int i = 0; i < size; i++) {
+ IPath classPath = classPathEntry[i].getPath();
+ if (classPath.isPrefixOf(path)) {
+ int count = classPath.segmentCount();
+ path = path.removeFirstSegments(count);
+ i += size;
+ }
+ }
+ }
+
+ // get java element
+ IJavaElement javaElement = javaProject.findElement(path);
+
+ IType[] types = getTypes(javaElement);
+ if (types != null) {
+ int size2 = types.length;
+ for (int i = 0; i < size2; i++) {
+ if (isServlet(types[i]))
+ return types[i].getFullyQualifiedName();
+ }
+ }
+ return null;
+ } catch (Exception e) {
+ Trace.trace("Could not find servlet class", e);
+ return null;
+ }
+ }
+
+ /**
+ * Returns true if this java type derives from javax.servlet.GenericServlet
+ * @param type org.eclipse.jdt.core.api.IType
+ * @return boolean
+ */
+ private static boolean isServlet(IType type) {
+ try {
+ ITypeHierarchy hierarchy = type.newSupertypeHierarchy(null);
+ IType[] superClasses = hierarchy.getAllSuperclasses(type);
+
+ int size = superClasses.length;
+ for (int i = 0; i < size; i++) {
+ if ("javax.servlet.GenericServlet".equals(superClasses[i].getFullyQualifiedName()))
+ return true;
+ }
+ return false;
+ } catch (Exception e) {
+ return false;
+ }
+ }
+}
\ No newline at end of file
diff --git a/plugins/org.eclipse.jst.server.core/sjavacore/org/eclipse/jst/server/internal/core/GenericRuntime.java b/plugins/org.eclipse.jst.server.core/sjavacore/org/eclipse/jst/server/internal/core/GenericRuntime.java
new file mode 100644
index 0000000..424dfd2
--- /dev/null
+++ b/plugins/org.eclipse.jst.server.core/sjavacore/org/eclipse/jst/server/internal/core/GenericRuntime.java
@@ -0,0 +1,76 @@
+/**********************************************************************
+ * Copyright (c) 2003 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * IBM - Initial API and implementation
+ **********************************************************************/
+package org.eclipse.jst.server.internal.core;
+
+import org.eclipse.core.runtime.*;
+import org.eclipse.jdt.launching.IVMInstall;
+import org.eclipse.jdt.launching.IVMInstallType;
+import org.eclipse.jdt.launching.JavaRuntime;
+import org.eclipse.jst.server.core.IGenericRuntime;
+import org.eclipse.wst.server.core.IRuntime;
+import org.eclipse.wst.server.core.ServerUtil;
+/**
+ *
+ */
+public class GenericRuntime implements IGenericRuntime {
+ protected static final String PROP_VM_INSTALL_TYPE_ID = "vm-install-type-id";
+ protected static final String PROP_VM_INSTALL_ID = "vm-install-id";
+
+ protected IRuntime runtime;
+
+ public GenericRuntime() { }
+
+ public void initialize(IRuntime newRuntime) {
+ this.runtime = newRuntime;
+ }
+
+ public String getVMInstallTypeId() {
+ return runtime.getAttribute(PROP_VM_INSTALL_TYPE_ID, (String)null);
+ }
+
+ public String getVMInstallId() {
+ return runtime.getAttribute(PROP_VM_INSTALL_ID, (String)null);
+ }
+
+ public IVMInstall getVMInstall() {
+ try {
+ IVMInstallType vmInstallType = JavaRuntime.getVMInstallType(getVMInstallTypeId());
+ IVMInstall[] vmInstalls = vmInstallType.getVMInstalls();
+ int size = vmInstalls.length;
+ String id = getVMInstallId();
+ for (int i = 0; i < size; i++) {
+ if (id.equals(vmInstalls[i].getId()))
+ return vmInstalls[i];
+ }
+ } catch (Exception e) { }
+ return null;
+ }
+
+ public IStatus validate() {
+ if (runtime.getName() == null || runtime.getName().length() == 0)
+ return new Status(IStatus.ERROR, JavaServerPlugin.PLUGIN_ID, 0, JavaServerPlugin.getResource("%errorName"), null);
+
+ if (ServerUtil.isNameInUse(runtime))
+ return new Status(IStatus.ERROR, JavaServerPlugin.PLUGIN_ID, 0, JavaServerPlugin.getResource("%errorDuplicateRuntimeName"), null);
+
+ IPath path = runtime.getLocation();
+ if (path == null || path.isEmpty())
+ return new Status(IStatus.ERROR, JavaServerPlugin.PLUGIN_ID, 0, "", null);
+ else if (!path.toFile().exists())
+ return new Status(IStatus.ERROR, JavaServerPlugin.PLUGIN_ID, 0, JavaServerPlugin.getResource("%errorLocation"), null);
+ else if (getVMInstall() == null)
+ return new Status(IStatus.ERROR, JavaServerPlugin.PLUGIN_ID, 0, JavaServerPlugin.getResource("%errorJRE"), null);
+ else
+ return new Status(IStatus.OK, JavaServerPlugin.PLUGIN_ID, 0, "", null);
+ }
+
+ public void dispose() { }
+}
\ No newline at end of file
diff --git a/plugins/org.eclipse.jst.server.core/sjavacore/org/eclipse/jst/server/internal/core/GenericRuntimeTargetHandler.java b/plugins/org.eclipse.jst.server.core/sjavacore/org/eclipse/jst/server/internal/core/GenericRuntimeTargetHandler.java
new file mode 100644
index 0000000..ccbaf99
--- /dev/null
+++ b/plugins/org.eclipse.jst.server.core/sjavacore/org/eclipse/jst/server/internal/core/GenericRuntimeTargetHandler.java
@@ -0,0 +1,64 @@
+/**********************************************************************
+ * Copyright (c) 2003 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * IBM - Initial API and implementation
+ **********************************************************************/
+package org.eclipse.jst.server.internal.core;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.jdt.core.IClasspathEntry;
+import org.eclipse.jdt.core.JavaCore;
+import org.eclipse.jdt.launching.IVMInstall;
+import org.eclipse.jdt.launching.JavaRuntime;
+import org.eclipse.jst.server.core.ClasspathRuntimeTargetHandler;
+
+import org.eclipse.wst.server.core.IRuntime;
+/**
+ *
+ */
+public class GenericRuntimeTargetHandler extends ClasspathRuntimeTargetHandler {
+ public IClasspathEntry[] getDelegateClasspathEntries(IRuntime runtime) {
+ GenericRuntime genericRuntime = (GenericRuntime) runtime.getDelegate();
+ IVMInstall vmInstall = genericRuntime.getVMInstall();
+ if (vmInstall != null) {
+ String name = vmInstall.getName();
+ return new IClasspathEntry[] { JavaCore.newContainerEntry(new Path(JavaRuntime.JRE_CONTAINER).append("org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType").append(name)) };
+ } else
+ return null;
+ }
+
+ public String getClasspathContainerLabel(IRuntime runtime, String id) {
+ return JavaServerPlugin.getResource("%runtimeTargetContainer");
+ }
+
+ public String[] getClasspathEntryIds(IRuntime runtime) {
+ return new String[1];
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.wst.server.target.IServerTargetDelegate#getClasspathEntries()
+ */
+ public IClasspathEntry[] resolveClasspathContainer(IRuntime runtime, String id) {
+ IPath installPath = runtime.getLocation();
+
+ if (installPath == null)
+ return new IClasspathEntry[0];
+
+ List list = new ArrayList();
+ addLibraryEntries(list, installPath.toFile(), false);
+ return resolveList(list);
+ }
+
+ public String getId() {
+ return "org.eclipse.jst.server.core.runtimeTarget";
+ }
+}
diff --git a/plugins/org.eclipse.jst.server.core/sjavacore/org/eclipse/jst/server/internal/core/GenericRuntimeWorkingCopy.java b/plugins/org.eclipse.jst.server.core/sjavacore/org/eclipse/jst/server/internal/core/GenericRuntimeWorkingCopy.java
new file mode 100644
index 0000000..6a8160a
--- /dev/null
+++ b/plugins/org.eclipse.jst.server.core/sjavacore/org/eclipse/jst/server/internal/core/GenericRuntimeWorkingCopy.java
@@ -0,0 +1,46 @@
+/**********************************************************************
+ * Copyright (c) 2003 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * IBM - Initial API and implementation
+ **********************************************************************/
+package org.eclipse.jst.server.internal.core;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.jdt.launching.IVMInstall;
+import org.eclipse.jdt.launching.JavaRuntime;
+import org.eclipse.jst.server.core.IGenericRuntimeWorkingCopy;
+import org.eclipse.wst.server.core.IRuntimeWorkingCopy;
+/**
+ *
+ */
+public class GenericRuntimeWorkingCopy extends GenericRuntime implements IGenericRuntimeWorkingCopy {
+ protected IRuntimeWorkingCopy wc;
+
+ public void initialize(IRuntimeWorkingCopy runtime2) {
+ wc = runtime2;
+ }
+
+ public void setDefaults() {
+ IVMInstall vmInstall = JavaRuntime.getDefaultVMInstall();
+ setVMInstall(vmInstall.getVMInstallType().getId(), vmInstall.getId());
+ }
+
+ public void setVMInstall(String typeId, String id) {
+ if (typeId == null)
+ wc.setAttribute(PROP_VM_INSTALL_TYPE_ID, (String)null);
+ else
+ wc.setAttribute(PROP_VM_INSTALL_TYPE_ID, typeId);
+
+ if (id == null)
+ wc.setAttribute(PROP_VM_INSTALL_ID, (String)null);
+ else
+ wc.setAttribute(PROP_VM_INSTALL_ID, id);
+ }
+
+ public void handleSave(byte id, IProgressMonitor monitor) { }
+}
\ No newline at end of file
diff --git a/plugins/org.eclipse.jst.server.core/sjavacore/org/eclipse/jst/server/internal/core/JavaServerPlugin.java b/plugins/org.eclipse.jst.server.core/sjavacore/org/eclipse/jst/server/internal/core/JavaServerPlugin.java
new file mode 100644
index 0000000..03d700a
--- /dev/null
+++ b/plugins/org.eclipse.jst.server.core/sjavacore/org/eclipse/jst/server/internal/core/JavaServerPlugin.java
@@ -0,0 +1,80 @@
+/**********************************************************************
+ * Copyright (c) 2003 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * IBM - Initial API and implementation
+ **********************************************************************/
+package org.eclipse.jst.server.internal.core;
+
+import java.text.MessageFormat;
+import org.eclipse.core.runtime.*;
+/**
+ * The main server tooling plugin class.
+ */
+public class JavaServerPlugin extends Plugin {
+ // server java plugin id
+ public static final String PLUGIN_ID = "org.eclipse.jst.server.core";
+
+ // singleton instance of this class
+ private static JavaServerPlugin singleton;
+
+ /**
+ * Create the JavaServerPlugin.
+ */
+ public JavaServerPlugin() {
+ super();
+ singleton = this;
+ }
+
+ /**
+ * Returns the singleton instance of this plugin.
+ *
+ * @return org.eclipse.jst.server.JavaServerPlugin
+ */
+ public static JavaServerPlugin getInstance() {
+ return singleton;
+ }
+
+ /**
+ * Returns the translated String found with the given key.
+ *
+ * @param key java.lang.String
+ * @return java.lang.String
+ */
+ public static String getResource(String key) {
+ try {
+ return Platform.getResourceString(getInstance().getBundle(), key);
+ } catch (Exception e) {
+ return key;
+ }
+ }
+ /**
+ * Returns the translated String found with the given key,
+ * and formatted with the given arguments using java.text.MessageFormat.
+ *
+ * @param key java.lang.String
+ * @param arguments java.lang.Object[]
+ * @return java.lang.String
+ */
+ public static String getResource(String key, Object[] arguments) {
+ try {
+ String text = getResource(key);
+ return MessageFormat.format(text, arguments);
+ } catch (Exception e) {
+ return key;
+ }
+ }
+
+ /**
+ * Convenience method for logging.
+ *
+ * @param status org.eclipse.core.runtime.IStatus
+ */
+ public static void log(IStatus status) {
+ getInstance().getLog().log(status);
+ }
+}
\ No newline at end of file
diff --git a/plugins/org.eclipse.jst.server.core/sjavacore/org/eclipse/jst/server/internal/core/RuntimeClasspathContainer.java b/plugins/org.eclipse.jst.server.core/sjavacore/org/eclipse/jst/server/internal/core/RuntimeClasspathContainer.java
new file mode 100644
index 0000000..13e36fb
--- /dev/null
+++ b/plugins/org.eclipse.jst.server.core/sjavacore/org/eclipse/jst/server/internal/core/RuntimeClasspathContainer.java
@@ -0,0 +1,77 @@
+/**********************************************************************
+ * Copyright (c) 2003 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * IBM - Initial API and implementation
+ **********************************************************************/
+package org.eclipse.jst.server.internal.core;
+
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.jdt.core.IClasspathContainer;
+import org.eclipse.jdt.core.IClasspathEntry;
+import org.eclipse.jst.server.core.ClasspathRuntimeTargetHandler;
+
+import org.eclipse.wst.server.core.IRuntime;
+/**
+ *
+ */
+public class RuntimeClasspathContainer implements IClasspathContainer {
+ public static final String SERVER_CONTAINER = JavaServerPlugin.PLUGIN_ID + ".container";
+
+ private IPath path;
+ private ClasspathRuntimeTargetHandler delegate;
+ private IRuntime runtime;
+
+ private String id;
+
+ public RuntimeClasspathContainer(IPath path, ClasspathRuntimeTargetHandler delegate, IRuntime runtime, String id) {
+ this.path = path;
+ this.delegate = delegate;
+ this.runtime = runtime;
+ this.id = id;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jdt.core.IClasspathContainer#getClasspathEntries()
+ */
+ public IClasspathEntry[] getClasspathEntries() {
+ IClasspathEntry[] entries = null;
+ if (delegate != null && runtime != null)
+ entries = delegate.resolveClasspathContainer(runtime, id);
+
+ if (entries != null)
+ return entries;
+ else
+ return new IClasspathEntry[0];
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jdt.core.IClasspathContainer#getDescription()
+ */
+ public String getDescription() {
+ String s = delegate.getClasspathContainerLabel(runtime, id);
+
+ if (s != null)
+ return s;
+ else
+ return JavaServerPlugin.getResource("%classpathContainerDescription");
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jdt.core.IClasspathContainer#getKind()
+ */
+ public int getKind() {
+ return IClasspathContainer.K_APPLICATION;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jdt.core.IClasspathContainer#getPath()
+ */
+ public IPath getPath() {
+ return path;
+ }
+}
\ No newline at end of file
diff --git a/plugins/org.eclipse.jst.server.core/sjavacore/org/eclipse/jst/server/internal/core/RuntimeClasspathContainerInitializer.java b/plugins/org.eclipse.jst.server.core/sjavacore/org/eclipse/jst/server/internal/core/RuntimeClasspathContainerInitializer.java
new file mode 100644
index 0000000..e9753f7
--- /dev/null
+++ b/plugins/org.eclipse.jst.server.core/sjavacore/org/eclipse/jst/server/internal/core/RuntimeClasspathContainerInitializer.java
@@ -0,0 +1,64 @@
+/**********************************************************************
+ * Copyright (c) 2003 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * IBM - Initial API and implementation
+ **********************************************************************/
+package org.eclipse.jst.server.internal.core;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.jdt.core.*;
+import org.eclipse.jst.server.core.ClasspathRuntimeTargetHandler;
+import org.eclipse.wst.server.core.IRuntime;
+import org.eclipse.wst.server.core.ServerCore;
+/**
+ *
+ */
+public class RuntimeClasspathContainerInitializer extends ClasspathContainerInitializer {
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jdt.core.ClasspathContainerInitializer#initialize(org.eclipse.core.runtime.IPath, org.eclipse.jdt.core.IJavaProject)
+ */
+ public void initialize(IPath containerPath, IJavaProject project) throws CoreException {
+ if (containerPath.segmentCount() > 0) {
+ if (containerPath.segment(0).equals(RuntimeClasspathContainer.SERVER_CONTAINER)) {
+ ClasspathRuntimeTargetHandler delegate = null;
+ IRuntime runtime = null;
+ String id = "";
+ if (containerPath.segmentCount() > 2) {
+ delegate = (ClasspathRuntimeTargetHandler) ServerCore.getRuntimeTargetHandler(containerPath.segment(1)).getDelegate();
+ String runtimeId = containerPath.segment(2);
+ runtime = ServerCore.getResourceManager().getRuntime(runtimeId);
+ if (containerPath.segmentCount() > 3)
+ id = containerPath.segment(3);
+ }
+ RuntimeClasspathContainer container = new RuntimeClasspathContainer(containerPath, delegate, runtime, id);
+ JavaCore.setClasspathContainer(containerPath, new IJavaProject[] {project}, new IClasspathContainer[] {container}, null);
+ }
+ }
+
+ /*int size = containerPath.segmentCount();
+ if (size > 0) {
+ if (containerPath.segment(0).equals(JavaRuntime.JRE_CONTAINER)) {
+ IVMInstall vm = resolveVM(containerPath);
+ JREContainer container = null;
+ if (vm != null) {
+ container = new JREContainer(vm, containerPath);
+ }
+ JavaCore.setClasspathContainer(containerPath, new IJavaProject[] {project}, new IClasspathContainer[] {container}, null);
+ }
+ }*/
+ }
+
+ /**
+ * @see org.eclipse.jdt.core.ClasspathContainerInitializer#getDescription(org.eclipse.core.runtime.IPath, org.eclipse.jdt.core.IJavaProject)
+ */
+ public String getDescription(IPath containerPath, IJavaProject project) {
+ return JavaServerPlugin.getResource("%classpathContainerDescription");
+ }
+}
\ No newline at end of file
diff --git a/plugins/org.eclipse.jst.server.core/sjavacore/org/eclipse/jst/server/internal/core/Trace.java b/plugins/org.eclipse.jst.server.core/sjavacore/org/eclipse/jst/server/internal/core/Trace.java
new file mode 100644
index 0000000..f5800c9
--- /dev/null
+++ b/plugins/org.eclipse.jst.server.core/sjavacore/org/eclipse/jst/server/internal/core/Trace.java
@@ -0,0 +1,51 @@
+/**********************************************************************
+ * Copyright (c) 2003 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * IBM - Initial API and implementation
+ **********************************************************************/
+package org.eclipse.jst.server.internal.core;
+/**
+ * Helper class to route trace output.
+ */
+public class Trace {
+ public static byte CONFIG = 0;
+ public static byte WARNING = 1;
+ public static byte SEVERE = 2;
+ public static byte FINEST = 3;
+
+ /**
+ * Trace constructor comment.
+ */
+ private Trace() {
+ super();
+ }
+
+ /**
+ * Trace the given text.
+ *
+ * @param s java.lang.String
+ */
+ public static void trace(byte level, String s) {
+ Trace.trace(level, s, null);
+ }
+
+ /**
+ * Trace the given message and exception.
+ *
+ * @param s java.lang.String
+ * @param t java.lang.Throwable
+ */
+ public static void trace(byte level, String s, Throwable t) {
+ if (!JavaServerPlugin.getInstance().isDebugging())
+ return;
+
+ System.out.println(s);
+ if (t != null)
+ t.printStackTrace();
+ }
+}
\ No newline at end of file
diff --git a/plugins/org.eclipse.jst.server.core/sjavacore/org/eclipse/jst/server/j2ee/EJBBean.java b/plugins/org.eclipse.jst.server.core/sjavacore/org/eclipse/jst/server/j2ee/EJBBean.java
new file mode 100644
index 0000000..a098867
--- /dev/null
+++ b/plugins/org.eclipse.jst.server.core/sjavacore/org/eclipse/jst/server/j2ee/EJBBean.java
@@ -0,0 +1,66 @@
+/**********************************************************************
+ * Copyright (c) 2003 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * IBM - Initial API and implementation
+ **********************************************************************/
+package org.eclipse.jst.server.j2ee;
+
+import org.eclipse.wst.server.core.model.IModule;
+import org.eclipse.wst.server.core.model.IModuleObject;
+
+public class EJBBean implements IModuleObject {
+ public static final String ID = "org.eclipse.jst.server.j2ee.ejb";
+
+ private IModule module;
+ private String jndiName;
+ private boolean local;
+ private boolean remote;
+
+ /**
+ * @deprecated - use the other constructor
+ * @param module
+ * @param ejbName
+ */
+ public EJBBean(IModule module, String ejbName) {
+ this.module = module;
+ this.jndiName = ejbName;
+ }
+
+ public EJBBean(IModule module, String jndiName, boolean remote, boolean local) {
+ this.module = module;
+ this.jndiName = jndiName;
+ this.remote = remote;
+ this.local = local;
+ }
+
+ /*
+ * @see IModuleObject#getId()
+ */
+ public String getId() {
+ return ID;
+ }
+
+ /*
+ * @see IModuleObject#getModule()
+ */
+ public IModule getModule() {
+ return module;
+ }
+
+ public String getJndiName() {
+ return jndiName;
+ }
+
+ public boolean hasRemoteInterface() {
+ return remote;
+ }
+
+ public boolean hasLocalInterface() {
+ return local;
+ }
+}
diff --git a/plugins/org.eclipse.jst.server.core/sjavacore/org/eclipse/jst/server/j2ee/IApplicationClientModule.java b/plugins/org.eclipse.jst.server.core/sjavacore/org/eclipse/jst/server/j2ee/IApplicationClientModule.java
new file mode 100644
index 0000000..ea15143
--- /dev/null
+++ b/plugins/org.eclipse.jst.server.core/sjavacore/org/eclipse/jst/server/j2ee/IApplicationClientModule.java
@@ -0,0 +1,14 @@
+/**********************************************************************
+ * Copyright (c) 2003 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * IBM - Initial API and implementation
+ **********************************************************************/
+package org.eclipse.jst.server.j2ee;
+
+public interface IApplicationClientModule extends IJ2EEModule {
+}
\ No newline at end of file
diff --git a/plugins/org.eclipse.jst.server.core/sjavacore/org/eclipse/jst/server/j2ee/IConnectorModule.java b/plugins/org.eclipse.jst.server.core/sjavacore/org/eclipse/jst/server/j2ee/IConnectorModule.java
new file mode 100644
index 0000000..e39dcb4
--- /dev/null
+++ b/plugins/org.eclipse.jst.server.core/sjavacore/org/eclipse/jst/server/j2ee/IConnectorModule.java
@@ -0,0 +1,24 @@
+/**********************************************************************
+ * Copyright (c) 2003 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * IBM - Initial API and implementation
+ **********************************************************************/
+package org.eclipse.jst.server.j2ee;
+
+import java.util.List;
+/**
+ * A J2EE connector module.
+ */
+public interface IConnectorModule extends IJ2EEModule {
+ /**
+ * Returns the classpath as a list of absolute IPaths.
+ *
+ * @param java.util.List
+ */
+ public List getClasspath();
+}
\ No newline at end of file
diff --git a/plugins/org.eclipse.jst.server.core/sjavacore/org/eclipse/jst/server/j2ee/IEJBModule.java b/plugins/org.eclipse.jst.server.core/sjavacore/org/eclipse/jst/server/j2ee/IEJBModule.java
new file mode 100644
index 0000000..5defe37
--- /dev/null
+++ b/plugins/org.eclipse.jst.server.core/sjavacore/org/eclipse/jst/server/j2ee/IEJBModule.java
@@ -0,0 +1,20 @@
+/**********************************************************************
+ * Copyright (c) 2003 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * IBM - Initial API and implementation
+ **********************************************************************/
+package org.eclipse.jst.server.j2ee;
+
+public interface IEJBModule extends IJ2EEModule {
+ /**
+ * Returns a version number in the form "x.y.z".
+ *
+ * @return java.lang.String
+ */
+ public String getEJBSpecificationVersion();
+}
\ No newline at end of file
diff --git a/plugins/org.eclipse.jst.server.core/sjavacore/org/eclipse/jst/server/j2ee/IEnterpriseApplication.java b/plugins/org.eclipse.jst.server.core/sjavacore/org/eclipse/jst/server/j2ee/IEnterpriseApplication.java
new file mode 100644
index 0000000..4f25930
--- /dev/null
+++ b/plugins/org.eclipse.jst.server.core/sjavacore/org/eclipse/jst/server/j2ee/IEnterpriseApplication.java
@@ -0,0 +1,58 @@
+/**********************************************************************
+ * Copyright (c) 2003 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * IBM - Initial API and implementation
+ **********************************************************************/
+package org.eclipse.jst.server.j2ee;
+
+import org.eclipse.core.runtime.IPath;
+
+import org.eclipse.wst.server.core.model.IModule;
+/**
+ *
+ */
+public interface IEnterpriseApplication extends IModule {
+ /**
+ * Returns a version number in the form "x.y.z".
+ *
+ * @return java.lang.String
+ */
+ public String getJ2EESpecificationVersion();
+
+ /**
+ * Returns the modules contained within this EAR.
+ *
+ * @return org.eclipse.jst.server.j2ee.IJ2EEModule[]
+ */
+ public IJ2EEModule[] getModules();
+
+ /**
+ * Returns the URI of the given J2EE module within this
+ * enterprise application.
+ *
+ * @param org.eclipse.jst.server.j2ee.IJ2EEModule
+ * @return java.lang.String
+ */
+ public String getURI(IJ2EEModule module);
+
+ /**
+ * Returns true if this EAR supports loose modules.
+ *
+ * @return boolean
+ */
+ public boolean containsLooseModules();
+
+ /**
+ * Returns the location of the root of the application. May
+ * return null if isUnitTest() returns false. This should
+ * be an absolute path that is not workbench relative.
+ *
+ * @return org.eclipse.core.runtime.IPath
+ */
+ public IPath getLocation();
+}
diff --git a/plugins/org.eclipse.jst.server.core/sjavacore/org/eclipse/jst/server/j2ee/IJ2EEModule.java b/plugins/org.eclipse.jst.server.core/sjavacore/org/eclipse/jst/server/j2ee/IJ2EEModule.java
new file mode 100644
index 0000000..ae79fd2
--- /dev/null
+++ b/plugins/org.eclipse.jst.server.core/sjavacore/org/eclipse/jst/server/j2ee/IJ2EEModule.java
@@ -0,0 +1,57 @@
+/**********************************************************************
+ * Copyright (c) 2003 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * IBM - Initial API and implementation
+ **********************************************************************/
+package org.eclipse.jst.server.j2ee;
+
+import org.eclipse.core.runtime.IPath;
+
+import org.eclipse.wst.server.core.model.IModule;
+/**
+ * An abstract J2EE module that can be deployed to a server.
+ */
+public interface IJ2EEModule extends IModule {
+ /**
+ * Returns a version number in the form "x.y.z".
+ *
+ * @param java.lang.String
+ */
+ public String getJ2EESpecificationVersion();
+
+ /**
+ * Returns the location of the root of the module. May
+ * return null if isUnitTest() returns false. This should
+ * be an absolute path that is not workbench relative.
+ *
+ * @return org.eclipse.core.runtime.IPath
+ */
+ public IPath getLocation();
+
+ /**
+ * Returns true if this is a binary (zipped) module, and
+ * false if it is expanded.
+ *
+ * <p>If true, members() should return only a single element -
+ * the binary (jar or zip file) that contains the contents of
+ * this module. (a single IModuleResource, e.g.
+ * myejb.jar) Also, getLocation() should return the full path
+ * up to and including the binary itself. (e.g.
+ * c:\temp\myejb.jar)</p>
+ *
+ * <p>If false, members() should return the entire contents
+ * of the module, starting at the root. There should be no
+ * preceeding directory structure. (an array of
+ * IModuleResources, e.g. index.html, WEB-INF/web.xml,
+ * ...) In this case, getLocation() should return the path to
+ * the root folder containing these resources.</p>
+ *
+ * @return boolean
+ */
+ public boolean isBinary();
+}
\ No newline at end of file
diff --git a/plugins/org.eclipse.jst.server.core/sjavacore/org/eclipse/jst/server/j2ee/ILooseArchive.java b/plugins/org.eclipse.jst.server.core/sjavacore/org/eclipse/jst/server/j2ee/ILooseArchive.java
new file mode 100644
index 0000000..fe63c0d
--- /dev/null
+++ b/plugins/org.eclipse.jst.server.core/sjavacore/org/eclipse/jst/server/j2ee/ILooseArchive.java
@@ -0,0 +1,49 @@
+/**********************************************************************
+ * Copyright (c) 2003 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * IBM - Initial API and implementation
+ **********************************************************************/
+package org.eclipse.jst.server.j2ee;
+
+import org.eclipse.core.runtime.IPath;
+
+import org.eclipse.wst.server.core.model.IModule;
+/**
+ *
+ */
+public interface ILooseArchive extends IModule {
+ /**
+ * Returns the location of the root of the loose utility. This should
+ * be an absolute path that is not workbench relative.
+ *
+ * @return org.eclipse.core.runtime.IPath
+ */
+ public IPath getLocation();
+
+ /**
+ * Returns true if this is a binary (zipped) archive, and
+ * false if it is expanded.
+ *
+ * <p>If true, members() should return only a single element -
+ * the binary (jar or zip file) that contains the contents of
+ * this module. (a single IPublishableResource, e.g.
+ * myejb.jar) Also, getLocation() should return the full path
+ * up to and including the binary itself. (e.g.
+ * c:\temp\myejb.jar)</p>
+ *
+ * <p>If false, members() should return the entire contents
+ * of the module, starting at the root. There should be no
+ * preceeding directory structure. (an array of
+ * IPublishableResources, e.g. index.html, WEB-INF/web.xml,
+ * ...) In this case, getLocation() should return the path to
+ * the root folder containing these resources.</p>
+ *
+ * @return boolean
+ */
+ public boolean isBinary();
+}
\ No newline at end of file
diff --git a/plugins/org.eclipse.jst.server.core/sjavacore/org/eclipse/jst/server/j2ee/ILooseArchiveSupport.java b/plugins/org.eclipse.jst.server.core/sjavacore/org/eclipse/jst/server/j2ee/ILooseArchiveSupport.java
new file mode 100644
index 0000000..bb9e381
--- /dev/null
+++ b/plugins/org.eclipse.jst.server.core/sjavacore/org/eclipse/jst/server/j2ee/ILooseArchiveSupport.java
@@ -0,0 +1,30 @@
+/**********************************************************************
+ * Copyright (c) 2003 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * IBM - Initial API and implementation
+ **********************************************************************/
+package org.eclipse.jst.server.j2ee;
+
+public interface ILooseArchiveSupport {
+ /**
+ * Return the loose archives that are contained within this enterprise
+ * application.
+ *
+ * @return ILooseArchive[]
+ */
+ public ILooseArchive[] getLooseArchives();
+
+ /**
+ * Returns the URI of the given loose archive within this
+ * enterprise application.
+ *
+ * @param com.ibm.etools.server.j2ee.ILooseArchive
+ * @return java.lang.String
+ */
+ public String getURI(ILooseArchive jar);
+}
\ No newline at end of file
diff --git a/plugins/org.eclipse.jst.server.core/sjavacore/org/eclipse/jst/server/j2ee/IStaticWeb.java b/plugins/org.eclipse.jst.server.core/sjavacore/org/eclipse/jst/server/j2ee/IStaticWeb.java
new file mode 100644
index 0000000..7a17d22
--- /dev/null
+++ b/plugins/org.eclipse.jst.server.core/sjavacore/org/eclipse/jst/server/j2ee/IStaticWeb.java
@@ -0,0 +1,25 @@
+/**********************************************************************
+ * Copyright (c) 2003 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * IBM - Initial API and implementation
+ **********************************************************************/
+package org.eclipse.jst.server.j2ee;
+
+import org.eclipse.wst.server.core.model.IModule;
+/**
+ * A static Web module that could be deployed to Apache or another
+ * HTTP server.
+ */
+public interface IStaticWeb extends IModule {
+ /**
+ * Returns the context root of the Web.
+ *
+ * @return java.lang.String
+ */
+ public String getContextRoot();
+}
\ No newline at end of file
diff --git a/plugins/org.eclipse.jst.server.core/sjavacore/org/eclipse/jst/server/j2ee/IWebModule.java b/plugins/org.eclipse.jst.server.core/sjavacore/org/eclipse/jst/server/j2ee/IWebModule.java
new file mode 100644
index 0000000..848033f
--- /dev/null
+++ b/plugins/org.eclipse.jst.server.core/sjavacore/org/eclipse/jst/server/j2ee/IWebModule.java
@@ -0,0 +1,44 @@
+/**********************************************************************
+ * Copyright (c) 2003 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * IBM - Initial API and implementation
+ **********************************************************************/
+package org.eclipse.jst.server.j2ee;
+
+public interface IWebModule extends IJ2EEModule {
+ /**
+ * Returns a version number in the form "x.y.z".
+ *
+ * @return java.lang.String
+ */
+ public String getServletSpecificationVersion();
+
+ /**
+ * Returns a version number in the form "x.y.z".
+ *
+ * @return java.lang.String
+ */
+ public String getJSPSpecificationVersion();
+
+ /**
+ * Returns the context root of the module.
+ *
+ * @return java.lang.String
+ */
+ public String getContextRoot();
+
+ /**
+ * Returns false if the files in this module are placed in the
+ * correct structure for testing before publishing. Returns true
+ * if the file system resources must be published before they will
+ * work.
+ *
+ * @return boolean
+ */
+ public boolean isPublishRequired();
+}
\ No newline at end of file
diff --git a/plugins/org.eclipse.jst.server.core/sjavacore/org/eclipse/jst/server/j2ee/J2EEUtil.java b/plugins/org.eclipse.jst.server.core/sjavacore/org/eclipse/jst/server/j2ee/J2EEUtil.java
new file mode 100644
index 0000000..1e04376
--- /dev/null
+++ b/plugins/org.eclipse.jst.server.core/sjavacore/org/eclipse/jst/server/j2ee/J2EEUtil.java
@@ -0,0 +1,50 @@
+/**********************************************************************
+ * Copyright (c) 2003 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * IBM - Initial API and implementation
+ **********************************************************************/
+package org.eclipse.jst.server.j2ee;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import org.eclipse.wst.server.core.ServerUtil;
+import org.eclipse.wst.server.core.model.IModule;
+/**
+ *
+ */
+public class J2EEUtil {
+ /**
+ * Returns the enterprise applications that the module is contained within.
+ *
+ * @param module org.eclipse.jst.server.j2ee.IJ2EEModule
+ * @return org.eclipse.jst.server.j2ee.IEnterpriseApplication
+ */
+ public static IEnterpriseApplication[] getEnterpriseApplications(IJ2EEModule module) {
+ Iterator iterator = ServerUtil.getModules("j2ee.ear", "*", false).iterator();
+ List list = new ArrayList();
+ while (iterator.hasNext()) {
+ IModule module2 = (IModule) iterator.next();
+ if (module2 instanceof IEnterpriseApplication) {
+ IEnterpriseApplication ear = (IEnterpriseApplication) module2;
+ IJ2EEModule[] modules = ear.getModules();
+ if (modules != null) {
+ int size = modules.length;
+ for (int i = 0; i < size; i++) {
+ if (modules[i].equals(module))
+ list.add(ear);
+ }
+ }
+ }
+ }
+ IEnterpriseApplication[] ears = new IEnterpriseApplication[list.size()];
+ list.toArray(ears);
+ return ears;
+ }
+}
diff --git a/plugins/org.eclipse.jst.server.core/sjavacore/org/eclipse/jst/server/j2ee/JndiLaunchable.java b/plugins/org.eclipse.jst.server.core/sjavacore/org/eclipse/jst/server/j2ee/JndiLaunchable.java
new file mode 100644
index 0000000..cae4c73
--- /dev/null
+++ b/plugins/org.eclipse.jst.server.core/sjavacore/org/eclipse/jst/server/j2ee/JndiLaunchable.java
@@ -0,0 +1,54 @@
+/**********************************************************************
+ * Copyright (c) 2003 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * IBM - Initial API and implementation
+ **********************************************************************/
+package org.eclipse.jst.server.j2ee;
+
+import java.util.Properties;
+
+import org.eclipse.wst.server.core.model.ILaunchable;
+/**
+ *
+ */
+public class JndiLaunchable implements ILaunchable {
+ public static final String ID = "jndi";
+
+ private Properties props;
+ private String jndiName;
+ private String server;
+ private int port;
+
+ public JndiLaunchable(Properties props, String jndiName) {
+ this.jndiName = jndiName;
+ this.props = props;
+ }
+
+ /*
+ * @see ILaunchable#getId()
+ */
+ public String getId() {
+ return ID;
+ }
+
+ public Properties getProperties() {
+ return props;
+ }
+
+ public String getJNDIName() {
+ return jndiName;
+ }
+
+ public String getServer() {
+ return server;
+ }
+
+ public int getHTTPPort() {
+ return port;
+ }
+}
\ No newline at end of file
diff --git a/plugins/org.eclipse.jst.server.core/sjavacore/org/eclipse/jst/server/j2ee/JndiObject.java b/plugins/org.eclipse.jst.server.core/sjavacore/org/eclipse/jst/server/j2ee/JndiObject.java
new file mode 100644
index 0000000..3161ec3
--- /dev/null
+++ b/plugins/org.eclipse.jst.server.core/sjavacore/org/eclipse/jst/server/j2ee/JndiObject.java
@@ -0,0 +1,40 @@
+/**********************************************************************
+ * Copyright (c) 2003 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * IBM - Initial API and implementation
+ **********************************************************************/
+package org.eclipse.jst.server.j2ee;
+
+import org.eclipse.wst.server.core.model.IModule;
+import org.eclipse.wst.server.core.model.IModuleObject;
+/**
+ *
+ */
+public class JndiObject implements IModuleObject {
+ public static final String ID = "org.eclipse.jst.server.j2ee.jndi";
+
+ private IModule module;
+ private String jndiName;
+
+ public JndiObject(IModule module, String jndiName) {
+ this.module = module;
+ this.jndiName = jndiName;
+ }
+
+ public String getId() {
+ return ID;
+ }
+
+ public IModule getModule() {
+ return module;
+ }
+
+ public String getJndiName() {
+ return jndiName;
+ }
+}
diff --git a/plugins/org.eclipse.jst.server.core/sjavacore/org/eclipse/jst/server/j2ee/Servlet.java b/plugins/org.eclipse.jst.server.core/sjavacore/org/eclipse/jst/server/j2ee/Servlet.java
new file mode 100644
index 0000000..b4a05fc
--- /dev/null
+++ b/plugins/org.eclipse.jst.server.core/sjavacore/org/eclipse/jst/server/j2ee/Servlet.java
@@ -0,0 +1,50 @@
+/**********************************************************************
+ * Copyright (c) 2003 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * IBM - Initial API and implementation
+ **********************************************************************/
+package org.eclipse.jst.server.j2ee;
+
+import org.eclipse.wst.server.core.model.IModule;
+import org.eclipse.wst.server.core.model.IModuleObject;
+/**
+ *
+ */
+public class Servlet implements IModuleObject {
+ public static final String ID = "org.eclipse.jst.server.j2ee.servlet";
+
+ private IModule module;
+ private String className;
+ private String alias;
+
+ public Servlet(IModule module, String className, String alias) {
+ this.module = module;
+ this.className = className;
+ this.alias = alias;
+ }
+
+ public String getId() {
+ return ID;
+ }
+
+ public IModule getModule() {
+ return module;
+ }
+
+ public String getServletClassName() {
+ return className;
+ }
+
+ public String getAlias() {
+ return alias;
+ }
+
+ public String toString() {
+ return "Servlet [module=" + module + ", class=" + className + ", alias=" + alias + "]";
+ }
+}
diff --git a/plugins/org.eclipse.jst.server.core/sjavacore/org/eclipse/jst/server/j2ee/WebResource.java b/plugins/org.eclipse.jst.server.core/sjavacore/org/eclipse/jst/server/j2ee/WebResource.java
new file mode 100644
index 0000000..4118747
--- /dev/null
+++ b/plugins/org.eclipse.jst.server.core/sjavacore/org/eclipse/jst/server/j2ee/WebResource.java
@@ -0,0 +1,46 @@
+/**********************************************************************
+ * Copyright (c) 2003 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * IBM - Initial API and implementation
+ **********************************************************************/
+package org.eclipse.jst.server.j2ee;
+
+import org.eclipse.core.runtime.IPath;
+
+import org.eclipse.wst.server.core.model.IModule;
+import org.eclipse.wst.server.core.model.IModuleObject;
+/**
+ *
+ */
+public class WebResource implements IModuleObject {
+ public static final String ID = "org.eclipse.jst.server.j2ee.webresource";
+
+ private IModule module;
+ private IPath path;
+
+ public WebResource(IModule module, IPath path) {
+ this.module = module;
+ this.path = path;
+ }
+
+ public String getId() {
+ return ID;
+ }
+
+ public IModule getModule() {
+ return module;
+ }
+
+ public IPath getPath() {
+ return path;
+ }
+
+ public String toString() {
+ return "WebResource [module=" + module + ", path=" + path + "]";
+ }
+}