Index: servercore/org/eclipse/wst/server/core/ServerCore.java =================================================================== RCS file: /cvsroot/webtools/servertools/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/ServerCore.java,v retrieving revision 1.39 diff -u -r1.39 ServerCore.java --- servercore/org/eclipse/wst/server/core/ServerCore.java 4 Mar 2008 22:41:08 -0000 1.39 +++ servercore/org/eclipse/wst/server/core/ServerCore.java 17 Oct 2008 14:38:40 -0000 @@ -10,11 +10,27 @@ **********************************************************************/ package org.eclipse.wst.server.core; -import java.util.*; +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.wst.server.core.internal.*; +import org.eclipse.core.runtime.CoreException; +import org.eclipse.core.runtime.IConfigurationElement; +import org.eclipse.core.runtime.IExtensionDelta; +import org.eclipse.core.runtime.IExtensionRegistry; +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.core.runtime.IRegistryChangeEvent; +import org.eclipse.core.runtime.IRegistryChangeListener; +import org.eclipse.core.runtime.Platform; +import org.eclipse.wst.server.core.internal.ModuleProperties; +import org.eclipse.wst.server.core.internal.ModuleType; +import org.eclipse.wst.server.core.internal.ResourceManager; +import org.eclipse.wst.server.core.internal.RuntimeType; +import org.eclipse.wst.server.core.internal.ServerPlugin; +import org.eclipse.wst.server.core.internal.ServerPreferences; +import org.eclipse.wst.server.core.internal.ServerType; +import org.eclipse.wst.server.core.internal.Trace; /** * Main class for server core API. *

@@ -32,6 +48,7 @@ public final class ServerCore { private static final String EXTENSION_SERVER_TYPE = "serverTypes"; private static final String EXTENSION_RUNTIME_TYPE = "runtimeTypes"; + private static final String EXTENSION_RUNTIME_SUPPORTEDMODULE_TYPE = "RuntimeSupportedModuleType"; // cached copy of all runtime types private static List runtimeTypes; @@ -190,6 +207,8 @@ IConfigurationElement[] cf = registry.getConfigurationElementsFor(ServerPlugin.PLUGIN_ID, EXTENSION_RUNTIME_TYPE); List list = new ArrayList(cf.length); addRuntimeTypes(cf, list); + cf = registry.getConfigurationElementsFor(ServerPlugin.PLUGIN_ID, EXTENSION_RUNTIME_SUPPORTEDMODULE_TYPE); + addRuntimeSupportedModuleTypes(cf, list); addRegistryListener(); runtimeTypes = list; @@ -197,6 +216,24 @@ } /** + * Load the loose Module Types. + */ + private static synchronized void addRuntimeSupportedModuleTypes(IConfigurationElement[] cf, List list) { + for (IConfigurationElement ce : cf) { + try { + IRuntimeType runtimeType = findRuntimeType(ce.getAttribute("runtimeType")); + if (runtimeType != null){ + IModuleType moduleType = new ModuleType(ce.getAttribute("moduleType"),ce.getAttribute("version")); + ((RuntimeType)runtimeType).addModuleType(moduleType); + } + Trace.trace(Trace.EXTENSION_POINT, " Loaded Runtime supported ModuleType: " + ce.getAttribute("id")); + } catch (Throwable t) { + Trace.trace(Trace.SEVERE, " Could not load Runtime supported ModuleType: " + ce.getAttribute("id"), t); + } + } + } + + /** * Load the runtime types. */ private static synchronized void addRuntimeTypes(IConfigurationElement[] cf, List list) { Index: servercore/org/eclipse/wst/server/core/internal/RuntimeType.java =================================================================== RCS file: /cvsroot/webtools/servertools/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/internal/RuntimeType.java,v retrieving revision 1.15 diff -u -r1.15 RuntimeType.java --- servercore/org/eclipse/wst/server/core/internal/RuntimeType.java 29 Aug 2007 14:18:33 -0000 1.15 +++ servercore/org/eclipse/wst/server/core/internal/RuntimeType.java 17 Oct 2008 14:38:40 -0000 @@ -15,7 +15,12 @@ import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.IConfigurationElement; import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.wst.server.core.*; +import org.eclipse.core.runtime.IStatus; +import org.eclipse.core.runtime.Status; +import org.eclipse.wst.server.core.IModuleType; +import org.eclipse.wst.server.core.IRuntimeType; +import org.eclipse.wst.server.core.IRuntimeWorkingCopy; +import org.eclipse.wst.server.core.ServerUtil; import org.eclipse.wst.server.core.model.RuntimeDelegate; /** * @@ -128,6 +133,21 @@ return new IModuleType[0]; } } + + /** + * Adds a Loose ModuleType to this runtime + * @param moduleType + * @throws CoreException if the moduleType is null or if already added + */ + public void addModuleType(IModuleType moduleType) throws CoreException{ + if (moduleType == null) + throw new CoreException(new Status(IStatus.ERROR,ServerPlugin.PLUGIN_ID,"Invalid moduleType")); + + if (moduleTypes.contains(moduleType)) + throw new CoreException(new Status(IStatus.ERROR,ServerPlugin.PLUGIN_ID,"Invalid moduleType")); + + moduleTypes.add(moduleType); + } public boolean canCreate() { try {