use of org.eclipse.jst.server.generic.core.internal.GenericServerRuntime in project webtools.servertools by eclipse.
the class GenericServerWizardFragment method getServerTypeDefinitionFor.
/**
* @param server
* @return
*/
private ServerRuntime getServerTypeDefinitionFor(IServerWorkingCopy server) {
GenericServerRuntime runtime = (GenericServerRuntime) server.getRuntime().getAdapter(GenericServerRuntime.class);
if (runtime == null) {
IRuntime wc = (IRuntime) getTaskModel().getObject(TaskModel.TASK_RUNTIME);
runtime = (GenericServerRuntime) wc.getAdapter(GenericServerRuntime.class);
if (runtime == null)
runtime = (GenericServerRuntime) wc.loadAdapter(GenericServerRuntime.class, new NullProgressMonitor());
}
String serverTyepId = server.getServerType().getId();
String runtimeTypeId = runtime.getRuntime().getRuntimeType().getId();
if (runtimeTypeId == null) {
return null;
}
Map runtimeProperties = runtime.getServerInstanceProperties();
ServerRuntime definition = getServerTypeDefinition(serverTyepId, runtimeTypeId, runtimeProperties);
return definition;
}
use of org.eclipse.jst.server.generic.core.internal.GenericServerRuntime in project webtools.servertools by eclipse.
the class GenericServerTest method testServerAndRuntimeInfoForServerDefOnly.
public void testServerAndRuntimeInfoForServerDefOnly() throws Exception {
GenericServerRuntime runtime = ServerRuntimeUtils.getGenericServerRuntime(TEST_SERVERDEFONLY_RUNTIMETYPE_ID);
GenericServer server = ServerRuntimeUtils.getGenericServer(TEST_SERVERDEFONLY_SERVERTYPE_ID, runtime.getRuntime());
assertNotNull(server);
ServerRuntime serverRuntime = server.getServerDefinition();
// Verify Server and Runtime info
ServerRuntimeUtils.verifyProperty(serverRuntime.getProperty(), "foo.prop.a", "a runtime property value");
ServerRuntimeUtils.verifyProperty(serverRuntime.getProperty(), "foo.prop.b", "a server property value");
ServerRuntimeUtils.verifyClasspath(serverRuntime.getClasspath(), "foo.classpath");
}
use of org.eclipse.jst.server.generic.core.internal.GenericServerRuntime in project webtools.servertools by eclipse.
the class ServerRuntimeUtils method getGenericServerRuntime.
public static GenericServerRuntime getGenericServerRuntime(String runtimeTypeId) throws CoreException {
GenericServerRuntime runtimeDelegate = null;
IRuntimeType[] runtimesTypes = ServerCore.getRuntimeTypes();
for (int i = 0; i < runtimesTypes.length; i++) {
IRuntimeType runtimeType = runtimesTypes[i];
if (runtimeType.getId().equals(runtimeTypeId)) {
IRuntime runtimeWorkingCopy = runtimeType.createRuntime(runtimeTypeId, null);
runtimeDelegate = (GenericServerRuntime) runtimeWorkingCopy.loadAdapter(GenericServerRuntime.class, new NullProgressMonitor());
break;
}
}
return runtimeDelegate;
}
use of org.eclipse.jst.server.generic.core.internal.GenericServerRuntime in project webtools.servertools by eclipse.
the class GenericServerRuntimeTest method testServerAndRuntimeInfo.
/**
* runtimeTypeId used as key to .serverdef
*/
public void testServerAndRuntimeInfo() throws Exception {
GenericServerRuntime runtime = ServerRuntimeUtils.getGenericServerRuntime(TEST_SERVERDEFONLY_RUNTIMETYPE_ID);
assertNotNull(runtime);
ServerRuntime serverRuntime = runtime.getServerTypeDefinition();
assertNotNull(serverRuntime);
// Verify runtime info, and server info
ServerRuntimeUtils.verifyProperty(serverRuntime.getProperty(), "foo.prop.a", "a runtime property value");
ServerRuntimeUtils.verifyProperty(serverRuntime.getProperty(), "foo.prop.b", "a server property value");
}
use of org.eclipse.jst.server.generic.core.internal.GenericServerRuntime in project webtools.servertools by eclipse.
the class GenericServerClasspathRuntimeHandlerTest method setUp.
/*
* @see TestCase#setUp()
*/
protected void setUp() throws Exception {
super.setUp();
IRuntimeType type = ServerCore.findRuntimeType("org.eclipse.jst.server.generic.runtime.jonas4");
IRuntimeWorkingCopy wc = type.createRuntime("testRuntime", null);
GenericServerRuntime delegate = (GenericServerRuntime) wc.loadAdapter(GenericServerRuntime.class, new NullProgressMonitor());
HashMap props = new HashMap();
props.put("mappernames", "");
props.put("classPathVariableName", "JONAS");
props.put("serverAddress", "127.0.0.1");
props.put("jonasBase", SERVER_ROOT);
props.put("jonasRoot", SERVER_ROOT);
props.put("protocols", "jrmp");
props.put("port", "9000");
delegate.setServerInstanceProperties(props);
delegate.setServerDefinitionId(SERVER_DEF_NAME);
wc.save(false, null);
fRuntime = wc.getOriginal();
}
Aggregations