use of org.eclipse.wst.server.core.IRuntimeType in project webtools.servertools by eclipse.
the class MatchesTestCase method testMatches.
public void testMatches() {
IRuntimeType rt = ServerCore.getRuntimeTypes()[0];
System.out.println("Runtime: " + rt.getName());
IModuleType[] mt = rt.getModuleTypes();
for (int i = 0; i < NUM; i++) {
ServerUtil.isSupportedModule(mt, "jst.web", "2.4");
}
long time = System.currentTimeMillis();
for (int i = 0; i < NUM; i++) {
ServerUtil.isSupportedModule(mt, "jst.web", "2.4");
}
System.out.println("Time: " + (System.currentTimeMillis() - time));
time = System.currentTimeMillis();
for (int i = 0; i < NUM; i++) {
ServerUtil.isSupportedModule(mt, "jst.*", "2.*");
}
System.out.println("Time2: " + (System.currentTimeMillis() - time));
time = System.currentTimeMillis();
for (int i = 0; i < NUM; i++) {
ServerUtil.isSupportedModule(mt, "*", "2.4");
}
System.out.println("Time3: " + (System.currentTimeMillis() - time));
}
use of org.eclipse.wst.server.core.IRuntimeType in project webtools.servertools by eclipse.
the class RuntimeTypesTestCase method testRuntimeTypesExtension.
public void testRuntimeTypesExtension() throws Exception {
IRuntimeType[] runtimeTypes = ServerCore.getRuntimeTypes();
if (runtimeTypes != null) {
for (IRuntimeType runtimeType : runtimeTypes) {
runtimeType.getId();
runtimeType.getName();
runtimeType.canCreate();
runtimeType.getDescription();
runtimeType.getVendor();
runtimeType.getVersion();
runtimeType.getModuleTypes();
}
}
}
use of org.eclipse.wst.server.core.IRuntimeType in project webtools.servertools by eclipse.
the class TomcatRuntime method setDefaults.
/**
* @see RuntimeDelegate#setDefaults(IProgressMonitor)
*/
public void setDefaults(IProgressMonitor monitor) {
IRuntimeType type = getRuntimeWorkingCopy().getRuntimeType();
Path p = new Path(TomcatPlugin.getPreference("location" + type.getId()));
if (p != null && p.toFile().exists() && verifyLocation(p).isOK())
getRuntimeWorkingCopy().setLocation(p);
}
use of org.eclipse.wst.server.core.IRuntimeType in project webtools.servertools by eclipse.
the class PreviewStartup method startup.
public void startup() {
// create runtime
IRuntime[] runtimes = ServerCore.getRuntimes();
IRuntime runtime = null;
for (IRuntime r : runtimes) {
if (r.getRuntimeType() != null && PreviewRuntime.ID.equals(r.getRuntimeType().getId())) {
if (ID.equals(r.getId()))
runtime = r;
}
}
if (runtime == null) {
try {
IRuntimeType runtimeType = ServerCore.findRuntimeType(PreviewRuntime.ID);
IRuntimeWorkingCopy wc = runtimeType.createRuntime(ID, null);
wc.setName("My Preview");
wc.setReadOnly(true);
runtime = wc.save(true, null);
} catch (CoreException ce) {
Trace.trace(Trace.WARNING, "Could not create default preview runtime");
}
}
// create server
IServer[] servers = ServerCore.getServers();
boolean found = false;
for (IServer s : servers) {
if (s.getServerType() != null && PreviewServer.ID.equals(s.getServerType().getId())) {
if (ID.equals(s.getId()))
found = true;
}
}
if (!found) {
try {
IServerType serverType = ServerCore.findServerType(PreviewServer.ID);
IServerWorkingCopy wc = serverType.createServer(ID, null, runtime, null);
wc.setName("My preview");
wc.setHost("localhost");
wc.setReadOnly(true);
wc.save(true, null);
} catch (CoreException ce) {
Trace.trace(Trace.WARNING, "Could not create default preview server");
}
}
}
use of org.eclipse.wst.server.core.IRuntimeType in project webtools.servertools by eclipse.
the class PreviewServer method createPreviewServer.
public static IServer createPreviewServer(String serverName) {
try {
NullProgressMonitor monitor = new NullProgressMonitor();
IRuntimeType runtimeType = ServerCore.findRuntimeType(PreviewRuntime.ID);
IRuntimeWorkingCopy runtimeCopy = runtimeType.createRuntime(PreviewRuntime.ID, monitor);
IRuntime runtime = runtimeCopy.save(true, monitor);
IServerType serverType = ServerCore.findServerType(ID);
IServerWorkingCopy workingCopy = serverType.createServer(ID, null, runtime, monitor);
workingCopy.setName(serverName);
workingCopy.setHost("localhost");
return workingCopy.save(true, monitor);
} catch (Exception e) {
Trace.trace(Trace.SEVERE, "Error creating server", e);
}
return null;
}
Aggregations