Examples of IServerType


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

  }

  public IServer getExistingServer() {
    IProgressMonitor monitor = new NullProgressMonitor();
    try {
      IServerType st = ServerCore.findServerType(serverType);
      if (st == null) {
        return null;
      }
      IRuntime runtime;
      if (serverPath != null || forceCreateRuntime) {
View Full Code Here

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

  public IServer createServer(IProgressMonitor monitor, IOverwriteQuery query, ServerHandlerCallback callback)
      throws CoreException {
    try {
      monitor.beginTask("Creating server configuration", 4); //$NON-NLS-1$

      IServerType st = ServerCore.findServerType(serverType);
      if (st == null) {
        throw new CoreException(CloudFoundryPlugin.getErrorStatus("Could not find server type \"" + serverType //$NON-NLS-1$
            + "\"")); //$NON-NLS-1$
      }
      IRuntime runtime;
View Full Code Here

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

        }

    if (useExistingServer.getSelection()) {
            return existingServerCombo.getServer();
    } else {
      IServerType serverType = ServerCore.findServerType("org.apache.sling.ide.launchpadServer");
      @SuppressWarnings("unused")
      IRuntime existingRuntime = null;//ServerCore.findRuntime("org.apache.sling.ide.launchpadRuntimeType");
      IRuntime[] existingRuntimes = ServerCore.getRuntimes();
      for (int i = 0; i < existingRuntimes.length; i++) {
        IRuntime aRuntime = existingRuntimes[i];
        if (aRuntime.getRuntimeType().getId().equals("org.apache.sling.ide.launchpadRuntimeType")) {
          existingRuntime = aRuntime;
        }
      }
     
            Version finalVersion = null;
     
      if (installToolingSupportBundle.getSelection()) {
                Version installedVersion;
                try {
                    installedVersion = getToolingSupportBundleVersion();
                } catch (OsgiClientException e) {
                    throw new CoreException(new Status(IStatus.ERROR, Activator.PLUGIN_ID,
                            "Failed reading the tooling support bundle version", e));
                }
                finalVersion = installedVersion;
                EmbeddedArtifactLocator artifactsLocator = Activator.getDefault().getArtifactLocator();
                EmbeddedArtifact toolingSupportBundle = artifactsLocator.loadToolingSupportBundle();
                Version ourVersion = new Version(toolingSupportBundle.getVersion());

                if (installedVersion == null || ourVersion.compareTo(installedVersion) > 0) {
          // then auto-install it if possible
          try {

                        InputStream contents = null;
                        try {
                            contents = toolingSupportBundle.openInputStream();
                            newOsgiClient().installBundle(contents, toolingSupportBundle.getName());
                        } finally {
                            IOUtils.closeQuietly(contents);
                        }
                        finalVersion = ourVersion;
          } catch (IOException e) {
                        throw new CoreException(new Status(IStatus.ERROR, Activator.PLUGIN_ID,
                                "Failed installing the tooling support bundle version", e));
                    } catch (OsgiClientException e) {
                        throw new CoreException(new Status(IStatus.ERROR, Activator.PLUGIN_ID,
                                "Failed installing the tooling support bundle version", e));
                    }
        }
      }
     
      IRuntimeType serverRuntime = ServerCore.findRuntimeType("org.apache.sling.ide.launchpadRuntimeType");
      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());
View Full Code Here

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

        IRuntimeWorkingCopy rtwc = launchpadRuntime.createRuntime("temp.sling.launchpad.rt.id",
                new NullProgressMonitor());
        rtwc.save(true, new NullProgressMonitor());

        IServerType serverType = null;
        for (IServerType type : ServerCore.getServerTypes()) {
            if ("org.apache.sling.ide.launchpadServer".equals(type.getId())) {
                serverType = type;
                break;
            }
        }

        if (serverType == null) {
            throw new IllegalArgumentException("No server type of type 'org.apache.sling.ide.launchpadServer' found");
        }

        IServerWorkingCopy wc = serverType.createServer("temp.sling.launchpad.server.id", null,
                new NullProgressMonitor());
        wc.setHost(config.getHostname());
        wc.setAttribute(ISlingLaunchpadServer.PROP_PORT, config.getPort());
        wc.setAttribute(ISlingLaunchpadServer.PROP_CONTEXT_PATH, config.getContextPath());
        wc.setAttribute(ISlingLaunchpadServer.PROP_USERNAME, config.getUsername());
View Full Code Here

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

  }

  public static boolean doesServerBelongToHost(IServer server, IHost host) {
    if (host != null && server != null) {
      IRSESystemType rseSystem = host.getSystemType();
      IServerType serverType = server.getServerType();
      if (rseSystem != null) {
        String hostSystemType = rseSystem.getId();
        if (serverType != null && serverType.getId() != null) {
          String serverSystemType = CloudFoundryBrandingExtensionPoint.getRemoteSystemTypeId(serverType.getId());
          return (hostSystemType != null && hostSystemType.equals(serverSystemType));
        }
      }
    }
    return false;
View Full Code Here

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

    IRuntimeWorkingCopy runtimeCopy = runtimeType.createRuntime(
        "HTTP Preview", mon); //$NON-NLS-1$

    IRuntime runtime = runtimeCopy.save(true, mon);

    IServerType serverType = ServerCore
        .findServerType("org.eclipse.wst.server.preview.server"); //$NON-NLS-1$

    IServerWorkingCopy workingCopy = serverType.createServer(
        httpServerName, null, runtime, mon);
    workingCopy.setName(httpServerName);
    workingCopy.setHost("localhost"); //$NON-NLS-1$

    return workingCopy.save(true, mon);
View Full Code Here

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

      final Properties pf = new Properties();
      pf.load(new FileInputStream(propertiesFile));
      System.out.println("Loaded properties: " + pf);

      final IServerType[] servertypes = ServerCore.getServerTypes();
      IServerType serverType = null;
      for (int i = 0; i < servertypes.length; i++)
      {
        if (servertypes[i].getName().equals(serverName))
        {
          serverType = servertypes[i];
          break;
        }
      }
      if (serverType == null)
      {
        System.out.println("Server not found!");
        return;
      }
      System.out.println("Server type found, ID is: " + serverType.getId());

      final IRuntimeType runtimeType = serverType.getRuntimeType();

      System.out.println("Associated runtime type: " + runtimeType.getName());
      System.out.println("Runtime type ID is: " + runtimeType.getId());

      final ServerRuntime serverRuntime = CorePlugin.getDefault().getServerTypeDefinitionManager().getServerRuntimeDefinition(serverType.getId(), runtimeType.getId(), null);
      System.out.println("ServerRuntime found: " + serverRuntime.getName());

      final List serverRuntimeProperties = serverRuntime.getProperty();
      final HashMap runtimeProperties = new HashMap();
      final HashMap serverProperties = new HashMap();
      for (int i = 0; i < serverRuntimeProperties.size(); i++)
      {
        final Property property = (Property) serverRuntimeProperties.get(i);
        Map values = null;
        if (property.getContext().equals(Property.CONTEXT_RUNTIME))
        {
          System.out.print("\tServer runtime property: ");
          values = runtimeProperties;
        }
        else
        {
          System.out.print("\tServer property: ");
          values = serverProperties;
        }
        System.out.println(property.getId() + ", default value is: " + property.getDefault());
        final String svalue = pf.getProperty(property.getId());
        if (svalue == null)
        {
          System.out.println("ERROR: No value associated for " + property.getId() + " in " + propertiesFile);
          return;
        }
        Object value = null;
        if (property.getType().equals(Property.TYPE_DIRECTORY))
        {
          final File f = new File(svalue);
          if (!f.exists() || !f.isDirectory())
          {
            System.out.println("ERROR: directory property " + property.getId() + " value does not exist or not a directory: " + svalue);
          }
          value = svalue;
        }
        else if (property.getType().equals(Property.TYPE_FILE))
        {
          final File f = new File(svalue);
          if (!f.exists() || !f.isFile())
          {
            System.out.println("ERROR: file property " + property.getId() + " value does not exist or not a regular file: " + svalue);
          }
          value = svalue;
        }
        else
        {
          value = svalue;
        }
        values.put(property.getId(), value);
      }

      System.out.println("Creating server runtime...");

      final RuntimeWorkingCopy rwc = (RuntimeWorkingCopy) runtimeType.createRuntime(runtimeType.getName() + " GENERATED", monitor);
      if (!pf.containsKey("location"))
      {
        System.out.println("ERROR: no location property in properties file: " + propertiesFile);
        return;
      }
      rwc.setLocation(new Path(pf.getProperty("location")));
      rwc.setName(runtimeType.getName() + " GENERATED");
      rwc.setStub(false);
      final Iterator it = runtimeProperties.entrySet().iterator();
      while (it.hasNext())
      {
        final Map.Entry e = (Entry) it.next();
        rwc.setAttribute((String) e.getKey(), (String) e.getValue());
      }
      Map m = rwc.getAttribute("generic_server_instance_properties", (Map) null);
      m.put("key", "generic_server_instance_properties");
      m.putAll(runtimeProperties);
      rwc.setAttribute("generic_server_instance_properties", m);
      rwc.setAttribute("runtime-type-id", runtimeType.getId());
      rwc.setAttribute("server_definition_id", serverRuntime.getId());
      final IRuntime runtime = rwc.save(true, monitor);

      System.out.println("Server runtime created: " + runtime.getName());

      System.out.println("Creating server instance...");

      final ServerWorkingCopy swc = (ServerWorkingCopy) serverType.createServer(null, null, runtime, monitor);
      swc.setName(serverName + " GENERATED");
      swc.setAttribute("server-type", serverType.getId());
      m = swc.getAttribute("generic_server_instance_properties", (Map) null);
      m.put("key", "generic_server_instance_properties");
      m.putAll(serverProperties);
      swc.setAttribute("generic_server_instance_properties", m);
View Full Code Here

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

      ServerBeanType type = sb.getBeanType();
      if( type != null ) {
        if( type.equals(Fabric8BeanProvider.FABRIC8_1x)) {
          String serverType = l.getServerAdapterId();
          if( serverType != null ) {
            IServerType t = ServerCore.findServerType(serverType);
            if( t != null ) {
              IRuntimeType rtt = t.getRuntimeType();
              try {
                IRuntimeWorkingCopy runtime = rtt.createRuntime(rtt.getId(), monitor);
                // commented out the naming of the runtime as it seems to break server to runtime links
                runtime.setName(dir.getName());
                runtime.setLocation(new Path(absolutePath));
View Full Code Here

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

       * @see org.eclipse.wst.server.core.model.RuntimeLocatorDelegate.IRuntimeSearchListener#runtimeFound(org.eclipse.wst.server.core.IRuntimeWorkingCopy)
       */
      public void runtimeFound(IRuntimeWorkingCopy runtime) {
        String runtimeTypeId = runtime.getRuntimeType().getId();
        String serverTypeId = runtimeTypeId.substring(0, runtimeTypeId.length() - 8);
        IServerType serverType = ServerCore.findServerType(serverTypeId);
        try {
          IServerWorkingCopy server = serverType.createServer(serverTypeId, null, runtime, monitor);
          listener.serverFound(server);
        } catch (Exception e) {
          Activator.getLogger().error(e);
        }
      }
View Full Code Here

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

  }
 
  private static void createFuseServer(File loc, String serverTypeId, String name, String runtimeName) {
    if (loc == null || !loc.isDirectory() || serverTypeId == null)
      return;
    IServerType serverType = ServerCore.findServerType(serverTypeId);
    if( serverType == null )
      return;
    IRuntimeType rtType = serverType.getRuntimeType();
    if( rtType == null )
      return;
   
    try {
      IPath locPath = new Path(loc.getAbsolutePath());
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.