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/05/22 02:18:20 UTC

svn commit: r658955 [1/3] - in /openejb/trunk/sandbox/openejb-eclipse-plugin: ./ common/ common/src/ common/src/main/ common/src/main/java/ common/src/main/java/org/ common/src/main/java/org/apache/ common/src/main/java/org/apache/openejb/ common/src/m...

Author: dsh
Date: Wed May 21 17:18:19 2008
New Revision: 658955

URL: http://svn.apache.org/viewvc?rev=658955&view=rev
Log:
OPENEJB-674 Eclipse plugin for OpenEJB

Contributed by: Jonathan Gallimore
Patch: openejb-674-19.diff

Added:
    openejb/trunk/sandbox/openejb-eclipse-plugin/common/
    openejb/trunk/sandbox/openejb-eclipse-plugin/common/pom.xml
    openejb/trunk/sandbox/openejb-eclipse-plugin/common/src/
    openejb/trunk/sandbox/openejb-eclipse-plugin/common/src/main/
    openejb/trunk/sandbox/openejb-eclipse-plugin/common/src/main/java/
    openejb/trunk/sandbox/openejb-eclipse-plugin/common/src/main/java/org/
    openejb/trunk/sandbox/openejb-eclipse-plugin/common/src/main/java/org/apache/
    openejb/trunk/sandbox/openejb-eclipse-plugin/common/src/main/java/org/apache/openejb/
    openejb/trunk/sandbox/openejb-eclipse-plugin/common/src/main/java/org/apache/openejb/plugins/
    openejb/trunk/sandbox/openejb-eclipse-plugin/common/src/main/java/org/apache/openejb/plugins/common/
    openejb/trunk/sandbox/openejb-eclipse-plugin/common/src/main/java/org/apache/openejb/plugins/common/ConversionException.java
    openejb/trunk/sandbox/openejb-eclipse-plugin/common/src/main/java/org/apache/openejb/plugins/common/Converter.java
    openejb/trunk/sandbox/openejb-eclipse-plugin/common/src/main/java/org/apache/openejb/plugins/common/EjbReferencesConverter.java
    openejb/trunk/sandbox/openejb-eclipse-plugin/common/src/main/java/org/apache/openejb/plugins/common/EntityBeanConverter.java
    openejb/trunk/sandbox/openejb-eclipse-plugin/common/src/main/java/org/apache/openejb/plugins/common/EntityBeanPojoConverter.java
    openejb/trunk/sandbox/openejb-eclipse-plugin/common/src/main/java/org/apache/openejb/plugins/common/IJDTFacade.java
    openejb/trunk/sandbox/openejb-eclipse-plugin/common/src/main/java/org/apache/openejb/plugins/common/MessageDrivenBeanConverter.java
    openejb/trunk/sandbox/openejb-eclipse-plugin/common/src/main/java/org/apache/openejb/plugins/common/Messages.java
    openejb/trunk/sandbox/openejb-eclipse-plugin/common/src/main/java/org/apache/openejb/plugins/common/OpenEjbXmlConverter.java
    openejb/trunk/sandbox/openejb-eclipse-plugin/common/src/main/java/org/apache/openejb/plugins/common/SessionBeanConverter.java
    openejb/trunk/sandbox/openejb-eclipse-plugin/common/src/main/java/org/apache/openejb/plugins/common/SessionBeanInterfaceModifier.java
    openejb/trunk/sandbox/openejb-eclipse-plugin/common/src/main/java/org/apache/openejb/plugins/common/SessionBeanRemoteAnnotationAdder.java
    openejb/trunk/sandbox/openejb-eclipse-plugin/common/src/main/resources/
    openejb/trunk/sandbox/openejb-eclipse-plugin/common/src/main/resources/org/
    openejb/trunk/sandbox/openejb-eclipse-plugin/common/src/main/resources/org/apache/
    openejb/trunk/sandbox/openejb-eclipse-plugin/common/src/main/resources/org/apache/openejb/
    openejb/trunk/sandbox/openejb-eclipse-plugin/common/src/main/resources/org/apache/openejb/plugins/
    openejb/trunk/sandbox/openejb-eclipse-plugin/common/src/main/resources/org/apache/openejb/plugins/common/
    openejb/trunk/sandbox/openejb-eclipse-plugin/common/src/main/resources/org/apache/openejb/plugins/common/messages.properties
    openejb/trunk/sandbox/openejb-eclipse-plugin/common/src/main/resources/org/apache/openejb/plugins/common/messages_de.properties
Modified:
    openejb/trunk/sandbox/openejb-eclipse-plugin/eclipse/build.xml
    openejb/trunk/sandbox/openejb-eclipse-plugin/features/org.apache.openejb.feature/.externalToolBuilders/Maven_Ant_Builder.launch
    openejb/trunk/sandbox/openejb-eclipse-plugin/features/org.apache.openejb.feature/maven-eclipse.xml
    openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.apache.openejb.helper.annotation.test/META-INF/MANIFEST.MF
    openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.apache.openejb.helper.annotation.test/pom.xml
    openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.apache.openejb.helper.annotation.test/src/main/java/org/apache/openejb/helper/annotation/tests/SessionBeanConverterTest.java
    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/maven-eclipse.xml
    openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.apache.openejb.helper.annotation/pom.xml
    openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.apache.openejb.helper.annotation/src/main/java/org/apache/openejb/helper/annotation/ConversionException.java
    openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.apache.openejb.helper.annotation/src/main/java/org/apache/openejb/helper/annotation/Converter.java
    openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.apache.openejb.helper.annotation/src/main/java/org/apache/openejb/helper/annotation/EjbReferencesConverter.java
    openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.apache.openejb.helper.annotation/src/main/java/org/apache/openejb/helper/annotation/EntityBeanConverter.java
    openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.apache.openejb.helper.annotation/src/main/java/org/apache/openejb/helper/annotation/EntityBeanPojoConverter.java
    openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.apache.openejb.helper.annotation/src/main/java/org/apache/openejb/helper/annotation/IJDTFacade.java
    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/MessageDrivenBeanConverter.java
    openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.apache.openejb.helper.annotation/src/main/java/org/apache/openejb/helper/annotation/OpenEjbXmlConverter.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.apache.openejb.helper.annotation/src/main/java/org/apache/openejb/helper/annotation/SessionBeanInterfaceModifier.java
    openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.apache.openejb.helper.annotation/src/main/java/org/apache/openejb/helper/annotation/SessionBeanRemoteAnnotationAdder.java
    openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.apache.openejb.helper.annotation/src/main/java/org/apache/openejb/helper/annotation/wizards/EJBMigrationRefactoring.java
    openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.eclipse.jst.server.generic.openejb/buildfiles/openejb.xml
    openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.eclipse.jst.server.generic.openejb/maven-eclipse.xml
    openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.eclipse.jst.server.generic.openejb/plugin.xml
    openejb/trunk/sandbox/openejb-eclipse-plugin/pom.xml

Added: openejb/trunk/sandbox/openejb-eclipse-plugin/common/pom.xml
URL: http://svn.apache.org/viewvc/openejb/trunk/sandbox/openejb-eclipse-plugin/common/pom.xml?rev=658955&view=auto
==============================================================================
--- openejb/trunk/sandbox/openejb-eclipse-plugin/common/pom.xml (added)
+++ openejb/trunk/sandbox/openejb-eclipse-plugin/common/pom.xml Wed May 21 17:18:19 2008
@@ -0,0 +1,126 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  ~ 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.
+  -->
+<project>
+  <parent>
+    <artifactId>eclipse-plugins</artifactId>
+    <groupId>org.apache.openejb</groupId>
+    <version>1.0.0</version>
+  </parent>
+  <modelVersion>4.0.0</modelVersion>
+  <groupId>org.apache.openejb</groupId>
+  <artifactId>plugins-common</artifactId>
+  <name>${artifactId}</name>
+  <version>1.0.0</version>
+  <dependencies>
+    <dependency>
+      <groupId>org.apache.geronimo.specs</groupId>
+      <artifactId>geronimo-ejb_3.0_spec</artifactId>
+      <version>1.0</version>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.xbean</groupId>
+      <artifactId>xbean-finder</artifactId>
+      <version>3.2-SNAPSHOT</version>
+    </dependency>
+    <dependency>
+      <groupId>javax.activation</groupId>
+      <artifactId>activation</artifactId>
+      <version>1.1</version>
+    </dependency>
+    <dependency>
+      <groupId>javax.xml</groupId>
+      <artifactId>jsr173</artifactId>
+      <version>1.0</version>
+    </dependency>
+    <dependency>
+      <groupId>javax.xml.bind</groupId>
+      <artifactId>jsr173_api</artifactId>
+      <version>1.0</version>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.geronimo.specs</groupId>
+      <artifactId>geronimo-activation_1.1_spec</artifactId>
+      <version>1.0</version>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.geronimo.specs</groupId>
+      <artifactId>geronimo-stax-api_1.0_spec</artifactId>
+      <version>1.0</version>
+    </dependency>
+    <dependency>
+      <groupId>javax.xml.bind</groupId>
+      <artifactId>jaxb-api</artifactId>
+      <version>2.0</version>
+    </dependency>
+    <dependency>
+      <groupId>com.sun.xml.bind</groupId>
+      <artifactId>jaxb-impl</artifactId>
+      <version>2.0.3</version>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.openejb</groupId>
+      <artifactId>openejb-jee</artifactId>
+      <version>3.1-SNAPSHOT</version>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.openejb</groupId>
+      <artifactId>openejb-core</artifactId>
+      <version>3.1-SNAPSHOT</version>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.openejb</groupId>
+      <artifactId>openejb-loader</artifactId>
+      <version>3.1-SNAPSHOT</version>
+    </dependency>
+    <dependency>
+      <groupId>javax.xml</groupId>
+      <artifactId>jsr173</artifactId>
+      <version>1.0</version>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.geronimo.specs</groupId>
+      <artifactId>geronimo-annotation_1.0_spec</artifactId>
+      <version>1.1</version>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.geronimo.specs</groupId>
+      <artifactId>geronimo-interceptor_3.0_spec</artifactId>
+      <version>1.0</version>
+    </dependency>
+    <dependency>
+      <groupId>wsdl4j</groupId>
+      <artifactId>wsdl4j</artifactId>
+      <version>1.6.1</version>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.geronimo.specs</groupId>
+      <artifactId>geronimo-jpa_3.0_spec</artifactId>
+      <version>1.1</version>
+    </dependency>
+    <dependency>
+      <groupId>log4j</groupId>
+      <artifactId>log4j</artifactId>
+      <version>1.2.12</version>
+    </dependency>
+    <dependency>
+      <groupId>org.codehaus.swizzle</groupId>
+      <artifactId>swizzle-stream</artifactId>
+      <version>1.0.1</version>
+    </dependency>
+  </dependencies>
+</project>

