Beispiel #1
0
  public static Object getRuntimeAdapter(
      org.eclipse.wst.common.project.facet.core.runtime.IRuntime facetRuntime,
      Class<?> adapterClass) {

    String runtimeId = facetRuntime.getProperty("id");

    for (org.eclipse.wst.server.core.IRuntime runtime : ServerCore.getRuntimes()) {
      if (runtime.getId().equals(runtimeId)) {

        if (IRuntime.class.equals(adapterClass)) {
          return runtime;
        }

        IRuntimeWorkingCopy runtimeWC = null;

        if (!runtime.isWorkingCopy()) {
          runtimeWC = runtime.createWorkingCopy();
        } else {
          runtimeWC = (IRuntimeWorkingCopy) runtime;
        }

        return (ILiferayRuntime) runtimeWC.loadAdapter(adapterClass, null);
      }
    }

    return null;
  }
 public void executeRemoteCommand(
     String initialWorkingDirectory,
     String command,
     String[] environment,
     IProgressMonitor monitor)
     throws CoreException {
   IServer s = ServerCore.findServer(serverId);
   IShellService service = findShellService(s);
   try {
     if (singleUseShell == null || !singleUseShell.isActive()) {
       singleUseShell = service.launchShell(initialWorkingDirectory, environment, monitor);
     } else if (initialWorkingDirectory != null) {
       // allow for a null working directory to ensure no command is run here
       singleUseShell.writeToShell("cd " + initialWorkingDirectory);
     }
     singleUseShell.writeToShell(command);
   } catch (RuntimeException re) {
     String className = service.getClass().getName();
     if (className.endsWith(".DStoreShellService")) {
       throw new CoreException(
           new Status(
               IStatus.ERROR,
               org.jboss.ide.eclipse.as.rse.core.RSECorePlugin.PLUGIN_ID,
               "no remote daemon installed. Please install a remote daemon or use an RSE server configured for ssh rather than dstore"));
     }
   } catch (SystemMessageException sme) {
     Status s2 =
         new Status(
             IStatus.ERROR,
             org.jboss.ide.eclipse.as.rse.core.RSECorePlugin.PLUGIN_ID,
             sme.getMessage(),
             sme);
     throw new CoreException(s2);
   }
 }
 @Override
 public Change createChange(IProgressMonitor pm) throws CoreException, OperationCanceledException {
   CompositeChange change = new CompositeChange(getName());
   ArrayList<IModule> tmpList;
   IServer[] allServers = ServerCore.getServers();
   for (int i = 0; i < allServers.length; i++) {
     IModule[] serversMods = allServers[i].getModules();
     tmpList = new ArrayList<IModule>();
     for (int j = 0; j < serversMods.length; j++) {
       if (serversMods[j].getProject() != null
           && serversMods[j].getProject().equals(projectToDelete)) {
         tmpList.add(serversMods[j]);
       }
     }
     IModule[] modsToRemove = tmpList.toArray(new IModule[tmpList.size()]);
     // If modsToRemove is empty, that means that the server does not have the affected project
     // deployed, or
     // the affected project is not a top-level module (for example, and EAR, or stand-alone WAR),
     // but we
     // need to check if the affected project is a child of a top-level module.
     if (modsToRemove.length > 0)
       change.add(new RemoveProjectFromServersChange(modsToRemove, allServers[i]));
     else if (hasParentInServer(projectToDelete, allServers[i], pm)) {
       change.add(new RefreshServerChange(allServers[i]));
     }
   }
   return change;
 }
 @Test
 public void testServerHomeSet() {
   assertNotNull(typeId);
   IServerType type = ServerCore.findServerType(typeId);
   if (type != null) {
     if (type.getRuntimeType() == null)
       fail("Server type " + typeId + " does not have an associated runtime");
     String rtType = type.getRuntimeType().getId();
     if (rtType == null) {
       fail("Runtime type for servertype " + typeId + " has a null id.");
     }
     assertTrue(Arrays.asList(IJBossToolingConstants.ALL_JBOSS_RUNTIMES).contains(rtType));
   } else {
     IRuntimeType t = ServerCore.findRuntimeType(typeId);
     assertNotNull(t);
     assertTrue(Arrays.asList(IJBossToolingConstants.ALL_JBOSS_RUNTIMES).contains(typeId));
   }
 }
