Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
View | Details | Raw Unified | Return to bug 249531 | Differences between
and this patch

Collapse All | Expand All

(-)servercore/org/eclipse/wst/server/core/ServerCore.java (-3 / +40 lines)
Lines 10-20 Link Here
10
 **********************************************************************/
10
 **********************************************************************/
11
package org.eclipse.wst.server.core;
11
package org.eclipse.wst.server.core;
12
12
13
import java.util.*;
13
import java.util.ArrayList;
14
import java.util.Iterator;
15
import java.util.List;
14
16
15
import org.eclipse.core.resources.IProject;
17
import org.eclipse.core.resources.IProject;
16
import org.eclipse.core.runtime.*;
18
import org.eclipse.core.runtime.CoreException;
17
import org.eclipse.wst.server.core.internal.*;
19
import org.eclipse.core.runtime.IConfigurationElement;
20
import org.eclipse.core.runtime.IExtensionDelta;
21
import org.eclipse.core.runtime.IExtensionRegistry;
22
import org.eclipse.core.runtime.IProgressMonitor;
23
import org.eclipse.core.runtime.IRegistryChangeEvent;
24
import org.eclipse.core.runtime.IRegistryChangeListener;
25
import org.eclipse.core.runtime.Platform;
26
import org.eclipse.wst.server.core.internal.ModuleProperties;
27
import org.eclipse.wst.server.core.internal.ModuleType;
28
import org.eclipse.wst.server.core.internal.ResourceManager;
29
import org.eclipse.wst.server.core.internal.RuntimeType;
30
import org.eclipse.wst.server.core.internal.ServerPlugin;
31
import org.eclipse.wst.server.core.internal.ServerPreferences;
32
import org.eclipse.wst.server.core.internal.ServerType;
33
import org.eclipse.wst.server.core.internal.Trace;
18
/**
34
/**
19
 * Main class for server core API.
35
 * Main class for server core API.
20
 * <p>
36
 * <p>
Lines 32-37 Link Here
32
public final class ServerCore {
48
public final class ServerCore {
33
	private static final String EXTENSION_SERVER_TYPE = "serverTypes";
49
	private static final String EXTENSION_SERVER_TYPE = "serverTypes";
34
	private static final String EXTENSION_RUNTIME_TYPE = "runtimeTypes";
50
	private static final String EXTENSION_RUNTIME_TYPE = "runtimeTypes";
51
	private static final String EXTENSION_RUNTIME_SUPPORTEDMODULE_TYPE = "RuntimeSupportedModuleType";
35
52
36
	//	cached copy of all runtime types
53
	//	cached copy of all runtime types
37
	private static List<IRuntimeType> runtimeTypes;
54
	private static List<IRuntimeType> runtimeTypes;
Lines 190-195 Link Here
190
		IConfigurationElement[] cf = registry.getConfigurationElementsFor(ServerPlugin.PLUGIN_ID, EXTENSION_RUNTIME_TYPE);
207
		IConfigurationElement[] cf = registry.getConfigurationElementsFor(ServerPlugin.PLUGIN_ID, EXTENSION_RUNTIME_TYPE);
191
		List<IRuntimeType> list = new ArrayList<IRuntimeType>(cf.length);
208
		List<IRuntimeType> list = new ArrayList<IRuntimeType>(cf.length);
192
		addRuntimeTypes(cf, list);
209
		addRuntimeTypes(cf, list);
210
		cf = registry.getConfigurationElementsFor(ServerPlugin.PLUGIN_ID, EXTENSION_RUNTIME_SUPPORTEDMODULE_TYPE);
211
		addRuntimeSupportedModuleTypes(cf, list);
193
		addRegistryListener();
212
		addRegistryListener();
194
		runtimeTypes = list;
213
		runtimeTypes = list;
195
		
214
		
Lines 197-202 Link Here
197
	}
216
	}
198
217
199
	/**
218
	/**
219
	 * Load the loose Module Types.
220
	 */
221
	private static synchronized void addRuntimeSupportedModuleTypes(IConfigurationElement[] cf, List<IRuntimeType> list) {
222
		for (IConfigurationElement ce : cf) {
223
			try {
224
				IRuntimeType runtimeType = findRuntimeType(ce.getAttribute("runtimeType"));
225
				if (runtimeType != null){
226
					IModuleType moduleType = new ModuleType(ce.getAttribute("moduleType"),ce.getAttribute("version"));
227
					((RuntimeType)runtimeType).addModuleType(moduleType);
228
				}
229
				Trace.trace(Trace.EXTENSION_POINT, "  Loaded Runtime supported ModuleType: " + ce.getAttribute("id"));
230
			} catch (Throwable t) {
231
				Trace.trace(Trace.SEVERE, "  Could not load Runtime supported ModuleType: " + ce.getAttribute("id"), t);
232
			}
233
		}
234
	}
235
	
236
	/**
200
	 * Load the runtime types.
237
	 * Load the runtime types.
201
	 */
238
	 */
202
	private static synchronized void addRuntimeTypes(IConfigurationElement[] cf, List<IRuntimeType> list) {
239
	private static synchronized void addRuntimeTypes(IConfigurationElement[] cf, List<IRuntimeType> list) {
(-)servercore/org/eclipse/wst/server/core/internal/RuntimeType.java (-1 / +21 lines)
Lines 15-21 Link Here
15
import org.eclipse.core.runtime.CoreException;
15
import org.eclipse.core.runtime.CoreException;
16
import org.eclipse.core.runtime.IConfigurationElement;
16
import org.eclipse.core.runtime.IConfigurationElement;
17
import org.eclipse.core.runtime.IProgressMonitor;
17
import org.eclipse.core.runtime.IProgressMonitor;
18
import org.eclipse.wst.server.core.*;
18
import org.eclipse.core.runtime.IStatus;
19
import org.eclipse.core.runtime.Status;
20
import org.eclipse.wst.server.core.IModuleType;
21
import org.eclipse.wst.server.core.IRuntimeType;
22
import org.eclipse.wst.server.core.IRuntimeWorkingCopy;
23
import org.eclipse.wst.server.core.ServerUtil;
19
import org.eclipse.wst.server.core.model.RuntimeDelegate;
24
import org.eclipse.wst.server.core.model.RuntimeDelegate;
20
/**
25
/**
21
 * 
26
 * 
Lines 128-133 Link Here
128
			return new IModuleType[0];
133
			return new IModuleType[0];
129
		}
134
		}
130
	}
135
	}
136
	
137
	/**
138
	 * Adds a Loose ModuleType to this runtime  
139
	 * @param moduleType
140
	 * @throws CoreException if the moduleType is null or if already added
141
	 */
142
	public void addModuleType(IModuleType moduleType) throws CoreException{
143
		if (moduleType == null)
144
			throw new CoreException(new Status(IStatus.ERROR,ServerPlugin.PLUGIN_ID,"Invalid moduleType"));
145
		
146
		if (moduleTypes.contains(moduleType))
147
			throw new CoreException(new Status(IStatus.ERROR,ServerPlugin.PLUGIN_ID,"Invalid moduleType"));
148
		
149
		moduleTypes.add(moduleType);
150
	}
131
151
132
	public boolean canCreate() {
152
	public boolean canCreate() {
133
		try {
153
		try {

Return to bug 249531