Added: openejb/trunk/sandbox/openejb-eclipse-plugin/common/src/main/java/org/apache/openejb/plugins/common/ConversionException.java
URL: http://svn.apache.org/viewvc/openejb/trunk/sandbox/openejb-eclipse-plugin/common/src/main/java/org/apache/openejb/plugins/common/ConversionException.java?rev=658955&view=auto
==============================================================================
--- openejb/trunk/sandbox/openejb-eclipse-plugin/common/src/main/java/org/apache/openejb/plugins/common/ConversionException.java (added)
+++ openejb/trunk/sandbox/openejb-eclipse-plugin/common/src/main/java/org/apache/openejb/plugins/common/ConversionException.java Wed May 21 17:18:19 2008
@@ -0,0 +1,54 @@
+/*
+ * 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.plugins.common;
+
+/**
+ * Represents a conversion error from trying to generate annotations
+ * using the OpenEjbXmlConverter
+ */
+public class ConversionException extends Exception {
+
+	/**
+	 *
+	 */
+	private static final long serialVersionUID = -4968483527572451177L;
+
+	public ConversionException() {
+	}
+
+	/**
+	 * @param message
+	 */
+	public ConversionException(String message) {
+		super(message);
+	}
+
+	/**
+	 * @param throwable
+	 */
+	public ConversionException(Throwable throwable) {
+		super(throwable);
+	}
+
+	/**
+	 * @param message
+	 * @param throwable
+	 */
+	public ConversionException(String message, Throwable throwable) {
+		super(message, throwable);
+	}
+}

