Examples of IRuntimeType


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

                                "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());
View Full Code Here

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

        this.config = config;
    }

    @Override
    protected void before() throws Throwable {
        IRuntimeType launchpadRuntime = null;
        for (IRuntimeType type : ServerCore.getRuntimeTypes()) {
            if ("org.apache.sling.ide.launchpadRuntimeType".equals(type.getId())) {
                launchpadRuntime = type;
                break;
            }
        }

        if (launchpadRuntime == null) {
            throw new IllegalArgumentException("No runtime of type 'org.apache.sling.ide.launchpadRuntimeType' found");
        }

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

        IServerType serverType = null;
        for (IServerType type : ServerCore.getServerTypes()) {
View Full Code Here

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

    "apache/bin/httpd.exe", "apache/bin/apache2ctl", "apache/bin/apache2", "apache/bin/httpd" //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
  };

  @Override
  public void setDefaults(IProgressMonitor monitor) {
    IRuntimeType type = getRuntimeWorkingCopy().getRuntimeType();
    getRuntimeWorkingCopy().setLocation(new Path(PEXServerPlugin.getPreference("location" + type.getId()))); //$NON-NLS-1$
  }
View Full Code Here

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

  public IServer createHTTPServer(String httpServerName) throws Exception {

    NullProgressMonitor mon = new NullProgressMonitor();

    IRuntimeType runtimeType = ServerCore
        .findRuntimeType("org.eclipse.wst.server.preview.runtime"); //$NON-NLS-1$

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

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

    IServerType serverType = ServerCore
View Full Code Here

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

   * @param server
   */
  public static IServer getTomcatServer() {
    IServer[] servers = ServerCore.getServers();
    for (IServer server : servers) {
      IRuntimeType type = server.getServerType().getRuntimeType();
      if (type.getName().startsWith(Constants.ApacheTomcat)) {
        return server;
      }
    }
    return null;
  }
View Full Code Here

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

  private void launchSync(){
    IServer tamcatServer = TomcatServerOsgiModel.getTomcatServer();
    ServerCore.addServerLifecycleListener(new IServerLifecycleListener() {
      @Override
      public void serverAdded(IServer server) {
        IRuntimeType type = server.getServerType().getRuntimeType();
        if (type.getName().startsWith(Constants.ApacheTomcat)) {
          server.addServerListener(new TomcatServerListener());
          Console.println(type.getName() + " Add Server Listener "
              + IServerListener.class.getName());
        }
      }
      @Override
      public void serverChanged(IServer server) {
        // TODO Auto-generated method stub
      }
      @Override
      public void serverRemoved(IServer server) {
        IRuntimeType type = server.getServerType().getRuntimeType();
        if (type.getName().startsWith(Constants.ApacheTomcat)) {
          server.removeServerListener(new TomcatServerListener());
          Console.println(type.getName() + " Remove Server Listener "
              + IServerListener.class.getName());
        }
      }
    });
    if (tamcatServer == null) {
View Full Code Here

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

        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());
View Full Code Here

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

        return (GeronimoRuntimeDelegate) wc.loadAdapter(GeronimoRuntimeDelegate.class, new NullProgressMonitor());
    }

    private String createName() {
        RuntimeDelegate dl = getRuntimeDelegate();
        IRuntimeType runtimeType = dl.getRuntime().getRuntimeType();
        String name = runtimeType.getName();
        IRuntime[] list = ServerCore.getRuntimes();
        int suffix = 1;
        String suffixName = name;
        for (int i = 0; i < list.length; i++) {
            if ((list[i].getName().equals(name) || list[i].getName().equals(suffixName))
View Full Code Here

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

     */
    private IRuntimeWorkingCopy resolveDirectoryToRuntime(final File directory,
            final IProgressMonitor monitor) {
        for (final String runtimeId : KarafWtpPluginActivator.RUNTIME_TYPE_IDS) {
            try {
                final IRuntimeType runtimeType = ServerCore.findRuntimeType(runtimeId);

                final String absolutePath = directory.getAbsolutePath();
                final String id = absolutePath.replace(File.separatorChar, '_').replace(':', '-');

                final IRuntimeWorkingCopy runtime = runtimeType.createRuntime(id, monitor);
                runtime.setName(directory.getName());
                runtime.setLocation(new Path(absolutePath));

                final IStatus status = runtime.validate(monitor);
                if (status == null || status.getSeverity() != IStatus.ERROR) {
View Full Code Here

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

    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());
      IRuntimeWorkingCopy rt = rtType.createRuntime(runtimeName, new NullProgressMonitor());
      rt.setLocation(locPath);
      rt.setName(runtimeName);
      // We don't need to set a vm, it can use default
      rt.save(true, new NullProgressMonitor());
      // TODO create the server also
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.