Beispiel #5
0
  public static IServerWorkingCopy createServerForRuntime(IRuntime runtime) {
    for (IServerType serverType : ServerCore.getServerTypes()) {
      if (serverType.getRuntimeType().equals(runtime.getRuntimeType())) {
        try {
          return serverType.createServer("server", null, runtime, null);
        } catch (CoreException e) {
        }
      }
    }

    return null;
  }
Beispiel #6
0
  public static boolean isLiferayRuntime(BridgedRuntime bridgedRuntime) {
    if (bridgedRuntime != null) {
      String id = bridgedRuntime.getProperty("id");

      if (id != null) {
        IRuntime runtime = ServerCore.findRuntime(id);

        return isLiferayRuntime(runtime);
      }
    }

    return false;
  }
  protected void createInfoGroup(Composite parent) {
    new Label(parent, SWT.LEFT).setText(Msgs.liferayPluginTypeLabel);

    final Text pluginTypeLabel = new Text(parent, SWT.READ_ONLY | SWT.BORDER);
    pluginTypeLabel.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, false, 1, 1));

    final IProjectFacet liferayFacet = ProjectUtil.getLiferayFacet(getFacetedProject());

    if (liferayFacet != null) {
      pluginTypeLabel.setText(liferayFacet.getLabel());
    }

    new Label(parent, SWT.LEFT).setText(Msgs.liferayRuntimeLabel);

    this.runtimeCombo = new Combo(parent, SWT.DROP_DOWN | SWT.READ_ONLY);
    this.runtimeCombo.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, false, 1, 1));

    String currentRuntimeName = null;

    try {
      ILiferayRuntime liferayRuntime = ServerUtil.getLiferayRuntime(getProject());

      currentRuntimeName = liferayRuntime.getRuntime().getName();
    } catch (Exception e) {
      ProjectUIPlugin.logError("Could not determine liferay runtime", e); // $NON-NLS-1$
    }

    final List<String> runtimeNames = new ArrayList<String>();
    int selectionIndex = -1;

    for (IRuntime runtime : ServerCore.getRuntimes()) {
      if (ServerUtil.isLiferayRuntime(runtime)) {
        runtimeNames.add(runtime.getName());

        if (runtime.getName().equals(currentRuntimeName)) {
          selectionIndex = runtimeNames.size() - 1;
        }
      }
    }

    if (runtimeNames.size() == 0) {
      runtimeNames.add("No Liferay runtimes available."); // $NON-NLS-1$
    }

    this.runtimeCombo.setItems(runtimeNames.toArray(new String[0]));

    if (selectionIndex > -1) {
      this.runtimeCombo.select(selectionIndex);
    }
  }
  @Parameters
  public static Collection<Object[]> data() {
    IServerType[] servers = ServerCore.getServerTypes();
    IRuntimeType[] rtTypes = ServerCore.getRuntimeTypes();

    // add all server / runtime type id's
    ArrayList<String> collector = new ArrayList<String>();
    for (int i = 0; i < servers.length; i++) {
      if (servers[i].getId().startsWith(IJBossToolingConstants.EAP_SERVER_PREFIX)
          || servers[i].getId().startsWith(IJBossToolingConstants.SERVER_AS_PREFIX))
        collector.add(servers[i].getId());
    }
    for (int i = 0; i < rtTypes.length; i++) {
      if (rtTypes[i].getId().startsWith(IJBossToolingConstants.RUNTIME_PREFIX))
        collector.add(rtTypes[i].getId());
    }

    // exclude deploy-only items
    collector.remove(IJBossToolingConstants.DEPLOY_ONLY_RUNTIME);
    collector.remove(IJBossToolingConstants.DEPLOY_ONLY_SERVER);

    String[] allTypes = (String[]) collector.toArray(new String[collector.size()]);
    return ServerParameterUtils.asCollection(allTypes);
  }
Beispiel #9
0
  /**
   * Returns list of cloud foundry server instances. May be emtpy, but not null.
   *
   * @return returns a non-null list of cloud foundry server instances. May be empty.
   */
  public static List<CloudFoundryServer> getCloudServers() {
    IServer[] servers = ServerCore.getServers();
    Set<CloudFoundryServer> matchedServers = new HashSet<CloudFoundryServer>();

    if (servers != null) {
      for (IServer server : servers) {
        CloudFoundryServer cfServer =
            (CloudFoundryServer) server.loadAdapter(CloudFoundryServer.class, null);
        if (cfServer != null) {
          matchedServers.add(cfServer);
        }
      }
    }

    return new ArrayList<CloudFoundryServer>(matchedServers);
  }
Beispiel #10
0
  /**
   * @param serverID unique ID of the server. This should not just be the name of the server, but
   *     the full id (e.g. for V2, it should include the space name)
   * @return CloudFoundry server that corresponds to the given ID, or null if not found
   */
  public static CloudFoundryServer getCloudServer(String serverID) {
    IServer[] servers = ServerCore.getServers();
    if (servers == null) {
      return null;
    }
    CloudFoundryServer cfServer = null;

    for (IServer server : servers) {
      cfServer = (CloudFoundryServer) server.loadAdapter(CloudFoundryServer.class, null);

      if (cfServer != null && cfServer.getServerId().equals(serverID)) {
        break;
      }
    }
    return cfServer;
  }
Beispiel #11
0
  public static IRuntimeWorkingCopy getRuntime(String runtimeTypeId, IPath location) {
    IRuntimeType runtimeType = ServerCore.findRuntimeType(runtimeTypeId);

    try {
      IRuntime runtime = runtimeType.createRuntime("runtime", null);

      IRuntimeWorkingCopy runtimeWC = runtime.createWorkingCopy();
      runtimeWC.setName("Runtime");
      runtimeWC.setLocation(location);

      return runtimeWC;
    } catch (CoreException e) {
      e.printStackTrace();
    }

    return null;
  }
  @Override
  public void performFinish(IProgressMonitor monitor) throws CoreException {
    ServerLifecycleAdapter listener =
        new ServerLifecycleAdapter() {
          @Override
          public void serverAdded(IServer server) {
            ServerCore.removeServerLifecycleListener(this);

            Job job = new ConnectJob(cfServer, server);
            // this is getting called before
            // CloudFoundryServer.saveConfiguration() has flushed the
            // configuration therefore delay job
            job.schedule(500L);
          }
        };
    ServerCore.addServerLifecycleListener(listener);
  }
  @Override
  public Object execute(ExecutionEvent event) throws ExecutionException {
    try {
      Liferay7UpgradeAssistantSettings settings =
          UpgradeAssistantSettingsUtil.getObjectFromStore(Liferay7UpgradeAssistantSettings.class);

      final String portalName = settings.getPortalSettings().getNewName();

      IServer server = ServerCore.findServer(portalName);

      server.start("run", new NullProgressMonitor());
    } catch (IOException | CoreException e) {
      e.printStackTrace();
    }

    return null;
  }
