Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

This commit was manufactured by cvs2svn to create tag 'v200711181933'.

  • Loading branch information...
commit c99aa5e9f8f177b8736fa01e9c302a02d9c75137 1 parent 5bb41ea
ndai authored
Showing with 0 additions and 16,078 deletions.
  1. +0 −7 plugins/org.eclipse.jst.server.generic.core/.classpath
  2. +0 −9 plugins/org.eclipse.jst.server.generic.core/.cvsignore
  3. +0 −4 plugins/org.eclipse.jst.server.generic.core/.options
  4. +0 −28 plugins/org.eclipse.jst.server.generic.core/.project
  5. +0 −31 plugins/org.eclipse.jst.server.generic.core/META-INF/MANIFEST.MF
  6. +0 −34 plugins/org.eclipse.jst.server.generic.core/about.html
  7. +0 −20 plugins/org.eclipse.jst.server.generic.core/build.properties
  8. +0 −19 plugins/org.eclipse.jst.server.generic.core/plugin.properties
  9. +0 −43 plugins/org.eclipse.jst.server.generic.core/plugin.xml
  10. +0 −116 plugins/org.eclipse.jst.server.generic.core/schema/genericpublisher.exsd
  11. +0 −122 plugins/org.eclipse.jst.server.generic.core/schema/serverdefinition.exsd
  12. +0 −90 plugins/org.eclipse.jst.server.generic.core/src/org/eclipse/jst/server/generic/core/internal/CorePlugin.java
  13. +0 −100 ...generic.core/src/org/eclipse/jst/server/generic/core/internal/ExternalDebugLaunchConfigurationDelegate.java
  14. +0 −197 ...rver.generic.core/src/org/eclipse/jst/server/generic/core/internal/ExternalLaunchConfigurationDelegate.java
  15. +0 −271 ...lipse.jst.server.generic.core/src/org/eclipse/jst/server/generic/core/internal/ExternalServerBehaviour.java
  16. +0 −81 .../org.eclipse.jst.server.generic.core/src/org/eclipse/jst/server/generic/core/internal/GenericPublisher.java
  17. +0 −312 ...ins/org.eclipse.jst.server.generic.core/src/org/eclipse/jst/server/generic/core/internal/GenericServer.java
  18. +0 −531 ...clipse.jst.server.generic.core/src/org/eclipse/jst/server/generic/core/internal/GenericServerBehaviour.java
  19. +0 −58 ...pse.jst.server.generic.core/src/org/eclipse/jst/server/generic/core/internal/GenericServerCoreMessages.java
  20. +0 −35 ...t.server.generic.core/src/org/eclipse/jst/server/generic/core/internal/GenericServerCoreMessages.properties
  21. +0 −136 ...generic.core/src/org/eclipse/jst/server/generic/core/internal/GenericServerLaunchConfigurationDelegate.java
  22. +0 −112 ...r.generic.core/src/org/eclipse/jst/server/generic/core/internal/GenericServerLaunchableAdapterDelegate.java
  23. +0 −218 ....eclipse.jst.server.generic.core/src/org/eclipse/jst/server/generic/core/internal/GenericServerRuntime.java
  24. +0 −69 ...server.generic.core/src/org/eclipse/jst/server/generic/core/internal/GenericServerRuntimeTargetHandler.java
  25. +0 −103 ....generic.core/src/org/eclipse/jst/server/generic/core/internal/GenericServerSourcePathComputerDelegate.java
  26. +0 −140 plugins/org.eclipse.jst.server.generic.core/src/org/eclipse/jst/server/generic/core/internal/PingThread.java
  27. +0 −49 ...ns/org.eclipse.jst.server.generic.core/src/org/eclipse/jst/server/generic/core/internal/PublishManager.java
  28. +0 −75 ...e.jst.server.generic.core/src/org/eclipse/jst/server/generic/core/internal/ServerTypeDefinitionManager.java
  29. +0 −89 ...ipse.jst.server.generic.core/src/org/eclipse/jst/server/generic/core/internal/ServerTypeDefinitionUtil.java
  30. +0 −88 plugins/org.eclipse.jst.server.generic.core/src/org/eclipse/jst/server/generic/core/internal/Trace.java
  31. +0 −163 ...erver.generic.core/src/org/eclipse/jst/server/generic/core/internal/publishers/AbstractModuleAssembler.java
  32. +0 −349 ...lipse.jst.server.generic.core/src/org/eclipse/jst/server/generic/core/internal/publishers/AntPublisher.java
  33. +0 −26 ...server.generic.core/src/org/eclipse/jst/server/generic/core/internal/publishers/DefaultModuleAssembler.java
  34. +0 −88 ...jst.server.generic.core/src/org/eclipse/jst/server/generic/core/internal/publishers/EarModuleAssembler.java
  35. +0 −218 ...pse.jst.server.generic.core/src/org/eclipse/jst/server/generic/core/internal/publishers/ModulePackager.java
  36. +0 −40 ...jst.server.generic.core/src/org/eclipse/jst/server/generic/core/internal/publishers/WarModuleAssembler.java
  37. +0 −80 ...lipse.jst.server.generic.core/src/org/eclipse/jst/server/generic/internal/core/util/ExtensionPointUtil.java
  38. +0 −123 ...ins/org.eclipse.jst.server.generic.core/src/org/eclipse/jst/server/generic/internal/core/util/FileUtil.java
  39. +0 −1,593 ...erver.generic.core/src/org/eclipse/jst/server/generic/internal/servertype/definition/ServerTypePackage.java
  40. +0 −168 ...er.generic.core/src/org/eclipse/jst/server/generic/internal/servertype/definition/impl/ArchiveTypeImpl.java
  41. +0 −220 ...r.generic.core/src/org/eclipse/jst/server/generic/internal/servertype/definition/impl/ArgumentPairImpl.java
  42. +0 −250 ...rver.generic.core/src/org/eclipse/jst/server/generic/internal/servertype/definition/impl/ClasspathImpl.java
  43. +0 −221 ...erver.generic.core/src/org/eclipse/jst/server/generic/internal/servertype/definition/impl/ExternalImpl.java
  44. +0 −307 ...generic.core/src/org/eclipse/jst/server/generic/internal/servertype/definition/impl/JndiConnectionImpl.java
  45. +0 −637 ...ic.core/src/org/eclipse/jst/server/generic/internal/servertype/definition/impl/LaunchConfigurationImpl.java
  46. +0 −276 ....server.generic.core/src/org/eclipse/jst/server/generic/internal/servertype/definition/impl/ModuleImpl.java
  47. +0 −276 ...st.server.generic.core/src/org/eclipse/jst/server/generic/internal/servertype/definition/impl/PortImpl.java
  48. +0 −168 ...server.generic.core/src/org/eclipse/jst/server/generic/internal/servertype/definition/impl/ProjectImpl.java
  49. +0 −394 ...erver.generic.core/src/org/eclipse/jst/server/generic/internal/servertype/definition/impl/PropertyImpl.java
  50. +0 −222 ....generic.core/src/org/eclipse/jst/server/generic/internal/servertype/definition/impl/PublisherDataImpl.java
  51. +0 −248 ...rver.generic.core/src/org/eclipse/jst/server/generic/internal/servertype/definition/impl/PublisherImpl.java
  52. +0 −946 ....generic.core/src/org/eclipse/jst/server/generic/internal/servertype/definition/impl/ServerRuntimeImpl.java
  53. +0 −211 ...eric.core/src/org/eclipse/jst/server/generic/internal/servertype/definition/impl/ServerTypeFactoryImpl.java
  54. +0 −1,585 ...eric.core/src/org/eclipse/jst/server/generic/internal/servertype/definition/impl/ServerTypePackageImpl.java
  55. +0 −328 ...c.core/src/org/eclipse/jst/server/generic/internal/servertype/definition/util/ServerTypeAdapterFactory.java
  56. +0 −53 ...e/src/org/eclipse/jst/server/generic/internal/servertype/definition/util/ServerTypeResourceFactoryImpl.java
  57. +0 −35 ...ric.core/src/org/eclipse/jst/server/generic/internal/servertype/definition/util/ServerTypeResourceImpl.java
  58. +0 −386 ...r.generic.core/src/org/eclipse/jst/server/generic/internal/servertype/definition/util/ServerTypeSwitch.java
  59. +0 −166 plugins/org.eclipse.jst.server.generic.core/src/org/eclipse/jst/server/generic/internal/xml/Resolver.java
  60. +0 −151 plugins/org.eclipse.jst.server.generic.core/src/org/eclipse/jst/server/generic/internal/xml/XMLUtils.java
  61. +0 −71 ...g.eclipse.jst.server.generic.core/src/org/eclipse/jst/server/generic/servertype/definition/ArchiveType.java
  62. +0 −86 ....eclipse.jst.server.generic.core/src/org/eclipse/jst/server/generic/servertype/definition/ArgumentPair.java
  63. +0 −133 ...org.eclipse.jst.server.generic.core/src/org/eclipse/jst/server/generic/servertype/definition/Classpath.java
  64. +0 −86 .../org.eclipse.jst.server.generic.core/src/org/eclipse/jst/server/generic/servertype/definition/External.java
  65. +0 −136 ...clipse.jst.server.generic.core/src/org/eclipse/jst/server/generic/servertype/definition/JndiConnection.java
  66. +0 −298 ...e.jst.server.generic.core/src/org/eclipse/jst/server/generic/servertype/definition/LaunchConfiguration.java
  67. +0 −116 ...ns/org.eclipse.jst.server.generic.core/src/org/eclipse/jst/server/generic/servertype/definition/Module.java
  68. +0 −116 plugins/org.eclipse.jst.server.generic.core/src/org/eclipse/jst/server/generic/servertype/definition/Port.java
  69. +0 −68 ...s/org.eclipse.jst.server.generic.core/src/org/eclipse/jst/server/generic/servertype/definition/Project.java
  70. +0 −172 .../org.eclipse.jst.server.generic.core/src/org/eclipse/jst/server/generic/servertype/definition/Property.java
  71. +0 −108 ...org.eclipse.jst.server.generic.core/src/org/eclipse/jst/server/generic/servertype/definition/Publisher.java
  72. +0 −92 ...eclipse.jst.server.generic.core/src/org/eclipse/jst/server/generic/servertype/definition/PublisherData.java
  73. +0 −440 ...eclipse.jst.server.generic.core/src/org/eclipse/jst/server/generic/servertype/definition/ServerRuntime.java
  74. +0 −158 ...pse.jst.server.generic.core/src/org/eclipse/jst/server/generic/servertype/definition/ServerTypeFactory.java
  75. +0 −153 plugins/org.eclipse.jst.server.generic.core/xsd/ServerTypeDefinitionSchema.xsd
  76. +0 −501 plugins/org.eclipse.jst.server.generic.core/xsd/org.eclipse.jst.server.generic.servertype.ecore
  77. +0 −97 plugins/org.eclipse.jst.server.generic.core/xsd/servertype.genmodel
  78. +0 −132 plugins/org.eclipse.jst.server.generic.core/xsd/servertype.xsd2ecore