Added: openejb/trunk/sandbox/openejb-eclipse-plugin/common/src/main/java/org/apache/openejb/plugins/common/Converter.java
URL: http://svn.apache.org/viewvc/openejb/trunk/sandbox/openejb-eclipse-plugin/common/src/main/java/org/apache/openejb/plugins/common/Converter.java?rev=658955&view=auto
==============================================================================
--- openejb/trunk/sandbox/openejb-eclipse-plugin/common/src/main/java/org/apache/openejb/plugins/common/Converter.java (added)
+++ openejb/trunk/sandbox/openejb-eclipse-plugin/common/src/main/java/org/apache/openejb/plugins/common/Converter.java Wed May 21 17:18:19 2008
@@ -0,0 +1,23 @@
+/*
+ * 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.plugins.common;
+
+import org.apache.openejb.config.AppModule;
+
+public interface Converter {
+	public void convert(AppModule module);
+}

Added: openejb/trunk/sandbox/openejb-eclipse-plugin/common/src/main/java/org/apache/openejb/plugins/common/EjbReferencesConverter.java
URL: http://svn.apache.org/viewvc/openejb/trunk/sandbox/openejb-eclipse-plugin/common/src/main/java/org/apache/openejb/plugins/common/EjbReferencesConverter.java?rev=658955&view=auto
==============================================================================
--- openejb/trunk/sandbox/openejb-eclipse-plugin/common/src/main/java/org/apache/openejb/plugins/common/EjbReferencesConverter.java (added)
+++ openejb/trunk/sandbox/openejb-eclipse-plugin/common/src/main/java/org/apache/openejb/plugins/common/EjbReferencesConverter.java Wed May 21 17:18:19 2008
@@ -0,0 +1,65 @@
+/*
+ * 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.plugins.common;
+
+import java.util.List;
+
+import javax.ejb.EJB;
+
+import org.apache.openejb.config.AppModule;
+import org.apache.openejb.config.EjbModule;
+import org.apache.openejb.jee.EjbJar;
+import org.apache.openejb.jee.EnterpriseBean;
+import org.apache.openejb.jee.SessionBean;
+
+public class EjbReferencesConverter implements Converter {
+
+	private IJDTFacade facade;
+
+	public EjbReferencesConverter(IJDTFacade facade) {
+		super();
+		this.facade = facade;
+	}
+
+	public void convert(AppModule module) {
+		List<EjbModule> ejbModules = module.getEjbModules();
+		for (EjbModule ejbModule : ejbModules) {
+			EjbJar ejbJar = ejbModule.getEjbJar();
+
+			EnterpriseBean[] enterpriseBeans = ejbJar.getEnterpriseBeans();
+			for (EnterpriseBean enterpriseBean : enterpriseBeans) {
+				if (! (enterpriseBean instanceof SessionBean)) {
+					continue;
+				}
+
+				SessionBean sessionBean = (SessionBean) enterpriseBean;
+				String remoteClass = sessionBean.getRemote();
+				String localClass = sessionBean.getLocal();
+
+				if (remoteClass != null && remoteClass.length() > 0) {
+					facade.addAnnotationToFieldsOfType(remoteClass, EJB.class, null);
+				}
+
+				if (localClass != null && localClass.length() > 0) {
+					facade.addAnnotationToFieldsOfType(localClass, EJB.class, null);
+				}
+			}
+		}
+	}
+
+
+}

Added: openejb/trunk/sandbox/openejb-eclipse-plugin/common/src/main/java/org/apache/openejb/plugins/common/EntityBeanConverter.java
URL: http://svn.apache.org/viewvc/openejb/trunk/sandbox/openejb-eclipse-plugin/common/src/main/java/org/apache/openejb/plugins/common/EntityBeanConverter.java?rev=658955&view=auto
==============================================================================
--- openejb/trunk/sandbox/openejb-eclipse-plugin/common/src/main/java/org/apache/openejb/plugins/common/EntityBeanConverter.java (added)
+++ openejb/trunk/sandbox/openejb-eclipse-plugin/common/src/main/java/org/apache/openejb/plugins/common/EntityBeanConverter.java Wed May 21 17:18:19 2008
@@ -0,0 +1,501 @@
+/*
+ * 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.plugins.common;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import javax.persistence.Entity;
+import javax.persistence.NamedNativeQueries;
+import javax.persistence.NamedQueries;
+import javax.persistence.Table;
+
+import org.apache.openejb.config.AppModule;
+import org.apache.openejb.config.EjbModule;
+import org.apache.openejb.jee.EnterpriseBean;
+import org.apache.openejb.jee.EntityBean;
+import org.apache.openejb.jee.jpa.Attributes;
+import org.apache.openejb.jee.jpa.Basic;
+import org.apache.openejb.jee.jpa.CascadeType;
+import org.apache.openejb.jee.jpa.Column;
+import org.apache.openejb.jee.jpa.EntityMappings;
+import org.apache.openejb.jee.jpa.FetchType;
+import org.apache.openejb.jee.jpa.GeneratedValue;
+import org.apache.openejb.jee.jpa.GenerationType;
+import org.apache.openejb.jee.jpa.Id;
+import org.apache.openejb.jee.jpa.IdClass;
+import org.apache.openejb.jee.jpa.ManyToOne;
+import org.apache.openejb.jee.jpa.NamedNativeQuery;
+import org.apache.openejb.jee.jpa.NamedQuery;
+import org.apache.openejb.jee.jpa.OneToMany;
+import org.apache.openejb.jee.jpa.OneToOne;
+import org.apache.openejb.jee.jpa.QueryHint;
+import org.apache.openejb.jee.jpa.RelationField;
+import org.apache.openejb.jee.jpa.SequenceGenerator;
+import org.apache.openejb.jee.jpa.TableGenerator;
+import org.apache.openejb.jee.jpa.UniqueConstraint;
+
+public class EntityBeanConverter implements Converter {
+
+	private IJDTFacade facade;
+
+	public EntityBeanConverter(IJDTFacade annotationHelper) {
+		super();
+		this.facade = annotationHelper;
+	}
+
+	@SuppressWarnings("unchecked") //$NON-NLS-1$
+	private void addOneToManyRelationshipAnnotations(EntityBean entityBean, org.apache.openejb.jee.jpa.Entity entity) {
+
+		List<OneToMany> relationships = entity.getAttributes().getOneToMany();
+		for (OneToMany relationship : relationships) {
+
+			Map oneToManyProperties = getPropertiesForRelationship(relationship);
+
+			String name = relationship.getName();
+			String nameGetter = "get" + name.substring(0, 1).toUpperCase() + name.substring(1); //$NON-NLS-1$
+
+			facade.addMethodAnnotation(entityBean.getEjbClass(), nameGetter, new String[] {}, javax.persistence.OneToMany.class, oneToManyProperties);
+		}
+	}
+
+	@SuppressWarnings("unchecked") //$NON-NLS-1$
+	private void addNamedQueriesAnnotations(EntityBean entityBean, org.apache.openejb.jee.jpa.Entity entity) {
+
+		List<NamedQuery> namedQueries = entity.getNamedQuery();
+		List namedQueriesValues = new ArrayList();
+
+		for (NamedQuery namedQuery : namedQueries) {
+			String name = namedQuery.getName();
+			String query = namedQuery.getQuery();
+
+			List<QueryHint> hints = namedQuery.getHint();
+
+			List hintProperties = new ArrayList();
+
+			for (QueryHint hint : hints) {
+				String hintName = hint.getName();
+				String hintValue = hint.getValue();
+
+				Map hintProperty = new HashMap();
+				hintProperty.put("name", hintName); //$NON-NLS-1$
+				hintProperty.put("value", hintValue); //$NON-NLS-1$
+				hintProperties.add(hintProperty);
+			}
+
+			Map namedQueryProperties = new HashMap();
+			namedQueryProperties.put("name", name); //$NON-NLS-1$
+			namedQueryProperties.put("query", query); //$NON-NLS-1$
+			namedQueryProperties.put("hints", hintProperties.toArray(new Object[0])); //$NON-NLS-1$
+
+			namedQueriesValues.add(namedQueryProperties);
+		}
+
+		Map namedQueriesProperties = new HashMap();
+		namedQueriesProperties.put("value", namedQueriesValues.toArray(new Object[0])); //$NON-NLS-1$
+
+		facade.addClassAnnotation(entityBean.getEjbClass(), NamedQueries.class, namedQueriesProperties);
+	}
+
+	private void addBasicAnnotations(EntityBean entityBean, List<Basic> basicAttributes) {
+		for (Basic basic : basicAttributes) {
+			String fieldName = basic.getName();
+			Column column = basic.getColumn();
+
+			addBasicAnnotation(entityBean, fieldName, basic, column);
+		}
+	}
+
+	private void addBasicAnnotation(EntityBean entityBean, String fieldName, Basic basic, Column column) {
+		addColumnAnnotation(entityBean, fieldName, column);
+		Boolean optional = basic.isOptional();
+		FetchType fetchType = basic.getFetch();
+
+		Map<String, Object> basicProps = new HashMap<String, Object>();
+		if (optional != null)
+			basicProps.put("optional", optional.booleanValue()); //$NON-NLS-1$
+		if (fetchType != null)
+			basicProps.put("fetch", fetchType.value()); //$NON-NLS-1$
+
+		// annotationHelper.addFieldAnnotation(entityBean.getEjbClass(),
+		// fieldName, javax.persistence.Basic.class, basicProps);
+
+		String methodName = convertFieldNameToGetterName(fieldName);
+		facade.addMethodAnnotation(entityBean.getEjbClass(), methodName, new String[0], javax.persistence.Basic.class, basicProps);
+	}
+
+	private String convertFieldNameToGetterName(String fieldName) {
+		String methodName = "get" + capitaliseFirstLetter(fieldName); //$NON-NLS-1$
+		return methodName;
+	}
+
+	private String capitaliseFirstLetter(String fieldName) {
+		if (fieldName == null) {
+			return null;
+		}
+
+		if (fieldName.length() == 0) {
+			return fieldName;
+		}
+
+		String firstLetter = fieldName.substring(0, 1).toUpperCase();
+		String restOfWord = ""; //$NON-NLS-1$
+
+		if (fieldName.length() > 1) {
+			restOfWord = fieldName.substring(1);
+		}
+
+		return firstLetter + restOfWord;
+	}
+
+	private void addColumnAnnotation(EntityBean entityBean, String fieldName, Column column) {
+		Map<String, Object> columnProps = new HashMap<String, Object>();
+		if (column.getName() != null)
+			columnProps.put("name", column.getName()); //$NON-NLS-1$
+		if (column.isUnique() != null)
+			columnProps.put("unique", column.isUnique().booleanValue()); //$NON-NLS-1$
+		if (column.isNullable() != null)
+			columnProps.put("nullable", column.isNullable().booleanValue()); //$NON-NLS-1$
+		if (column.isInsertable() != null)
+			columnProps.put("insertable", column.isInsertable().booleanValue()); //$NON-NLS-1$
+		if (column.isUpdatable() != null)
+			columnProps.put("updatable", column.isUpdatable().booleanValue()); //$NON-NLS-1$
+		if (column.getColumnDefinition() != null)
+			columnProps.put("columnDefinition", column.getColumnDefinition()); //$NON-NLS-1$
+		if (column.getTable() != null)
+			columnProps.put("table", column.getTable()); //$NON-NLS-1$
+		if (column.getLength() != null)
+			columnProps.put("length", column.getLength().intValue()); //$NON-NLS-1$
+		if (column.getPrecision() != null)
+			columnProps.put("precision", column.getPrecision().intValue()); //$NON-NLS-1$
+		if (column.getScale() != null)
+			columnProps.put("scale", column.getScale().intValue()); //$NON-NLS-1$
+
+		// annotationHelper.addFieldAnnotation(entityBean.getEjbClass(),
+		// fieldName, javax.persistence.Column.class, columnProps);
+
+		String methodName = convertFieldNameToGetterName(fieldName);
+		facade.addMethodAnnotation(entityBean.getEjbClass(), methodName, new String[0], javax.persistence.Column.class, columnProps);
+
+	}
+
+	private void addTableAnnotation(EntityBean entityBean, org.apache.openejb.jee.jpa.Entity entity) {
+		String tableName = entity.getTable().getName();
+		String schemaName = entity.getTable().getSchema();
+		String catalogName = entity.getTable().getCatalog();
+
+		Map<String, Object> tableProperties = new HashMap<String, Object>();
+		if (tableName != null && tableName.length() > 0) {
+			tableProperties.put("name", tableName); //$NON-NLS-1$
+		}
+
+		if (schemaName != null && schemaName.length() > 0) {
+			tableProperties.put("schema", schemaName); //$NON-NLS-1$
+		}
+
+		if (catalogName != null && catalogName.length() > 0) {
+			tableProperties.put("catalog", catalogName); //$NON-NLS-1$
+		}
+
+		facade.addClassAnnotation(entityBean.getEjbClass(), Table.class, tableProperties);
+	}
+
+	private org.apache.openejb.jee.jpa.Entity getEntity(EntityMappings entityMappings, String ejbName) {
+		List<org.apache.openejb.jee.jpa.Entity> entities = entityMappings.getEntity();
+
+		for (org.apache.openejb.jee.jpa.Entity entity : entities) {
+			if (entity.getName().equals(ejbName)) {
+				return entity;
+			}
+		}
+
+		return null;
+	}
+
+	private List<EntityBean> getEntityBeans(AppModule appModule) {
+		List<EntityBean> result = new ArrayList<EntityBean>();
+
+		List<EjbModule> ejbModules = appModule.getEjbModules();
+		for (EjbModule ejbModule : ejbModules) {
+			EnterpriseBean[] enterpriseBeans = ejbModule.getEjbJar().getEnterpriseBeans();
+
+			for (EnterpriseBean enterpriseBean : enterpriseBeans) {
+				if (enterpriseBean instanceof EntityBean) {
+					result.add((EntityBean) enterpriseBean);
+				}
+			}
+		}
+
+		return result;
+	}
+
+	@SuppressWarnings("unchecked") //$NON-NLS-1$
+	public void convert(AppModule appModule) {
+		EntityMappings entityMappings = appModule.getCmpMappings();
+		List<EntityBean> entityBeans = getEntityBeans(appModule);
+
+		for (EntityBean entityBean : entityBeans) {
+
+			checkEjbClassName(entityBean);
+
+			facade.addClassAnnotation(entityBean.getEjbClass(), Entity.class, null);
+			org.apache.openejb.jee.jpa.Entity entity = getEntity(entityMappings, entityBean.getEjbName());
+
+			if (entity != null) {
+				addTableAnnotation(entityBean, entity);
+
+				Attributes attributes = entity.getAttributes();
+
+				addIdAnnotations(entityBean, attributes.getId());
+				addIdClassAnnotation(entityBean, entity);
+				addBasicAnnotations(entityBean, attributes.getBasic());
+				addNamedQueriesAnnotations(entityBean, entity);
+				addNamedNativeQueriesAnnotations(entityBean, entity);
+				addOneToManyRelationshipAnnotations(entityBean, entity);
+				addManyToOneRelationshipAnnotations(entityBean, entity);
+				addOneToOneRelationshipAnnotations(entityBean, entity);
+			}
+		}
+	}
+
+	@SuppressWarnings("unchecked") //$NON-NLS-1$
+	private void addOneToOneRelationshipAnnotations(EntityBean entityBean, org.apache.openejb.jee.jpa.Entity entity) {
+		List<OneToOne> relationships = entity.getAttributes().getOneToOne();
+		for (OneToOne relationship : relationships) {
+
+			String name = relationship.getName();
+			String nameGetter = "get" + name.substring(0, 1).toUpperCase() + name.substring(1); //$NON-NLS-1$
+
+			Map<String, Object> oneToOneProperties = getPropertiesForRelationship(relationship);
+
+			facade.addMethodAnnotation(entityBean.getEjbClass(), nameGetter, new String[] {}, javax.persistence.OneToOne.class, oneToOneProperties);
+		}
+	}
+
+	@SuppressWarnings("unchecked") //$NON-NLS-1$
+	private void addManyToOneRelationshipAnnotations(EntityBean entityBean, org.apache.openejb.jee.jpa.Entity entity) {
+		List<ManyToOne> relationships = entity.getAttributes().getManyToOne();
+		for (ManyToOne relationship : relationships) {
+
+			String name = relationship.getName();
+			String nameGetter = "get" + name.substring(0, 1).toUpperCase() + name.substring(1); //$NON-NLS-1$
+
+			Map manyToOneProperties = getPropertiesForRelationship(relationship);
+
+			Boolean optional = relationship.isOptional();
+			if (optional != null) {
+				manyToOneProperties.put("optional", optional.booleanValue()); //$NON-NLS-1$
+			}
+
+
+			facade.addMethodAnnotation(entityBean.getEjbClass(), nameGetter, new String[] {}, javax.persistence.OneToOne.class, manyToOneProperties);
+		}
+	}
+
+	@SuppressWarnings("unchecked") //$NON-NLS-1$
+	private Map<String,Object> getPropertiesForRelationship(RelationField relationship) {
+		String targetEntity = relationship.getTargetEntity();
+		FetchType fetch = relationship.getFetch();
+		CascadeType cascade = relationship.getCascade();
+
+
+		Map<String, Object> manyToOneProperties = new HashMap<String, Object>();
+		if (fetch != null) {
+			manyToOneProperties.put("fetch", fetch.value()); //$NON-NLS-1$
+		}
+
+		if (cascade != null) {
+			List cascadeList = new ArrayList();
+			if (cascade.isCascadeAll()) {
+				cascadeList.add(javax.persistence.CascadeType.ALL);
+			}
+
+			if (cascade.isCascadeMerge()) {
+				cascadeList.add(javax.persistence.CascadeType.MERGE);
+			}
+
+			if (cascade.isCascadePersist()) {
+				cascadeList.add(javax.persistence.CascadeType.PERSIST);
+			}
+
+			if (cascade.isCascadeRefresh()) {
+				cascadeList.add(javax.persistence.CascadeType.REFRESH);
+			}
+
+			if (cascade.isCascadeRemove()) {
+				cascadeList.add(javax.persistence.CascadeType.REMOVE);
+			}
+
+			manyToOneProperties.put("cascade", cascadeList.toArray(new Object[0])); //$NON-NLS-1$
+		}
+
+		if (targetEntity != null && targetEntity.length() > 0) {
+			manyToOneProperties.put("targetEntity", targetEntity); //$NON-NLS-1$
+		}
+		return manyToOneProperties;
+	}
+
+	@SuppressWarnings("unchecked") //$NON-NLS-1$
+	private void addIdClassAnnotation(EntityBean entityBean, org.apache.openejb.jee.jpa.Entity entity) {
+		IdClass idClass = entity.getIdClass();
+
+		if (idClass == null) {
+			return;
+		}
+
+		String cls = idClass.getClazz();
+
+		Map props = new HashMap();
+		props.put("value", cls); //$NON-NLS-1$
+
+		facade.addClassAnnotation(entityBean.getEjbClass(), javax.persistence.IdClass.class, props);
+	}
+
+	@SuppressWarnings("unchecked") //$NON-NLS-1$
+	private void addNamedNativeQueriesAnnotations(EntityBean entityBean, org.apache.openejb.jee.jpa.Entity entity) {
+		List<NamedNativeQuery> namedQueries = entity.getNamedNativeQuery();
+		List namedQueriesValues = new ArrayList();
+
+		for (NamedNativeQuery namedQuery : namedQueries) {
+			String name = namedQuery.getName();
+			String query = namedQuery.getQuery();
+
+			List<QueryHint> hints = namedQuery.getHint();
+
+			List hintProperties = new ArrayList();
+
+			for (QueryHint hint : hints) {
+				String hintName = hint.getName();
+				String hintValue = hint.getValue();
+
+				Map hintProperty = new HashMap();
+				hintProperty.put("name", hintName); //$NON-NLS-1$
+				hintProperty.put("value", hintValue); //$NON-NLS-1$
+				hintProperties.add(hintProperty);
+			}
+
+			Map namedQueryProperties = new HashMap();
+			namedQueryProperties.put("name", name); //$NON-NLS-1$
+			namedQueryProperties.put("query", query); //$NON-NLS-1$
+			namedQueryProperties.put("hints", hintProperties.toArray(new Object[0])); //$NON-NLS-1$
+
+			namedQueriesValues.add(namedQueryProperties);
+		}
+
+		if (namedQueriesValues.size() > 0) {
+			Map namedQueriesProperties = new HashMap();
+			namedQueriesProperties.put("value", namedQueriesValues.toArray(new Object[0])); //$NON-NLS-1$
+
+			facade.addClassAnnotation(entityBean.getEjbClass(), NamedNativeQueries.class, namedQueriesProperties);
+		}
+	}
+
+	private void addIdAnnotations(EntityBean entityBean, List<Id> ids) {
+		for (Id id : ids) {
+			addIdAnnotation(entityBean, id);
+
+			String fieldName = id.getName();
+			Column column = id.getColumn();
+
+			addColumnAnnotation(entityBean, fieldName, column);
+		}
+	}
+
+	@SuppressWarnings("unchecked") //$NON-NLS-1$
+	private void addIdAnnotation(EntityBean entityBean, Id id) {
+		String fieldName = id.getName();
+
+		String methodName = convertFieldNameToGetterName(fieldName);
+		String[] emptySignature = new String[0];
+		facade.addMethodAnnotation(entityBean.getEjbClass(), methodName, emptySignature , javax.persistence.Id.class, null);
+
+
+		GeneratedValue generatedValue = id.getGeneratedValue();
+		if (generatedValue != null) {
+			Map<String, Object> generatedValueProps = new HashMap<String, Object>();
+			generatedValueProps.put("generator", generatedValue.getGenerator()); //$NON-NLS-1$
+
+			GenerationType strategy = generatedValue.getStrategy();
+			switch (strategy) {
+				case AUTO:
+					generatedValueProps.put("strategy", javax.persistence.GenerationType.AUTO); //$NON-NLS-1$
+					break;
+				case IDENTITY:
+					generatedValueProps.put("strategy", javax.persistence.GenerationType.IDENTITY); //$NON-NLS-1$
+					break;
+				case SEQUENCE:
+					generatedValueProps.put("strategy", javax.persistence.GenerationType.SEQUENCE); //$NON-NLS-1$
+					break;
+				case TABLE:
+					generatedValueProps.put("strategy", javax.persistence.GenerationType.TABLE); //$NON-NLS-1$
+					break;
+			}
+
+			facade.addMethodAnnotation(entityBean.getEjbClass(), methodName, emptySignature, javax.persistence.GeneratedValue.class, generatedValueProps);
+		}
+
+		SequenceGenerator sequenceGenerator = id.getSequenceGenerator();
+		if (sequenceGenerator != null) {
+			Map<String, Object> sequenceGeneratorProps = new HashMap<String, Object>();
+			sequenceGeneratorProps.put("name", sequenceGenerator.getName()); //$NON-NLS-1$
+			sequenceGeneratorProps.put("sequenceName", sequenceGenerator.getSequenceName()); //$NON-NLS-1$
+			sequenceGeneratorProps.put("initialValue", sequenceGenerator.getInitialValue().intValue()); //$NON-NLS-1$
+			sequenceGeneratorProps.put("allocationSize", sequenceGenerator.getAllocationSize().intValue()); //$NON-NLS-1$
+
+			facade.addMethodAnnotation(entityBean.getEjbClass(), methodName, emptySignature, javax.persistence.SequenceGenerator.class, sequenceGeneratorProps);
+		}
+
+		TableGenerator tableGenerator = id.getTableGenerator();
+		if (tableGenerator != null) {
+			Map<String, Object> tableGeneratorProps = new HashMap<String, Object>();
+			tableGeneratorProps.put("name", tableGenerator.getName()); //$NON-NLS-1$
+			tableGeneratorProps.put("table", tableGenerator.getTable()); //$NON-NLS-1$
+			tableGeneratorProps.put("catalog", tableGenerator.getCatalog()); //$NON-NLS-1$
+			tableGeneratorProps.put("schema", tableGenerator.getSchema()); //$NON-NLS-1$
+			tableGeneratorProps.put("pkColumnName", tableGenerator.getPkColumnName()); //$NON-NLS-1$
+			tableGeneratorProps.put("valueColumnName", tableGenerator.getValueColumnName()); //$NON-NLS-1$
+			tableGeneratorProps.put("pkColumnValue", tableGenerator.getPkColumnValue()); //$NON-NLS-1$
+			tableGeneratorProps.put("initialValue", tableGenerator.getInitialValue().intValue()); //$NON-NLS-1$
+			tableGeneratorProps.put("allocationSize", tableGenerator.getAllocationSize().intValue()); //$NON-NLS-1$
+
+			List uniqueConstraintPropsList = new ArrayList();
+
+			List<UniqueConstraint> uniqueConstraints = tableGenerator.getUniqueConstraint();
+			for (UniqueConstraint uniqueConstriant : uniqueConstraints) {
+				Map<String, Object> uniqueConstraintProps = new HashMap<String, Object>();
+				List<String> columns = uniqueConstriant.getColumnName();
+				uniqueConstraintProps.put("columnNames", columns.toArray(new String[0])); //$NON-NLS-1$
+				uniqueConstraintPropsList.add(uniqueConstraintProps);
+			}
+
+			tableGeneratorProps.put("uniqueConstraints", uniqueConstraintPropsList.toArray(new Object[0])); //$NON-NLS-1$
+			facade.addMethodAnnotation(entityBean.getEjbClass(), methodName, emptySignature, javax.persistence.TableGenerator.class, tableGeneratorProps);
+		}
+	}
+
+	private void checkEjbClassName(EntityBean entityBean) {
+		String ejbClass = entityBean.getEjbClass();
+		String ejbSuperClass = facade.getSuperClass(ejbClass);
+		if (ejbSuperClass != null && ejbSuperClass.length() > 0) {
+			if (facade.classImplements(ejbSuperClass, "javax.ejb.EntityBean")) { //$NON-NLS-1$
+				entityBean.setEjbClass(ejbSuperClass);
+			}
+		}
+	}
+}

Added: openejb/trunk/sandbox/openejb-eclipse-plugin/common/src/main/java/org/apache/openejb/plugins/common/EntityBeanPojoConverter.java
URL: http://svn.apache.org/viewvc/openejb/trunk/sandbox/openejb-eclipse-plugin/common/src/main/java/org/apache/openejb/plugins/common/EntityBeanPojoConverter.java?rev=658955&view=auto
==============================================================================
--- openejb/trunk/sandbox/openejb-eclipse-plugin/common/src/main/java/org/apache/openejb/plugins/common/EntityBeanPojoConverter.java (added)
+++ openejb/trunk/sandbox/openejb-eclipse-plugin/common/src/main/java/org/apache/openejb/plugins/common/EntityBeanPojoConverter.java Wed May 21 17:18:19 2008
@@ -0,0 +1,157 @@
+/*
+ * 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.plugins.common;
+
+import java.util.List;
+
+import org.apache.openejb.config.AppModule;
+import org.apache.openejb.config.EjbModule;
+import org.apache.openejb.jee.EjbJar;
+import org.apache.openejb.jee.EnterpriseBean;
+import org.apache.openejb.jee.EntityBean;
+import org.apache.openejb.jee.jpa.Basic;
+import org.apache.openejb.jee.jpa.Entity;
+import org.apache.openejb.jee.jpa.EntityMappings;
+import org.apache.openejb.jee.jpa.Id;
+import org.apache.openejb.jee.jpa.ManyToMany;
+import org.apache.openejb.jee.jpa.ManyToOne;
+import org.apache.openejb.jee.jpa.OneToMany;
+import org.apache.openejb.jee.jpa.OneToOne;
+
+public class EntityBeanPojoConverter implements Converter {
+
+	private IJDTFacade facade;
+
+	public EntityBeanPojoConverter(IJDTFacade facade) {
+		super();
+		this.facade = facade;
+	}
+
+	public void convert(AppModule module) {
+		EntityMappings cmpMappings = module.getCmpMappings();
+
+		List<EjbModule> ejbModules = module.getEjbModules();
+		for (EjbModule ejbModule : ejbModules) {
+			EjbJar ejbJar = ejbModule.getEjbJar();
+			EnterpriseBean[] enterpriseBeans = ejbJar.getEnterpriseBeans();
+
+			for (EnterpriseBean enterpriseBean : enterpriseBeans) {
+				if (!(enterpriseBean instanceof EntityBean)) {
+					continue;
+				}
+
+				EntityBean entityBean = (EntityBean) enterpriseBean;
+				Entity entity = getMapping(cmpMappings, entityBean.getEjbName());
+
+				if (entity != null) {
+					convertBeanToPojo(entityBean, entity);
+				}
+			}
+		}
+	}
+
+	private Entity getMapping(EntityMappings entityMappings, String ejbName) {
+			List<Entity> entities = entityMappings.getEntity();
+
+			for (Entity entity : entities) {
+				if (entity.getName().equals(ejbName)) {
+					return entity;
+				}
+			}
+
+			return null;
+	}
+
+	private void convertBeanToPojo(EntityBean entityBean, Entity entity) {
+		facade.removeAbstractModifierFromClass(entityBean.getEjbClass());
+        facade.removeInterface(entityBean.getEjbClass(), "javax.ejb.EntityBean");
+
+        List<Basic> basicList = entity.getAttributes().getBasic();
+		for (Basic basic : basicList) {
+			convertGetterAndSetterToNonAbstract(entityBean.getEjbClass(), basic.getName());
+		}
+
+		List<Id> ids = entity.getAttributes().getId();
+		for (Id id : ids) {
+			convertGetterAndSetterToNonAbstract(entityBean.getEjbClass(), id.getName());
+		}
+
+		List<ManyToMany> manyToMany = entity.getAttributes().getManyToMany();
+		for (ManyToMany relationship : manyToMany) {
+			convertGetterAndSetterToNonAbstract(entityBean.getEjbClass(), relationship.getName());
+		}
+
+		List<OneToMany> oneToMany = entity.getAttributes().getOneToMany();
+		for (OneToMany relationship : oneToMany) {
+			convertGetterAndSetterToNonAbstract(entityBean.getEjbClass(), relationship.getName());
+		}
+
+		List<ManyToOne> manyToOne = entity.getAttributes().getManyToOne();
+		for (ManyToOne relationship : manyToOne) {
+			convertGetterAndSetterToNonAbstract(entityBean.getEjbClass(), relationship.getName());
+		}
+
+		List<OneToOne> oneToOne = entity.getAttributes().getOneToOne();
+		for (OneToOne relationship : oneToOne) {
+			convertGetterAndSetterToNonAbstract(entityBean.getEjbClass(), relationship.getName());
+		}
+	}
+
+	private void convertGetterAndSetterToNonAbstract(String cls, String fieldName) {
+		String[] emptySignature = new String[0];
+		String getterMethodName = convertFieldNameToGetterName(fieldName);
+		String setterMethodName = convertFieldNameToSetterName(fieldName);
+
+		String fieldType = facade.getMethodReturnType(cls, getterMethodName, emptySignature);
+		facade.addField(cls, fieldName, fieldType);
+
+		String getterMethodBody = "return " + fieldName + ";"; //$NON-NLS-1$ //$NON-NLS-2$
+		String setterMethodBody = "this." + fieldName + " = ${0};"; //$NON-NLS-1$ //$NON-NLS-2$
+
+		facade.removeAbstractModifierFromMethod(cls, getterMethodName, emptySignature, getterMethodBody);
+		facade.removeAbstractModifierFromMethod(cls, setterMethodName, new String[] { fieldType }, setterMethodBody);
+	}
+
+	private String convertFieldNameToGetterName(String fieldName) {
+		String methodName = "get" + capitaliseFirstLetter(fieldName); //$NON-NLS-1$
+		return methodName;
+	}
+
+	private String capitaliseFirstLetter(String fieldName) {
+		if (fieldName == null) {
+			return null;
+		}
+
+		if (fieldName.length() == 0) {
+			return fieldName;
+		}
+
+		String firstLetter = fieldName.substring(0, 1).toUpperCase();
+		String restOfWord = ""; //$NON-NLS-1$
+
+		if (fieldName.length() > 1) {
+			restOfWord = fieldName.substring(1);
+		}
+
+		return firstLetter + restOfWord;
+	}
+
+	private String convertFieldNameToSetterName(String fieldName) {
+		String methodName = "set" + capitaliseFirstLetter(fieldName); //$NON-NLS-1$
+		return methodName;
+	}
+}

Added: openejb/trunk/sandbox/openejb-eclipse-plugin/common/src/main/java/org/apache/openejb/plugins/common/IJDTFacade.java
URL: http://svn.apache.org/viewvc/openejb/trunk/sandbox/openejb-eclipse-plugin/common/src/main/java/org/apache/openejb/plugins/common/IJDTFacade.java?rev=658955&view=auto
==============================================================================
--- openejb/trunk/sandbox/openejb-eclipse-plugin/common/src/main/java/org/apache/openejb/plugins/common/IJDTFacade.java (added)
+++ openejb/trunk/sandbox/openejb-eclipse-plugin/common/src/main/java/org/apache/openejb/plugins/common/IJDTFacade.java Wed May 21 17:18:19 2008
@@ -0,0 +1,36 @@
+/*
+ * 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.plugins.common;
+
+import java.lang.annotation.Annotation;
+import java.util.Map;
+
+public interface IJDTFacade {
+	void addClassAnnotation(String targetClass, Class<? extends Annotation> annotation, Map<String,Object> properties);
+	void addMethodAnnotation(String fullyQualifiedClassName, String methodName, String[] signature, Class<?> annotationClass, Map<String, Object> properties);
+	void addFieldAnnotation(String targetClass, String targetField, Class<?> annotation, Map<String, Object> properties);
+	void removeInterface(String targetClass, String interfaceToRemove);
+	void removeAbstractModifierFromClass(String targetClass);
+	void removeAbstractModifierFromMethod(String targetClass, String methodName, String[] signature, String methodBody);
+	String getSuperClass(String targetClass);
+	boolean classImplements(String targetClass, String targetInterface);
+	String getMethodReturnType(String targetClass, String methodName, String[] signature);
+	void addField(String targetClass, String fieldName, String fieldType);
+	void addAnnotationToFieldsOfType(String targetClass, Class<?> annotation, Map<String, Object> properties);
+	void addInterface(String ejbClass, String interfaceClass);
+}

Added: openejb/trunk/sandbox/openejb-eclipse-plugin/common/src/main/java/org/apache/openejb/plugins/common/MessageDrivenBeanConverter.java
URL: http://svn.apache.org/viewvc/openejb/trunk/sandbox/openejb-eclipse-plugin/common/src/main/java/org/apache/openejb/plugins/common/MessageDrivenBeanConverter.java?rev=658955&view=auto
==============================================================================
--- openejb/trunk/sandbox/openejb-eclipse-plugin/common/src/main/java/org/apache/openejb/plugins/common/MessageDrivenBeanConverter.java (added)
+++ openejb/trunk/sandbox/openejb-eclipse-plugin/common/src/main/java/org/apache/openejb/plugins/common/MessageDrivenBeanConverter.java Wed May 21 17:18:19 2008
@@ -0,0 +1,28 @@
+/*
+ * 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.plugins.common;
+
+import org.apache.openejb.config.AppModule;
+
+public class MessageDrivenBeanConverter implements Converter {
+
+	public void convert(AppModule module) {
+		// TODO Auto-generated method stub
+
+	}
+
+}

Added: openejb/trunk/sandbox/openejb-eclipse-plugin/common/src/main/java/org/apache/openejb/plugins/common/Messages.java
URL: http://svn.apache.org/viewvc/openejb/trunk/sandbox/openejb-eclipse-plugin/common/src/main/java/org/apache/openejb/plugins/common/Messages.java?rev=658955&view=auto
==============================================================================
--- openejb/trunk/sandbox/openejb-eclipse-plugin/common/src/main/java/org/apache/openejb/plugins/common/Messages.java (added)
+++ openejb/trunk/sandbox/openejb-eclipse-plugin/common/src/main/java/org/apache/openejb/plugins/common/Messages.java Wed May 21 17:18:19 2008
@@ -0,0 +1,22 @@
+package org.apache.openejb.plugins.common;
+
+import java.util.MissingResourceException;
+import java.util.ResourceBundle;
+
+public class Messages {
+	private static final String BUNDLE_NAME = "org.apache.openejb.plugins.common.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/common/src/main/java/org/apache/openejb/plugins/common/OpenEjbXmlConverter.java
URL: http://svn.apache.org/viewvc/openejb/trunk/sandbox/openejb-eclipse-plugin/common/src/main/java/org/apache/openejb/plugins/common/OpenEjbXmlConverter.java?rev=658955&view=auto
==============================================================================
--- openejb/trunk/sandbox/openejb-eclipse-plugin/common/src/main/java/org/apache/openejb/plugins/common/OpenEjbXmlConverter.java (added)
+++ openejb/trunk/sandbox/openejb-eclipse-plugin/common/src/main/java/org/apache/openejb/plugins/common/OpenEjbXmlConverter.java Wed May 21 17:18:19 2008
@@ -0,0 +1,126 @@
+/*
+ * 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.plugins.common;
+
+import java.util.HashMap;
+
+import javax.xml.bind.JAXBElement;
+import javax.xml.bind.JAXBException;
+import javax.xml.parsers.ParserConfigurationException;
+
+import org.apache.openejb.OpenEJBException;
+import org.apache.openejb.config.AppModule;
+import org.apache.openejb.config.CmpJpaConversion;
+import org.apache.openejb.config.EjbModule;
+import org.apache.openejb.config.InitEjbDeployments;
+import org.apache.openejb.config.OpenEjb2Conversion;
+import org.apache.openejb.jee.EjbJar;
+import org.apache.openejb.jee.JaxbJavaee;
+import org.apache.openejb.jee.oejb2.JaxbOpenejbJar2;
+import org.apache.openejb.jee.oejb2.OpenejbJarType;
+import org.apache.openejb.jee.oejb3.OpenejbJar;
+import org.xml.sax.InputSource;
+import org.xml.sax.SAXException;
+
+/**
+ * Scans an ejb-jar.xml file using a JAXB parser, and adds annotations
+ * to source based on the XML.
+ *
+ * Depends on an implementation of IJavaProjectAnnotationFacade
+ *
+ */
+public class OpenEjbXmlConverter {
+
+	public static final String CLS_TRANSACTION_ATTRIBUTE = "javax.ejb.TransactionAttribute"; //$NON-NLS-1$
+	public static final String CLS_APPLICATION_EXCEPTION = "javax.ejb.ApplicationException"; //$NON-NLS-1$
+	public static final String CLS_STATEFUL = "javax.ejb.Stateful"; //$NON-NLS-1$
+	public static final String CLS_STATELESS = "javax.ejb.Stateless"; //$NON-NLS-1$
+	public static final String CLS_MESSAGE_DRIVEN = "javax.ejb.MessageDriven"; //$NON-NLS-1$
+	public static final String STATELESS_CLASS = CLS_STATELESS;
+	private Converter[] converters;
+
+
+
+	public OpenEjbXmlConverter(Converter[] converters) {
+		super();
+		this.converters = converters;
+	}
+
+	/**
+	 * Parses the XML
+	 * @param source An input source to the content of ejb-jar.xml
+	 * @return Whether or not the parsing was successful
+	 * @throws ConversionException
+	 */
+	public boolean convert(InputSource source) throws ConversionException {
+		return convert(source, null);
+	}
+
+	/**
+	 * Parses the XML
+	 * @param ejbJarSrc An input source to the content of ejb-jar.xml
+	 * @param openEjbJarSrc An input source to the content of openejb-jar.xml (optional)
+	 * @return Whether or not the parsing was successful
+	 * @throws ConversionException
+	 */
+	@SuppressWarnings("unchecked") //$NON-NLS-1$
+	public boolean convert(InputSource ejbJarSrc, InputSource openEjbJarSrc) throws ConversionException {
+		AppModule appModule = getAppModule(ejbJarSrc, openEjbJarSrc);
+
+		for (Converter converter : converters) {
+			converter.convert(appModule);
+		}
+
+		return true;
+	}
+
+	private AppModule getAppModule(InputSource ejbJarSrc, InputSource openEjbJarSrc) throws ConversionException {
+		AppModule appModule = new AppModule(getClass().getClassLoader(), "ModuleToConvert"); //$NON-NLS-1$
+
+		try {
+			EjbJar ejbJar = (EjbJar) JaxbJavaee.unmarshal(EjbJar.class, ejbJarSrc.getByteStream());
+	        EjbModule ejbModule = new EjbModule(ejbJar, new OpenejbJar());
+	        appModule.getEjbModules().add(ejbModule);
+
+			if (openEjbJarSrc != null) {
+		        InitEjbDeployments initEjbDeployments = new InitEjbDeployments();
+		        initEjbDeployments.deploy(ejbModule, new HashMap<String,String>());
+
+		        JAXBElement<?> element = (JAXBElement<?>) JaxbOpenejbJar2.unmarshal(OpenejbJarType.class, openEjbJarSrc.getByteStream());
+		        OpenejbJarType openejbJarType = (OpenejbJarType) element.getValue();
+		        ejbModule.getAltDDs().put("openejb-jar.xml", openejbJarType); //$NON-NLS-1$
+
+		        CmpJpaConversion cmpJpaConversion = new CmpJpaConversion();
+		        cmpJpaConversion.deploy(appModule);
+
+		        OpenEjb2Conversion openEjb2Conversion = new OpenEjb2Conversion();
+		        openEjb2Conversion.deploy(appModule);
+			}
+
+			return appModule;
+		} catch (JAXBException e) {
+			throw new ConversionException(Messages.getString("org.apache.openejb.helper.annotation.conversionExceptionMsg.1"), e); //$NON-NLS-1$
+		} catch (ParserConfigurationException e) {
+			throw new ConversionException(Messages.getString("org.apache.openejb.helper.annotation.conversionExceptionMsg.2"), e); //$NON-NLS-1$
+		} catch (SAXException e) {
+			throw new ConversionException(Messages.getString("org.apache.openejb.helper.annotation.conversionExceptionMsg.3"), e); //$NON-NLS-1$
+		} catch (OpenEJBException e) {
+			throw new ConversionException(Messages.getString("org.apache.openejb.helper.annotation.conversionExceptionMsg.4")); //$NON-NLS-1$
+		}
+	}
+}

Added: openejb/trunk/sandbox/openejb-eclipse-plugin/common/src/main/java/org/apache/openejb/plugins/common/SessionBeanConverter.java
URL: http://svn.apache.org/viewvc/openejb/trunk/sandbox/openejb-eclipse-plugin/common/src/main/java/org/apache/openejb/plugins/common/SessionBeanConverter.java?rev=658955&view=auto
==============================================================================
--- openejb/trunk/sandbox/openejb-eclipse-plugin/common/src/main/java/org/apache/openejb/plugins/common/SessionBeanConverter.java (added)
+++ openejb/trunk/sandbox/openejb-eclipse-plugin/common/src/main/java/org/apache/openejb/plugins/common/SessionBeanConverter.java Wed May 21 17:18:19 2008
@@ -0,0 +1,349 @@
+/*
+ * 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.plugins.common;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+
+import javax.annotation.security.DeclareRoles;
+import javax.annotation.security.DenyAll;
+import javax.annotation.security.PermitAll;
+import javax.annotation.security.RolesAllowed;
+import javax.annotation.security.RunAs;
+import javax.ejb.MessageDriven;
+import javax.ejb.Stateful;
+import javax.ejb.Stateless;
+import javax.ejb.TransactionAttribute;
+import javax.ejb.TransactionAttributeType;
+import javax.ejb.TransactionManagement;
+import javax.ejb.TransactionManagementType;
+import javax.interceptor.ExcludeClassInterceptors;
+import javax.interceptor.ExcludeDefaultInterceptors;
+import javax.interceptor.Interceptors;
+
+import org.apache.openejb.config.AppModule;
+import org.apache.openejb.config.EjbModule;
+import org.apache.openejb.jee.ActivationConfig;
+import org.apache.openejb.jee.ActivationConfigProperty;
+import org.apache.openejb.jee.ApplicationException;
+import org.apache.openejb.jee.AssemblyDescriptor;
+import org.apache.openejb.jee.EjbJar;
+import org.apache.openejb.jee.EnterpriseBean;
+import org.apache.openejb.jee.InterceptorBinding;
+import org.apache.openejb.jee.MessageDrivenBean;
+import org.apache.openejb.jee.Method;
+import org.apache.openejb.jee.MethodParams;
+import org.apache.openejb.jee.MethodPermission;
+import org.apache.openejb.jee.MethodTransaction;
+import org.apache.openejb.jee.NamedMethod;
+import org.apache.openejb.jee.RemoteBean;
+import org.apache.openejb.jee.SecurityRoleRef;
+import org.apache.openejb.jee.SessionBean;
+import org.apache.openejb.jee.SessionType;
+import org.apache.openejb.jee.StatefulBean;
+import org.apache.openejb.jee.StatelessBean;
+import org.apache.openejb.jee.TransactionType;
+
+public class SessionBeanConverter implements Converter {
+
+	public static final String CLS_TRANSACTION_ATTRIBUTE = "javax.ejb.TransactionAttribute"; //$NON-NLS-1$
+	public static final String CLS_APPLICATION_EXCEPTION = "javax.ejb.ApplicationException"; //$NON-NLS-1$
+	public static final String CLS_STATEFUL = "javax.ejb.Stateful"; //$NON-NLS-1$
+	public static final String CLS_STATELESS = "javax.ejb.Stateless"; //$NON-NLS-1$
+	public static final String CLS_MESSAGE_DRIVEN = "javax.ejb.MessageDriven"; //$NON-NLS-1$
+	public static final String STATELESS_CLASS = CLS_STATELESS;
+	protected IJDTFacade annotationHelper;
+
+
+	/**
+	 * Constucts a new converter
+	 * @param annotationHelper Annotation Facade to use for adding annotations
+	 */
+	public SessionBeanConverter(IJDTFacade annotationHelper) {
+		this.annotationHelper = annotationHelper;
+	}
+
+	private void processApplicationExceptions(EjbJar ejbJar) {
+		List<ApplicationException> exceptionList = ejbJar.getAssemblyDescriptor().getApplicationException();
+		Iterator<ApplicationException> iterator = exceptionList.iterator();
+
+		while (iterator.hasNext()) {
+			ApplicationException element = (ApplicationException) iterator.next();
+			String exceptionClass = element.getExceptionClass();
+
+			annotationHelper.addClassAnnotation(exceptionClass, javax.ejb.ApplicationException.class, null);
+		}
+	}
+
+	private void processEnterpriseBeans(EjbJar ejbJar) {
+		EnterpriseBean[] enterpriseBeans = ejbJar.getEnterpriseBeans();
+		Iterator<EnterpriseBean> iterator = Arrays.asList(enterpriseBeans).iterator();
+		while (iterator.hasNext()) {
+			EnterpriseBean bean = (EnterpriseBean) iterator.next();
+			if (bean instanceof SessionBean) {
+				SessionBean sessionBean = (SessionBean) bean;
+				processSessionBean(sessionBean);
+			} else if (bean instanceof MessageDrivenBean) {
+				MessageDrivenBean messageDriven = (MessageDrivenBean) bean;
+				processMessageDrivenBean(messageDriven);
+			}
+
+			processTransactionManagement(bean, ejbJar.getAssemblyDescriptor());
+			processBeanSecurityIdentity(bean);
+			processDeclaredRoles(bean);
+		}
+
+		processMethodPermissions(ejbJar);
+	}
+
+	/**
+	 * Generates transaction management annotations for an Enterprise Bean
+	 * @param bean The enterprise bean to generate annotations for
+	 * @param descriptor The assembly descriptor
+	 */
+	public void processTransactionManagement(EnterpriseBean bean, AssemblyDescriptor descriptor) {
+		TransactionType transactionType = bean.getTransactionType();
+
+		if (transactionType != null && (! TransactionType.CONTAINER.equals(transactionType))) {
+			Map<String,Object> props = new HashMap<String, Object>();
+			props.put("value", TransactionManagementType.BEAN); //$NON-NLS-1$
+
+			annotationHelper.addClassAnnotation(bean.getEjbClass(), TransactionManagement.class, props);
+		}
+
+		Map<String, List<MethodTransaction>> methodTransactions = descriptor.getMethodTransactions(bean.getEjbName());
+		if (methodTransactions.containsKey("*")) { //$NON-NLS-1$
+			List<MethodTransaction> defaultTransactions = methodTransactions.get("*"); //$NON-NLS-1$
+			MethodTransaction defaultTransaction = defaultTransactions.get(0);
+
+			Map<String, Object> props = new HashMap<String, Object>();
+			props.put("value", TransactionAttributeType.valueOf(defaultTransaction.getAttribute().name())); //$NON-NLS-1$
+			annotationHelper.addClassAnnotation(bean.getEjbClass(), TransactionAttribute.class, props);
+		}
+
+		Iterator<String> iterator = methodTransactions.keySet().iterator();
+		while (iterator.hasNext()) {
+			String methodName = (String) iterator.next();
+			if ("*".equals(methodName)) { //$NON-NLS-1$
+				continue;
+			}
+
+			List<MethodTransaction> transactions = methodTransactions.get(methodName);
+			MethodTransaction methodTransaction = transactions.get(0);
+
+			Map<String, Object> props = new HashMap<String, Object>();
+			props.put("value", TransactionAttributeType.valueOf(methodTransaction.getAttribute().name())); //$NON-NLS-1$
+
+			MethodParams methodParams = methodTransaction.getMethod().getMethodParams();
+			String[] params = methodParams.getMethodParam().toArray(new String[0]);
+			annotationHelper.addMethodAnnotation(bean.getEjbClass(), methodName, params, TransactionAttribute.class, props);
+		}
+	}
+
+	public void processMessageDrivenBean(MessageDrivenBean bean) {
+		Map<String, Object> props = new HashMap<String, Object>();
+
+		ActivationConfig activationConfig = bean.getActivationConfig();
+		if (activationConfig != null) {
+			List<Map<String, Object>> activationConfigPropertiesList = new ArrayList<Map<String,Object>>();
+
+			List<ActivationConfigProperty> activationConfigProperties = activationConfig.getActivationConfigProperty();
+
+			for (ActivationConfigProperty activationConfigProperty : activationConfigProperties) {
+				HashMap<String, Object> configProps = new HashMap<String, Object>();
+				configProps.put("propertyName", activationConfigProperty.getActivationConfigPropertyName()); //$NON-NLS-1$
+				configProps.put("propertyValue", activationConfigProperty.getActivationConfigPropertyValue()); //$NON-NLS-1$
+
+				activationConfigPropertiesList.add(configProps);
+			}
+
+			if (bean.getMessageDestinationLink() != null && bean.getMessageDestinationLink().length() > 0) {
+				if (! hasConfigProperty(activationConfigPropertiesList, "destination")) { //$NON-NLS-1$
+					HashMap<String, Object> configProps = new HashMap<String, Object>();
+					configProps.put("propertyName", "destination"); //$NON-NLS-1$ //$NON-NLS-2$
+					configProps.put("propertyValue", bean.getMessageDestinationLink()); //$NON-NLS-1$
+
+					activationConfigPropertiesList.add(configProps);
+				}
+			}
+
+			props.put("activationConfig", activationConfigPropertiesList.toArray(new HashMap[0])); //$NON-NLS-1$
+		}
+
+		props.put("name", bean.getEjbName()); //$NON-NLS-1$
+		annotationHelper.addClassAnnotation(bean.getEjbClass(), MessageDriven.class, props);
+	}
+
+
+	private boolean hasConfigProperty(List<Map<String, Object>> activationConfigPropertiesList, String propertyName) {
+		for (Map<String,Object> configProperty : activationConfigPropertiesList) {
+			if (configProperty.get("propertyName") != null && configProperty.get("propertyName").toString().equals(propertyName)) { //$NON-NLS-1$ //$NON-NLS-2$
+				return true;
+			}
+		}
+
+		return false;
+	}
+
+	public void processSessionBean(SessionBean sessionBean) {
+		String ejbClass = sessionBean.getEjbClass();
+		if (sessionBean instanceof StatelessBean || sessionBean.getSessionType() == SessionType.STATELESS) {
+			annotationHelper.addClassAnnotation(ejbClass, Stateless.class, null);
+		} else if (sessionBean instanceof StatefulBean || sessionBean.getSessionType() == SessionType.STATEFUL) {
+			annotationHelper.addClassAnnotation(ejbClass, Stateful.class, null);
+		}
+	}
+
+	public void processMethodPermissions(EjbJar ejbJar) {
+		AssemblyDescriptor descriptor = ejbJar.getAssemblyDescriptor();
+
+		List<MethodPermission> methodPermissions = descriptor.getMethodPermission();
+		Iterator<MethodPermission> iterator = methodPermissions.iterator();
+
+		while (iterator.hasNext()) {
+			MethodPermission methodPermission = (MethodPermission) iterator.next();
+			List<String> roles = methodPermission.getRoleName();
+
+			if (roles == null || roles.size() == 0) {
+				continue;
+			}
+
+			String[] roleList = roles.toArray(new String[0]);
+			Map<String, Object> roleProps = new HashMap<String, Object>();
+			roleProps.put("value", roleList); //$NON-NLS-1$
+
+
+			List<Method> methods = methodPermission.getMethod();
+			Iterator<Method> methodIter = methods.iterator();
+
+			while (methodIter.hasNext()) {
+				Method method = (Method) methodIter.next();
+				EnterpriseBean enterpriseBean = ejbJar.getEnterpriseBean(method.getEjbName());
+
+				MethodParams methodParams = method.getMethodParams();
+				String[] params = methodParams.getMethodParam().toArray(new String[0]);
+
+				if ((! "*".equals(method.getMethodName())) &&  descriptor.getExcludeList().getMethod().contains(method)) { //$NON-NLS-1$
+					annotationHelper.addMethodAnnotation(enterpriseBean.getEjbClass(), method.getMethodName(), params, DenyAll.class, null);
+					continue;
+				}
+
+				if (methodPermission.getUnchecked()) {
+					if ("*".equals(method.getMethodName())) { //$NON-NLS-1$
+						annotationHelper.addClassAnnotation(enterpriseBean.getEjbClass(), PermitAll.class, null);
+					} else {
+						annotationHelper.addMethodAnnotation(enterpriseBean.getEjbClass(), method.getMethodName(), params, PermitAll.class, null);
+					}
+				} else {
+					if ("*".equals(method.getMethodName())) { //$NON-NLS-1$
+						annotationHelper.addClassAnnotation(enterpriseBean.getEjbClass(), RolesAllowed.class, roleProps);
+					} else {
+						annotationHelper.addMethodAnnotation(enterpriseBean.getEjbClass(), method.getMethodName(), params, RolesAllowed.class, roleProps);
+					}
+				}
+			}
+		}
+	}
+
+	public void processBeanSecurityIdentity(EnterpriseBean bean) {
+		if (bean.getSecurityIdentity() == null) {
+			return;
+		}
+
+		Map<String, Object> runAsProps = new HashMap<String, Object>();
+		runAsProps.put("value", bean.getSecurityIdentity().getRunAs()); //$NON-NLS-1$
+
+		annotationHelper.addClassAnnotation(bean.getEjbClass(), RunAs.class, runAsProps);
+	}
+
+	public void processDeclaredRoles(EnterpriseBean bean) {
+		if (! (bean instanceof RemoteBean)) {
+			return;
+		}
+
+		RemoteBean remoteBean = (RemoteBean) bean;
+		List<SecurityRoleRef> securityRoleRefs = remoteBean.getSecurityRoleRef();
+
+		if (securityRoleRefs == null || securityRoleRefs.size() == 0) {
+			return;
+		}
+
+		Map<String, Object> props = new HashMap<String, Object>();
+		List<String> roleList = new ArrayList<String>();
+
+		for (SecurityRoleRef securityRoleRef : securityRoleRefs) {
+			roleList.add(securityRoleRef.getRoleName());
+		}
+
+		props.put("value", roleList.toArray(new String[0])); //$NON-NLS-1$
+		annotationHelper.addClassAnnotation(bean.getEjbClass(), DeclareRoles.class, props);
+	}
+
+	public void processInterceptors(EjbJar ejbJar) {
+		List<InterceptorBinding> interceptorBindings = ejbJar.getAssemblyDescriptor().getInterceptorBinding();
+
+		for (InterceptorBinding interceptorBinding : interceptorBindings) {
+			EnterpriseBean bean = ejbJar.getEnterpriseBean(interceptorBinding.getEjbName());
+
+			List<String> interceptorClasses = interceptorBinding.getInterceptorClass();
+
+			String[] classes = interceptorClasses.toArray(new String[0]);
+
+			Map<String, Object> properties = new HashMap<String, Object>();
+			properties.put("value", classes); //$NON-NLS-1$
+
+			if (interceptorBinding.getMethod() == null) {
+				if (interceptorBinding.getExcludeDefaultInterceptors()) {
+					annotationHelper.addClassAnnotation(bean.getEjbClass(), ExcludeDefaultInterceptors.class, properties);
+				}
+
+				if (interceptorBinding.getExcludeClassInterceptors()) {
+					annotationHelper.addClassAnnotation(bean.getEjbClass(), ExcludeClassInterceptors.class, properties);
+				}
+
+				annotationHelper.addClassAnnotation(bean.getEjbClass(), Interceptors.class, properties);
+			} else {
+				NamedMethod method = interceptorBinding.getMethod();
+				String[] signature = method.getMethodParams().getMethodParam().toArray(new String[0]);
+
+				if (interceptorBinding.getExcludeDefaultInterceptors()) {
+					annotationHelper.addMethodAnnotation(bean.getEjbClass(), method.getMethodName(), signature, ExcludeDefaultInterceptors.class, properties);
+				}
+
+				if (interceptorBinding.getExcludeClassInterceptors()) {
+					annotationHelper.addMethodAnnotation(bean.getEjbClass(), method.getMethodName(), signature, ExcludeClassInterceptors.class, properties);
+				}
+
+				annotationHelper.addMethodAnnotation(bean.getEjbClass(), method.getMethodName(), signature, Interceptors.class, properties);
+			}
+		}
+	}
+
+	public void convert(AppModule module) {
+		List<EjbModule> ejbModules = module.getEjbModules();
+		for (EjbModule ejbModule : ejbModules) {
+			EjbJar ejbJar = ejbModule.getEjbJar();
+
+			processEnterpriseBeans(ejbJar);
+			processApplicationExceptions(ejbJar);
+		}
+	}
+}

Added: openejb/trunk/sandbox/openejb-eclipse-plugin/common/src/main/java/org/apache/openejb/plugins/common/SessionBeanInterfaceModifier.java
URL: http://svn.apache.org/viewvc/openejb/trunk/sandbox/openejb-eclipse-plugin/common/src/main/java/org/apache/openejb/plugins/common/SessionBeanInterfaceModifier.java?rev=658955&view=auto
==============================================================================
--- openejb/trunk/sandbox/openejb-eclipse-plugin/common/src/main/java/org/apache/openejb/plugins/common/SessionBeanInterfaceModifier.java (added)
+++ openejb/trunk/sandbox/openejb-eclipse-plugin/common/src/main/java/org/apache/openejb/plugins/common/SessionBeanInterfaceModifier.java Wed May 21 17:18:19 2008
@@ -0,0 +1,68 @@
+/*
+ * 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.plugins.common;
+
+import java.util.List;
+
+import org.apache.openejb.config.AppModule;
+import org.apache.openejb.config.EjbModule;
+
+import org.apache.openejb.jee.EjbJar;
+import org.apache.openejb.jee.EnterpriseBean;
+import org.apache.openejb.jee.SessionBean;
+
+public class SessionBeanInterfaceModifier implements Converter {
+
+	private IJDTFacade facade;
+
+	public SessionBeanInterfaceModifier(IJDTFacade facade) {
+		super();
+		this.facade = facade;
+	}
+
+	public void convert(AppModule module) {
+		List<EjbModule> ejbModules = module.getEjbModules();
+		for (EjbModule ejbModule : ejbModules) {
+			EjbJar ejbJar = ejbModule.getEjbJar();
+			EnterpriseBean[] enterpriseBeans = ejbJar.getEnterpriseBeans();
+
+			for (EnterpriseBean enterpriseBean : enterpriseBeans) {
+				if (!(enterpriseBean instanceof SessionBean)) {
+					continue;
+				}
+
+				SessionBean sessionBean = (SessionBean) enterpriseBean;
+				String ejbClass = sessionBean.getEjbClass();
+
+				facade.removeInterface(ejbClass, "javax.ejb.SessionBean"); //$NON-NLS-1$
+
+				String remoteInterface = sessionBean.getRemote();
+				if (remoteInterface != null && remoteInterface.length() > 0) {
+					facade.addInterface(ejbClass, remoteInterface);
+					facade.removeInterface(remoteInterface, "javax.ejb.EJBObject"); //$NON-NLS-1$
+				}
+
+				String localInterface = sessionBean.getLocal();
+				if (localInterface != null && localInterface.length() > 0) {
+					facade.addInterface(ejbClass, localInterface);
+					facade.removeInterface(localInterface, "javax.ejb.EJBLocalObject"); //$NON-NLS-1$
+				}
+			}
+		}
+	}
+
+}

Added: openejb/trunk/sandbox/openejb-eclipse-plugin/common/src/main/java/org/apache/openejb/plugins/common/SessionBeanRemoteAnnotationAdder.java
URL: http://svn.apache.org/viewvc/openejb/trunk/sandbox/openejb-eclipse-plugin/common/src/main/java/org/apache/openejb/plugins/common/SessionBeanRemoteAnnotationAdder.java?rev=658955&view=auto
==============================================================================
--- openejb/trunk/sandbox/openejb-eclipse-plugin/common/src/main/java/org/apache/openejb/plugins/common/SessionBeanRemoteAnnotationAdder.java (added)
+++ openejb/trunk/sandbox/openejb-eclipse-plugin/common/src/main/java/org/apache/openejb/plugins/common/SessionBeanRemoteAnnotationAdder.java Wed May 21 17:18:19 2008
@@ -0,0 +1,76 @@
+/*
+ * 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.plugins.common;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import javax.ejb.Remote;
+import javax.ejb.RemoteHome;
+
+import org.apache.openejb.config.AppModule;
+import org.apache.openejb.config.EjbModule;
+
+import org.apache.openejb.jee.EjbJar;
+import org.apache.openejb.jee.EnterpriseBean;
+import org.apache.openejb.jee.RemoteBean;
+import org.apache.openejb.jee.SessionBean;
+
+public class SessionBeanRemoteAnnotationAdder implements Converter {
+
+	private IJDTFacade facade;
+
+	public SessionBeanRemoteAnnotationAdder(IJDTFacade facade) {
+		this.facade = facade;
+	}
+
+	public void convert(AppModule module) {
+		List<EjbModule> ejbModules = module.getEjbModules();
+		for (EjbModule ejbModule : ejbModules) {
+			EjbJar ejbJar = ejbModule.getEjbJar();
+
+			EnterpriseBean[] enterpriseBeans = ejbJar.getEnterpriseBeans();
+			for (EnterpriseBean enterpriseBean : enterpriseBeans) {
+				if (!(enterpriseBean instanceof SessionBean)) {
+					continue;
+				}
+
+				SessionBean sessionBean = (SessionBean) enterpriseBean;
+				addRemoteAndRemoteHomeAnnotations(sessionBean);
+			}
+		}
+
+	}
+
+	private void addRemoteAndRemoteHomeAnnotations(SessionBean sessionBean) {
+		String ejbClass = sessionBean.getEjbClass();
+
+		if (sessionBean instanceof RemoteBean) {
+			if (sessionBean.getRemote() != null && sessionBean.getRemote().length() > 0) {
+				facade.addClassAnnotation(sessionBean.getRemote(), Remote.class, null);
+			}
+
+			if (sessionBean.getHome() != null && sessionBean.getHome().length() > 0) {
+				Map<String, Object> props = new HashMap<String, Object>();
+				props.put("value", sessionBean.getHome()); //$NON-NLS-1$
+
+				facade.addClassAnnotation(ejbClass, RemoteHome.class, props);
+			}
+		}
+	}
+}

Added: openejb/trunk/sandbox/openejb-eclipse-plugin/common/src/main/resources/org/apache/openejb/plugins/common/messages.properties
URL: http://svn.apache.org/viewvc/openejb/trunk/sandbox/openejb-eclipse-plugin/common/src/main/resources/org/apache/openejb/plugins/common/messages.properties?rev=658955&view=auto
==============================================================================
--- openejb/trunk/sandbox/openejb-eclipse-plugin/common/src/main/resources/org/apache/openejb/plugins/common/messages.properties (added)
+++ openejb/trunk/sandbox/openejb-eclipse-plugin/common/src/main/resources/org/apache/openejb/plugins/common/messages.properties Wed May 21 17:18:19 2008
@@ -0,0 +1,17 @@
+org.apache.openejb.helper.annotation.conversionExceptionMsg.1=Unable to unmarshal XML
+org.apache.openejb.helper.annotation.conversionExceptionMsg.2=Unable to unmarshal XML (parser configuration error)
+org.apache.openejb.helper.annotation.conversionExceptionMsg.3=Unable to unmarshal XML (SAX error - XML badly formed?)
+org.apache.openejb.helper.annotation.conversionExceptionMsg.4=Unable to convert openejb-jar.xml to orm.xml
+org.apache.openejb.helper.annotation.warnings.1=Annotation %1$s already used on %2$s
+org.apache.openejb.helper.annotation.warnings.2=An error occurred adding annotation %1$s to class %2$s
+org.apache.openejb.helper.annotation.warnings.3=An error occurred adding annotation %1$s to method %2$s on %3$s
+org.apache.openejb.helper.annotation.warnings.4=An error occurred adding annotation %1$s to field %2$s on %3$s
+org.apache.openejb.helper.annotation.compositChangeString=Add EJB 3.0 Annotations
+org.apache.openejb.helper.annotation.warnings.5=An error occurred removing %1$s from %2$s
+org.apache.openejb.helper.annotation.warnings.6=An error occurred removing abstract from %1$s
+org.apache.openejb.helper.annotation.warnings.7=Unable to remove abstract modifier from: %1$s.%2$s
+org.apache.openejb.helper.annotation.warnings.8=An error occurred determining interfaces of %1$s
+org.apache.openejb.helper.annotation.warnings.9=Error occurred getting superclass of %1$s
+org.apache.openejb.helper.annotation.warnings.10=Error getting return type of %1$s.%2$s
+org.apache.openejb.helper.annotation.warnings.11=Error adding field %1$s on %2$s
+org.apache.openejb.helper.annotation.warnings.12=An error occurred adding %1$s to %2$s

Added: openejb/trunk/sandbox/openejb-eclipse-plugin/common/src/main/resources/org/apache/openejb/plugins/common/messages_de.properties
URL: http://svn.apache.org/viewvc/openejb/trunk/sandbox/openejb-eclipse-plugin/common/src/main/resources/org/apache/openejb/plugins/common/messages_de.properties?rev=658955&view=auto
==============================================================================
--- openejb/trunk/sandbox/openejb-eclipse-plugin/common/src/main/resources/org/apache/openejb/plugins/common/messages_de.properties (added)
+++ openejb/trunk/sandbox/openejb-eclipse-plugin/common/src/main/resources/org/apache/openejb/plugins/common/messages_de.properties Wed May 21 17:18:19 2008
@@ -0,0 +1,17 @@
+org.apache.openejb.helper.annotation.conversionExceptionMsg.1=Fehler beim Erstellen des XML Dokuments
+org.apache.openejb.helper.annotation.conversionExceptionMsg.2=Fehler beim Erstellen des XML Dokuments (parser configuration error)
+org.apache.openejb.helper.annotation.conversionExceptionMsg.3=Fehler beim Erstellen des XML Dokuments (SAX error - XML Dokument ist wom\u00f6glich nicht wohlgeformt?)
+org.apache.openejb.helper.annotation.conversionExceptionMsg.4=openejb-jar.xml konnte nicht nach orm.xml konvertiert werden
+org.apache.openejb.helper.annotation.warnings.1=Annotation %1$s existiert bereits f\u00fcr %2$s
+org.apache.openejb.helper.annotation.warnings.2=Beim Erstellen der Annotation %1$s f\u00fcr die Klasse %2$s trat ein Fehler auf
+org.apache.openejb.helper.annotation.warnings.3=Beim Erstellen der Annotation %1$s f\u00fcr die Methode %2$s der Klasse %3$s trat ein Fehler auf
+org.apache.openejb.helper.annotation.warnings.4=Beim Erstellen der Annotation %1$s f\u00fcr das Feld %2$s der Klasse %3$s trat ein Fehler auf
+org.apache.openejb.helper.annotation.compositChangeString=EJB 3.0 Annotations hinzuf\u00fcgen
+org.apache.openejb.helper.annotation.warnings.5=Beim Entfernen der Annotation %1$s f\u00fcr die Klasse %2$s trat ein Fehler auf
+org.apache.openejb.helper.annotation.warnings.6=Beim entfernen des Schl\u00fcsselworts abstract f\u00fcr die Klasse %1$s trat ein Fehler auf
+org.apache.openejb.helper.annotation.warnings.7=Der abstract Modifikator konnte von %1$s.%2$s nicht entfernt werden
+org.apache.openejb.helper.annotation.warnings.8=Die Schnittstellen von %1$s konnten nicht ermittelt werden
+org.apache.openejb.helper.annotation.warnings.9=Die Basisklasse von %1$s konnte nicht ermittelt werden
+org.apache.openejb.helper.annotation.warnings.10=Der r\u00fcckgabewert von %1$s.%2$s konnte nicht ermittelt werden
+org.apache.openejb.helper.annotation.warnings.11=Das Feld %1$s konnte nicht zur Klasse %2$s hinzugef\u00fcgt werden
+org.apache.openejb.helper.annotation.warnings.12=Die Schnittstellenklasse %1$s konnte der Klasse %2$s nicht hinzugef\u00fcgt werden

Modified: openejb/trunk/sandbox/openejb-eclipse-plugin/eclipse/build.xml
URL: http://svn.apache.org/viewvc/openejb/trunk/sandbox/openejb-eclipse-plugin/eclipse/build.xml?rev=658955&r1=658954&r2=658955&view=diff
==============================================================================
--- openejb/trunk/sandbox/openejb-eclipse-plugin/eclipse/build.xml (original)
+++ openejb/trunk/sandbox/openejb-eclipse-plugin/eclipse/build.xml Wed May 21 17:18:19 2008
@@ -24,8 +24,8 @@
     <target name="init">
         <property name="europa_drop"    value="R-3.3.1.1-200710231652"/>
         <property name="dtp_drop"       value="1.5"/>
-        <property name="emf_drop"       value="2.3.1/R200709252135"/>
-        <property name="gef_drop"       value="R-3.3.1-200709241000"/>
+        <property name="emf_drop"       value="2.3.2/R200802051830"/>
+        <property name="gef_drop"       value="3.3.2/R200802211602"/>
         <property name="wtp_drop"       value="R-2.0.2-20080223205547"/>
 
         <property name="base_url"           value="http://www.eclipse.org/downloads/download.php?file="/>
@@ -40,14 +40,14 @@
         <property name="wtp_download_url"   value="${base_url}/webtools/downloads/drops/R2.0/${wtp_drop}/"/>
 
         <property name="europa_jee_win32"       value="eclipse-SDK-3.3.1.1-win32.zip"/>
-        <property name="europa_jee_linux"       value="eclipse-SDK-3.3.1.1-linux-gtk.tar"/>
+        <property name="europa_jee_linux"       value="eclipse-SDK-3.3.1.1-linux-gtk-x86_64.tar"/>
         <property name="europa_jee_macos"       value="eclipse-SDK-3.3.1.1-macosx-carbon.tar"/>
         <property name="europa_jee_linux_gz"    value="${europa_jee_linux}.gz"/>
         <property name="europa_jee_macos_gz"    value="${europa_jee_macos}.gz"/>
 
-        <property name="dtp_sdk"    value="dtp-sdk_1.5.1_101607.zip"/>
-        <property name="emf_sdo"    value="emf-sdo-xsd-SDK-2.3.1.zip"/>
-        <property name="gef_sdk"    value="GEF-SDK-3.3.1.zip"/>
+        <property name="dtp_sdk"    value="dtp-sdk_1.5.2_022008.zip"/>
+        <property name="emf_sdo"    value="emf-sdo-xsd-SDK-2.3.2.zip"/>
+        <property name="gef_sdk"    value="GEF-SDK-3.3.2.zip"/>
         <property name="wtp_sdk"    value="wtp-sdk-${wtp_drop}.zip"/>
 	<property name="testing"    value="eclipse-test-framework-3.3.1.1.zip"/>