Beispiel #14
0
  public static IServer[] getServersForRuntime(IRuntime runtime) {
    List<IServer> serverList = new ArrayList<IServer>();

    if (runtime != null) {
      IServer[] servers = ServerCore.getServers();

      if (!CoreUtil.isNullOrEmpty(servers)) {
        for (IServer server : servers) {
          if (runtime.equals(server.getRuntime())) {
            serverList.add(server);
          }
        }
      }
    }

    return serverList.toArray(new IServer[0]);
  }
 @Before
 public void setup() throws IOException, CoreException {
   // remove all servers
   for (final IServer server : ServerCore.getServers()) {
     server.stop(true);
     TaskMonitor monitor =
         new TaskMonitor() {
           @Override
           public boolean isComplete() {
             return !(server.canStop().isOK());
           }
         };
     TimeoutUtils.timeout(monitor, 2, TimeUnit.SECONDS);
     server.delete();
   }
   //
   EventService.getInstance().resetSubscribers();
   liveReloadServerPort = SocketUtil.findUnusedPort(50000, 55000);
 }
 public static IServer getServer(String serverId) {
   IServer server = null;
   for (IServer s : getServers()) {
     if (s.getId().equalsIgnoreCase(serverId)) {
       server = s;
       break;
     }
   }
   if (server == null) {
     IServer[] s = ServerCore.getServers();
     for (IServer aserver : s) {
       if (aserver.getId().equals(serverId)) {
         server = aserver;
         break;
       }
     }
   }
   return server;
 }
 public IHostShell createStartupShell(
     String initialWorkingDirectory,
     String command,
     String[] environment,
     IProgressMonitor monitor)
     throws CoreException, SystemMessageException {
   resetStartupShell();
   IServer s = ServerCore.findServer(serverId);
   IShellService service = findShellService(s);
   try {
     IHostShell hs = service.runCommand(initialWorkingDirectory, command, environment, monitor);
     listener =
         new IHostShellOutputListener() {
           public void shellOutputChanged(IHostShellChangeEvent event) {
             IHostOutput[] lines = event.getLines();
             String[] lines2 = new String[lines.length];
             for (int i = 0; i < lines.length; i++) {
               lines2[i] = lines[i].getString();
             }
             writeToConsole(lines2);
           }
         };
     startupShell = hs;
     startupShell.addOutputListener(listener);
     return hs;
   } catch (SystemMessageException sme) {
     throw sme;
   } catch (RuntimeException re) {
     throw new CoreException(
         new Status(
             IStatus.ERROR,
             org.jboss.ide.eclipse.as.rse.core.RSECorePlugin.PLUGIN_ID,
             re.getMessage(),
             re));
   }
 }
 /** listen to all lifecycle events from servers, ie, when a server is started and stopped */
 private void addServerLifeCycleListener() {
   this.serverLifeCycleListener = new ServerLifeCycleListener();
   ServerCore.addServerLifecycleListener(serverLifeCycleListener);
 }
  /* (non-Javadoc)
   * @see org.eclipse.jface.dialogs.IDialogPage#createControl(org.eclipse.swt.widgets.Composite)
   */
  @Override
  public void createControl(Composite parent) {
    Composite container = new Composite(parent, SWT.NULL);
    container.setLayout(new GridLayout(3, false));

    Group runtimeGrp = new Group(container, SWT.NONE);
    GridData runtimeGrpData = new GridData(SWT.FILL, SWT.CENTER, true, false, 3, 1);
    runtimeGrp.setLayout(new GridLayout(3, false));
    runtimeGrp.setLayoutData(runtimeGrpData);
    runtimeGrp.setText(Messages.newProjectWizardRuntimePageRuntimeGroupLabel);

    Label runtimeLabel = new Label(runtimeGrp, SWT.NONE);
    GridData runtimeLabelData = new GridData(SWT.FILL, SWT.CENTER, true, false, 3, 1);
    runtimeLabel.setLayoutData(runtimeLabelData);
    runtimeLabel.setText(Messages.newProjectWizardRuntimePageRuntimeLabel);

    runtimeComboViewer = new ComboViewer(runtimeGrp, SWT.NONE | SWT.READ_ONLY);
    runtimeComboViewer.setComparator(
        new ViewerComparator(
            new Comparator<String>() {

              @Override
              public int compare(String o1, String o2) {
                if (Messages.newProjectWizardRuntimePageNoRuntimeSelectedLabel.equals(o1)) {
                  return -1;
                }
                return o1.compareTo(o2);
              }
            }));

    GridData runtimeComboData = new GridData(SWT.FILL, SWT.FILL, true, false, 2, 1);
    runtimeComboViewer.getCombo().setLayoutData(runtimeComboData);
    runtimeComboViewer
        .getCombo()
        .setToolTipText(Messages.newProjectWizardRuntimePageRuntimeDescription);
    runtimeComboViewer.setContentProvider(ArrayContentProvider.getInstance());
    runtimeComboViewer
        .getCombo()
        .addModifyListener(
            new ModifyListener() {
              /*
               * (non-Javadoc)
               * @see org.eclipse.swt.events.ModifyListener#modifyText(org.eclipse.swt.events.ModifyEvent)
               */
              @Override
              public void modifyText(ModifyEvent e) {
                lastSelectedRuntime = runtimeComboViewer.getSelection().toString();
                preselectCamelVersionForRuntime(determineRuntimeCamelVersion(getSelectedRuntime()));
                validate();
              }
            });

    try {
      configureRuntimeCombo();
    } catch (CoreException ex) {
      ProjectTemplatesActivator.pluginLog().logError(ex);
    }

    Button runtimeNewButton = new Button(runtimeGrp, SWT.NONE);
    GridData runtimeNewButtonData = new GridData(SWT.FILL, SWT.CENTER, false, false);
    runtimeNewButton.setLayoutData(runtimeNewButtonData);
    runtimeNewButton.setText(Messages.newProjectWizardRuntimePageRuntimeNewButtonLabel);
    runtimeNewButton.setToolTipText(
        Messages.newProjectWizardRuntimePageRuntimeNewButtonDescription);
    runtimeNewButton.addSelectionListener(
        new SelectionAdapter() {
          /*
           * (non-Javadoc)
           * @see org.eclipse.swt.events.SelectionAdapter#widgetSelected(org.eclipse.swt.events.SelectionEvent)
           */

          @Override
          public void widgetSelected(SelectionEvent e) {
            String[] oldRuntimes = runtimeComboViewer.getCombo().getItems();
            boolean created = ServerUIUtil.showNewRuntimeWizard(getShell(), null, null);
            if (created) {
              String[] newRuntimes = runtimeComboViewer.getCombo().getItems();
              String newRuntime = getNewRuntime(oldRuntimes, newRuntimes);
              if (newRuntime != null) {
                runtimeComboViewer.setSelection(new StructuredSelection(newRuntime));
              }
            }
          }
        });

    new Label(runtimeGrp, SWT.None);

    Group camelGrp = new Group(container, SWT.NONE);
    GridData camelGrpData = new GridData(SWT.FILL, SWT.FILL, true, true, 3, 20);
    camelGrp.setLayout(new GridLayout(3, false));
    camelGrp.setLayoutData(camelGrpData);
    camelGrp.setText(Messages.newProjectWizardRuntimePageCamelGroupLabel);

    Label camelVersionLabel = new Label(camelGrp, SWT.NONE);
    GridData camelLabelData = new GridData(SWT.FILL, SWT.CENTER, true, false, 3, 1);
    camelVersionLabel.setLayoutData(camelLabelData);
    camelVersionLabel.setText(Messages.newProjectWizardRuntimePageCamelLabel);

    camelVersionCombo = new Combo(camelGrp, SWT.RIGHT | SWT.READ_ONLY);
    GridData camelComboData = new GridData(SWT.FILL, SWT.CENTER, true, false, 2, 1);
    camelVersionCombo.setLayoutData(camelComboData);
    camelVersionCombo.setItems(getSupportedCamelVersions());
    camelVersionCombo.select(Math.max(camelVersionCombo.getItemCount() - 1, 0));
    camelVersionCombo.setToolTipText(Messages.newProjectWizardRuntimePageCamelDescription);
    camelVersionCombo.addSelectionListener(
        new SelectionAdapter() {
          /* (non-Javadoc)
           * @see org.eclipse.swt.events.SelectionAdapter#widgetSelected(org.eclipse.swt.events.SelectionEvent)
           */
          @Override
          public void widgetSelected(SelectionEvent e) {
            validate();
          }
        });
    // TODO: leaving that out until we decide to support other camel versions than the ones we ship
    //		camelVersionCombo.addFocusListener(new FocusAdapter() {
    //			/* (non-Javadoc)
    //			 * @see org.eclipse.swt.events.FocusAdapter#focusLost(org.eclipse.swt.events.FocusEvent)
    //			 */
    //			@Override
    //			public void focusLost(FocusEvent e) {
    //				super.focusLost(e);
    //				validate();
    //			}
    //
    //			/* (non-Javadoc)
    //			 * @see org.eclipse.swt.events.FocusAdapter#focusGained(org.eclipse.swt.events.FocusEvent)
    //			 */
    //			@Override
    //			public void focusGained(FocusEvent e) {
    //				super.focusGained(e);
    //				setPageComplete(false);
    //			}
    //		});

    new Label(camelGrp, SWT.None);

    warningIconLabel = new Label(camelGrp, SWT.None);
    GridData camelLblData = new GridData(SWT.FILL, SWT.TOP, false, true, 1, 20);
    camelLblData.verticalIndent = 20;
    warningIconLabel.setImage(getSWTImage(SWT.ICON_WARNING));
    warningIconLabel.setLayoutData(camelLblData);
    warningIconLabel.setVisible(false);

    camelInfoText = new StyledText(camelGrp, SWT.WRAP | SWT.MULTI);
    GridData camelInfoData = new GridData(SWT.FILL, SWT.TOP, true, true, 2, 20);
    camelInfoData.verticalIndent = 0;
    camelInfoData.heightHint = 150;
    camelInfoText.setLayoutData(camelInfoData);
    camelInfoText.setEnabled(false);
    camelInfoText.setEditable(false);
    camelInfoText.setBackground(container.getBackground());

    new Label(camelGrp, SWT.None);

    setControl(container);

    IRuntimeLifecycleListener listener =
        new IRuntimeLifecycleListener() {

          @Override
          public void runtimeRemoved(IRuntime runtime) {
            runInUIThread();
          }

          @Override
          public void runtimeChanged(IRuntime runtime) {
            runInUIThread();
          }

          @Override
          public void runtimeAdded(IRuntime runtime) {
            runInUIThread();
          }

          private void runInUIThread() {
            Display.getDefault()
                .asyncExec(
                    new Runnable() {

                      @Override
                      public void run() {
                        try {
                          configureRuntimeCombo();
                        } catch (CoreException ex) {
                          ProjectTemplatesActivator.pluginLog()
                              .logError("Unable to handle runtime change event", ex); // $NON-NLS-1$
                        }
                      }
                    });
          }
        };
    ServerCore.addRuntimeLifecycleListener(listener);
    validate();
  }
  public void launch(
      ILaunchConfiguration configuration, String mode, ILaunch launch, IProgressMonitor monitor)
      throws CoreException {
    IServer server = ServerUtil.getServer(configuration);
    if (server == null) {
      Trace.trace(Trace.FINEST, "Launch configuration could not find server");
      // throw CoreException();
      return;
    }

    if (server.shouldPublish() && ServerCore.isAutoPublishing())
      server.publish(IServer.PUBLISH_INCREMENTAL, monitor);

    PreviewServerBehaviour previewServer =
        (PreviewServerBehaviour) server.loadAdapter(PreviewServerBehaviour.class, null);

    int size = REQUIRED_BUNDLE_IDS.length;
    String[] jars = new String[size];
    for (int i = 0; i < size; i++) {
      Bundle b = Platform.getBundle(REQUIRED_BUNDLE_IDS[i]);
      IPath path = null;
      if (b != null) path = PreviewRuntime.getJarredPluginPath(b);
      if (path == null)
        throw new CoreException(
            new Status(
                IStatus.ERROR,
                PreviewPlugin.PLUGIN_ID,
                "Could not find required bundle " + REQUIRED_BUNDLE_IDS[i]));
      jars[i] = path.toOSString();
    }

    // Appending the bin onto the classpath is to support running from the workbench
    // when org.eclipse.wst.server.preview is checked out
    Trace.trace(Trace.FINEST, jars[CLASSPATH_BIN_INDEX_PREVIEW_SERVER] + File.separator + "bin");
    if (new File(jars[CLASSPATH_BIN_INDEX_PREVIEW_SERVER] + File.separator + "bin").exists())
      jars[CLASSPATH_BIN_INDEX_PREVIEW_SERVER] =
          jars[CLASSPATH_BIN_INDEX_PREVIEW_SERVER] + File.separator + "bin";

    IVMInstall vm = verifyVMInstall(configuration);

    IVMRunner runner = vm.getVMRunner(mode);
    if (runner == null) runner = vm.getVMRunner(ILaunchManager.RUN_MODE);

    File workingDir = verifyWorkingDirectory(configuration);
    String workingDirName = null;
    if (workingDir != null) workingDirName = workingDir.getAbsolutePath();

    // Program & VM args
    String pgmArgs =
        "\"" + previewServer.getTempDirectory().append("preview.xml").toOSString() + "\"";
    // getProgramArguments(configuration);
    String vmArgs = getVMArguments(configuration);
    String[] envp = getEnvironment(configuration);

    ExecutionArguments execArgs = new ExecutionArguments(vmArgs, pgmArgs);

    // VM-specific attributes
    Map vmAttributesMap = getVMSpecificAttributesMap(configuration);

    // Classpath
    String[] classpath2 = getClasspath(configuration);
    String[] classpath = new String[classpath2.length + REQUIRED_BUNDLE_IDS.length];
    System.arraycopy(jars, 0, classpath, 0, REQUIRED_BUNDLE_IDS.length);
    System.arraycopy(classpath2, 0, classpath, REQUIRED_BUNDLE_IDS.length, classpath2.length);

    // Create VM config
    VMRunnerConfiguration runConfig = new VMRunnerConfiguration(MAIN_CLASS, classpath);
    runConfig.setProgramArguments(execArgs.getProgramArgumentsArray());
    runConfig.setVMArguments(execArgs.getVMArgumentsArray());
    runConfig.setWorkingDirectory(workingDirName);
    runConfig.setEnvironment(envp);
    runConfig.setVMSpecificAttributesMap(vmAttributesMap);

    // Bootpath
    String[] bootpath = getBootpath(configuration);
    if (bootpath != null && bootpath.length > 0) runConfig.setBootClassPath(bootpath);

    setDefaultSourceLocator(launch, configuration);

    // Launch the configuration
    previewServer.setupLaunch(launch, mode, monitor);

    if (ILaunchManager.PROFILE_MODE.equals(mode))
      ServerProfilerDelegate.configureProfiling(launch, vm, runConfig, monitor);

    try {
      runner.run(runConfig, launch, monitor);
      previewServer.addProcessListener(launch.getProcesses()[0]);
    } catch (Exception e) {
      // ignore - process failed
    }
  }
 private static void addExistingServers() {
   IServer[] s = ServerCore.getServers();
   for (IServer server : s) {
     if (!getServers().contains(server)) serverAdded(server);
   }
 }
 public static void deInitiateAppServerManagementOperations() {
   if (carbonServerLifeCycleListener != null) {
     ServerCore.removeServerLifecycleListener(carbonServerLifeCycleListener);
   }
 }
 public static void initiateAppServerManagementOperations() {
   carbonServerLifeCycleListener = new CarbonServerLifeCycleListener();
   ServerCore.addServerLifecycleListener(carbonServerLifeCycleListener);
 }
Beispiel #24
0
 public static IRuntime getRuntime(
     org.eclipse.wst.common.project.facet.core.runtime.IRuntime runtime) {
   return ServerCore.findRuntime(runtime.getProperty("id"));
 }
 /**
  * removes the current listener to all lifecycle events from servers, ie, when a server is started
  * and stopped
  */
 private void removeServerLifeCycleListener() {
   ServerCore.removeServerLifecycleListener(serverLifeCycleListener);
   serverLifeCycleListener.stop();
 }