use of org.eclipse.wst.server.core.internal.Server in project webtools.servertools by eclipse.
the class ServerTransfer method javaToNative.
/* (non-Javadoc)
* @see org.eclipse.swt.dnd.Transfer#javaToNative(java.lang.Object, org.eclipse.swt.dnd.TransferData)
*/
protected void javaToNative(Object data, TransferData transferData) {
if (!(data instanceof IServer[]))
return;
IServer[] servers = (IServer[]) data;
try {
ByteArrayOutputStream out = new ByteArrayOutputStream();
XMLMemento memento = XMLMemento.createWriteRoot("servers");
// write each element
for (int i = 0; i < servers.length; i++) {
IMemento child = memento.createChild("server");
((Server) servers[i]).serialize(child);
}
memento.save(out);
// cleanup
out.close();
byte[] bytes = out.toByteArray();
super.javaToNative(bytes, transferData);
} catch (IOException e) {
// it's best to send nothing if there were problems
}
}
use of org.eclipse.wst.server.core.internal.Server in project webtools.servertools by eclipse.
the class StopAction method stop.
public static void stop(IServer server, Shell shell) {
// TODO - should redo
ServerUIPlugin.addTerminationWatch(shell, server, ServerUIPlugin.STOP);
IJobManager jobManager = Job.getJobManager();
Job[] jobs = jobManager.find(ServerUtil.SERVER_JOB_FAMILY);
for (Job j : jobs) {
if (j instanceof Server.StartJob) {
Server.StartJob startJob = (Server.StartJob) j;
if (startJob.getServer().equals(server)) {
startJob.cancel();
return;
}
}
}
server.stop(false);
}
use of org.eclipse.wst.server.core.internal.Server in project webtools.servertools by eclipse.
the class AbstractTomcatServerTestCase method verifyLegacyDeployConfig.
/**
* Verify configuration when deployment directory is unset.
* Deployment directory should default to "webapps".
* @throws Exception
*/
public void verifyLegacyDeployConfig() throws Exception {
TomcatServer ts = getTomcatServer();
assertNotNull(ts);
ts.setDeployDirectory("webapps");
TomcatServerBehaviour tsb = getTomcatServerBehaviour();
assertNotNull(tsb);
assertEquals("webapps", ts.getDeployDirectory());
// Verify that legacy setting results in attribute removal
Server svr = (Server) getServer().loadAdapter(Server.class, null);
assertNotNull(svr);
String attr = svr.getAttribute("webapps", (String) null);
assertNull(attr);
IPath tempDir = tsb.getTempDirectory();
IPath baseDir = tsb.getRuntimeBaseDirectory();
assertEquals(tempDir, baseDir);
IPath deployDir = tsb.getServerDeployDirectory();
assertEquals(baseDir.append("webapps"), deployDir);
}
Aggregations