Examples of IServerWorkingCopy


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

        if (!ServerUtil.containsModule(server, modules[0], monitor)) {
          add = new IModule[] { modules[0] };
        }
        else {
          // Delete them first
          IServerWorkingCopy wc = server.createWorkingCopy();
          wc.modifyModules(null, modules, monitor);
          wc.save(true, null);
          cloudServer.getBehaviour().refreshModules(monitor);

          new WaitWithProgressJob(5, 1000) {

            @Override
            protected boolean internalRunInWait(IProgressMonitor monitor) throws CoreException {
              boolean found = cloudServer.getExistingCloudModule(modules[0]) != null;
              if (found) {
                cloudServer.getBehaviour().refreshModules(monitor);
              }
              // If the app has been found, try again until it
              // is not found
              return !found;
            }

          }.run(monitor);

          // Create new ones
          IModule[] newModules = ServerUtil.getModules(project);
          if (newModules != null && newModules.length == 1) {
            add = new IModule[] { newModules[0] };
          }
        }
        if (add != null && add.length > 0) {
          IServerWorkingCopy wc = server.createWorkingCopy();
          wc = server.createWorkingCopy();
          IStatus status = wc.canModifyModules(add, null, null);
          if (status.getSeverity() != IStatus.ERROR) {
            CloudFoundryPlugin.getModuleCache().getData(wc.getOriginal())
                .tagForAutomaticRepublish(new RepublishModule(add[0], appModule.getDeploymentInfo()));

            // publish the module
            wc.modifyModules(add, null, monitor);
            wc.save(true, null);
            republished = true;
          }
          else {
            throw new CoreException(status);
          }
View Full Code Here

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

    }
    super.saveConfiguration(monitor);
  }

  public IStatus doDeleteModules(final Collection<IModule> deletedModules) {
    IServerWorkingCopy wc = getServer().createWorkingCopy();
    try {
      deleteServicesOnModuleRemove.set(Boolean.FALSE);
      wc.modifyModules(null, deletedModules.toArray(new IModule[deletedModules.size()]), null);
      wc.save(true, null);
    }
    catch (CoreException e) {
      // log error to avoid pop-up dialog
      CloudFoundryPlugin
          .getDefault()
View Full Code Here

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

public class UpdatePasswordCommand extends BaseCommandHandler {

  public Object execute(ExecutionEvent event) throws ExecutionException {
    initializeSelection(event);
    IServerWorkingCopy wc = selectedServer.createWorkingCopy();
    final CloudFoundryServer cfServer = (CloudFoundryServer) wc.loadAdapter(CloudFoundryServer.class, null);
    final UpdatePasswordDialog dialog = new UpdatePasswordDialog(Display.getDefault().getActiveShell(), cfServer.getUsername());
   
    if (dialog.open() == IDialogConstants.OK_ID) {
      String errorMsg = CloudUiUtil.updatePassword(dialog.getPassword(), cfServer, wc);
      if (errorMsg != null) {
View Full Code Here

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

    try {
      monitor.beginTask("Launching " + project.getName(), IProgressMonitor.UNKNOWN); //$NON-NLS-1$

      IServer server = createServer(new SubProgressMonitor(monitor, 1), NEVER_OVERWRITE);

      IServerWorkingCopy wc = server.createWorkingCopy();
      IModule[] modules = ServerUtil.getModules(project);
      if (modules == null || modules.length == 0) {
        throw new CoreException(
            CloudFoundryPlugin.getErrorStatus("Sample project does not contain web modules: " + project)); //$NON-NLS-1$
      }

      if (!Arrays.asList(wc.getModules()).contains(modules[0])) {
        wc.modifyModules(modules, new IModule[0], monitor);
        server = wc.save(true, monitor);
      }
      server.publish(IServer.PUBLISH_INCREMENTAL, monitor);

      restartServer(server, monitor);
View Full Code Here

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

          serverConfiguration.delete(true, true, monitor);
        }
      }
    }

    IServerWorkingCopy wc = st.createServer(serverName, null, runtime, new SubProgressMonitor(monitor, 1));
    wc.setName(serverName);
    if (callback != null) {
      callback.configureServer(wc);
    }
    server = wc.save(true, new SubProgressMonitor(monitor, 1));
    return server;
  }
View Full Code Here

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

    public void addModule(IProject project) throws CoreException {
      Assert.isNotNull(server, "Invoke createServer() first");

      IModule[] modules = ServerUtil.getModules(project);
      IServerWorkingCopy wc = server.createWorkingCopy();
      wc.modifyModules(modules, new IModule[0], null);
      wc.save(true, null);
    }
View Full Code Here

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

    public IServer createServer() throws CoreException {
      Assert.isTrue(server == null, "createServer() already invoked");

      server = handler.createServer(new NullProgressMonitor(), ServerHandler.ALWAYS_OVERWRITE);
      IServerWorkingCopy serverWC = server.createWorkingCopy();
      CloudFoundryServer cloudFoundryServer = (CloudFoundryServer) serverWC.loadAdapter(CloudFoundryServer.class,
          null);
      CredentialProperties credentials = getCredentials();
      cloudFoundryServer.setPassword(credentials.password);
      cloudFoundryServer.setUsername(credentials.userEmail);

      cloudFoundryServer.setUrl(getUrl());

      setDefaultCloudSpace(cloudFoundryServer, credentials.organization, credentials.space);

      serverWC.save(true, null);
      return server;
    }
View Full Code Here

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

      try {
                // TODO there should be a nicer API for creating this, and also a central place for defaults
                // TODO - we should not be creating runtimes, but maybe matching against existing ones
                IRuntime runtime = serverRuntime.createRuntime(null, monitor);
                runtime = runtime.createWorkingCopy().save(true, monitor);
                IServerWorkingCopy wc = serverType.createServer(null, null, runtime, monitor);
        wc.setHost(getHostname());
                wc.setName(newServerName.getText());
        wc.setAttribute(ISlingLaunchpadServer.PROP_PORT, getPort());
        wc.setAttribute(ISlingLaunchpadServer.PROP_DEBUG_PORT, Integer.parseInt(newServerDebugPort.getText()));
                wc.setAttribute(ISlingLaunchpadServer.PROP_INSTALL_LOCALLY, installToolingSupportBundle.getSelection());
                wc.setAttribute(ISlingLaunchpadServer.PROP_USERNAME, newServerUsername.getText());
                wc.setAttribute(ISlingLaunchpadServer.PROP_PASSWORD, newServerPassword.getText());
                wc.setAttribute("auto-publish-time", 0);
                if (finalVersion != null) {
                    wc.setAttribute(String.format(ISlingLaunchpadServer.PROP_BUNDLE_VERSION_FORMAT,
                        EmbeddedArtifactLocator.SUPPORT_BUNDLE_SYMBOLIC_NAME), finalVersion.toString());
                }
        wc.setRuntime(runtime);
                server = wc.save(true, monitor);
                return server;
      } catch (CoreException e) {
                throw new CoreException(new Status(IStatus.ERROR, Activator.PLUGIN_ID,
                        "Failed creating the new server instance", e));
View Full Code Here

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

            public IModule call() throws Exception {
                return ServerUtil.getModule(project);
            }
        }, notNullValue(IModule.class));

        IServerWorkingCopy serverWorkingCopy = server.createWorkingCopy();
        serverWorkingCopy.modifyModules(new IModule[] { bundleModule }, new IModule[0], new NullProgressMonitor());
        serverWorkingCopy.save(false, new NullProgressMonitor());

    }
View Full Code Here

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

    }

    public void setAttribute(String name, boolean value) throws CoreException {

        IServerWorkingCopy serverWorkingCopy = server.createWorkingCopy();
        serverWorkingCopy.setAttribute(name, value);
        serverWorkingCopy.save(false, new NullProgressMonitor());
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.