View
7 plugins/org.eclipse.jst.server.generic.core/.classpath
@@ -1,7 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<classpath>
- <classpathentry kind="src" path="src"/>
- <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
- <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
- <classpathentry kind="output" path="bin"/>
-</classpath>
View
9 plugins/org.eclipse.jst.server.generic.core/.cvsignore
@@ -1,9 +0,0 @@
-bin
-build.xml
-genericserver.jar
-org.eclipse.jst.server.generic.core_1.0.0.jar
-temp.folder
-*.settings
-genericserversrc.zip
-@dot
-javaCompiler...args
View
4 plugins/org.eclipse.jst.server.generic.core/.options
@@ -1,4 +0,0 @@
-# Debugging options for the org.eclipse.jst.server.tomcat.core plugin
-
-# Turn on general debugging
-org.eclipse.jst.server.generic.core/debug=true
View
28 plugins/org.eclipse.jst.server.generic.core/.project
@@ -1,28 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<projectDescription>
- <name>org.eclipse.jst.server.generic.core</name>
- <comment></comment>
- <projects>
- </projects>
- <buildSpec>
- <buildCommand>
- <name>org.eclipse.jdt.core.javabuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- <buildCommand>
- <name>org.eclipse.pde.ManifestBuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- <buildCommand>
- <name>org.eclipse.pde.SchemaBuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- </buildSpec>
- <natures>
- <nature>org.eclipse.pde.PluginNature</nature>
- <nature>org.eclipse.jdt.core.javanature</nature>
- </natures>
-</projectDescription>
View
31 plugins/org.eclipse.jst.server.generic.core/META-INF/MANIFEST.MF
@@ -1,31 +0,0 @@
-Manifest-Version: 1.0
-Bundle-ManifestVersion: 2
-Bundle-Name: %pluginName
-Bundle-SymbolicName: org.eclipse.jst.server.generic.core; singleton:=true
-Bundle-Version: 1.0.101.qualifier
-Bundle-Activator: org.eclipse.jst.server.generic.core.internal.CorePlugin
-Bundle-Vendor: %providerName
-Bundle-Localization: plugin
-Export-Package: org.eclipse.jst.server.generic.core.internal;x-internal:=true,
- org.eclipse.jst.server.generic.core.internal.publishers;x-internal:=true,
- org.eclipse.jst.server.generic.internal.core.util;x-internal:=true,
- org.eclipse.jst.server.generic.internal.servertype.definition;x-internal:=true,
- org.eclipse.jst.server.generic.internal.servertype.definition.impl;x-internal:=true,
- org.eclipse.jst.server.generic.internal.servertype.definition.util;x-internal:=true,
- org.eclipse.jst.server.generic.internal.xml;x-internal:=true,
- org.eclipse.jst.server.generic.servertype.definition
-Require-Bundle: org.eclipse.core.runtime;bundle-version="[3.2.0,4.0.0)",
- org.eclipse.core.resources;bundle-version="[3.2.0,4.0.0)",
- org.eclipse.debug.core;bundle-version="[3.2.0,4.0.0)",
- org.eclipse.jdt.core;bundle-version="[3.2.0,4.0.0)",
- org.eclipse.jdt.launching;visibility:="reexport";bundle-version="[3.2.0,4.0.0)",
- org.eclipse.wst.server.core;bundle-version="[1.0.102,1.2.0)",
- org.eclipse.jst.server.core;bundle-version="[1.0.102,1.2.0)",
- org.eclipse.ant.ui;resolution:="optional";bundle-version="[3.2.0,4.0.0)",
- org.eclipse.emf.common;visibility:="reexport";bundle-version="[2.2.0,2.3.0)",
- org.eclipse.emf.ecore;bundle-version="[2.2.0,2.3.0)",
- org.eclipse.emf.ecore.xmi;bundle-version="[2.2.0,2.3.0)",
- org.eclipse.ui.externaltools;resolution:="optional";bundle-version="[3.1.100,3.3.0)",
- org.apache.ant;bundle-version="[1.6.5,1.7.0)",
- org.eclipse.debug.ui;resolution:="optional";bundle-version="[3.2.0,4.0.0)"
-Eclipse-LazyStart: true
View
34 plugins/org.eclipse.jst.server.generic.core/about.html
@@ -1,34 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN">
-<HTML>
-
-<head>
-<title>About</title>
-<meta http-equiv=Content-Type content="text/html; charset=ISO-8859-1">
-</head>
-
-<BODY lang="EN-US">
-
-<H3>About This Content</H3>
-
-<P>May 2, 2006</P>
-
-<H3>License</H3>
-
-<P>The Eclipse Foundation makes available all content in this plug-in
-("Content"). Unless otherwise indicated below, the Content is provided to you
-under the terms and conditions of the Eclipse Public License Version 1.0
-("EPL"). A copy of the EPL is available at
-<A href="http://www.eclipse.org/org/documents/epl-v10.php">http://www.eclipse.org/org/documents/epl-v10.php</A>.
-For purposes of the EPL, "Program" will mean the Content.</P>
-
-<P>If you did not receive this Content directly from the Eclipse Foundation, the
-Content is being redistributed by another party ("Redistributor") and different
-terms and conditions may apply to your use of any object code in the Content.
-Check the Redistributor’s license that was provided with the Content. If no such
-license exists, contact the Redistributor. Unless otherwise indicated below, the
-terms and conditions of the EPL still apply to any source code in the Content
-and such source code may be obtained at
-<A href="http://www.eclipse.org/">http://www.eclipse.org/</A>.</P>
-
-</BODY>
-</HTML>
View
20 plugins/org.eclipse.jst.server.generic.core/build.properties
@@ -1,20 +0,0 @@
-##################################################################################################
-# Copyright (c) 2005 Eteration A.S. and Gorkem Ercan. All rights reserved. This program and the
-# accompanying materials are made available under the terms of the Eclipse Public License v1.0
-# which accompanies this distribution, and is available at
-# http://www.eclipse.org/legal/epl-v10.html
-#
-# Contributors: Gorkem Ercan - initial API and implementation
-#
-###################################################################################################
-source.. = src/
-output.. = bin/
-bin.includes = .,\
- xsd/ServerTypeDefinitionSchema.xsd,\
- META-INF/,\
- plugin.xml,\
- plugin.properties,\
- about.html
-src.includes = xsd/,\
- schema/,\
- build.properties
View
19 plugins/org.eclipse.jst.server.generic.core/plugin.properties
@@ -1,19 +0,0 @@
-##################################################################################################
-# Copyright (c) 2005 Eteration A.S. and Gorkem Ercan. All rights reserved. This program and the
-# accompanying materials are made available under the terms of the Eclipse Public License v1.0
-# which accompanies this distribution, and is available at
-# http://www.eclipse.org/legal/epl-v10.html
-#
-# Contributors: Gorkem Ercan - initial API and implementation
-#
-###################################################################################################
-pluginName= Generic Server Plugin
-providerName=Eclipse.org
-pluginDescription=Provides generic server tools with easy to develop meta data configuration files
-
-externalLaunchConfigurationTypeName=Generic Server(External Launch)
-launchConfigurationTypeName=Generic Server
-extensionPointServerdefinition=Server definition
-extensionPointGenericpublisher=Generic Publisher
-# ====================================================================
-
View
43 plugins/org.eclipse.jst.server.generic.core/plugin.xml
@@ -1,43 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<?eclipse version="3.0"?>
-<plugin>
-
- <extension-point id="serverdefinition" name="%extensionPointServerdefinition" schema="schema/serverdefinition.exsd"/>
- <extension-point id="genericpublisher" name="%extensionPointGenericpublisher" schema="schema/genericpublisher.exsd"/>
-
- <extension point="org.eclipse.debug.core.launchConfigurationTypes">
- <launchConfigurationType
- id="org.eclipse.jst.server.generic.core.launchConfigurationType"
- name="%launchConfigurationTypeName"
- delegate="org.eclipse.jst.server.generic.core.internal.GenericServerLaunchConfigurationDelegate"
- modes="run, debug, profile"
- sourceLocatorId="org.eclipse.jdt.launching.sourceLocator.JavaSourceLookupDirector"
- sourcePathComputerId="org.eclipse.jst.server.generic.core.sourcePathComputer"/>
- <launchConfigurationType
- id="org.eclipse.jst.server.generic.core.ExternalLaunchConfigurationType"
- name="%externalLaunchConfigurationTypeName"
- delegate="org.eclipse.jst.server.generic.core.internal.ExternalLaunchConfigurationDelegate"
- modes="run, debug"
- sourceLocatorId="org.eclipse.jdt.launching.sourceLocator.JavaSourceLookupDirector"
- sourcePathComputerId="org.eclipse.jst.server.generic.core.sourcePathComputer"/>
- </extension>
-
- <extension point="org.eclipse.debug.core.sourcePathComputers">
- <sourcePathComputer
- id="org.eclipse.jst.server.generic.core.sourcePathComputer"
- class="org.eclipse.jst.server.generic.core.internal.GenericServerSourcePathComputerDelegate"/>
- </extension>
-
- <extension point="org.eclipse.wst.server.core.launchableAdapters">
- <launchableAdapter
- class="org.eclipse.jst.server.generic.core.internal.GenericServerLaunchableAdapterDelegate"
- id="org.eclipse.jst.server.generic.web"/>
- </extension>
-
- <extension point="org.eclipse.jst.server.generic.core.genericpublisher">
- <genericpublisher
- class="org.eclipse.jst.server.generic.core.internal.publishers.AntPublisher"
- id="org.eclipse.jst.server.generic.antpublisher"/>
- </extension>
-
-</plugin>
View
116 plugins/org.eclipse.jst.server.generic.core/schema/genericpublisher.exsd
@@ -1,116 +0,0 @@
-<?xml version='1.0' encoding='UTF-8'?>
-<!-- Schema file written by PDE -->
-<schema targetNamespace="org.eclipse.jst.server.generic.core">
-<annotation>
- <appInfo>
- <meta.schema plugin="org.eclipse.jst.server.generic.core" id="genericpublisher" name="Generic Publisher"/>
- </appInfo>
- <documentation>
- Defines a publisher that can be used for publishing modules to servers for generic servers.
- </documentation>
- </annotation>
-
- <element name="extension">
- <complexType>
- <sequence>
- <element ref="genericpublisher"/>
- </sequence>
- <attribute name="point" type="string" use="required">
- <annotation>
- <documentation>
- a fully qualified identifier of the target extension point
- </documentation>
- </annotation>
- </attribute>
- <attribute name="id" type="string">
- <annotation>
- <documentation>
- an optional identifier of the extension instance
- </documentation>
- </annotation>
- </attribute>
- <attribute name="name" type="string">
- <annotation>
- <documentation>
- an optional name of the extension instance
- </documentation>
- <appInfo>
- <meta.attribute translatable="true"/>
- </appInfo>
- </annotation>
- </attribute>
- </complexType>
- </element>
-
- <element name="genericpublisher">
- <complexType>
- <attribute name="id" type="string">
- <annotation>
- <documentation>
- The unique id that refers to this publisher
- </documentation>
- </annotation>
- </attribute>
- <attribute name="class" type="string">
- <annotation>
- <documentation>
- class that extends GenericPublisher
- </documentation>
- </annotation>
- </attribute>
- </complexType>
- </element>
-
- <annotation>
- <appInfo>
- <meta.section type="since"/>
- </appInfo>
- <documentation>
- 1.0
- </documentation>
- </annotation>
-
- <annotation>
- <appInfo>
- <meta.section type="examples"/>
- </appInfo>
- <documentation>
- &lt;pre&gt;
- &lt;extension point=&quot;org.eclipse.jst.server.generic.core.genericpublisher&quot;&gt;
- &lt;genericpublisher
- class=&quot;org.eclipse.jst.server.generic.core.internal.publishers.AntPublisher&quot;
- id=&quot;org.eclipse.jst.server.generic.antpublisher&quot;/&gt;
- &lt;/extension&gt;
- &lt;/pre&gt;
- </documentation>
- </annotation>
-
- <annotation>
- <appInfo>
- <meta.section type="apiInfo"/>
- </appInfo>
- <documentation>
- Value of the attribute class must be a fully qualified name of a Java class that extends org.eclipse.jst.server.generic.core.internal.GenericPublisher abstract class.
- </documentation>
- </annotation>
-
- <annotation>
- <appInfo>
- <meta.section type="implementation"/>
- </appInfo>
- <documentation>
-
- </documentation>
- </annotation>
-
- <annotation>
- <appInfo>
- <meta.section type="copyright"/>
- </appInfo>
- <documentation>
- Copyright (c) 2005 Eteration A.S. and Gorkem Ercan. All rights reserved. This program and the accompanying materials are made available under the terms of the Eclipse Public License v1.0 which accompanies this distribution, and is available at
-&lt;a href=&quot;http://www.eclipse.org/legal/epl-v10.html&quot;&gt;http://www.eclipse.org/legal/epl-v10.html&lt;/a&gt;
- </documentation>
- </annotation>
-
-</schema>
View
122 plugins/org.eclipse.jst.server.generic.core/schema/serverdefinition.exsd
@@ -1,122 +0,0 @@
-<?xml version='1.0' encoding='UTF-8'?>
-<!-- Schema file written by PDE -->
-<schema targetNamespace="org.eclipse.jst.server.generic.core">
-<annotation>
- <appInfo>
- <meta.schema plugin="org.eclipse.jst.server.generic.core" id="serverdefinition" name="Server Definition"/>
- </appInfo>
- <documentation>
- This extension point defines a new generic server definition file.
- </documentation>
- </annotation>
-
- <element name="extension">
- <complexType>
- <sequence>
- <element ref="serverdefinition" minOccurs="1" maxOccurs="unbounded"/>
- </sequence>
- <attribute name="point" type="string" use="required">
- <annotation>
- <documentation>
- a fully qualified identifier of the target extension point
- </documentation>
- </annotation>
- </attribute>
- <attribute name="id" type="string">
- <annotation>
- <documentation>
- an optional identifier of the extension instance
- </documentation>
- </annotation>
- </attribute>
- <attribute name="name" type="string">
- <annotation>
- <documentation>
- an optional name of the extension instance
- </documentation>
- <appInfo>
- <meta.attribute translatable="true"/>
- </appInfo>
- </annotation>
- </attribute>
- </complexType>
- </element>
-
- <element name="serverdefinition">
- <complexType>
- <sequence>
- </sequence>
- <attribute name="id" type="string" use="required">
- <annotation>
- <documentation>
- server id
- </documentation>
- </annotation>
- </attribute>
- <attribute name="definitionfile" type="string" use="required">
- <annotation>
- <documentation>
- location of the generic server definition file
- </documentation>
- <appInfo>
- <meta.attribute kind="resource"/>
- </appInfo>
- </annotation>
- </attribute>
- </complexType>
- </element>
-
- <annotation>
- <appInfo>
- <meta.section type="since"/>
- </appInfo>
- <documentation>
- 1.0
- </documentation>
- </annotation>
-
- <annotation>
- <appInfo>
- <meta.section type="examples"/>
- </appInfo>
- <documentation>
-
-&lt;pre&gt;
-&lt;extension point=&quot;org.eclipse.jst.server.generic.core.serverdefinition&quot;&gt;
- &lt;serverdefinition id=&quot;org.eclipse.jst.server.generic.runtime.jonas4&quot; definitionfile=&quot;/servers/jonas.serverdef&quot;&gt;
- &lt;/serverdefinition&gt;
-&lt;/extension&gt;
-&lt;/pre&gt;
- </documentation>
- </annotation>
-
- <annotation>
- <appInfo>
- <meta.section type="apiInfo"/>
- </appInfo>
- <documentation>
-
- </documentation>
- </annotation>
-
- <annotation>
- <appInfo>
- <meta.section type="implementation"/>
- </appInfo>
- <documentation>
-
- </documentation>
- </annotation>
-
- <annotation>
- <appInfo>
- <meta.section type="copyright"/>
- </appInfo>
- <documentation>
- Copyright (c) 2005 Eteration A.S. and Gorkem Ercan. All rights reserved. This program and the accompanying materials are made available under the terms of the Eclipse Public License v1.0 which accompanies this distribution, and is available at
-&lt;a href=&quot;http://www.eclipse.org/legal/epl-v10.html&quot;&gt;http://www.eclipse.org/legal/epl-v10.html&lt;/a&gt;
-
- </documentation>
- </annotation>
-
-</schema>
View
90 ...ins/org.eclipse.jst.server.generic.core/src/org/eclipse/jst/server/generic/core/internal/CorePlugin.java
@@ -1,90 +0,0 @@
-/***************************************************************************************************
- * Copyright (c) 2005 Eteration A.S. and Gorkem Ercan. All rights reserved. This program and the
- * accompanying materials are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors: Gorkem Ercan - initial API and implementation
- *
- **************************************************************************************************/
-package org.eclipse.jst.server.generic.core.internal;
-
-
-import java.io.IOException;
-import java.net.URL;
-
-import org.eclipse.core.runtime.FileLocator;
-import org.eclipse.core.runtime.Plugin;
-import org.osgi.framework.BundleContext;
-
-/**
- * The main plugin class to be used in the desktop.
- *
- * @author Gorkem Ercan
- */
-public class CorePlugin extends Plugin {
-
-
- /**
- * Plug-in ID
- */
- public static final String PLUGIN_ID = "org.eclipse.jst.server.generic.core"; //$NON-NLS-1$
-
- //The shared instance.
- private static CorePlugin plugin;
- private ServerTypeDefinitionManager fServerTypeDefinitionManager;
- /**
- * The constructor.
- */
- public CorePlugin() {
- super();
- plugin = this;
- }
-
-
- /* (non-Javadoc)
- * @see org.eclipse.core.runtime.Plugin#start(org.osgi.framework.BundleContext)
- */
- public void start(BundleContext context) throws Exception {
- super.start(context);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.core.runtime.Plugin#stop(org.osgi.framework.BundleContext)
- */
- public void stop(BundleContext context) throws Exception {
- super.stop(context);
- }
-
- /**
- * Returns the shared instance.
- * @return genericServerCoreInstance
- */
- public static CorePlugin getDefault() {
- return plugin;
- }
-
-
- /**
- * Returns the server type definition manager instance
- *
- * @return instance
- */
- public ServerTypeDefinitionManager getServerTypeDefinitionManager()
- {
- if(fServerTypeDefinitionManager==null)
- fServerTypeDefinitionManager = new ServerTypeDefinitionManager(getInstallUrl());
- return fServerTypeDefinitionManager;
- }
-
- private URL getInstallUrl()
- {
- try {
- return FileLocator.resolve(this.getBundle().getEntry("/")); //$NON-NLS-1$
- } catch (IOException e) {
- return null;
- }
- }
-
-
-}
View
100 ...eric.core/src/org/eclipse/jst/server/generic/core/internal/ExternalDebugLaunchConfigurationDelegate.java
@@ -1,100 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.jst.server.generic.core.internal;
-
-import java.util.Map;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.NullProgressMonitor;
-import org.eclipse.debug.core.ILaunch;
-import org.eclipse.debug.core.ILaunchConfiguration;
-import org.eclipse.debug.core.model.IDebugTarget;
-import org.eclipse.jdt.launching.AbstractJavaLaunchConfigurationDelegate;
-import org.eclipse.jdt.launching.IJavaLaunchConfigurationConstants;
-import org.eclipse.jdt.launching.IVMConnector;
-import org.eclipse.jdt.launching.JavaRuntime;
-import org.eclipse.osgi.util.NLS;
-
-/**
- * <p>Extension of <code>AbstractJavaLaunchConfigurationDelegate</code> that supports
- * the connection to remote JVMs for external servers. Used for debugging.</p>
- *
- * <p>Based on JavaRemoteApplicationLaunchConfigurationDelegate</p>
- */
-public class ExternalDebugLaunchConfigurationDelegate extends AbstractJavaLaunchConfigurationDelegate {
-
- /* (non-Javadoc)
- * @see org.eclipse.debug.core.model.ILaunchConfigurationDelegate#launch(org.eclipse.debug.core.ILaunchConfiguration, java.lang.String, org.eclipse.debug.core.ILaunch, org.eclipse.core.runtime.IProgressMonitor)
- */
- public void launch(ILaunchConfiguration configuration, String mode, ILaunch launch, IProgressMonitor monitor) throws CoreException {
-
- if (monitor == null) {
- monitor = new NullProgressMonitor();
- }
-
- monitor.beginTask(NLS.bind(GenericServerCoreMessages.attachingToExternalGenericServer,new String[]{configuration.getName()}), 3);
-
- // check for cancellation
- if (monitor.isCanceled()) {
- return;
- }
-
- monitor.subTask(GenericServerCoreMessages.verifyingExternalServerDebuggingLaunchAttributes);
-
- String connectorId = getVMConnectorId(configuration);
- IVMConnector connector = null;
- if (connectorId == null) {
- connector = JavaRuntime.getDefaultVMConnector();
- } else {
- connector = JavaRuntime.getVMConnector(connectorId);
- }
- if (connector == null) {
- abort(GenericServerCoreMessages.externalServerDebugConnectorNotSpecified,
- null, IJavaLaunchConfigurationConstants.ERR_CONNECTOR_NOT_AVAILABLE);
- }
-
- Map argMap = configuration.getAttribute(IJavaLaunchConfigurationConstants.ATTR_CONNECT_MAP, (Map)null);
-
- int connectTimeout = JavaRuntime.getPreferences().getInt(JavaRuntime.PREF_CONNECT_TIMEOUT);
- argMap.put("timeout", ""+connectTimeout); //$NON-NLS-1$//$NON-NLS-2$
-
- // check for cancellation
- if (monitor.isCanceled()) {
- return;
- }
-
- monitor.worked(1);
-
- monitor.subTask(GenericServerCoreMessages.creatingExternalServerDebuggingSourceLocator);
- // set the default source locator if required
- setDefaultSourceLocator(launch, configuration);
- monitor.worked(1);
-
- // connect to remote VM
- connector.connect(argMap, monitor, launch);
-
- // check for cancellation
- if (monitor.isCanceled()) {
- IDebugTarget[] debugTargets = launch.getDebugTargets();
- for (int i = 0; i < debugTargets.length; i++) {
- IDebugTarget target = debugTargets[i];
- if (target.canDisconnect()) {
- target.disconnect();
- }
- }
- return;
- }
-
- monitor.done();
- }
-}
View
197 ...r.generic.core/src/org/eclipse/jst/server/generic/core/internal/ExternalLaunchConfigurationDelegate.java
@@ -1,197 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2005 BEA Systems, Inc.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * rfrost@bea.com
- * tyip@bea.com
- *
- * Based on GenericServerLaunchConfigurationDelegate by Gorkem Ercan
- *******************************************************************************/
-
-package org.eclipse.jst.server.generic.core.internal;
-
-import java.io.File;
-import java.io.IOException;
-import java.util.HashMap;
-import java.util.Map;
-
-import org.apache.tools.ant.taskdefs.Execute;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.debug.core.DebugPlugin;
-import org.eclipse.debug.core.ILaunch;
-import org.eclipse.debug.core.ILaunchConfiguration;
-import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
-import org.eclipse.debug.core.ILaunchManager;
-import org.eclipse.debug.core.model.IProcess;
-import org.eclipse.debug.core.model.RuntimeProcess;
-import org.eclipse.jdt.launching.AbstractJavaLaunchConfigurationDelegate;
-import org.eclipse.jdt.launching.IJavaLaunchConfigurationConstants;
-import org.eclipse.wst.server.core.IServer;
-import org.eclipse.wst.server.core.ServerUtil;
-import org.eclipse.wst.server.core.model.ServerBehaviourDelegate;
-
-/**
- * <p>Extension of <code>AbstractJavaLaunchConfigurationDelegate</code> that supports
- * servers which are started/stopped via external executables (e.g. scripts).</p>
- *
- * <p>Note: <code>AbstractJavaLaunchConfigurationDelegate</code> is extended simply to take advantage
- * of a set of useful code that is not directly related to launching a JVM-based app.</p>
- */
-public class ExternalLaunchConfigurationDelegate extends AbstractJavaLaunchConfigurationDelegate {
-
- /**
- * Identifier for the executable server configuration type
- * (value <code>"org.eclipse.jst.server.generic.core.ExternalLaunchConfigurationType"</code>).
- */
- public static final String ID_EXTERNAL_LAUNCH_TYPE = CorePlugin.PLUGIN_ID + ".ExternalLaunchConfigurationType"; //$NON-NLS-1$
-
- /**
- * Name of the launch configuration attribute that holds the external executable commandline.
- */
- public static final String COMMANDLINE = CorePlugin.PLUGIN_ID + ".COMMANDLINE"; //$NON-NLS-1$
-
- /**
- * Name of the launch configuration attribute that holds a descriptive name for the external executable.
- */
- public static final String EXECUTABLE_NAME = CorePlugin.PLUGIN_ID + ".EXECUTABLE_NAME"; //$NON-NLS-1$
-
- /**
- * Name of the launch configuration attribute that holds the debug port.
- */
- public static final String DEBUG_PORT = CorePlugin.PLUGIN_ID + ".DEBUG_PORT"; //$NON-NLS-1$
-
- /**
- * Default value for the descriptive name for the external executable.
- */
- public static final String DEFAULT_EXECUTABLE_NAME = "External Generic Server"; //$NON-NLS-1$
-
- /**
- * Debugging launch configuration delegate.
- */
- private static ExternalDebugLaunchConfigurationDelegate debuggingDelegate =
- new ExternalDebugLaunchConfigurationDelegate();
-
- /* (non-Javadoc)
- * @see org.eclipse.debug.core.model.ILaunchConfigurationDelegate#launch(org.eclipse.debug.core.ILaunchConfiguration, java.lang.String, org.eclipse.debug.core.ILaunch, org.eclipse.core.runtime.IProgressMonitor)
- */
- public void launch(ILaunchConfiguration configuration,
- String mode,
- ILaunch launch,
- IProgressMonitor monitor) throws CoreException {
- IServer server = ServerUtil.getServer(configuration);
- if (server == null) {
- abort(GenericServerCoreMessages.missingServer, null, IJavaLaunchConfigurationConstants.ERR_INTERNAL_ERROR);
- }
-
- ExternalServerBehaviour serverBehavior = (ExternalServerBehaviour) server.loadAdapter(ServerBehaviourDelegate.class, null);
-
- // initialize the server, check the ports and start the PingThread that will check
- // server state
- serverBehavior.setupLaunch(launch, mode, monitor);
-
- // get the "external" command
- String commandline = configuration.getAttribute(COMMANDLINE, (String) null);
- if (commandline == null || commandline.length() == 0) {
- abort(GenericServerCoreMessages.commandlineUnspecified, null, IJavaLaunchConfigurationConstants.ERR_INTERNAL_ERROR);
- }
-
- // parse the "external" command into multiple args
- String[] cmdArgs = DebugPlugin.parseArguments(commandline);
- // get the "programArguments", parsed into multiple args
- String[] pgmArgs = DebugPlugin.parseArguments(getProgramArguments(configuration));
-
- // Create the full array of cmds
- String[] cmds = new String[cmdArgs.length + pgmArgs.length];
- System.arraycopy(cmdArgs, 0, cmds, 0, cmdArgs.length);
- System.arraycopy(pgmArgs, 0, cmds, cmdArgs.length, pgmArgs.length);
-
- // get a descriptive name for the executable
- String executableName = configuration.getAttribute(EXECUTABLE_NAME, DEFAULT_EXECUTABLE_NAME);
-
- // get the executable environment
- ILaunchManager manager = DebugPlugin.getDefault().getLaunchManager();
- String[] env = manager.getEnvironment(configuration);
-
- // get the working directory
- File workingDir = verifyWorkingDirectory(configuration);
- if (workingDir == null) {
- abort(GenericServerCoreMessages.workingdirUnspecified, null, IJavaLaunchConfigurationConstants.ERR_INTERNAL_ERROR);
- }
-
- // Launch the executable for the configuration using the Ant Execute class
- try {
- Process process = Execute.launch(null, cmds, env, workingDir, true);
- serverBehavior.startPingThread();
- IProcess runtimeProcess = new RuntimeProcess(launch, process, executableName, null);
- launch.addProcess(runtimeProcess);
- serverBehavior.setProcess(runtimeProcess);
- } catch (IOException ioe) {
- abort(GenericServerCoreMessages.errorLaunchingExecutable, ioe, IJavaLaunchConfigurationConstants.ERR_INTERNAL_ERROR);
- }
-
- if (mode.equals("debug")) { //$NON-NLS-1$
- ILaunchConfigurationWorkingCopy wc = createDebuggingConfig(configuration);
- // if we're launching the debugging we need to wait for the config to start
- // before launching the debugging session
- serverBehavior.setDebuggingConfig(wc, mode, launch, monitor);
- }
- }
-
- private ILaunchConfigurationWorkingCopy createDebuggingConfig(ILaunchConfiguration configuration)
- throws CoreException {
- ILaunchConfigurationWorkingCopy wc = configuration.getWorkingCopy();
- setDebugArgument(wc, IJavaLaunchConfigurationConstants.ATTR_CONNECT_MAP, "hostname", "localhost"); //$NON-NLS-1$//$NON-NLS-2$
- String port = configuration.getAttribute(DEBUG_PORT, (String) null);
- if (port==null || port.length()==0) {
- abort(GenericServerCoreMessages.debugPortUnspecified, null, IJavaLaunchConfigurationConstants.ERR_INTERNAL_ERROR);
- }
- setDebugArgument(wc, IJavaLaunchConfigurationConstants.ATTR_CONNECT_MAP, "port", port); //$NON-NLS-1$
- return wc;
- }
-
- /**
- * Starts the debugging session
- */
- protected static void startDebugging(ILaunchConfigurationWorkingCopy wc,
- String mode,
- ILaunch launch,
- IProgressMonitor monitor) throws CoreException {
- Trace.trace(Trace.FINEST, "Starting debugging"); //$NON-NLS-1$
- debuggingDelegate.launch(wc, mode, launch, monitor);
- }
-
- private void setDebugArgument(ILaunchConfigurationWorkingCopy config, String attribKey, String key, String arg) {
- try {
- Map args = config.getAttribute(attribKey, (Map)null);
- if (args!=null) {
- args = new HashMap(args);
- } else {
- args = new HashMap();
- }
- args.put(key, String.valueOf(arg));
- config.setAttribute(attribKey, args);
- } catch (CoreException ce) {
- // ignore
- }
- }
-
- /**
- * Throws a core exception with the given message and optional
- * exception. The exception's status code will indicate an error.
- *
- * @param message error message
- * @param exception cause of the error, or <code>null</code>
- * @exception CoreException with the given message and underlying
- * exception
- */
- protected void abort(String message, Throwable exception, int code) throws CoreException {
- throw new CoreException(new Status(IStatus.ERROR, CorePlugin.getDefault().getBundle().getSymbolicName(), code, message, exception));
- }
-}
View
271 ...se.jst.server.generic.core/src/org/eclipse/jst/server/generic/core/internal/ExternalServerBehaviour.java
@@ -1,271 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2005 BEA Systems, Inc.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * rfrost@bea.com - initial API and implementation
- *
- * Based on GenericServerBehavior by Gorkem Ercan
- *******************************************************************************/
-package org.eclipse.jst.server.generic.core.internal;
-
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.debug.core.ILaunch;
-import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
-import org.eclipse.debug.core.ILaunchManager;
-import org.eclipse.debug.core.model.IProcess;
-import org.eclipse.jdt.launching.IJavaLaunchConfigurationConstants;
-import org.eclipse.jst.server.generic.internal.xml.Resolver;
-import org.eclipse.jst.server.generic.servertype.definition.External;
-import org.eclipse.jst.server.generic.servertype.definition.ServerRuntime;
-import org.eclipse.osgi.util.NLS;
-import org.eclipse.wst.server.core.IServer;
-import org.eclipse.wst.server.core.ServerPort;
-import org.eclipse.wst.server.core.internal.Server;
-import org.eclipse.wst.server.core.util.SocketUtil;
-
-/**
- * Subclass of <code>GenericServerBehavior</code> that supports
- * servers which are started/stopped via external executables (e.g. scripts).
- */
-public class ExternalServerBehaviour extends GenericServerBehaviour {
-
- // config for debugging session
- private ILaunchConfigurationWorkingCopy fLaunchConfigurationWC;
- private String fMode;
- private ILaunch fLaunch;
- private IProgressMonitor fProgressMonitor;
-
- /**
- * Override to reset the status if the state was unknown
- * @param force
- */
- public void stop(boolean force) {
- resetStatus(getServer().getServerState());
- super.stop(force);
- }
-
- /**
- * Override to set status to unknown if the port was in use and to reset the status if the state was
- * unknown and an exception was not thrown. Will want to change logic once external generic server pings
- * server process to determine state instead of maintaining handle to process.
- */
- protected void setupLaunch(ILaunch launch, String launchMode, IProgressMonitor monitor) throws CoreException {
- int state = getServer().getServerState();
- try {
- super.setupLaunch(launch, launchMode, monitor);
- } catch (CoreException ce) {
- ServerPort portInUse = portInUse();
- if (portInUse != null) {
- Trace.trace(Trace.WARNING, "Port " + portInUse.getPort() + " is currently in use"); //$NON-NLS-1$//$NON-NLS-2$
- Status status = new Status(IStatus.WARNING, CorePlugin.PLUGIN_ID, IStatus.OK,
- NLS.bind(GenericServerCoreMessages.errorPortInUse,Integer.toString(portInUse.getPort()),portInUse.getName()), null);
- setServerStatus(status);
- setServerState(IServer.STATE_UNKNOWN);
- }
- throw ce;
- }
- resetStatus(state);
- }
-
- private ServerPort portInUse() {
- ServerPort[] ports = getServer().getServerPorts(null);
- ServerPort sp;
- for(int i=0;i<ports.length;i++){
- sp = ports[i];
- if (SocketUtil.isPortInUse(sp.getPort(), 5)) {
- return sp;
- }
- }
- return null;
- }
-
- /**
- * Override to trigger the launch of the debugging session (if appropriate).
- */
- protected synchronized void setServerStarted() {
- if (fLaunchConfigurationWC != null) {
- try {
- ExternalLaunchConfigurationDelegate.startDebugging(fLaunchConfigurationWC, fMode, fLaunch, fProgressMonitor);
- } catch (CoreException ce) {
- // failed to start debugging, so set mode to run
- setMode(ILaunchManager.RUN_MODE);
- final Status status = new Status(IStatus.ERROR, CorePlugin.PLUGIN_ID, 1,
- GenericServerCoreMessages.errorStartingExternalDebugging, ce);
- CorePlugin.getDefault().getLog().log(status);
- Trace.trace(Trace.SEVERE, GenericServerCoreMessages.errorStartingExternalDebugging, ce);
- } finally {
- clearDebuggingConfig();
- }
- }
- setServerState(IServer.STATE_STARTED);
- }
-
- /*
- * If the server state is unknown, reset the status to OK
- */
- private void resetStatus(int state) {
- if (state == IServer.STATE_UNKNOWN) {
- setServerStatus(null);
- }
- }
-
- /**
- * Since terminate() is called during restart, need to override to
- * call shutdown instead of just killing the original process.
- */
- protected void terminate() {
- int state = getServer().getServerState();
- if (state == IServer.STATE_STOPPED)
- return;
-
- // cache a ref to the current process
- IProcess currentProcess = process;
- // set the process var to null so that GenericServerBehavior.setProcess()
- // will grab the stop executable (and declare the server stopped when it exits)
- process = null;
-
- // execute the standard shutdown
- shutdown(state);
-
- // if the shutdown did not terminate the process, forcibly terminate it
- try {
- if (currentProcess != null && !currentProcess.isTerminated()) {
- Trace.trace(Trace.FINER, "About to kill process: " + currentProcess); //$NON-NLS-1$
- currentProcess.terminate();
- currentProcess = null;
- }
- } catch (Exception e) {
- Trace.trace(Trace.SEVERE, "Error killing the process", e); //$NON-NLS-1$
- }
- }
-
- /**
- * Override superclass method to correctly setup the launch configuration for starting an external
- * server.
- * @param workingCopy
- * @param monitor
- * @throws CoreException
- */
- public void setupLaunchConfiguration(ILaunchConfigurationWorkingCopy workingCopy,
- IProgressMonitor monitor) throws CoreException {
- clearDebuggingConfig();
- ServerRuntime serverDef = getServerDefinition();
- Resolver resolver = serverDef.getResolver();
- workingCopy.setAttribute(IJavaLaunchConfigurationConstants.ATTR_WORKING_DIRECTORY,
- resolver.resolveProperties(serverDef.getStart().getWorkingDirectory()));
- String external = resolver.resolveProperties(getExternalForOS(serverDef.getStart().getExternal()));
- workingCopy.setAttribute(ExternalLaunchConfigurationDelegate.COMMANDLINE, external);
- workingCopy.setAttribute(ExternalLaunchConfigurationDelegate.DEBUG_PORT,
- resolver.resolveProperties(serverDef.getStart().getDebugPort()));
- // just use the commandline for now
- workingCopy.setAttribute(ExternalLaunchConfigurationDelegate.EXECUTABLE_NAME, external);
- Map environVars = getEnvironmentVariables(getServerDefinition().getStart());
- if(!environVars.isEmpty()){
- workingCopy.setAttribute(ILaunchManager.ATTR_ENVIRONMENT_VARIABLES,environVars);
- }
- String existingProgArgs = workingCopy.getAttribute(IJavaLaunchConfigurationConstants.ATTR_PROGRAM_ARGUMENTS, (String)null);
- String serverProgArgs = getProgramArguments();
- if(existingProgArgs==null || existingProgArgs.indexOf(serverProgArgs)<0) {
- workingCopy.setAttribute(IJavaLaunchConfigurationConstants.ATTR_PROGRAM_ARGUMENTS,serverProgArgs);
- }
- }
-
- /*
- * Returns the first external whose "os" attribute matches (case insensitive) the beginning
- * of the name of the current OS (as determined by the System "os.name" property). If
- * no such match is found, returns the first external that does not have an OS attribute.
- */
- private String getExternalForOS(List externals) {
- String currentOS = System.getProperty("os.name").toLowerCase(); //$NON-NLS-1$
- External external;
- String matchingExternal = null;
- String externalOS;
- Iterator i = externals.iterator();
- while (i.hasNext()) {
- external= (External) i.next();
- externalOS = external.getOs();
- if (externalOS == null) {
- if (matchingExternal == null) {
- matchingExternal = external.getValue();
- }
- } else if (currentOS.startsWith(externalOS.toLowerCase())) {
- matchingExternal = external.getValue();
- break;
- }
- }
- return matchingExternal;
- }
-
- /**
- * Returns the String ID of the launch configuration type.
- * @return launchTypeID
- */
- protected String getConfigTypeID() {
- return ExternalLaunchConfigurationDelegate.ID_EXTERNAL_LAUNCH_TYPE;
- }
-
- /**
- * Returns the String name of the stop launch configuration.
- * @return launcherName
- */
- protected String getStopLaunchName() {
- return GenericServerCoreMessages.externalStopLauncher;
- }
-
- /**
- * Sets up the launch configuration for stopping the server.
- *
- */
- protected void setupStopLaunchConfiguration(GenericServerRuntime runtime, ILaunchConfigurationWorkingCopy wc) {
- clearDebuggingConfig();
- ServerRuntime serverDef = getServerDefinition();
- Resolver resolver = serverDef.getResolver();
- wc.setAttribute(IJavaLaunchConfigurationConstants.ATTR_WORKING_DIRECTORY,
- resolver.resolveProperties(serverDef.getStop().getWorkingDirectory()));
- String external = resolver.resolveProperties(getExternalForOS(serverDef.getStop().getExternal()));
- wc.setAttribute(ExternalLaunchConfigurationDelegate.COMMANDLINE, external);
- // just use commandline for now
- Map environVars = getEnvironmentVariables(getServerDefinition().getStop());
- if(!environVars.isEmpty()){
- wc.setAttribute(ILaunchManager.ATTR_ENVIRONMENT_VARIABLES,environVars);
- }
- wc.setAttribute(
- IJavaLaunchConfigurationConstants.ATTR_PROGRAM_ARGUMENTS,
- resolver.resolveProperties(serverDef.getStop().getProgramArgumentsAsString()));
- wc.setAttribute(ExternalLaunchConfigurationDelegate.EXECUTABLE_NAME, external);
- wc.setAttribute(Server.ATTR_SERVER_ID, getServer().getId());
- }
-
- /**
- * Sets the configuration to use for launching a debugging session
- */
- protected synchronized void setDebuggingConfig(ILaunchConfigurationWorkingCopy wc,
- String mode,
- ILaunch launch,
- IProgressMonitor monitor) {
- this.fLaunchConfigurationWC = wc;
- this.fMode = mode;
- this.fLaunch = launch;
- this.fProgressMonitor = monitor;
- }
-
- private synchronized void clearDebuggingConfig() {
- this.fLaunchConfigurationWC = null;
- this.fMode = null;
- this.fLaunch = null;
- this.fProgressMonitor = null;
- }
-
-
-}
View
81 ...g.eclipse.jst.server.generic.core/src/org/eclipse/jst/server/generic/core/internal/GenericPublisher.java
@@ -1,81 +0,0 @@
-/***************************************************************************************************
- * Copyright (c) 2005 Eteration A.S. and Gorkem Ercan. All rights reserved. This program and the
- * accompanying materials are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors: Gorkem Ercan - initial API and implementation
- *
- **************************************************************************************************/
-package org.eclipse.jst.server.generic.core.internal;
-
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.wst.server.core.IModule;
-import org.eclipse.wst.server.core.IModuleArtifact;
-import org.eclipse.wst.server.core.IServer;
-
-/**
- * The abstract publisher. This is intended to be subclassed by
- * clients implementing the genericpublisher extension point.
- *
- * @author Gorkem Ercan
- */
-public abstract class GenericPublisher
-{
-
- private IModule[] fModule;
- private GenericServerRuntime fServerRuntime;
- private GenericServer fServer;
-
- protected void initialize(IModule[] module, IServer server)
- {
- fModule = module;
- fServer = (GenericServer)server.loadAdapter(GenericServer.class,null);
- fServerRuntime = (GenericServerRuntime)server.getRuntime().loadAdapter(GenericServerRuntime.class,null);
- }
- /**
- * Called by the generic server implementation when a module is
- * removed form the server instance.
- * Subclasses may extend this method to perform their own module removal
- *
- * @param monitor
- * @return status
- */
- public abstract IStatus[] unpublish(IProgressMonitor monitor);
-
- /**
- * Called by the generic server implementation when a publish module
- * event occurs.
- * Subclasses may extend this method to perform their own publishing
- *
- * @param resource
- * @param monitor
- * @return status
- */
- public abstract IStatus[] publish(IModuleArtifact[] resource,
- IProgressMonitor monitor);
-
- /**
- * Returns the module associated with this publisher instance
- * @return module
- */
- public IModule[] getModule() {
- return fModule;
- }
-
- /**
- * Generic server instance
- * @return server
- */
- public GenericServer getServer(){
- return fServer;
- }
- /**
- * a handle to server definition.
- * @return serverdef
- */
- public GenericServerRuntime getServerRuntime() {
- return fServerRuntime;
- }
-}
View
312 .../org.eclipse.jst.server.generic.core/src/org/eclipse/jst/server/generic/core/internal/GenericServer.java
@@ -1,312 +0,0 @@
-/***************************************************************************************************
- * Copyright (c) 2005 Eteration A.S. and Gorkem Ercan. All rights reserved. This program and the
- * accompanying materials are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors: Gorkem Ercan - initial API and implementation
- *
- **************************************************************************************************/
-package org.eclipse.jst.server.generic.core.internal;
-
-import java.io.File;
-import java.net.URL;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.jst.server.core.FacetUtil;
-import org.eclipse.jst.server.core.IEnterpriseApplication;
-import org.eclipse.jst.server.core.IWebModule;
-import org.eclipse.jst.server.generic.servertype.definition.Module;
-import org.eclipse.jst.server.generic.servertype.definition.Port;
-import org.eclipse.jst.server.generic.servertype.definition.Property;
-import org.eclipse.jst.server.generic.servertype.definition.ServerRuntime;
-import org.eclipse.osgi.util.NLS;
-import org.eclipse.wst.server.core.IModule;
-import org.eclipse.wst.server.core.IModuleType;
-import org.eclipse.wst.server.core.ServerPort;
-import org.eclipse.wst.server.core.ServerUtil;
-import org.eclipse.wst.server.core.model.IURLProvider;
-import org.eclipse.wst.server.core.model.ServerDelegate;
-
-/**
- * Generic XML based server implementation.
- *
- * @author Gorkem Ercan
- */
-public class GenericServer extends ServerDelegate implements IURLProvider {
-
- private static final String ATTR_GENERIC_SERVER_MODULES = "Generic_Server_Modules_List"; //$NON-NLS-1$
-
- public IStatus canModifyModules(IModule[] add, IModule[] remove) {
- List moduleTypes = getServerDefinition().getModule();
- int found =0;
- for (int i = 0; i < add.length; i++) {
- for(int j=0;j<moduleTypes.size();j++){
- Module module = (Module)moduleTypes.get(j);
- if(add[i].getModuleType()!= null && add[i].getModuleType().getId().equals(module.getType())){
- found++;
- break;
- }
- }
- }
-
- for (int i = 0; i < add.length; i++) {
- IModule module = add[i];
- if (module.getProject() != null) {
- IStatus status = FacetUtil.verifyFacets(module.getProject(), getServer());
- if (status != null && !status.isOK())
- return status;
- }
- }
-
- if(found==add.length)
- return new Status(IStatus.OK, CorePlugin.PLUGIN_ID, 0, "CanModifyModules", null); //$NON-NLS-1$
-
- return new Status(IStatus.ERROR, CorePlugin.PLUGIN_ID, 0, GenericServerCoreMessages.moduleNotCompatible, null);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.wst.server.core.model.ServerDelegate#modifyModules(org.eclipse.wst.server.core.IModule[], org.eclipse.wst.server.core.IModule[], org.eclipse.core.runtime.IProgressMonitor)
- */
- public void modifyModules(IModule[] add, IModule[] remove, IProgressMonitor monitor) throws CoreException {
-
- List modules = this.getAttribute(ATTR_GENERIC_SERVER_MODULES,(List)null);
-
- if(add!=null&& add.length>0)
- {
- if(modules==null) {
- modules=new ArrayList(add.length);
- }
- for (int i = 0; i < add.length; i++) {
-
- if(modules.contains(add[i].getId())==false)
- modules.add(add[i].getId());
- }
- }
- if(remove!=null && remove.length>0 && modules!=null)
- {
- for (int i = 0; i < remove.length; i++) {
- modules.remove(remove[i].getId());
- }
- }
- if(modules!=null)
- setAttribute(ATTR_GENERIC_SERVER_MODULES,modules);
-
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.wst.server.core.model.IServerDelegate#getChildModules(org.eclipse.wst.server.core.model.IModule[])
- */
- public IModule[] getChildModules(IModule[] module) {
- if (module[0] != null && module[0].getModuleType() != null) {
- if (module.length == 1) {
- IModuleType moduleType = module[0].getModuleType();
- if (moduleType != null && "jst.ear".equals(moduleType.getId())) { //$NON-NLS-1$
- IEnterpriseApplication enterpriseApplication = (IEnterpriseApplication) module[0]
- .loadAdapter(IEnterpriseApplication.class, null);
- if (enterpriseApplication != null) {
- IModule[] earModules = enterpriseApplication.getModules();
- if ( earModules != null) {
- return earModules;
- }
- }
- }
- else if (moduleType != null && "jst.web".equals(moduleType.getId())) { //$NON-NLS-1$
- IWebModule webModule = (IWebModule) module[0].loadAdapter(IWebModule.class, null);
- if (webModule != null) {
- IModule[] modules = webModule.getModules();
- return modules;
- }
- }
- }
- }
- return new IModule[0];
- }
-
- /**
- * Returns the server instance properties including runtime properties.
- *
- * @return server instance properties.
- */
- private Map getInstanceProperties() {
- Map runtimeProperties =getRuntimeDelegate().getServerInstanceProperties();
- Map serverProperties = getServerInstanceProperties();
- Map instanceProperties = new HashMap(runtimeProperties.size()+serverProperties.size());
- instanceProperties.putAll(runtimeProperties);
- instanceProperties.putAll(serverProperties);
- return instanceProperties;
- }
-
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.wst.server.core.model.IMonitorableServer#getServerPorts()
- */
- public org.eclipse.wst.server.core.ServerPort[] getServerPorts() {
- List ports = new ArrayList();
- Iterator pIter = this.getServerDefinition().getPort().iterator();
- while (pIter.hasNext()) {
- Port element = (Port) pIter.next();
- int port = Integer.parseInt(getServerDefinition().getResolver().resolveProperties(element.getNo()));
- ports.add(new ServerPort("server", element.getName(), port, element.getProtocol())); //$NON-NLS-1$
- }
-
- return (org.eclipse.wst.server.core.ServerPort[])ports.toArray(new org.eclipse.wst.server.core.ServerPort[ports.size()]);
- }
-
-
- /* (non-Javadoc)
- * @see org.eclipse.wtp.server.core.model.IURLProvider#getModuleRootURL(org.eclipse.wtp.server.core.model.IModule)
- */
- public URL getModuleRootURL(IModule module) {
-
- try {
- if (module == null || module.loadAdapter(IWebModule.class,null)==null )
- return null;
-
- IWebModule webModule =(IWebModule)module.loadAdapter(IWebModule.class,null);
- String host = getServer().getHost();
- String url = "http://"+host; //$NON-NLS-1$
- int port = 0;
-
- port = getHttpPort();
- port =ServerUtil.getMonitoredPort(getServer(), port, "web"); //$NON-NLS-1$
- if (port != 80)
- url += ":" + port; //$NON-NLS-1$
-
- url += "/"+webModule.getContextRoot(); //$NON-NLS-1$
-
- if (!url.endsWith("/")) //$NON-NLS-1$
- url += "/"; //$NON-NLS-1$
-
- return new URL(url);
- } catch (Exception e) {
- Trace.trace("Could not get root URL", e); //$NON-NLS-1$
- return null;
- }
-
- }
-
- /**
- * Return http port
- * @return port
- */
- protected int getHttpPort() {
- int port=-1;
- Iterator pIter = this.getServerDefinition().getPort().iterator();
- while (pIter.hasNext()) {
- Port aPort = (Port) pIter.next();
- if(port== -1)
- port = Integer.parseInt(getServerDefinition().getResolver().resolveProperties(aPort.getNo()));
- else if( "http".equals(aPort.getProtocol() ) ) //$NON-NLS-1$
- port = Integer.parseInt(aPort.getNo());
- }
- if( port == -1)
- port = 8080;
- return port;
- }
-
- /**
- * Returns the ServerRuntime that represents the .serverdef
- * file for this server.
- * @return server runtime
- */
- public ServerRuntime getServerDefinition(){
- String rtTypeId = getServer().getRuntime().getRuntimeType().getId();
- return CorePlugin.getDefault().getServerTypeDefinitionManager().getServerRuntimeDefinition(rtTypeId,getInstanceProperties());
- }
-
- private GenericServerRuntime getRuntimeDelegate(){
- return (GenericServerRuntime)getServer().getRuntime().loadAdapter(GenericServerRuntime.class,null);
- }
-
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.wst.server.core.model.ServerDelegate#getRootModules(org.eclipse.wst.server.core.IModule)
- */
- public IModule[] getRootModules(IModule module) throws CoreException {
- IStatus status = canModifyModules(new IModule[] { module }, null);
- if (status != null && !status.isOK())
- throw new CoreException(status);;
- IModule[] childs = doGetParentModules(module);
- if(childs.length>0)
- return childs;
- return new IModule[] { module };
- }
-
-
- private IModule[] doGetParentModules(IModule module) {
- IModule[] ears = ServerUtil.getModules("jst.ear"); //$NON-NLS-1$
- ArrayList list = new ArrayList();
- for (int i = 0; i < ears.length; i++) {
- IEnterpriseApplication ear = (IEnterpriseApplication)ears[i].loadAdapter(IEnterpriseApplication.class,null);
- IModule[] childs = ear.getModules();
- for (int j = 0; j < childs.length; j++) {
- if(childs[j].equals(module))
- list.add(ears[i]);
- }
- }
- return (IModule[])list.toArray(new IModule[list.size()]);
- }
- /**
- * Returns the server properties.
- * @return Map of properties.
- */
- public Map getServerInstanceProperties() {
- return getAttribute(GenericServerRuntime.SERVER_INSTANCE_PROPERTIES, new HashMap());
- }
- /**
- * Change the server instance properties.
- *
- * @param map
- */
- public void setServerInstanceProperties(Map map) {
- setAttribute(GenericServerRuntime.SERVER_INSTANCE_PROPERTIES, map);
- }
- /**
- * Checks if the properties set for this server is valid.
- * @return status
- */
- public IStatus validate() {
- List props = this.getServerDefinition().getProperty();
- for(int i=0;i<props.size();i++)
- {
- Property property =(Property)props.get(i);
- if(property.getType().equals(Property.TYPE_DIRECTORY) || property.getType().equals(Property.TYPE_FILE))
- {
- String path= (String)getInstanceProperties().get(property.getId());
- if(path!=null && !pathExist(path))
- return new Status(IStatus.ERROR, CorePlugin.PLUGIN_ID, 0, NLS.bind(GenericServerCoreMessages.invalidPath,path), null);
- }
- }
- return new Status(IStatus.OK, CorePlugin.PLUGIN_ID, 0, "", null); //$NON-NLS-1$
- }
- private boolean pathExist(String path){
- File f = new File(path);
- return f.exists();
- }
-
- public void setDefaults(IProgressMonitor monitor) {
- List props = this.getServerDefinition().getProperty();
- Map instancePropsMap = new HashMap();
- for (Iterator iter = props.iterator(); iter.hasNext();) {
- Property element = (Property) iter.next();
- if(Property.CONTEXT_SERVER.equalsIgnoreCase(element.getContext()))
- instancePropsMap.put(element.getId(), element.getDefault());
- }
- setServerInstanceProperties(instancePropsMap);
- }
-
-}
View
531 ...pse.jst.server.generic.core/src/org/eclipse/jst/server/generic/core/internal/GenericServerBehaviour.java
@@ -1,531 +0,0 @@
-/***************************************************************************************************
- * Copyright (c) 2005 Eteration A.S. and Gorkem Ercan. All rights reserved. This program and the
- * accompanying materials are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors: Gorkem Ercan - initial API and implementation
- *
- **************************************************************************************************/
-package org.eclipse.jst.server.generic.core.internal;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.NullProgressMonitor;
-import org.eclipse.core.runtime.Path;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.debug.core.DebugEvent;
-import org.eclipse.debug.core.DebugPlugin;
-import org.eclipse.debug.core.IDebugEventSetListener;
-import org.eclipse.debug.core.ILaunch;
-import org.eclipse.debug.core.ILaunchConfiguration;
-import org.eclipse.debug.core.ILaunchConfigurationType;
-import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
-import org.eclipse.debug.core.ILaunchManager;
-import org.eclipse.debug.core.model.IProcess;
-import org.eclipse.debug.ui.IDebugUIConstants;
-import org.eclipse.jdt.launching.IJavaLaunchConfigurationConstants;
-import org.eclipse.jdt.launching.IRuntimeClasspathEntry;
-import org.eclipse.jdt.launching.IVMInstall;
-import org.eclipse.jdt.launching.JavaRuntime;
-import org.eclipse.jst.server.generic.servertype.definition.ArchiveType;
-import org.eclipse.jst.server.generic.servertype.definition.ArgumentPair;
-import org.eclipse.jst.server.generic.servertype.definition.Classpath;
-import org.eclipse.jst.server.generic.servertype.definition.LaunchConfiguration;
-import org.eclipse.jst.server.generic.servertype.definition.ServerRuntime;
-import org.eclipse.osgi.util.NLS;
-import org.eclipse.wst.server.core.IModule;
-import org.eclipse.wst.server.core.IServer;
-import org.eclipse.wst.server.core.ServerPort;
-import org.eclipse.wst.server.core.internal.DeletedModule;
-import org.eclipse.wst.server.core.model.ServerBehaviourDelegate;
-import org.eclipse.wst.server.core.model.ServerDelegate;
-import org.eclipse.wst.server.core.util.SocketUtil;
-
-/**
- * Server behaviour delegate implementation for generic server.
- *
- * @author Gorkem Ercan
- */
-public class GenericServerBehaviour extends ServerBehaviourDelegate {
-
- private static final String ATTR_STOP = "stop-server"; //$NON-NLS-1$
-
- // the thread used to ping the server to check for startup
- protected transient PingThread ping = null;
- protected transient IDebugEventSetListener processListener;
- protected transient IProcess process;
-
- /* (non-Javadoc)
- * @see org.eclipse.wst.server.core.model.ServerBehaviourDelegate#publishServer(org.eclipse.core.runtime.IProgressMonitor)
- */
- public void publishServer(int kind, IProgressMonitor monitor) throws CoreException {
- // do nothing
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.wst.server.core.model.ServerBehaviourDelegate#publishModule(org.eclipse.wst.server.core.IModule[], org.eclipse.wst.server.core.IModule, org.eclipse.core.runtime.IProgressMonitor)
- */
- public void publishModule(int kind, int deltaKind, IModule[] module,
- IProgressMonitor monitor) throws CoreException {
-
-
- if(REMOVED == deltaKind){
- removeFromServer(module,monitor);
- }
- else{
- checkClosed(module);
- String publisherId = ServerTypeDefinitionUtil.getPublisherID(module[0], getServerDefinition());
- GenericPublisher publisher = PublishManager.getPublisher(publisherId);
- if(publisher==null){
- IStatus status = new Status(IStatus.ERROR,CorePlugin.PLUGIN_ID,0, NLS.bind(GenericServerCoreMessages.unableToCreatePublisher,publisherId),null);
- throw new CoreException(status);
- }
- publisher.initialize(module,getServer());
- IStatus[] status= publisher.publish(null,monitor);
- if(status==null){
- setModulePublishState(module, IServer.PUBLISH_STATE_NONE);
- }else {
- for (int i=0; i < status.length; i++) {
- if (IStatus.ERROR == status[i].getSeverity()){
- setModulePublishState(module, IServer.PUBLISH_STATE_UNKNOWN);
- throw new CoreException(status[i]);
- }
- }
- }
- }
- }
-
- private void checkClosed(IModule[] module) throws CoreException
- {
- for(int i=0;i<module.length;i++)
- {
- if(module[i] instanceof DeletedModule)
- {
- IStatus status = new Status(IStatus.ERROR,CorePlugin.PLUGIN_ID,0, NLS.bind(GenericServerCoreMessages.canNotPublishDeletedModule,module[i].getName()),null);
- throw new CoreException(status);
- }
- }
- }
- private void removeFromServer(IModule[] module, IProgressMonitor monitor) throws CoreException
- {
- String publisherId = ServerTypeDefinitionUtil.getPublisherID(module[0], getServerDefinition());
- GenericPublisher publisher = PublishManager.getPublisher(publisherId);
- if(publisher==null){
- IStatus status = new Status(IStatus.ERROR,CorePlugin.PLUGIN_ID,0,NLS.bind(GenericServerCoreMessages.unableToCreatePublisher,publisherId),null);
- throw new CoreException(status);
- }
- publisher.initialize(module,getServer());
- publisher.unpublish(monitor);
- }
-
-
- /* (non-Javadoc)
- * @see org.eclipse.wst.server.core.model.ServerBehaviourDelegate#stop(boolean)
- */
- public void stop(boolean force) {
- if (force) {
- terminate();
- return;
- }
-
- int state = getServer().getServerState();
- if (state == IServer.STATE_STOPPED)
- return;
- else if (state == IServer.STATE_STARTING || state == IServer.STATE_STOPPING) {
- terminate();
- return;
- }
-
- shutdown(state);
- }
-
- /**
- * Shuts down the server via the launch configuration.
- */
- protected void shutdown(int state) {
- GenericServerRuntime runtime = getRuntimeDelegate();
- try {
- Trace.trace(Trace.FINEST, "Stopping Server"); //$NON-NLS-1$
- if (state != IServer.STATE_STOPPED)
- setServerState(IServer.STATE_STOPPING);
- String configTypeID = getConfigTypeID();
- ILaunchManager mgr = DebugPlugin.getDefault().getLaunchManager();
- ILaunchConfigurationType type = mgr.getLaunchConfigurationType(configTypeID);
- String launchName = getStopLaunchName();
- String uniqueLaunchName = mgr.generateUniqueLaunchConfigurationNameFrom(launchName);
- ILaunchConfiguration conf = null;
- ILaunchConfiguration[] lch = mgr.getLaunchConfigurations(type);
- for (int i = 0; i < lch.length; i++) {
- if (launchName.equals(lch[i].getName())) {
- conf = lch[i];
- break;
- }
- }
-
- ILaunchConfigurationWorkingCopy wc = null;
- if (conf != null) {
- wc = conf.getWorkingCopy();
- } else {
- wc = type.newInstance(null, uniqueLaunchName);
- }
-
- // To stop from appearing in history lists
- wc.setAttribute(IDebugUIConstants.ATTR_PRIVATE, true);
- // Set the stop attribute so that we know we are stopping
- wc.setAttribute(ATTR_STOP, "true"); //$NON-NLS-1$
-
- // Setup the launch config for stopping the server
- setupStopLaunchConfiguration(runtime, wc);
-
- // Launch the stop launch config
- wc.launch(ILaunchManager.RUN_MODE, new NullProgressMonitor());
-
- } catch (Exception e) {
- Trace.trace(Trace.SEVERE, "Error stopping Server", e); //$NON-NLS-1$
- }
- }
-
- /**
- * Returns the String ID of the launch configuration type.
- * @return id
- */
- protected String getConfigTypeID() {
- return IJavaLaunchConfigurationConstants.ID_JAVA_APPLICATION;
- }
-
- /**
- * Returns the String name of the stop launch configuration.
- * @return launchname
- */
- protected String getStopLaunchName() {
- return "GenericServerStopper"; //$NON-NLS-1$
- }
-
- private boolean isRemote(){
- return (getServer().getServerType().supportsRemoteHosts()&& !SocketUtil.isLocalhost(getServer().getHost()) );
- }
- /**
- * Sets up the launch configuration for stopping the server.
- */
- protected void setupStopLaunchConfiguration(GenericServerRuntime runtime, ILaunchConfigurationWorkingCopy wc) {
- if(isRemote())// Do not launch for remote servers.
- return;
-
- wc.setAttribute(
- IJavaLaunchConfigurationConstants.ATTR_MAIN_TYPE_NAME,
- getServerDefinition().getResolver().resolveProperties(this.getServerDefinition().getStop().getMainClass()));
-
- IVMInstall vmInstall = runtime.getVMInstall();
- wc.setAttribute(
- IJavaLaunchConfigurationConstants.ATTR_VM_INSTALL_TYPE, runtime
- .getVMInstallTypeId());
- wc.setAttribute(
- IJavaLaunchConfigurationConstants.ATTR_VM_INSTALL_NAME,
- vmInstall.getName());
-
- setupLaunchClasspath(wc, vmInstall, getStopClasspath());
-
- Map environVars = getEnvironmentVariables(getServerDefinition().getStop());
- if(!environVars.isEmpty()){
- wc.setAttribute(ILaunchManager.ATTR_ENVIRONMENT_VARIABLES,environVars);
- }
-
- wc.setAttribute(
- IJavaLaunchConfigurationConstants.ATTR_WORKING_DIRECTORY,
- getServerDefinition().getResolver().resolveProperties(getServerDefinition().getStop().getWorkingDirectory()));
- wc.setAttribute(
- IJavaLaunchConfigurationConstants.ATTR_PROGRAM_ARGUMENTS,
- getServerDefinition().getResolver().resolveProperties(getServerDefinition().getStop().getProgramArgumentsAsString()));
- wc.setAttribute(
- IJavaLaunchConfigurationConstants.ATTR_VM_ARGUMENTS,
- getServerDefinition().getResolver().resolveProperties(getServerDefinition().getStop().getVmParametersAsString()));
- }
-
- /**
- * Start class name
- * @return name
- */
- public String getStartClassName() {
- return getServerDefinition().getResolver().resolveProperties(getServerDefinition().getStart().getMainClass());
- }
-
- /**
- * Server definition
- * @return serverdef
- */
- public ServerRuntime getServerDefinition() {
- GenericServer server = (GenericServer)getServer().loadAdapter(ServerDelegate.class, null);
- return server.getServerDefinition();
- }
-
- protected GenericServerRuntime getRuntimeDelegate() {
- return (GenericServerRuntime)getServer().getRuntime().loadAdapter(GenericServerRuntime.class,null);
- }
-
- private List getStartClasspath() {
- String cpRef = getServerDefinition().getStart().getClasspathReference();
- return serverClasspath(cpRef);
- }
-
- /**
- * @param cpRef
- * @return classpath
- */
- protected List serverClasspath(String cpRef) {
- Classpath classpath = getServerDefinition().getClasspath(cpRef);
-
- List cpEntryList = new ArrayList(classpath.getArchive().size());
- Iterator iterator= classpath.getArchive().iterator();
- while(iterator.hasNext())
- {
- ArchiveType archive = (ArchiveType)iterator.next();
- String cpath = getServerDefinition().getResolver().resolveProperties(archive.getPath());
-
- cpEntryList.add(JavaRuntime.newArchiveRuntimeClasspathEntry(
- new Path(cpath)));
- }
- return cpEntryList;
- }
-
- /**
- * @param wc
- * @param vmInstall
- */
- protected void setupLaunchClasspath(ILaunchConfigurationWorkingCopy wc, IVMInstall vmInstall, List cp) {
- //merge existing classpath with server classpath
- try {
- IRuntimeClasspathEntry[] existingCps = JavaRuntime.computeUnresolvedRuntimeClasspath(wc);
- for (int i = 0; i < existingCps.length; i++) {
- if(cp.contains(existingCps[i])==false){
- cp.add(existingCps[i]);
- }
- }
- } catch (CoreException e) {
- // ignore
- }
-
- wc.setAttribute(IJavaLaunchConfigurationConstants.ATTR_CLASSPATH, convertCPEntryToMemento(cp));
- wc.setAttribute(IJavaLaunchConfigurationConstants.ATTR_DEFAULT_CLASSPATH,false);
- }
-
- private List convertCPEntryToMemento(List cpEntryList)
- {
- List list = new ArrayList(cpEntryList.size());
- Iterator iterator = cpEntryList.iterator();
- while(iterator.hasNext())
- {
- IRuntimeClasspathEntry entry = (IRuntimeClasspathEntry)iterator.next();
- try {
- list.add(entry.getMemento());
- } catch (CoreException e) {
- // ignore
- }
- }
- return list;
- }
-
- private String getWorkingDirectory() {
- return getServerDefinition().getResolver().resolveProperties(getServerDefinition().getStart().getWorkingDirectory());
- }
-
- protected String getProgramArguments() {
- return getServerDefinition().getResolver().resolveProperties(getServerDefinition().getStart().getProgramArgumentsAsString());
- }
-
- protected Map getEnvironmentVariables(LaunchConfiguration config){
- List variables = config.getEnvironmentVariable();
- Map varsMap = new HashMap(variables.size());
- Iterator iterator= variables.iterator();
- while(iterator.hasNext()){
- ArgumentPair pair = (ArgumentPair)iterator.next();
- varsMap.put(pair.getName(),getServerDefinition().getResolver().resolveProperties(pair.getValue()));
- }
- return varsMap;
- }
-
- private String getVmArguments() {
- return getServerDefinition().getResolver().resolveProperties(getServerDefinition().getStart().getVmParametersAsString());
- }
-
- public void setupLaunchConfiguration(ILaunchConfigurationWorkingCopy workingCopy, IProgressMonitor monitor) throws CoreException {
- if(isRemote())// No launch for remote servers.
- return;
-
- workingCopy.setAttribute(
- IJavaLaunchConfigurationConstants.ATTR_MAIN_TYPE_NAME,
- getStartClassName());
-
- GenericServerRuntime runtime = getRuntimeDelegate();
-
- IVMInstall vmInstall = runtime.getVMInstall();
- workingCopy.setAttribute(
- IJavaLaunchConfigurationConstants.ATTR_VM_INSTALL_TYPE, runtime
- .getVMInstallTypeId());
- workingCopy.setAttribute(
- IJavaLaunchConfigurationConstants.ATTR_VM_INSTALL_NAME,
- vmInstall.getName());
-
- setupLaunchClasspath(workingCopy, vmInstall, getStartClasspath());
-
-
- workingCopy.setAttribute(
- IJavaLaunchConfigurationConstants.ATTR_WORKING_DIRECTORY,
- getWorkingDirectory());
-
-
- Map environVars = getEnvironmentVariables(getServerDefinition().getStart());
- if(!environVars.isEmpty()){
- workingCopy.setAttribute(ILaunchManager.ATTR_ENVIRONMENT_VARIABLES,environVars);
- }
-
- String existingProgArgs = workingCopy.getAttribute(IJavaLaunchConfigurationConstants.ATTR_PROGRAM_ARGUMENTS, (String)null);
- String serverProgArgs = getProgramArguments();
- if(existingProgArgs==null || existingProgArgs.indexOf(serverProgArgs)<0) {
- workingCopy.setAttribute(IJavaLaunchConfigurationConstants.ATTR_PROGRAM_ARGUMENTS,serverProgArgs);
- }
- String existingVMArgs = workingCopy.getAttribute(IJavaLaunchConfigurationConstants.ATTR_VM_ARGUMENTS,(String)null);
- String serverVMArgs= getVmArguments();
- if(existingVMArgs==null || existingVMArgs.indexOf(serverVMArgs)<0) {
- workingCopy.setAttribute(IJavaLaunchConfigurationConstants.ATTR_VM_ARGUMENTS,serverVMArgs);
- }
- }
-
- /**
- * Setup for starting the server. Checks all ports available
- * and sets server state and mode.
- *
- * @param launch ILaunch
- * @param launchMode String
- * @param monitor IProgressMonitor
- */
- protected void setupLaunch(ILaunch launch, String launchMode, IProgressMonitor monitor) throws CoreException {
- if ("true".equals(launch.getLaunchConfiguration().getAttribute(ATTR_STOP, "false"))) //$NON-NLS-1$ //$NON-NLS-2$
- return;
-
- String host = getServer().getHost();
- ServerPort[] ports = getServer().getServerPorts(null);
- ServerPort sp = null;
- if(SocketUtil.isLocalhost(host)){
- for(int i=0;i<ports.length;i++){
- sp= ports[i];
- if (SocketUtil.isPortInUse(ports[i].getPort(), 5))
- throw new CoreException(new Status(IStatus.ERROR, CorePlugin.PLUGIN_ID, 0, NLS.bind(GenericServerCoreMessages.errorPortInUse,Integer.toString(sp.getPort()),sp.getName()),null));
- }
- }
- setServerState(IServer.STATE_STARTING);
- setMode(launchMode);
- }
- /**
- * Call to start Ping thread that will check for startup of the server.
- *
- */
- protected void startPingThread()
- {
- try {
- String url = "http://"+getServer().getHost();; //$NON-NLS-1$
- ServerPort[] ports = getServer().getServerPorts(null);
- ServerPort sp = null;
- for(int i=0;i<ports.length;i++){
- if(ports[i].getProtocol().equalsIgnoreCase("http")){//$NON-NLS-1$
- sp=ports[i];
- }
- }
- if(sp==null){
- Trace.trace(Trace.SEVERE, "Can't ping for server startup."); //$NON-NLS-1$
- return;
- }
- int port = sp.getPort();
- if (port != 80)
- url += ":" + port; //$NON-NLS-1$
- ping = new PingThread(getServer(), url, this);
- } catch (Exception e) {
- Trace.trace(Trace.SEVERE, "Can't ping for server startup."); //$NON-NLS-1$
- }
- }
-
- protected void setProcess(final IProcess newProcess) {
- if (process != null)
- return;
- if(processListener!=null)
- DebugPlugin.getDefault().removeDebugEventListener(processListener);
- if (newProcess==null)
- return;
- process = newProcess;
- processListener = new IDebugEventSetListener() {
- public void handleDebugEvents(DebugEvent[] events) {
- if (events != null) {
- int size = events.length;
- for (int i = 0; i < size; i++) {
- if (process!= null && process.equals(events[i].getSource()) && events[i].getKind() == DebugEvent.TERMINATE) {
- DebugPlugin.getDefault().removeDebugEventListener(this);
- stopImpl();
- }
- }
- }
- }
- };
- DebugPlugin.getDefault().addDebugEventListener(processListener);
- }
-
- protected void stopImpl() {
- if (ping != null) {
- ping.stop();
- ping = null;
- }
- if (process != null) {
- process = null;
- DebugPlugin.getDefault().removeDebugEventListener(processListener);
- processListener = null;
- }
- setServerState(IServer.STATE_STOPPED);
- }
-
- /**
- * Terminates the server.
- * This method may be called before a process created while setting up the
- * launch config.
- */
- protected void terminate() {
- if (getServer().getServerState() == IServer.STATE_STOPPED)
- return;
-
- try {
- setServerState(IServer.STATE_STOPPING);
- Trace.trace(Trace.FINEST, "Killing the Server process"); //$NON-NLS-1$
- if (process != null && !process.isTerminated()) {
- process.terminate();
-
- }
- stopImpl();
- } catch (Exception e) {
- Trace.trace(Trace.SEVERE, "Error killing the process", e); //$NON-NLS-1$
- }
- }
-
- private List getStopClasspath() {
- String cpRef = getServerDefinition().getStop().getClasspathReference();
- return serverClasspath(cpRef);
- }
-
- public void publishFinish(IProgressMonitor monitor) throws CoreException {
- IModule[] modules = this.getServer().getModules();
- boolean allpublished= true;
- for (int i = 0; i < modules.length; i++) {
- if(this.getServer().getModulePublishState(new IModule[]{modules[i]})!=IServer.PUBLISH_STATE_NONE)
- allpublished=false;
- }
- if(allpublished)
- setServerPublishState(IServer.PUBLISH_STATE_NONE);
- }
-
- protected void setServerStarted() {
- setServerState(IServer.STATE_STARTED);
- }
-}
View
58 ....jst.server.generic.core/src/org/eclipse/jst/server/generic/core/internal/GenericServerCoreMessages.java
@@ -1,58 +0,0 @@
-/***************************************************************************************************
- * Copyright (c) 2005 Eteration A.S. and Gorkem Ercan. All rights reserved. This program and the
- * accompanying materials are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors: Gorkem Ercan - initial API and implementation
- *
- **************************************************************************************************/
-package org.eclipse.jst.server.generic.core.internal;
-
-import org.eclipse.osgi.util.NLS;
-
-/**
- * Helper class to get messages
- *
- * @author Gorkem Ercan
- */
-public class GenericServerCoreMessages extends NLS{
-
- private static final String RESOURCE_BUNDLE= "org.eclipse.jst.server.generic.core.internal.GenericServerCoreMessages";//$NON-NLS-1$
- public static String cancelNoPublish;
- public static String moduleNotCompatible;
- public static String errorPortInUse;
- public static String errorJRE;
- public static String errorNoServerType;
- public static String errorNoClasspath;
- public static String errorMissingClasspathEntry;
- public static String errorRemoveModuleAntpublisher;
- public static String errorPublishAntpublisher;
- public static String commandlineUnspecified;
- public static String noProfiler;
- public static String workingdirUnspecified;
- public static String errorLaunchingExecutable;
- public static String missingServer;
- public static String externalStopLauncher;
- public static String debugPortUnspecified;
- public static String errorStartingExternalDebugging;
- public static String invalidPath;
- public static String runModeNotSupported;
- public static String unableToCreatePublisher;
- public static String canNotPublishDeletedModule;
- public static String antLauncherMissing;
- public static String attachingToExternalGenericServer;
- public static String verifyingExternalServerDebuggingLaunchAttributes;
- public static String externalServerDebugConnectorNotSpecified;
- public static String creatingExternalServerDebuggingSourceLocator;
-
-
- static{
- NLS.initializeMessages(RESOURCE_BUNDLE, GenericServerCoreMessages.class);
- }
-
-
-
-
-
-}
View
35 ...erver.generic.core/src/org/eclipse/jst/server/generic/core/internal/GenericServerCoreMessages.properties
@@ -1,35 +0,0 @@
-###############################################################################
-# Copyright (c) 2005 Eteration A.S. and Gorkem Ercan. All rights reserved. This program and the
-# accompanying materials are made available under the terms of the Eclipse Public License v1.0
-# which accompanies this distribution, and is available at
-# http://www.eclipse.org/legal/epl-v10.html
-#
-# Contributors: Gorkem Ercan - initial API and implementation
-#
-###############################################################################
-errorJRE=Invalid JRE
-errorNoServerType=No server type definition
-errorMissingClasspathEntry=Missing classpath entry {0}
-errorPortInUse=Server port In Use {0}-{1}
-cancelNoPublish=Nothing to publish
-moduleNotCompatible=Module type is not compatible
-errorNoClasspath=No classpath is defined
-errorRemoveModuleAntpublisher= Remove module failed using Ant publisher
-errorPublishAntpublisher= Publish failed using Ant publisher
-commandlineUnspecified=Executable commandline is unspecified
-workingdirUnspecified=Working directory is unspecified or invalid
-errorLaunchingExecutable=Error launching executable
-missingServer=Server does not exist
-externalStopLauncher=ExternalLaunchStopper
-debugPortUnspecified=Debugging port is unspecified
-errorStartingExternalDebugging=Error launching remote debugging for external server, changing to non-debugging mode.\nPlease check the debug port setting and ensure that the specified 'start' executable launches the server with debugging enabled
-invalidPath = {0} is not valid
-runModeNotSupported= Selected VM does not support this mode
-unableToCreatePublisher=Unable to create publisher {0}
-canNotPublishDeletedModule=Can not publish because module {0} is closed or deleted
-antLauncherMissing=Ant launcher is missing or disabled
-noProfiler=Could not launch in profiling mode because no profilers are configured.
-attachingToExternalGenericServer=Attaching to external generic server {0}.
-verifyingExternalServerDebuggingLaunchAttributes=Verifying debugging launch attributes.
-externalServerDebugConnectorNotSpecified=Debugging connector not specified.
-creatingExternalServerDebuggingSourceLocator=Creating debugging source locator.
View
136 ...eric.core/src/org/eclipse/jst/server/generic/core/internal/GenericServerLaunchConfigurationDelegate.java
@@ -1,136 +0,0 @@
-/***************************************************************************************************
- * Copyright (c) 2005 Eteration A.S. and Gorkem Ercan. All rights reserved. This program and the
- * accompanying materials are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors: Gorkem Ercan - initial API and implementation
- *
- **************************************************************************************************/
-package org.eclipse.jst.server.generic.core.internal;
-
-import java.io.File;
-import java.util.Map;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.debug.core.ILaunch;
-import org.eclipse.debug.core.ILaunchConfiguration;
-import org.eclipse.debug.core.ILaunchManager;
-import org.eclipse.jdt.launching.AbstractJavaLaunchConfigurationDelegate;
-import org.eclipse.jdt.launching.ExecutionArguments;
-import org.eclipse.jdt.launching.IJavaLaunchConfigurationConstants;
-import org.eclipse.jdt.launching.IVMInstall;
-import org.eclipse.jdt.launching.IVMRunner;
-import org.eclipse.jdt.launching.VMRunnerConfiguration;
-import org.eclipse.jst.server.core.internal.JavaServerPlugin;
-import org.eclipse.jst.server.core.internal.ServerProfiler;
-import org.eclipse.wst.server.core.IServer;
-import org.eclipse.wst.server.core.ServerUtil;
-import org.eclipse.wst.server.core.model.ServerBehaviourDelegate;
-import org.eclipse.wst.server.core.util.SocketUtil;
-/**
- * ServerLaunchConfiguration for the generic server.
- *
- * @author Gorkem Ercan
- */
-public class GenericServerLaunchConfigurationDelegate extends AbstractJavaLaunchConfigurationDelegate {
-
- /* (non-Javadoc)
- * @see org.eclipse.debug.core.model.ILaunchConfigurationDelegate#launch(org.eclipse.debug.core.ILaunchConfiguration, java.lang.String, org.eclipse.debug.core.ILaunch, org.eclipse.core.runtime.IProgressMonitor)
- */
- public void launch(ILaunchConfiguration configuration, String mode,
- ILaunch launch, IProgressMonitor monitor) throws CoreException {
-
- IServer server = ServerUtil.getServer(configuration);
- if (server == null) {
- abort(GenericServerCoreMessages.missingServer, null,
- IJavaLaunchConfigurationConstants.ERR_INTERNAL_ERROR);
- }
- GenericServerBehaviour genericServer = (GenericServerBehaviour) server.loadAdapter(ServerBehaviourDelegate.class, null);
-
- try {
- genericServer.setupLaunch(launch, mode, monitor);
- if(genericServer.getServer().getServerType().supportsRemoteHosts() && !SocketUtil.isLocalhost(genericServer.getServer().getHost())){
- // no launch for remote servers
- return;
- }
-
- String mainTypeName = genericServer.getStartClassName();
- IVMInstall vm = verifyVMInstall(configuration);
- IVMRunner runner = vm.getVMRunner(mode);
-
- if(runner == null && ILaunchManager.PROFILE_MODE.equals(mode)){
- runner = vm.getVMRunner(ILaunchManager.RUN_MODE);
- }
- if(runner == null){
- throw new CoreException(new Status(IStatus.ERROR,CorePlugin.PLUGIN_ID,0,GenericServerCoreMessages.runModeNotSupported,null));
- }
- File workingDir = verifyWorkingDirectory(configuration);
- String workingDirName = null;
- if (workingDir != null)
- workingDirName = workingDir.getAbsolutePath();
-
- // Program & VM args
- String pgmArgs = getProgramArguments(configuration);
- String vmArgs = getVMArguments(configuration);
- String[] envp= getEnvironment(configuration);
-
- if (ILaunchManager.PROFILE_MODE.equals(mode)) {
- ServerProfiler[] sp = JavaServerPlugin.getServerProfilers();
- if (sp == null || sp.length==0 || runner == null) {
- genericServer.stopImpl();
- throw new CoreException(new Status(IStatus.ERROR, CorePlugin.PLUGIN_ID, 0, GenericServerCoreMessages.noProfiler, null));
- }
- String vmArgs2 = sp[0].getVMArgs(); //$NON-NLS-1$
- vmArgs = vmArgs + " " + vmArgs2; //$NON-NLS-1$
- }
- ExecutionArguments execArgs = new ExecutionArguments(vmArgs, pgmArgs);
-
- // VM-specific attributes
- Map vmAttributesMap = getVMSpecificAttributesMap(configuration);
-
- // Classpath
- String[] classpath = getClasspath(configuration);
-
- // Create VM config
- VMRunnerConfiguration runConfig = new VMRunnerConfiguration(
- mainTypeName, 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
- genericServer.startPingThread();
- runner.run(runConfig, launch, monitor);
- genericServer.setProcess(launch.getProcesses()[0]);
- } catch (CoreException e) {
- Trace.trace(Trace.SEVERE,"error launching generic server",e); //$NON-NLS-1$
- genericServer.terminate();
- throw e;
- }
- }
-
- /**
- * Throws a core exception with the given message and optional
- * exception. The exception's status code will indicate an error.
- *
- * @param message error message
- * @param exception cause of the error, or <code>null</code>
- * @exception CoreException with the given message and underlying
- * exception
- */
- protected void abort(String message, Throwable exception, int code) throws CoreException {
- throw new CoreException(new Status(IStatus.ERROR, CorePlugin.getDefault().getBundle().getSymbolicName(), code, message, exception));
- }
-
-}
View
112 ...eneric.core/src/org/eclipse/jst/server/generic/core/internal/GenericServerLaunchableAdapterDelegate.java
@@ -1,112 +0,0 @@
-/***************************************************************************************************
- * Copyright (c) 2005 Eteration A.S. and Gorkem Ercan. All rights reserved. This program and the
- * accompanying materials are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors: Gorkem Ercan - initial API and implementation
- *
- **************************************************************************************************/
-package org.eclipse.jst.server.generic.core.internal;
-
-import java.net.URL;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Properties;
-import org.eclipse.wst.server.core.IModuleArtifact;
-import org.eclipse.wst.server.core.IServer;
-import org.eclipse.wst.server.core.model.*;
-import org.eclipse.wst.server.core.util.HttpLaunchable;
-import org.eclipse.wst.server.core.util.WebResource;
-import org.eclipse.jst.server.core.EJBBean;
-import org.eclipse.jst.server.core.JndiLaunchable;
-import org.eclipse.jst.server.core.JndiObject;
-import org.eclipse.jst.server.core.Servlet;
-import org.eclipse.jst.server.generic.servertype.definition.ArgumentPair;
-import org.eclipse.jst.server.generic.servertype.definition.ServerRuntime;
-/**
- * Launchable adapter delegate for generic servers.
- * @author Gorkem Ercan
- */
-public class GenericServerLaunchableAdapterDelegate extends LaunchableAdapterDelegate {
- private static final String JAVA_NAMING_PROVIDER_URL_PROPKEY = "java.naming.provider.url"; //$NON-NLS-1$
- private static final String JAVA_NAMING_FACTORY_INITIAL_PROPKEY = "java.naming.factory.initial"; //$NON-NLS-1$
-
- /*
- * @see ILaunchableAdapterDelegate#getLaunchable(IServer, IModuleObject)
- */
- public Object getLaunchable(IServer server, IModuleArtifact moduleObject) {
- ServerDelegate delegate = (ServerDelegate)server.loadAdapter(ServerDelegate.class,null);
- if (!(delegate instanceof GenericServer))
- return null;
- if ((moduleObject instanceof Servlet) ||(moduleObject instanceof WebResource))
- return prepareHttpLaunchable(moduleObject, delegate);
-
- if((moduleObject instanceof EJBBean) || (moduleObject instanceof JndiObject))
- return prepareJndiLaunchable(moduleObject,delegate);
- return null;
- }
-
- private Object prepareJndiLaunchable(IModuleArtifact moduleObject, ServerDelegate delegate) {
- JndiLaunchable launchable = null;
- GenericServer genericServer = (GenericServer)delegate;
- ServerRuntime definition = genericServer.getServerDefinition();
- Properties props = new Properties();
- props.put(JAVA_NAMING_FACTORY_INITIAL_PROPKEY,definition.getJndiConnection().getInitialContextFactory());
- props.put(JAVA_NAMING_PROVIDER_URL_PROPKEY,definition.getJndiConnection().getProviderUrl());
- List jps = definition.getJndiConnection().getJndiProperty();
- Iterator propsIt =jps.iterator();
- while(propsIt.hasNext()){
- ArgumentPair prop = (ArgumentPair)propsIt.next();
- props.put(prop.getName(),prop.getValue());
- }
-
- if(moduleObject instanceof EJBBean)
- {
- EJBBean bean = (EJBBean)moduleObject;
- launchable = new JndiLaunchable(props,bean.getJndiName());
- }
- if(moduleObject instanceof JndiObject)
- {
- JndiObject jndi = (JndiObject)moduleObject;
- launchable = new JndiLaunchable(props,jndi.getJndiName());
- }
- return launchable;
- }
-
- /**
- * @param moduleObject
- * @param delegate
- * @return object
- */
- private Object prepareHttpLaunchable(IModuleArtifact moduleObject, ServerDelegate delegate) {
- try {
- URL url = ((IURLProvider) delegate).getModuleRootURL(moduleObject.getModule());
-
- Trace.trace("root: " + url); //$NON-NLS-1$
-
- if (moduleObject instanceof Servlet) {
- Servlet servlet = (Servlet) moduleObject;
- if (servlet.getAlias() != null) {
- String path = servlet.getAlias();
- if (path.startsWith("/")) //$NON-NLS-1$
- path = path.substring(1);
- url = new URL(url, path);
- } else
- url = new URL(url, "servlet/" + servlet.getServletClassName()); //$NON-NLS-1$
- } else if (moduleObject instanceof WebResource) {
- WebResource resource = (WebResource) moduleObject;
- String path = resource.getPath().toString();
- Trace.trace("path: " + path); //$NON-NLS-1$
- if (path != null && path.startsWith("/") && path.length() > 0) //$NON-NLS-1$
- path = path.substring(1);
- if (pat