You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tomee.apache.org by ds...@apache.org on 2008/04/11 00:35:39 UTC
svn commit: r646994 - in
/openejb/trunk/sandbox/openejb-eclipse-plugin/plugins:
org.apache.openejb.helper.annotation/
org.apache.openejb.helper.annotation/META-INF/
org.apache.openejb.helper.annotation/src/main/java/org/apache/openejb/helper/annotation...
Author: dsh
Date: Thu Apr 10 15:35:24 2008
New Revision: 646994
URL: http://svn.apache.org/viewvc?rev=646994&view=rev
Log:
OPENEJB-674 Eclipse plugin for OpenEJB
Contributed by: Jonathan Gallimore
Patch: openejb-674-18.diff
Added:
openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.eclipse.jst.server.generic.openejb/src/main/
openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.eclipse.jst.server.generic.openejb/src/main/java/
openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.eclipse.jst.server.generic.openejb/src/main/java/org/
openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.eclipse.jst.server.generic.openejb/src/main/java/org/apache/
openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.eclipse.jst.server.generic.openejb/src/main/java/org/apache/openejb/
openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.eclipse.jst.server.generic.openejb/src/main/java/org/apache/openejb/eclipse/
openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.eclipse.jst.server.generic.openejb/src/main/java/org/apache/openejb/eclipse/server/
openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.eclipse.jst.server.generic.openejb/src/main/java/org/apache/openejb/eclipse/server/Activator.java
openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.eclipse.jst.server.generic.openejb/src/main/java/org/apache/openejb/eclipse/server/Messages.java
openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.eclipse.jst.server.generic.openejb/src/main/java/org/apache/openejb/eclipse/server/OpenEJBLaunchConfigurationDelegate.java
openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.eclipse.jst.server.generic.openejb/src/main/java/org/apache/openejb/eclipse/server/OpenEJBLaunchConfigurationTabGroup.java
openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.eclipse.jst.server.generic.openejb/src/main/java/org/apache/openejb/eclipse/server/OpenEJBRuntimeClasspathProviderDelegate.java
openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.eclipse.jst.server.generic.openejb/src/main/java/org/apache/openejb/eclipse/server/OpenEJBRuntimeDelegate.java
openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.eclipse.jst.server.generic.openejb/src/main/java/org/apache/openejb/eclipse/server/OpenEJBRuntimeFragment.java
openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.eclipse.jst.server.generic.openejb/src/main/java/org/apache/openejb/eclipse/server/OpenEJBServer.java
openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.eclipse.jst.server.generic.openejb/src/main/java/org/apache/openejb/eclipse/server/OpenEJBServerBehaviour.java
openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.eclipse.jst.server.generic.openejb/src/main/java/org/apache/openejb/eclipse/server/OpenEJBServerFragment.java
openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.eclipse.jst.server.generic.openejb/src/main/java/org/apache/openejb/eclipse/server/ServerComposite.java
openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.eclipse.jst.server.generic.openejb/src/main/resources/
openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.eclipse.jst.server.generic.openejb/src/main/resources/org/
openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.eclipse.jst.server.generic.openejb/src/main/resources/org/apache/
openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.eclipse.jst.server.generic.openejb/src/main/resources/org/apache/openejb/
openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.eclipse.jst.server.generic.openejb/src/main/resources/org/apache/openejb/eclipse/
openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.eclipse.jst.server.generic.openejb/src/main/resources/org/apache/openejb/eclipse/server/
openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.eclipse.jst.server.generic.openejb/src/main/resources/org/apache/openejb/eclipse/server/messages.properties
openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.eclipse.jst.server.generic.openejb/src/main/resources/org/apache/openejb/eclipse/server/messages_de.properties
openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.eclipse.jst.server.generic.openejb/src/main/resources/org/apache/openejb/eclipse/server/runtime.gif (with props)
Modified:
openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.apache.openejb.helper.annotation/META-INF/MANIFEST.MF
openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.apache.openejb.helper.annotation/build.properties
openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.apache.openejb.helper.annotation/src/main/java/org/apache/openejb/helper/annotation/JDTFacade.java
openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.apache.openejb.helper.annotation/src/main/java/org/apache/openejb/helper/annotation/SessionBeanConverter.java
openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.eclipse.jst.server.generic.openejb/META-INF/MANIFEST.MF
openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.eclipse.jst.server.generic.openejb/plugin.properties
openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.eclipse.jst.server.generic.openejb/plugin.xml
openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.eclipse.jst.server.generic.openejb/plugin_de.properties
openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.eclipse.jst.server.generic.openejb/pom.xml
openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.eclipse.jst.server.generic.openejb/servers/openejb3.serverdef
Modified: openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.apache.openejb.helper.annotation/META-INF/MANIFEST.MF
URL: http://svn.apache.org/viewvc/openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.apache.openejb.helper.annotation/META-INF/MANIFEST.MF?rev=646994&r1=646993&r2=646994&view=diff
==============================================================================
--- openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.apache.openejb.helper.annotation/META-INF/MANIFEST.MF (original)
+++ openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.apache.openejb.helper.annotation/META-INF/MANIFEST.MF Thu Apr 10 15:35:24 2008
@@ -38,7 +38,8 @@
lib/wsdl4j-1.6.1.jar,
lib/geronimo-jpa_3.0_spec-1.1.jar,
lib/log4j-1.2.12.jar,
- lib/swizzle-stream-1.0.1.jar
+ lib/swizzle-stream-1.0.1.jar,
+ target/classes/
Main-Class: org.apache.openejb.helper.annotation.cli.Main
Export-Package: org.apache.openejb.helper.annotation
Bundle-Vendor: %providerName
Modified: openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.apache.openejb.helper.annotation/build.properties
URL: http://svn.apache.org/viewvc/openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.apache.openejb.helper.annotation/build.properties?rev=646994&r1=646993&r2=646994&view=diff
==============================================================================
--- openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.apache.openejb.helper.annotation/build.properties (original)
+++ openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.apache.openejb.helper.annotation/build.properties Thu Apr 10 15:35:24 2008
@@ -7,4 +7,5 @@
target/classes/META-INF/,\
target/classes/lib/,\
target/classes/org/,\
- lib/
+ lib/,\
+ target/classes/
Modified: openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.apache.openejb.helper.annotation/src/main/java/org/apache/openejb/helper/annotation/JDTFacade.java
URL: http://svn.apache.org/viewvc/openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.apache.openejb.helper.annotation/src/main/java/org/apache/openejb/helper/annotation/JDTFacade.java?rev=646994&r1=646993&r2=646994&view=diff
==============================================================================
--- openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.apache.openejb.helper.annotation/src/main/java/org/apache/openejb/helper/annotation/JDTFacade.java (original)
+++ openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.apache.openejb.helper.annotation/src/main/java/org/apache/openejb/helper/annotation/JDTFacade.java Thu Apr 10 15:35:24 2008
@@ -435,7 +435,9 @@
TypeDeclaration typeDeclaration = getTypeDeclaration(cu, fullyQualifiedClassName);
MethodDeclaration method = getMethodDeclaration(typeDeclaration, methodName, signature);
-
+ if (method == null) {
+ return;
+ }
Annotation modifier = createModifier(cu.getAST(), annotationClass, properties, cu);
method.modifiers().add(0, modifier);
Modified: openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.apache.openejb.helper.annotation/src/main/java/org/apache/openejb/helper/annotation/SessionBeanConverter.java
URL: http://svn.apache.org/viewvc/openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.apache.openejb.helper.annotation/src/main/java/org/apache/openejb/helper/annotation/SessionBeanConverter.java?rev=646994&r1=646993&r2=646994&view=diff
==============================================================================
--- openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.apache.openejb.helper.annotation/src/main/java/org/apache/openejb/helper/annotation/SessionBeanConverter.java (original)
+++ openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.apache.openejb.helper.annotation/src/main/java/org/apache/openejb/helper/annotation/SessionBeanConverter.java Thu Apr 10 15:35:24 2008
@@ -119,11 +119,9 @@
processTransactionManagement(bean, ejbJar.getAssemblyDescriptor());
processBeanSecurityIdentity(bean);
processDeclaredRoles(bean);
- processMethodPermissions(ejbJar);
}
-
-
+ processMethodPermissions(ejbJar);
}
/**
Modified: openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.eclipse.jst.server.generic.openejb/META-INF/MANIFEST.MF
URL: http://svn.apache.org/viewvc/openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.eclipse.jst.server.generic.openejb/META-INF/MANIFEST.MF?rev=646994&r1=646993&r2=646994&view=diff
==============================================================================
--- openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.eclipse.jst.server.generic.openejb/META-INF/MANIFEST.MF (original)
+++ openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.eclipse.jst.server.generic.openejb/META-INF/MANIFEST.MF Thu Apr 10 15:35:24 2008
@@ -5,10 +5,32 @@
Bundle-Version: 1.0.0
Bundle-Vendor: %providerName
Bundle-Localization: plugin
-Require-Bundle: org.eclipse.jst.server.core,
+Require-Bundle: org.eclipse.ui,
+ org.eclipse.jface.text,
+ org.eclipse.jst.server.core,
org.eclipse.jst.server.generic.core,
org.eclipse.jst.server.generic.ui,
org.eclipse.jst.server.ui,
org.eclipse.jst.common.project.facet.core,
org.eclipse.wst.common.project.facet.core,
- org.eclipse.wst.common.project.facet.ui
+ org.eclipse.wst.common.project.facet.ui,
+ org.eclipse.wst.server.ui,
+ org.eclipse.ui.ide,
+ org.eclipse.core.resources,
+ org.eclipse.core.runtime,
+ org.eclipse.core.commands,
+ org.eclipse.jdt.core,
+ org.eclipse.core.filebuffers,
+ org.eclipse.ltk.ui.refactoring,
+ org.eclipse.ltk.core.refactoring,
+ org.junit,
+ org.eclipse.jdt.ui,
+ org.eclipse.search,
+ org.eclipse.wst.server.core,
+ org.eclipse.debug.core,
+ org.eclipse.debug.ui,
+ org.eclipse.jdt.debug.ui
+Bundle-ClassPath: target/classes/,
+ .
+Bundle-Activator: org.apache.openejb.eclipse.server.Activator
+Eclipse-LazyStart: false
Modified: openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.eclipse.jst.server.generic.openejb/plugin.properties
URL: http://svn.apache.org/viewvc/openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.eclipse.jst.server.generic.openejb/plugin.properties?rev=646994&r1=646993&r2=646994&view=diff
==============================================================================
--- openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.eclipse.jst.server.generic.openejb/plugin.properties (original)
+++ openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.eclipse.jst.server.generic.openejb/plugin.properties Thu Apr 10 15:35:24 2008
@@ -42,6 +42,8 @@
openejbServerTypeName=OpenEJB 3.0.0
openejbServerTypeDescription=Publishes and runs EJB 3.0 modules on a local server.
+openejbLaunchConfigurationType=OpenEJB 3.0.0 Standalone server
+
#######################################################################
# ======================= openejb3.serverdef =======================
#######################################################################
Modified: openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.eclipse.jst.server.generic.openejb/plugin.xml
URL: http://svn.apache.org/viewvc/openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.eclipse.jst.server.generic.openejb/plugin.xml?rev=646994&r1=646993&r2=646994&view=diff
==============================================================================
--- openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.eclipse.jst.server.generic.openejb/plugin.xml (original)
+++ openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.eclipse.jst.server.generic.openejb/plugin.xml Thu Apr 10 15:35:24 2008
@@ -25,24 +25,35 @@
description="%openejbRuntimeTypeDescription"
vendor="%openejbCategory"
version="3.0.0"
- class="org.eclipse.jst.server.generic.core.internal.GenericServerRuntime">
+ class="org.apache.openejb.eclipse.server.OpenEJBRuntimeDelegate">
<moduleType
types="jst.ejb"
versions="2.1, 3.0"/>
</runtimeType>
</extension>
+ <extension point="org.eclipse.debug.core.launchConfigurationTypes">
+ <launchConfigurationType
+ delegate="org.apache.openejb.eclipse.server.OpenEJBLaunchConfigurationDelegate"
+ id="org.apache.openejb.eclipse.server.launchConfigurationType"
+ modes="run, debug, profile"
+ name="%openejbLaunchConfigurationType"
+ sourceLocatorId="org.eclipse.jst.server.generic.openejb.sourceLocator"
+ sourcePathComputerId="org.eclipse.jst.server.generic.openejb.sourcePathComputer"/>
+ </extension>
+
+
<extension point="org.eclipse.wst.server.core.serverTypes">
<serverType
runtime="true"
- class="org.eclipse.jst.server.generic.core.internal.GenericServer"
+ class="org.apache.openejb.eclipse.server.OpenEJBServer"
id="org.apache.openejb.server.generic.openejb3"
initialState="stopped"
supportsRemoteHosts="false"
runtimeTypeId="org.apache.openejb.server.generic.runtime.openejb3"
description="%openejbRuntimeTypeDescription"
- launchConfigId="org.eclipse.jst.server.generic.core.launchConfigurationType"
- behaviourClass="org.eclipse.jst.server.generic.core.internal.GenericServerBehaviour"
+ launchConfigId="org.apache.openejb.eclipse.server.launchConfigurationType"
+ behaviourClass="org.apache.openejb.eclipse.server.OpenEJBServerBehaviour"
name="%openejbServerTypeName"
startTimeout="20000"
stopTimeout="20000"
@@ -55,18 +66,18 @@
<fragment
id="org.eclipse.jst.server.generic.runtime"
typeIds="org.apache.openejb.server.generic.runtime.openejb3"
- class="org.eclipse.jst.server.generic.ui.internal.GenericServerRuntimeWizardFragment"/>
+ class="org.apache.openejb.eclipse.server.OpenEJBRuntimeFragment"/>
<fragment
id="org.eclipse.jst.server.generic.server"
typeIds="org.apache.openejb.server.generic.openejb3"
- class="org.eclipse.jst.server.generic.ui.internal.GenericServerWizardFragment"/>
+ class="org.apache.openejb.eclipse.server.OpenEJBServerFragment"/>
</extension>´
<extension point="org.eclipse.jst.server.core.runtimeClasspathProviders">
<runtimeClasspathProvider
id="org.eclipse.jst.server.generic.runtimeTarget"
- runtimeTypeIds="org.apache.openejb.server.generic.runtime.openejb*"
- class="org.eclipse.jst.server.generic.core.internal.GenericServerRuntimeTargetHandler"/>
+ runtimeTypeIds="org.apache.openejb.server.generic.runtime.openejb3"
+ class="org.apache.openejb.eclipse.server.OpenEJBRuntimeClasspathProviderDelegate"/>
</extension>
<extension point="org.eclipse.jst.server.generic.core.serverdefinition">
@@ -102,6 +113,10 @@
<facet
id="jst.ejb"
version="2.1, 3.0"/>
+ <facet
+ id="jst.java"
+ version="1.4, 5.0">
+ </facet>
</supported>
@@ -114,4 +129,28 @@
runtime-component="org.apache.openejb.server.generic.runtime.openejb"
version="3.0.0"/>
</extension>
+
+ <extension point="org.eclipse.debug.ui.launchConfigurationTabGroups">
+ <launchConfigurationTabGroup
+ id="org.apache.openejb.eclipse.server.launchConfigurationTabGroup"
+ type="org.apache.openejb.eclipse.server.launchConfigurationType"
+ class="org.apache.openejb.eclipse.server.OpenEJBLaunchConfigurationTabGroup">
+ </launchConfigurationTabGroup>
+ </extension>
+ <extension
+ point="org.eclipse.debug.core.sourcePathComputers">
+ <sourcePathComputer
+ class="org.eclipse.jdt.launching.sourcelookup.containers.JavaSourcePathComputer"
+ id="org.eclipse.jst.server.generic.openejb.sourcePathComputer">
+ </sourcePathComputer>
+ </extension>
+ <extension
+ point="org.eclipse.debug.core.sourceLocators">
+ <sourceLocator
+ class="org.eclipse.jdt.internal.launching.JavaSourceLookupDirector"
+ id="org.eclipse.jst.server.generic.openejb.sourceLocator"
+ name="%openejbSourceLocator">
+ </sourceLocator>
+ </extension>
+
</plugin>
Modified: openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.eclipse.jst.server.generic.openejb/plugin_de.properties
URL: http://svn.apache.org/viewvc/openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.eclipse.jst.server.generic.openejb/plugin_de.properties?rev=646994&r1=646993&r2=646994&view=diff
==============================================================================
--- openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.eclipse.jst.server.generic.openejb/plugin_de.properties (original)
+++ openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.eclipse.jst.server.generic.openejb/plugin_de.properties Thu Apr 10 15:35:24 2008
@@ -41,6 +41,7 @@
openejbServerTypeName=OpenEJB 3.0.0
openejbServerTypeDescription=Installiert EJB 3.0 Module auf einem lokalen Server und startet diese
+openejbLaunchConfigurationType=OpenEJB 3.0.0 Standalone-Server
#######################################################################
# ======================= openejb3.serverdef =======================
Modified: openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.eclipse.jst.server.generic.openejb/pom.xml
URL: http://svn.apache.org/viewvc/openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.eclipse.jst.server.generic.openejb/pom.xml?rev=646994&r1=646993&r2=646994&view=diff
==============================================================================
--- openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.eclipse.jst.server.generic.openejb/pom.xml (original)
+++ openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.eclipse.jst.server.generic.openejb/pom.xml Thu Apr 10 15:35:24 2008
@@ -13,65 +13,71 @@
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
~ See the License for the specific language governing permissions and
~ limitations under the License.
--->
-<!-- $Rev: 577554 $ $Date: 2007-09-20 06:35:12 +0100 (Thu, 20 Sep 2007) $ -->
-<project>
- <modelVersion>4.0.0</modelVersion>
- <groupId>org.apache.openejb</groupId>
- <artifactId>org.eclipse.jst.server.generic.openejb</artifactId>
- <version>1.0.0</version>
- <packaging>jar</packaging>
- <name>${artifactId}</name>
- <parent>
- <groupId>org.apache.openejb</groupId>
- <artifactId>eclipse-plugins-parent</artifactId>
- <version>1.0.0</version>
- <relativePath>../pom.xml</relativePath>
- </parent>
- <build>
- <resources>
- <resource>
- <directory>.</directory>
- <includes>
+-->
+<!-- $Rev: 577554 $ $Date: 2007-09-20 06:35:12 +0100 (Thu, 20 Sep 2007) $ -->
+<project>
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.apache.openejb</groupId>
+ <artifactId>org.eclipse.jst.server.generic.openejb</artifactId>
+ <version>1.0.0</version>
+ <packaging>jar</packaging>
+ <name>${artifactId}</name>
+ <parent>
+ <groupId>org.apache.openejb</groupId>
+ <artifactId>eclipse-plugins-parent</artifactId>
+ <version>1.0.0</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <build>
+ <resources>
+ <resource>
+ <directory>.</directory>
+ <includes>
<include>plugin.xml</include>
<include>about.html</include>
<include>plugin.properties</include>
- <include>plugin_*.properties</include>
- </includes>
- </resource>
- <resource>
- <targetPath>META-INF</targetPath>
- <directory>META-INF</directory>
- <includes>
- <include>MANIFEST.MF</include>
- </includes>
- </resource>
- <resource>
- <directory>buildfiles</directory>
- <targetPath>buildfiles</targetPath>
- <includes>
- <include>*</include>
- </includes>
- </resource>
- <resource>
- <directory>servers</directory>
- <targetPath>servers</targetPath>
- <includes>
- <include>*</include>
- </includes>
- </resource>
- </resources>
- <plugins>
- <plugin>
- <groupId>org.apache.geronimo.devtools</groupId>
- <artifactId>maven-eclipsepde-plugin</artifactId>
- </plugin>
- <plugin>
- <artifactId>maven-antrun-plugin</artifactId>
- </plugin>
- <plugin>
- <artifactId>maven-jar-plugin</artifactId>
- </plugin>
- </plugins>
- </build>
-</project>
+ <include>plugin_*.properties</include>
+ </includes>
+ </resource>
+ <resource>
+ <targetPath>META-INF</targetPath>
+ <directory>META-INF</directory>
+ <includes>
+ <include>MANIFEST.MF</include>
+ </includes>
+ </resource>
+ <resource>
+ <directory>buildfiles</directory>
+ <targetPath>buildfiles</targetPath>
+ <includes>
+ <include>*</include>
+ </includes>
+ </resource>
+ <resource>
+ <directory>src/main/resources</directory>
+ <includes>
+ <include>**/*</include>
+ </includes>
+ </resource>
+ <resource>
+ <directory>servers</directory>
+ <targetPath>servers</targetPath>
+ <includes>
+ <include>*</include>
+ </includes>
+ </resource>
+ </resources>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.geronimo.devtools</groupId>
+ <artifactId>maven-eclipsepde-plugin</artifactId>
+ </plugin>
+ <plugin>
+ <artifactId>maven-antrun-plugin</artifactId>
+ </plugin>
+ <plugin>
+ <artifactId>maven-jar-plugin</artifactId>
+ </plugin>
+ </plugins>
+ </build>
+</project>
Modified: openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.eclipse.jst.server.generic.openejb/servers/openejb3.serverdef
URL: http://svn.apache.org/viewvc/openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.eclipse.jst.server.generic.openejb/servers/openejb3.serverdef?rev=646994&r1=646993&r2=646994&view=diff
==============================================================================
--- openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.eclipse.jst.server.generic.openejb/servers/openejb3.serverdef (original)
+++ openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.eclipse.jst.server.generic.openejb/servers/openejb3.serverdef Thu Apr 10 15:35:24 2008
@@ -1,80 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<tns:ServerRuntime
- xmlns:tns="http://eclipse.org/jst/server/generic/ServerTypeDefinition"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://eclipse.org/jst/server/generic/ServerTypeDefinition ServerTypeDefinitionSchema.xsd "
- name="OpenEJB" version="3.0.0">
-<property id="serverRootDirectory"
- label="%ApplicationServerDirectory"
- type="directory"
- context="runtime"
- default="/your_server_root" />
-<property id="serverAddress"
- label="%serverAddress"
- type="string"
- context="server"
- default="127.0.0.1" />
-<property id="port"
- label="%serverPort"
- type="string"
- context="server"
- default="4201" />
-
-
- <port>
- <no>${port}</no>
- <name>ejbd</name>
- <protocol>ejbd</protocol>
- </port>
-
- <module>
- <type>jst.ejb</type>
- <publishDir>${serverRootDirectory}/apps</publishDir>
- <publisherReference>org.eclipse.jst.server.generic.antpublisher</publisherReference>
- </module>
-
-
- <project>
- <classpathReference>openejb.project</classpathReference>
- </project>
-
- <start>
- <mainClass>org.apache.openejb.cli.Bootstrap</mainClass>
- <workingDirectory>${serverRootDirectory}</workingDirectory>
- <programArguments>start</programArguments>
- <vmParameters>-Dopenejb.home=${serverRootDirectory} -javaagent:${serverRootDirectory}/lib/openejb-javaagent-3.0.0-SNAPSHOT.jar </vmParameters>
- <classpathReference>openejb</classpathReference>
- </start>
-
- <stop>
- <mainClass>org.apache.openejb.cli.Bootstrap</mainClass>
- <workingDirectory>${serverRootDirectory}</workingDirectory>
- <programArguments>stop</programArguments>
- <vmParameters>-Dopenejb.home=${serverRootDirectory} -javaagent:${serverRootDirectory}/lib/openejb-javaagent-3.0.0-SNAPSHOT.jar </vmParameters>
- <classpathReference>openejb</classpathReference>
- </stop>
- <publisher id="org.eclipse.jst.server.generic.antpublisher">
- <publisherdata>
- <dataname>build.file</dataname>
- <datavalue>/buildfiles/openejb.xml</datavalue>
- </publisherdata>
- <publisherdata>
- <dataname>target.publish.jst.ejb</dataname>
- <datavalue>deploy.j2ee.ejb</datavalue>
- </publisherdata>
- <publisherdata>
- <dataname>target.unpublish.jst.ejb</dataname>
- <datavalue>undeploy.j2ee.ejb</datavalue>
- </publisherdata>
- </publisher>
-
- <classpath id="openejb" >
- <archive path="${serverRootDirectory}/lib/openejb-core-3.0.0-SNAPSHOT.jar" />
- <archive path="${serverRootDirectory}/lib/openejb-javaagent-3.0.0-SNAPSHOT.jar" />
- <archive path="${serverRootDirectory}/lib/geronimo-ejb_3.0_spec-1.0.jar" />
- </classpath>
- <classpath id="openejb.project" >
- <archive path="${serverRootDirectory}/lib/geronimo-ejb_3.0_spec-1.0.jar" />
- </classpath>
-
-</tns:ServerRuntime>
\ No newline at end of file
Added: openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.eclipse.jst.server.generic.openejb/src/main/java/org/apache/openejb/eclipse/server/Activator.java
URL: http://svn.apache.org/viewvc/openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.eclipse.jst.server.generic.openejb/src/main/java/org/apache/openejb/eclipse/server/Activator.java?rev=646994&view=auto
==============================================================================
--- openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.eclipse.jst.server.generic.openejb/src/main/java/org/apache/openejb/eclipse/server/Activator.java (added)
+++ openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.eclipse.jst.server.generic.openejb/src/main/java/org/apache/openejb/eclipse/server/Activator.java Thu Apr 10 15:35:24 2008
@@ -0,0 +1,48 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.openejb.eclipse.server;
+
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.jface.resource.ImageRegistry;
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+
+public class Activator extends AbstractUIPlugin {
+
+ private static Activator instance = new Activator();
+
+ private Activator() {
+ // TODO Auto-generated constructor stub
+ }
+
+ public static Activator getDefault() {
+ return instance;
+ }
+
+ @Override
+ protected ImageRegistry createImageRegistry() {
+ ImageRegistry imageRegistry = new ImageRegistry();
+ imageRegistry.put("RUNTIME", ImageDescriptor.createFromURL(getClass().getResource("runtime.gif")));
+
+ return imageRegistry;
+ }
+
+ public ImageDescriptor getImageDescriptor(String key) {
+ return getImageRegistry().getDescriptor(key);
+ }
+
+
+}
Added: openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.eclipse.jst.server.generic.openejb/src/main/java/org/apache/openejb/eclipse/server/Messages.java
URL: http://svn.apache.org/viewvc/openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.eclipse.jst.server.generic.openejb/src/main/java/org/apache/openejb/eclipse/server/Messages.java?rev=646994&view=auto
==============================================================================
--- openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.eclipse.jst.server.generic.openejb/src/main/java/org/apache/openejb/eclipse/server/Messages.java (added)
+++ openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.eclipse.jst.server.generic.openejb/src/main/java/org/apache/openejb/eclipse/server/Messages.java Thu Apr 10 15:35:24 2008
@@ -0,0 +1,38 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.openejb.eclipse.server;
+
+import java.util.MissingResourceException;
+import java.util.ResourceBundle;
+
+public class Messages {
+ private static final String BUNDLE_NAME = "org.apache.openejb.eclipse.server.messages"; //$NON-NLS-1$
+
+ private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle
+ .getBundle(BUNDLE_NAME);
+
+ private Messages() {
+ }
+
+ public static String getString(String key) {
+ try {
+ return RESOURCE_BUNDLE.getString(key);
+ } catch (MissingResourceException e) {
+ return '!' + key + '!';
+ }
+ }
+}
Added: openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.eclipse.jst.server.generic.openejb/src/main/java/org/apache/openejb/eclipse/server/OpenEJBLaunchConfigurationDelegate.java
URL: http://svn.apache.org/viewvc/openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.eclipse.jst.server.generic.openejb/src/main/java/org/apache/openejb/eclipse/server/OpenEJBLaunchConfigurationDelegate.java?rev=646994&view=auto
==============================================================================
--- openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.eclipse.jst.server.generic.openejb/src/main/java/org/apache/openejb/eclipse/server/OpenEJBLaunchConfigurationDelegate.java (added)
+++ openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.eclipse.jst.server.generic.openejb/src/main/java/org/apache/openejb/eclipse/server/OpenEJBLaunchConfigurationDelegate.java Thu Apr 10 15:35:24 2008
@@ -0,0 +1,122 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.openejb.eclipse.server;
+
+import java.io.File;
+import java.util.Map;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+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.ServerProfilerDelegate;
+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;
+
+public class OpenEJBLaunchConfigurationDelegate extends AbstractJavaLaunchConfigurationDelegate {
+
+ public void launch(ILaunchConfiguration configuration, String mode, ILaunch launch, IProgressMonitor monitor) throws CoreException {
+ IServer server = ServerUtil.getServer(configuration);
+ if (server == null) {
+ abort("Missing server", null,
+ IJavaLaunchConfigurationConstants.ERR_INTERNAL_ERROR);
+ }
+ OpenEJBServerBehaviour genericServer = (OpenEJBServerBehaviour) 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 = "org.apache.openejb.cli.Bootstrap";
+ 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 RuntimeException();
+ }
+
+ 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);
+
+ 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);
+
+ if (ILaunchManager.PROFILE_MODE.equals(mode)) {
+ try {
+ ServerProfilerDelegate.configureProfiling(launch, vm, runConfig, monitor);
+ } catch (CoreException ce) {
+// genericServer.stopImpl();
+ throw ce;
+ }
+ }
+
+ // Launch the configuration
+// genericServer.startPingThread();
+ genericServer.setState(IServer.STATE_STARTING);
+ genericServer.start(launch);
+ runner.run(runConfig, launch, monitor);
+// genericServer.setProcess(launch.getProcesses()[0]);
+ } catch (CoreException e) {
+// genericServer.terminate();
+ throw e;
+ }
+
+ }
+}
Added: openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.eclipse.jst.server.generic.openejb/src/main/java/org/apache/openejb/eclipse/server/OpenEJBLaunchConfigurationTabGroup.java
URL: http://svn.apache.org/viewvc/openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.eclipse.jst.server.generic.openejb/src/main/java/org/apache/openejb/eclipse/server/OpenEJBLaunchConfigurationTabGroup.java?rev=646994&view=auto
==============================================================================
--- openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.eclipse.jst.server.generic.openejb/src/main/java/org/apache/openejb/eclipse/server/OpenEJBLaunchConfigurationTabGroup.java (added)
+++ openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.eclipse.jst.server.generic.openejb/src/main/java/org/apache/openejb/eclipse/server/OpenEJBLaunchConfigurationTabGroup.java Thu Apr 10 15:35:24 2008
@@ -0,0 +1,51 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.openejb.eclipse.server;
+
+import org.eclipse.debug.ui.AbstractLaunchConfigurationTabGroup;
+import org.eclipse.debug.ui.CommonTab;
+import org.eclipse.debug.ui.EnvironmentTab;
+import org.eclipse.debug.ui.ILaunchConfigurationDialog;
+import org.eclipse.debug.ui.ILaunchConfigurationTab;
+import org.eclipse.debug.ui.sourcelookup.SourceLookupTab;
+import org.eclipse.jdt.debug.ui.launchConfigurations.JavaArgumentsTab;
+import org.eclipse.jdt.debug.ui.launchConfigurations.JavaClasspathTab;
+import org.eclipse.jdt.debug.ui.launchConfigurations.JavaJRETab;
+import org.eclipse.wst.server.ui.ServerLaunchConfigurationTab;
+
+public class OpenEJBLaunchConfigurationTabGroup extends AbstractLaunchConfigurationTabGroup {
+
+ public void createTabs(ILaunchConfigurationDialog dialog, String mode) {
+ ILaunchConfigurationTab[] tabs = new ILaunchConfigurationTab[7];
+ tabs[0] = new ServerLaunchConfigurationTab( new String[] { "org.apache.openejb" } );
+ tabs[0].setLaunchConfigurationDialog(dialog);
+ tabs[1] = new JavaArgumentsTab();
+ tabs[1].setLaunchConfigurationDialog(dialog);
+ tabs[2] = new JavaClasspathTab();
+ tabs[2].setLaunchConfigurationDialog(dialog);
+ tabs[3] = new SourceLookupTab();
+ tabs[3].setLaunchConfigurationDialog(dialog);
+ tabs[4] = new EnvironmentTab();
+ tabs[4].setLaunchConfigurationDialog(dialog);
+ tabs[5] = new JavaJRETab();
+ tabs[5].setLaunchConfigurationDialog(dialog);
+ tabs[6] = new CommonTab();
+ tabs[6].setLaunchConfigurationDialog(dialog);
+ setTabs(tabs);
+ }
+
+}
Added: openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.eclipse.jst.server.generic.openejb/src/main/java/org/apache/openejb/eclipse/server/OpenEJBRuntimeClasspathProviderDelegate.java
URL: http://svn.apache.org/viewvc/openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.eclipse.jst.server.generic.openejb/src/main/java/org/apache/openejb/eclipse/server/OpenEJBRuntimeClasspathProviderDelegate.java?rev=646994&view=auto
==============================================================================
--- openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.eclipse.jst.server.generic.openejb/src/main/java/org/apache/openejb/eclipse/server/OpenEJBRuntimeClasspathProviderDelegate.java (added)
+++ openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.eclipse.jst.server.generic.openejb/src/main/java/org/apache/openejb/eclipse/server/OpenEJBRuntimeClasspathProviderDelegate.java Thu Apr 10 15:35:24 2008
@@ -0,0 +1,64 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.openejb.eclipse.server;
+
+import java.io.File;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.jdt.core.IClasspathEntry;
+import org.eclipse.jdt.core.JavaCore;
+import org.eclipse.jst.server.core.RuntimeClasspathProviderDelegate;
+import org.eclipse.wst.server.core.IRuntime;
+
+public class OpenEJBRuntimeClasspathProviderDelegate extends RuntimeClasspathProviderDelegate {
+
+ @Override
+ public IClasspathEntry[] resolveClasspathContainer(IProject project, IRuntime runtime) {
+ IPath installPath = runtime.getLocation();
+
+ if (installPath == null)
+ return new IClasspathEntry[0];
+
+ List<IClasspathEntry> list = getClientJars(installPath);
+ return (IClasspathEntry[])list.toArray(new IClasspathEntry[0]);
+ }
+
+ private List<IClasspathEntry> getClientJars(IPath installPath) {
+ File libFolder = new File(installPath.toString() + File.separator + "lib");
+ if (! libFolder.exists()) {
+ return null;
+ }
+
+ List<IClasspathEntry> classpathEntries = new ArrayList<IClasspathEntry>();
+ File[] files = libFolder.listFiles();
+
+ for (File file : files) {
+ if ((file.getName().startsWith("javaee-api") && file.getName().endsWith(".jar"))
+ || (file.getName().startsWith("openejb-client") && file.getName().endsWith(".jar"))) {
+ Path jar = new Path(file.getAbsolutePath());
+ classpathEntries.add(JavaCore.newLibraryEntry(jar, null, null));
+ }
+ }
+
+ return classpathEntries;
+ }
+
+}
Added: openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.eclipse.jst.server.generic.openejb/src/main/java/org/apache/openejb/eclipse/server/OpenEJBRuntimeDelegate.java
URL: http://svn.apache.org/viewvc/openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.eclipse.jst.server.generic.openejb/src/main/java/org/apache/openejb/eclipse/server/OpenEJBRuntimeDelegate.java?rev=646994&view=auto
==============================================================================
--- openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.eclipse.jst.server.generic.openejb/src/main/java/org/apache/openejb/eclipse/server/OpenEJBRuntimeDelegate.java (added)
+++ openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.eclipse.jst.server.generic.openejb/src/main/java/org/apache/openejb/eclipse/server/OpenEJBRuntimeDelegate.java Thu Apr 10 15:35:24 2008
@@ -0,0 +1,138 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.openejb.eclipse.server;
+
+import java.io.File;
+
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.jdt.launching.IVMInstall;
+import org.eclipse.jdt.launching.IVMInstallType;
+import org.eclipse.jdt.launching.JavaRuntime;
+import org.eclipse.jst.server.core.IJavaRuntime;
+import org.eclipse.wst.server.core.model.RuntimeDelegate;
+
+public class OpenEJBRuntimeDelegate extends RuntimeDelegate implements IJavaRuntime {
+ private static final String PROP_VM_INSTALL_TYPE_ID = "vm-install-type-id"; //$NON-NLS-1$
+ private static final String PROP_VM_INSTALL_ID = "vm-install-id"; //$NON-NLS-1$
+
+ @Override
+ public IStatus validate() {
+
+ if (this.getRuntimeWorkingCopy() == null) {
+ return new Status(IStatus.ERROR, "org.eclipse.jst.generic.openejb", "");
+ }
+
+ if (this.getRuntimeWorkingCopy().getLocation() == null) {
+ return new Status(IStatus.ERROR, "org.eclipse.jst.generic.openejb", "");
+ }
+
+ File libFolder = new File(this.getRuntimeWorkingCopy().getLocation().toString() + File.separator + "lib");
+ if (! (libFolder.exists() && libFolder.isDirectory())) {
+ return new Status(IStatus.ERROR, "org.eclipse.jst.generic.openejb", "Invalid lib folder");
+ }
+
+ File coreJar = getFileWithPrefix("openejb-core", ".jar");
+ File agentJar = getFileWithPrefix("openejb-javaagent", ".jar");
+
+
+ if (coreJar == null) {
+ return new Status(IStatus.ERROR, "org.eclipse.jst.generic.openejb", "Unable to find openejb-core jar");
+ }
+
+ if (agentJar == null) {
+ return new Status(IStatus.ERROR, "org.eclipse.jst.generic.openejb", "Unable to find openejb-javaagent jar");
+ }
+
+ return super.validate();
+ }
+
+ private File getFileWithPrefix(String prefix, String suffix) {
+ File libFolder = new File(this.getRuntimeWorkingCopy().getLocation().toString() + File.separator + "lib");
+ if (! (libFolder.exists() && libFolder.isDirectory())) {
+ return null;
+ }
+
+ File[] files = libFolder.listFiles();
+
+ for (File file : files) {
+ if (! file.getName().endsWith(suffix)) {
+ continue;
+ }
+
+ if (file.getName().startsWith(prefix)) {
+ return file;
+ }
+ }
+
+ return null;
+ }
+
+
+
+ public String getJavaAgent() {
+ return getFileWithPrefix("openejb-javaagent", ".jar").getAbsolutePath();
+ }
+
+ public String getCore() {
+ return getFileWithPrefix("openejb-core", ".jar").getAbsolutePath();
+ }
+
+ public IVMInstall getVMInstall() {
+ if (getVMInstallTypeId() == null)
+ return JavaRuntime.getDefaultVMInstall();
+ try {
+ IVMInstallType vmInstallType = JavaRuntime.getVMInstallType(getVMInstallTypeId());
+ IVMInstall[] vmInstalls = vmInstallType.getVMInstalls();
+ int size = vmInstalls.length;
+ String id = getVMInstallId();
+ for (int i = 0; i < size; i++) {
+ if (id.equals(vmInstalls[i].getId()))
+ return vmInstalls[i];
+ }
+ } catch (Exception e) {
+ // ignore
+ }
+ return null;
+ }
+
+ /**
+ * Returns the vm type id
+ * @return id
+ */
+ public String getVMInstallTypeId() {
+ return getAttribute(PROP_VM_INSTALL_TYPE_ID, (String)null);
+ }
+
+ /**
+ * Is use default VM selected
+ * @return boolean
+ */
+ public boolean isUsingDefaultJRE() {
+ return getVMInstallTypeId() == null;
+ }
+
+
+ /**
+ * Returns VM id
+ * @return id
+ */
+ public String getVMInstallId() {
+ return getAttribute(PROP_VM_INSTALL_ID, (String)null);
+ }
+
+}
Added: openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.eclipse.jst.server.generic.openejb/src/main/java/org/apache/openejb/eclipse/server/OpenEJBRuntimeFragment.java
URL: http://svn.apache.org/viewvc/openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.eclipse.jst.server.generic.openejb/src/main/java/org/apache/openejb/eclipse/server/OpenEJBRuntimeFragment.java?rev=646994&view=auto
==============================================================================
--- openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.eclipse.jst.server.generic.openejb/src/main/java/org/apache/openejb/eclipse/server/OpenEJBRuntimeFragment.java (added)
+++ openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.eclipse.jst.server.generic.openejb/src/main/java/org/apache/openejb/eclipse/server/OpenEJBRuntimeFragment.java Thu Apr 10 15:35:24 2008
@@ -0,0 +1,147 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.openejb.eclipse.server;
+
+import java.io.File;
+
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.jface.dialogs.IMessageProvider;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.DirectoryDialog;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Text;
+import org.eclipse.wst.server.core.IRuntimeWorkingCopy;
+import org.eclipse.wst.server.core.TaskModel;
+import org.eclipse.wst.server.ui.wizard.IWizardHandle;
+import org.eclipse.wst.server.ui.wizard.WizardFragment;
+
+public class OpenEJBRuntimeFragment extends WizardFragment {
+
+ private IWizardHandle handle;
+
+ @Override
+ public boolean hasComposite() {
+ return true;
+ }
+
+ @Override
+ public Composite createComposite(Composite parent, IWizardHandle handle) {
+ this.handle = handle;
+ handle.setTitle(Messages.getString("org.apache.openejb.eclipse.server.runtimeTitle"));
+ handle.setDescription(Messages.getString("org.apache.openejb.eclipse.server.runtimeDescription"));
+ handle.setImageDescriptor(Activator.getDefault().getImageDescriptor("RUNTIME"));
+ final Composite composite = new Composite(parent, SWT.NULL);
+ GridLayout gridLayout = new GridLayout(3, false);
+ composite.setLayout(gridLayout);
+
+ GridData gridData = new GridData();
+ gridData.minimumWidth = 200;
+ gridData.minimumHeight = 200;
+
+ Label locationLabel = new Label(composite, SWT.NONE);
+ locationLabel.setText(Messages.getString("org.apache.openejb.eclipse.server.openejbhomelabel"));
+
+ final Text locationText = new Text(composite, SWT.BORDER);
+ GridData textData = new GridData();
+ textData.widthHint = 200;
+ locationText.setLayoutData(textData);
+
+ try {
+ String location = getRuntimeDelegate().getRuntimeWorkingCopy().getLocation().toString();
+ locationText.setText(location);
+ } catch (Exception e) {
+ }
+
+ locationText.addModifyListener(new org.eclipse.swt.events.ModifyListener() {
+ public void modifyText(org.eclipse.swt.events.ModifyEvent e) {
+ getRuntimeDelegate().getRuntimeWorkingCopy().setLocation(new Path(locationText.getText()));
+ validate();
+ }
+ });
+
+ Button browseEjbJarButton = new Button(composite, SWT.NONE);
+ browseEjbJarButton.setText("Browse");
+
+ browseEjbJarButton.addSelectionListener(new org.eclipse.swt.events.SelectionAdapter() {
+ public void widgetSelected(org.eclipse.swt.events.SelectionEvent e) {
+ DirectoryDialog dialog = new DirectoryDialog(composite.getShell());
+ dialog.setMessage("Selection installation dir");
+ dialog.setFilterPath(locationText.getText());
+ String selectedDirectory = dialog.open();
+ if (selectedDirectory != null)
+ locationText.setText(selectedDirectory);
+ }
+ });
+
+ return composite;
+ }
+
+ protected OpenEJBRuntimeDelegate getRuntimeDelegate() {
+ IRuntimeWorkingCopy wc = (IRuntimeWorkingCopy) getTaskModel().getObject(TaskModel.TASK_RUNTIME);
+ if (wc == null) {
+ return null;
+ }
+
+ return (OpenEJBRuntimeDelegate) wc.loadAdapter(OpenEJBRuntimeDelegate.class, new NullProgressMonitor());
+ }
+
+ private void validate() {
+ File installationDirectory = getRuntimeDelegate().getRuntimeWorkingCopy().getLocation().toFile();
+ if (! installationDirectory.exists()) {
+ handle.setMessage("Directory does not exist", IMessageProvider.ERROR);
+ return;
+ }
+
+ IStatus status = getRuntimeDelegate().getRuntimeWorkingCopy().validate(new NullProgressMonitor());
+ if (status.getSeverity() != IStatus.OK) {
+ handle.setMessage(status.getMessage(), IMessageProvider.ERROR);
+ return;
+ }
+
+ handle.setMessage("", IMessageProvider.NONE);
+ }
+
+
+
+ @Override
+ public boolean isComplete() {
+ IRuntimeWorkingCopy wc = getRuntimeDelegate().getRuntimeWorkingCopy();
+ IStatus status = wc.validate(null);
+ return status == null || status.getSeverity() != IStatus.ERROR;
+ }
+
+
+ @Override
+ public void enter() {
+// validate();
+ }
+
+
+ @Override
+ public void exit() {
+// validate();
+ }
+
+
+
+}
Added: openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.eclipse.jst.server.generic.openejb/src/main/java/org/apache/openejb/eclipse/server/OpenEJBServer.java
URL: http://svn.apache.org/viewvc/openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.eclipse.jst.server.generic.openejb/src/main/java/org/apache/openejb/eclipse/server/OpenEJBServer.java?rev=646994&view=auto
==============================================================================
--- openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.eclipse.jst.server.generic.openejb/src/main/java/org/apache/openejb/eclipse/server/OpenEJBServer.java (added)
+++ openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.eclipse.jst.server.generic.openejb/src/main/java/org/apache/openejb/eclipse/server/OpenEJBServer.java Thu Apr 10 15:35:24 2008
@@ -0,0 +1,119 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.openejb.eclipse.server;
+
+import java.util.ArrayList;
+
+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.core.internal.CorePlugin;
+import org.eclipse.jst.server.generic.servertype.definition.ServerRuntime;
+import org.eclipse.wst.server.core.IModule;
+import org.eclipse.wst.server.core.IModuleType;
+import org.eclipse.wst.server.core.IServer;
+import org.eclipse.wst.server.core.ServerUtil;
+import org.eclipse.wst.server.core.model.ServerDelegate;
+
+public class OpenEJBServer extends ServerDelegate {
+
+ @Override
+ public IStatus canModifyModules(IModule[] add, IModule[] remove) {
+ if (add != null) {
+ for (int i = 0; i < add.length; i++) {
+ if (!isSupportedModule(add[i])) {
+ return new Status(IStatus.ERROR, "org.eclipse.jst.generic.openejb", "Module not compatible", null);
+ }
+ if (add[i].getProject() != null) {
+ IStatus status = FacetUtil.verifyFacets(add[i].getProject(), getServer());
+ if (status != null && !status.isOK())
+ return status;
+ }
+ }
+ }
+ return Status.OK_STATUS;
+ }
+
+ private boolean isSupportedModule(IModule module) {
+ return (module.getModuleType() != null && module.getModuleType().getId().equals("jst.ejb"));
+
+ }
+
+ @Override
+ 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];
+ }
+
+ @Override
+ public IModule[] getRootModules(IModule module) throws CoreException {
+ if (!isSupportedModule(module))
+ return null;
+ IStatus status = canModifyModules(new IModule[] { module }, null);
+ if (status != null && !status.isOK())
+ throw new CoreException(status);
+
+ IModule[] parents = doGetParentModules(module);
+ if (parents.length > 0)
+ return parents;
+ return new IModule[] { module };
+ }
+
+ @SuppressWarnings("unchecked")
+ 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()]);
+ }
+
+ @Override
+ public void modifyModules(IModule[] add, IModule[] remove, IProgressMonitor monitor) throws CoreException {
+ // do owt for the time being
+ }
+
+}
Added: openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.eclipse.jst.server.generic.openejb/src/main/java/org/apache/openejb/eclipse/server/OpenEJBServerBehaviour.java
URL: http://svn.apache.org/viewvc/openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.eclipse.jst.server.generic.openejb/src/main/java/org/apache/openejb/eclipse/server/OpenEJBServerBehaviour.java?rev=646994&view=auto
==============================================================================
--- openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.eclipse.jst.server.generic.openejb/src/main/java/org/apache/openejb/eclipse/server/OpenEJBServerBehaviour.java (added)
+++ openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.eclipse.jst.server.generic.openejb/src/main/java/org/apache/openejb/eclipse/server/OpenEJBServerBehaviour.java Thu Apr 10 15:35:24 2008
@@ -0,0 +1,276 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.openejb.eclipse.server;
+
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.lang.reflect.Field;
+import java.net.Socket;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.zip.ZipEntry;
+import java.util.zip.ZipOutputStream;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IPath;
+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.ILaunch;
+import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
+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.wst.server.core.IModule;
+import org.eclipse.wst.server.core.IServer;
+import org.eclipse.wst.server.core.model.IModuleFile;
+import org.eclipse.wst.server.core.model.IModuleFolder;
+import org.eclipse.wst.server.core.model.IModuleResource;
+import org.eclipse.wst.server.core.model.ServerBehaviourDelegate;
+import org.eclipse.wst.server.core.util.ProjectModule;
+
+public class OpenEJBServerBehaviour extends ServerBehaviourDelegate {
+
+ @SuppressWarnings("serial")
+ public class ServerStoppedException extends Exception {
+ }
+
+ private class ServerMonitor extends Thread {
+
+ private static final int ONE_SECOND = 1000;
+ private boolean running = false;
+
+ @Override
+ public void run() {
+ while (true) {
+ try {
+ Thread.sleep(ONE_SECOND);
+ } catch (InterruptedException e) {
+ stopServer();
+ }
+
+ try {
+ check();
+ } catch (ServerStoppedException e) {
+ // break out the loop and stop monitoring
+ // a restart will start a new monitor
+ break;
+ }
+ }
+ }
+
+ private void check() throws ServerStoppedException {
+ // connect to admin interface
+ try {
+ Socket socket = new Socket("localhost", 4200);
+ socket.close();
+
+ // update the server status if this is first time we've connected
+ if (! running) {
+ running = true;
+ setState(IServer.STATE_STARTED);
+ }
+ } catch (IOException e) {
+ if (running) {
+ // looks like server has started successfully, but has died
+ setServerState(IServer.STATE_STOPPED);
+ running = false;
+ }
+ // server might not be started yet
+ }
+ // if success, server is running
+ }
+
+ /*
+ * @see org.apache.openejb.server.admin.AdminDaemon.service(Socket socket)
+ */
+ private void stopServer() {
+ // connect to admin interface, and send 'Q' to stop the server
+ try {
+ Socket socket = new Socket("localhost", 4200);
+ socket.getOutputStream().write('Q');
+ socket.close();
+
+ setState(IServer.STATE_STOPPING);
+ } catch (IOException e) {
+ // we're really stuck
+ }
+ }
+
+ public void terminate() {
+ this.interrupt();
+ }
+
+ public ServerMonitor() {
+ super();
+ }
+ }
+
+ private ServerMonitor monitor;
+
+ @Override
+ public void stop(boolean force) {
+ if (monitor == null) {
+ return;
+ }
+
+ monitor.terminate();
+ }
+
+ @Override
+ public void setupLaunchConfiguration(ILaunchConfigurationWorkingCopy workingCopy, IProgressMonitor monitor) throws CoreException {
+ workingCopy.setAttribute(IJavaLaunchConfigurationConstants.ATTR_MAIN_TYPE_NAME, "org.apache.openejb.cli.Bootstrap");
+
+ OpenEJBRuntimeDelegate runtime = getRuntimeDelegate();
+
+ IVMInstall vmInstall = runtime.getVMInstall();
+ if (vmInstall != null)
+ workingCopy.setAttribute(IJavaLaunchConfigurationConstants.ATTR_JRE_CONTAINER_PATH, JavaRuntime.newJREContainerPath(vmInstall).toPortableString());
+
+ workingCopy.setAttribute(IJavaLaunchConfigurationConstants.ATTR_PROGRAM_ARGUMENTS, "start");
+ workingCopy.setAttribute(IJavaLaunchConfigurationConstants.ATTR_VM_ARGUMENTS, "-Dopenejb.home=" + getServer().getRuntime().getLocation().toString() /*+ " -javaagent:" + runtime.getJavaAgent()*/);
+
+ List<IRuntimeClasspathEntry> cp = new ArrayList<IRuntimeClasspathEntry>();
+ IPath serverJar = new Path(runtime.getCore());
+ cp.add(JavaRuntime.newArchiveRuntimeClasspathEntry(serverJar));
+
+ List<String> classPath = new ArrayList<String>();
+ for (IRuntimeClasspathEntry entry : cp) {
+ classPath.add(entry.getMemento());
+ }
+
+ workingCopy.setAttribute(IJavaLaunchConfigurationConstants.ATTR_CLASSPATH, classPath);
+ workingCopy.setAttribute(IJavaLaunchConfigurationConstants.ATTR_DEFAULT_CLASSPATH, false);
+ }
+
+ private OpenEJBRuntimeDelegate getRuntimeDelegate() {
+ OpenEJBRuntimeDelegate rd = (OpenEJBRuntimeDelegate) getServer().getRuntime().getAdapter(OpenEJBRuntimeDelegate.class);
+ if (rd == null)
+ rd = (OpenEJBRuntimeDelegate) getServer().getRuntime().loadAdapter(OpenEJBRuntimeDelegate.class, new NullProgressMonitor());
+ return rd;
+ }
+
+ public void setState(int state) {
+ setServerState(state);
+ }
+
+ public void start(ILaunch launch) {
+ monitor = new ServerMonitor();
+ monitor.start();
+ }
+
+ @Override
+ protected IStatus publishModule(int kind, IModule[] modules, int deltaKind, IProgressMonitor monitor) {
+ IPath appsDir = getRuntimeDelegate().getRuntime().getLocation().append("/apps");
+
+ if (deltaKind == REMOVED) {
+ StringBuffer removedMsg = new StringBuffer();
+
+ for (IModule module : modules) {
+ File target = new File(appsDir.toFile(), module.getName() + ".jar");
+ if (target.exists() && target.isFile()) {
+ boolean deleted = target.delete();
+
+ if (! deleted) {
+ removedMsg.append("Unable to delete module: " + target.getAbsolutePath() + " from server\n");
+ }
+ }
+ }
+
+ if (removedMsg.length() == 0) {
+ return new Status(IStatus.OK, "org.eclipse.jst.server.generic.openejb", "");
+ } else {
+ return new Status(IStatus.WARNING, "org.eclipse.jst.server.generic.openejb", removedMsg.toString());
+ }
+ }
+
+ try {
+ for (IModule module : modules) {
+ ProjectModule projectModule = (ProjectModule) module.loadAdapter(ProjectModule.class, null);
+ if (projectModule == null) {
+ continue;
+ }
+
+ IModuleResource[] members = projectModule.members();
+
+ try {
+ File tempJarFile = File.createTempFile("oejb", ".jar");
+ ZipOutputStream zos = new ZipOutputStream(new FileOutputStream(tempJarFile));
+
+
+ for (IModuleResource resource : members) {
+ IPath projectLocation = module.getProject().getLocation();
+
+ writeResourceToZipStream(zos, resource, projectLocation);
+
+ }
+
+ zos.close();
+
+ File target = new File(appsDir.toFile(), module.getName() + ".jar");
+
+ tempJarFile.renameTo(target);
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ }
+ } catch (CoreException e) {
+ e.printStackTrace();
+ }
+
+ return super.publishModule(kind, modules, deltaKind, monitor);
+ }
+
+ private void writeResourceToZipStream(ZipOutputStream zipStream, IModuleResource resource, IPath projectLocation) throws IOException, FileNotFoundException {
+ byte[] buffer = new byte[8192];
+ if (resource instanceof IModuleFile) {
+ IPath relativePath = resource.getModuleRelativePath().append("/" + resource.getName());
+
+ try {
+ Field fileField = resource.getClass().getDeclaredField("file");
+ fileField.setAccessible(true);
+ IFile obj = (IFile) fileField.get(resource);
+ InputStream is = obj.getContents();
+
+ ZipEntry zipEntry = new ZipEntry(relativePath.toString());
+ zipStream.putNextEntry(zipEntry);
+
+ int bytesRead = -1;
+ while ((bytesRead = is.read(buffer)) > 0) {
+ zipStream.write(buffer, 0, bytesRead);
+ }
+
+ is.close();
+ zipStream.closeEntry();
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ } else if (resource instanceof IModuleFolder) {
+ IModuleResource[] resources = ((IModuleFolder) resource).members();
+ for (IModuleResource childResource : resources) {
+ writeResourceToZipStream(zipStream, childResource, projectLocation);
+ }
+ }
+ }
+}
Added: openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.eclipse.jst.server.generic.openejb/src/main/java/org/apache/openejb/eclipse/server/OpenEJBServerFragment.java
URL: http://svn.apache.org/viewvc/openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.eclipse.jst.server.generic.openejb/src/main/java/org/apache/openejb/eclipse/server/OpenEJBServerFragment.java?rev=646994&view=auto
==============================================================================
--- openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.eclipse.jst.server.generic.openejb/src/main/java/org/apache/openejb/eclipse/server/OpenEJBServerFragment.java (added)
+++ openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.eclipse.jst.server.generic.openejb/src/main/java/org/apache/openejb/eclipse/server/OpenEJBServerFragment.java Thu Apr 10 15:35:24 2008
@@ -0,0 +1,46 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.openejb.eclipse.server;
+
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.wst.server.ui.wizard.IWizardHandle;
+import org.eclipse.wst.server.ui.wizard.WizardFragment;
+
+public class OpenEJBServerFragment extends WizardFragment {
+
+ private IWizardHandle handle;
+
+ @Override
+ public Composite createComposite(Composite parent, IWizardHandle handle) {
+ this.handle = handle;
+ handle.setTitle("OpenEJB Server");
+ handle.setImageDescriptor(Activator.getDefault().getImageDescriptor("RUNTIME"));
+ ServerComposite serverComposite = new ServerComposite(parent, SWT.NULL);
+ return serverComposite;
+ }
+
+ @Override
+ public boolean hasComposite() {
+ return true;
+ }
+
+ @Override
+ public boolean isComplete() {
+ return true;
+ }
+}
Added: openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.eclipse.jst.server.generic.openejb/src/main/java/org/apache/openejb/eclipse/server/ServerComposite.java
URL: http://svn.apache.org/viewvc/openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.eclipse.jst.server.generic.openejb/src/main/java/org/apache/openejb/eclipse/server/ServerComposite.java?rev=646994&view=auto
==============================================================================
--- openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.eclipse.jst.server.generic.openejb/src/main/java/org/apache/openejb/eclipse/server/ServerComposite.java (added)
+++ openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.eclipse.jst.server.generic.openejb/src/main/java/org/apache/openejb/eclipse/server/ServerComposite.java Thu Apr 10 15:35:24 2008
@@ -0,0 +1,55 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.openejb.eclipse.server;
+
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.graphics.Point;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.widgets.Text;
+
+public class ServerComposite extends Composite {
+
+ private Label portLabel = null;
+ private Text portText = null;
+
+ public ServerComposite(Composite parent, int style) {
+ super(parent, style);
+ initialize();
+ }
+
+ private void initialize() {
+ portLabel = new Label(this, SWT.NONE);
+ portLabel.setText(Messages.getString("org.apache.openejb.eclipse.server.ejbPort"));
+ portText = new Text(this, SWT.BORDER);
+ portText.setText("4201");
+ GridLayout gridLayout = new GridLayout();
+ gridLayout.numColumns = 2;
+ this.setLayout(gridLayout);
+ setSize(new Point(300, 200));
+ }
+
+
+ public String getPort() {
+ return portText.getText();
+ }
+
+ public void setPort(String port) {
+ this.portText.setText(port);
+ }
+}
Added: openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.eclipse.jst.server.generic.openejb/src/main/resources/org/apache/openejb/eclipse/server/messages.properties
URL: http://svn.apache.org/viewvc/openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.eclipse.jst.server.generic.openejb/src/main/resources/org/apache/openejb/eclipse/server/messages.properties?rev=646994&view=auto
==============================================================================
--- openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.eclipse.jst.server.generic.openejb/src/main/resources/org/apache/openejb/eclipse/server/messages.properties (added)
+++ openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.eclipse.jst.server.generic.openejb/src/main/resources/org/apache/openejb/eclipse/server/messages.properties Thu Apr 10 15:35:24 2008
@@ -0,0 +1,24 @@
+#######################################################################
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+# $Rev: 577442 $ $Date: 2007-09-19 21:43:00 +0100 (Wed, 19 Sep 2007) $
+#
+#######################################################################
+org.apache.openejb.eclipse.server.runtimeTitle=OpenEJB Runtime
+org.apache.openejb.eclipse.server.runtimeDescription=Set configuration options for the OpenEJB runtime
+org.apache.openejb.eclipse.server.openejbhomelabel=OpenEJB home directory
+org.apache.openejb.eclipse.server.ejbPort=EJB Port
Added: openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.eclipse.jst.server.generic.openejb/src/main/resources/org/apache/openejb/eclipse/server/messages_de.properties
URL: http://svn.apache.org/viewvc/openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.eclipse.jst.server.generic.openejb/src/main/resources/org/apache/openejb/eclipse/server/messages_de.properties?rev=646994&view=auto
==============================================================================
--- openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.eclipse.jst.server.generic.openejb/src/main/resources/org/apache/openejb/eclipse/server/messages_de.properties (added)
+++ openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.eclipse.jst.server.generic.openejb/src/main/resources/org/apache/openejb/eclipse/server/messages_de.properties Thu Apr 10 15:35:24 2008
@@ -0,0 +1,24 @@
+#######################################################################
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+# $Rev: 577442 $ $Date: 2007-09-19 21:43:00 +0100 (Wed, 19 Sep 2007) $
+#
+#######################################################################
+org.apache.openejb.eclipse.server.runtimeTitle=OpenEJB Runtime
+org.apache.openejb.eclipse.server.runtimeDescription=Set configuration options for the OpenEJB runtime
+org.apache.openejb.eclipse.server.openejbhomelabel=OpenEJB home directory
+org.apache.openejb.eclipse.server.ejbPort=EJB Port
Added: openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.eclipse.jst.server.generic.openejb/src/main/resources/org/apache/openejb/eclipse/server/runtime.gif
URL: http://svn.apache.org/viewvc/openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.eclipse.jst.server.generic.openejb/src/main/resources/org/apache/openejb/eclipse/server/runtime.gif?rev=646994&view=auto
==============================================================================
Binary file - no diff available.
Propchange: openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.eclipse.jst.server.generic.openejb/src/main/resources/org/apache/openejb/eclipse/server/runtime.gif
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream