org.eclipse.wst.server.core.IServerWorkingCopy Java Examples

The following examples show how to use org.eclipse.wst.server.core.IServerWorkingCopy. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: BOSWebServerManager.java    From bonita-studio with GNU General Public License v2.0 6 votes vote down vote up
protected IServer configureServer(final IRuntime runtime, final IServerType sType, final IFile file,
        final IFolder configurationFolder,
        final IProgressMonitor monitor)
        throws CoreException {
    final IServer server = ServerCore.findServer(BONITA_TOMCAT_SERVER_ID);
    IServerWorkingCopy serverWC = null;
    if (server != null) {
        serverWC = server.createWorkingCopy();
    }
    if (serverWC == null) {
        serverWC = sType.createServer(BONITA_TOMCAT_SERVER_ID, file, runtime, monitor);
    }
    serverWC.setServerConfiguration(configurationFolder);
    serverWC.setAttribute(ITomcatServer.PROPERTY_INSTANCE_DIR,
            tomcatInstanceLocation);
    serverWC.setAttribute(ITomcatServer.PROPERTY_DEPLOY_DIR,
            tomcatInstanceLocation + File.separatorChar + "webapps");
    serverWC.setAttribute(START_TIMEOUT, 300);
    return serverWC.save(true, monitor);
}
 
Example #2
Source File: LocalAppEngineServerDelegateTest.java    From google-cloud-eclipse with Apache License 2.0 5 votes vote down vote up
private LocalAppEngineServerDelegate getDelegateWithServer() throws CoreException {
  IServerWorkingCopy serverWorkingCopy =
      ServerCore.findServerType("com.google.cloud.tools.eclipse.appengine.standard.server")
        .createServer("testServer", null, null);
  IRuntimeWorkingCopy runtimeWorkingCopy =
      ServerCore.findRuntimeType("com.google.cloud.tools.eclipse.appengine.standard.runtime")
        .createRuntime("testRuntime", null);
  IRuntime runtime = runtimeWorkingCopy.save(true, null);
  serverWorkingCopy.setRuntime(runtime);
  IServer original = serverWorkingCopy.save(true, null);
  return LocalAppEngineServerDelegate.getAppEngineServer(original);
}
 
Example #3
Source File: LocalAppEnginePublishOperationTest.java    From google-cloud-eclipse with Apache License 2.0 5 votes vote down vote up
/**
 * Verify that multi-web-module works.
 */
@Test
public void testPublishingSubmodules() throws CoreException {
  IServerType serverType =
      ServerCore.findServerType("com.google.cloud.tools.eclipse.appengine.standard.server");
  IServerWorkingCopy serverWorkingCopy =
      serverType.createServer(getClass().getName(), null, null);
  serverWorkingCopy.modifyModules(new IModule[] {serverModule}, null, null);
  server = serverWorkingCopy.saveAll(true, null);
  assertTrue(server.canPublish().isOK());
  assertTrue("publish failed", server.publish(IServer.PUBLISH_CLEAN, null).isOK());

  LocalAppEngineServerBehaviour serverBehaviour =
      server.getAdapter(LocalAppEngineServerBehaviour.class);
  assertNotNull(serverBehaviour);

  // now verify the result
  IPath deployDirectory = serverBehaviour.getModuleDeployDirectory(serverModule);
  File publishedModule = deployDirectory.toFile();
  assertTrue(publishedModule.isDirectory());
  File webInf = new File(publishedModule, "WEB-INF");
  assertTrue(webInf.isDirectory());

  assertTrue(new File(webInf, "appengine-web.xml").isFile());
  assertTrue(new File(webInf, "web.xml").isFile());
  assertTrue(new File(webInf, "classes/sox/server/GreetingServiceImpl.class").isFile());
  assertTrue(new File(webInf, "lib/servlet-2.5.jar").isFile());
  assertTrue(new File(webInf, "lib/sox-shared.jar").isFile());
}
 
Example #4
Source File: LaunchHelper.java    From google-cloud-eclipse with Apache License 2.0 5 votes vote down vote up
private IServer createServer(IModule[] modules, SubMonitor progress) throws CoreException {
  IServerType serverType = ServerCore.findServerType(LocalAppEngineServerDelegate.SERVER_TYPE_ID);
  IServerWorkingCopy serverWorkingCopy =
      serverType.createServer(null, null, progress.newChild(4));
  serverWorkingCopy.modifyModules(modules, null, progress.newChild(4));
  return serverWorkingCopy.save(false, progress.newChild(2));
}
 
Example #5
Source File: PortConfigurator.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
private void updatePort(final ServerPort serverPort, final int newPort, final IProgressMonitor monitor)
        throws CoreException {
    BonitaStudioLog.debug(
            String.format("Unable to use port %s for %s, port %s will be used instead.", serverPort.getPort(),
                    serverPort.getName(), newPort),
            EnginePlugin.PLUGIN_ID);
    final IServerWorkingCopy workingCopy = server.createWorkingCopy();
    final TomcatServer loadAdapter = (TomcatServer) workingCopy.loadAdapter(TomcatServer.class, monitor);
    final TomcatConfiguration configuration = loadAdapter.getTomcatConfiguration();
    configuration.modifyServerPort(serverPort.getId(), newPort);
    workingCopy.saveAll(true, monitor);
}
 
Example #6
Source File: ApplyDefaultCQServerValuesFragment.java    From aem-eclipse-developer-tools with Apache License 2.0 3 votes vote down vote up
@Override
public void performFinish(IProgressMonitor monitor) throws CoreException {

    IServer server = (IServer) getTaskModel().getObject(TaskModel.TASK_SERVER);
    if (server instanceof IServerWorkingCopy) {
        IServerWorkingCopy wc = (IServerWorkingCopy) server;

        wc.setAttribute(ISlingLaunchpadServer.PROP_PORT, DefaultCQLaunchpadConfiguration.INSTANCE.getPort());
        
        wc.save(true, monitor);
    }

}