tomee-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jgallim...@apache.org
Subject svn commit: r711945 [1/2] - in /openejb/trunk/sandbox/openejb-eclipse-plugin: common/src/main/java/org/apache/openejb/plugins/common/ common/src/test/java/org/apache/openejb/plugins/common/ plugins/org.apache.openejb.builder/src/main/java/org/apache/op...
Date Thu, 06 Nov 2008 19:03:39 GMT
Author: jgallimore
Date: Thu Nov  6 11:03:06 2008
New Revision: 711945

URL: http://svn.apache.org/viewvc?rev=711945&view=rev
Log:
OEP-9 Initial attempt to generate EJB 3 persistence code from EJB 2 entity beans

Added:
    openejb/trunk/sandbox/openejb-eclipse-plugin/common/src/main/java/org/apache/openejb/plugins/common/EntityBeanUsageConverter.java
    openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.apache.openejb.devtools.core/src/main/java/org/apache/openejb/devtools/core/BlockModifier.java
    openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.apache.openejb.devtools.core/src/main/java/org/apache/openejb/devtools/core/CompilationUnitCache.java   (contents, props changed)
      - copied, changed from r701860, openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.apache.openejb.builder/src/main/java/org/apache/openejb/builder/CompilationUnitCache.java
    openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.apache.openejb.devtools.core/src/main/java/org/apache/openejb/devtools/core/ConvertMethodInvocationToCode.java
    openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.apache.openejb.devtools.core/src/main/java/org/apache/openejb/devtools/core/ConvertMethodInvocationToConstructor.java
    openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.apache.openejb.devtools.core/src/main/java/org/apache/openejb/devtools/core/JDTUtils.java
    openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.apache.openejb.helper.annotation.test/src/main/java/org/apache/openejb/helper/annotation/tests/ConvertEjbCreateMethodToConstructorTest.java
    openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.apache.openejb.helper.annotation.test/src/main/java/org/apache/openejb/helper/annotation/tests/ConvertFinderMethodToCodeTest.java
    openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.apache.openejb.helper.annotation.test/src/main/resources/org/apache/openejb/helper/annotation/tests/Ejb21Product.txt
    openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.apache.openejb.helper.annotation.test/src/main/resources/org/apache/openejb/helper/annotation/tests/Ejb21ProductBean.txt
    openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.apache.openejb.helper.annotation.test/src/main/resources/org/apache/openejb/helper/annotation/tests/Ejb21ProductHome.txt
    openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.apache.openejb.helper.annotation.test/src/main/resources/org/apache/openejb/helper/annotation/tests/Ejb21SessionBean.txt
    openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.apache.openejb.helper.annotation.test/src/main/resources/org/apache/openejb/helper/annotation/tests/Expected30ProductBean.txt
    openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.apache.openejb.helper.annotation.test/src/main/resources/org/apache/openejb/helper/annotation/tests/ExpectedSessionBean.txt
    openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.apache.openejb.helper.annotation.test/src/main/resources/org/apache/openejb/helper/annotation/tests/ProductManagerBean21-1.txt
    openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.apache.openejb.helper.annotation.test/src/main/resources/org/apache/openejb/helper/annotation/tests/ProductManagerBean21-2.txt
    openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.apache.openejb.helper.annotation.test/src/main/resources/org/apache/openejb/helper/annotation/tests/ProductManagerBean21-3.txt
    openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.apache.openejb.helper.annotation.test/src/main/resources/org/apache/openejb/helper/annotation/tests/ProductManagerBean30-1.txt
    openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.apache.openejb.helper.annotation.test/src/main/resources/org/apache/openejb/helper/annotation/tests/ProductManagerBean30-2.txt
    openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.apache.openejb.helper.annotation.test/src/main/resources/org/apache/openejb/helper/annotation/tests/ProductManagerBean30-3.txt
Removed:
    openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.apache.openejb.builder/src/main/java/org/apache/openejb/builder/CompilationUnitCache.java
Modified:
    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/IJDTFacade.java
    openejb/trunk/sandbox/openejb-eclipse-plugin/common/src/test/java/org/apache/openejb/plugins/common/JDTFacadeStub.java
    openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.apache.openejb.builder/src/main/java/org/apache/openejb/builder/IncrementalProjectBuilder.java
    openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.apache.openejb.builder/src/main/java/org/apache/openejb/builder/SingletonDependencyFinder.java
    openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.apache.openejb.devtools.core/src/main/java/org/apache/openejb/devtools/core/JDTFacade.java
    openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.apache.openejb.helper.annotation.test/src/main/java/org/apache/openejb/helper/annotation/fixtures/ProjectFixture.java
    openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.apache.openejb.helper.annotation.test/src/main/java/org/apache/openejb/helper/annotation/tests/AddAnnotationTest.java
    openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.apache.openejb.helper.annotation.test/src/main/java/org/apache/openejb/helper/annotation/tests/AllTests.java
    openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.apache.openejb.helper.annotation.test/src/main/resources/org/apache/openejb/helper/annotation/tests/ExpectedResult1.txt
    openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.apache.openejb.helper.annotation.test/src/main/resources/org/apache/openejb/helper/annotation/tests/ExpectedResult2.txt
    openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.apache.openejb.helper.annotation.test/src/main/resources/org/apache/openejb/helper/annotation/tests/ExpectedResult3.txt
    openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.apache.openejb.helper.annotation.test/src/main/resources/org/apache/openejb/helper/annotation/tests/ExpectedResult4.txt
    openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.apache.openejb.helper.annotation.test/src/main/resources/org/apache/openejb/helper/annotation/tests/ExpectedResult5.txt
    openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.apache.openejb.helper.annotation.test/src/main/resources/org/apache/openejb/helper/annotation/tests/ExpectedResult6.txt
    openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.apache.openejb.helper.annotation.test/src/main/resources/org/apache/openejb/helper/annotation/tests/ExpectedResult7.txt
    openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.apache.openejb.helper.annotation.test/src/main/resources/org/apache/openejb/helper/annotation/tests/ExpectedResult8.txt
    openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.apache.openejb.helper.annotation.test/src/main/resources/org/apache/openejb/helper/annotation/tests/Test1.txt
    openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.apache.openejb.helper.annotation.test/src/main/resources/org/apache/openejb/helper/annotation/tests/Test2.txt
    openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.apache.openejb.helper.annotation.test/src/main/resources/org/apache/openejb/helper/annotation/tests/Test3.txt
    openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.apache.openejb.helper.annotation.test/src/main/resources/org/apache/openejb/helper/annotation/tests/Test4.txt
    openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.apache.openejb.helper.annotation.test/src/main/resources/org/apache/openejb/helper/annotation/tests/Test5.txt
    openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.apache.openejb.helper.annotation.test/src/main/resources/org/apache/openejb/helper/annotation/tests/Test6.txt
    openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.apache.openejb.helper.annotation.test/src/main/resources/org/apache/openejb/helper/annotation/tests/Test7.txt
    openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.apache.openejb.helper.annotation.test/src/main/resources/org/apache/openejb/helper/annotation/tests/Test8.txt
    openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.apache.openejb.helper.annotation/src/main/java/org/apache/openejb/helper/annotation/wizards/EJBMigrationRefactoring.java

Modified: 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=711945&r1=711944&r2=711945&view=diff
==============================================================================
--- openejb/trunk/sandbox/openejb-eclipse-plugin/common/src/main/java/org/apache/openejb/plugins/common/EjbReferencesConverter.java (original)
+++ openejb/trunk/sandbox/openejb-eclipse-plugin/common/src/main/java/org/apache/openejb/plugins/common/EjbReferencesConverter.java Thu Nov  6 11:03:06 2008
@@ -24,6 +24,7 @@
 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.SessionBean;
 
 public class EjbReferencesConverter implements Converter {
@@ -38,31 +39,32 @@
 	public void convert(AppModule module) {
 		List<EjbModule> ejbModules = module.getEjbModules();
 		for (EjbModule ejbModule : ejbModules) {
-			EjbJar ejbJar = ejbModule.getEjbJar();
+			convert(ejbModule);
+		}
+	}
 
-			EnterpriseBean[] enterpriseBeans = ejbJar.getEnterpriseBeans();
-			for (EnterpriseBean enterpriseBean : enterpriseBeans) {
-				if (! (enterpriseBean instanceof SessionBean)) {
-					continue;
+	private void convert(EjbModule ejbModule) {
+		EjbJar ejbJar = ejbModule.getEjbJar();
+		EnterpriseBean[] enterpriseBeans = ejbJar.getEnterpriseBeans();
+		for (EnterpriseBean enterpriseBean : enterpriseBeans) {
+			if (enterpriseBean instanceof EntityBean) {
+				continue;
+			}
+			
+			try {
+				SessionBean sessionBean = (SessionBean) enterpriseBean;
+				String remoteClass = sessionBean.getRemote();
+				String localClass = sessionBean.getLocal();
+				if (remoteClass != null && remoteClass.length() > 0) {
+					facade.addAnnotationToFieldsOfType(remoteClass, EJB.class, null);
 				}
-
-				try {
-					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);
-					}
-				} catch (Exception e) {
-					String warning = String.format(Messages.getString("org.apache.openejb.helper.annotation.warnings.12"), "@javax.ejb.EJB", enterpriseBean.getEjbClass());
-					facade.addWarning(warning);
+				if (localClass != null && localClass.length() > 0) {
+					facade.addAnnotationToFieldsOfType(localClass, EJB.class, null);
 				}
+			} catch (Exception e) {
+				String warning = String.format(Messages.getString("org.apache.openejb.helper.annotation.warnings.12"), "@javax.ejb.EJB", enterpriseBean.getEjbClass());
+				facade.addWarning(warning);
 			}
 		}
 	}
-
-
 }

Added: openejb/trunk/sandbox/openejb-eclipse-plugin/common/src/main/java/org/apache/openejb/plugins/common/EntityBeanUsageConverter.java
URL: http://svn.apache.org/viewvc/openejb/trunk/sandbox/openejb-eclipse-plugin/common/src/main/java/org/apache/openejb/plugins/common/EntityBeanUsageConverter.java?rev=711945&view=auto
==============================================================================
--- openejb/trunk/sandbox/openejb-eclipse-plugin/common/src/main/java/org/apache/openejb/plugins/common/EntityBeanUsageConverter.java (added)
+++ openejb/trunk/sandbox/openejb-eclipse-plugin/common/src/main/java/org/apache/openejb/plugins/common/EntityBeanUsageConverter.java Thu Nov  6 11:03:06 2008
@@ -0,0 +1,142 @@
+/*
+ * 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.Collection;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import javax.persistence.EntityManagerFactory;
+import javax.persistence.PersistenceUnit;
+
+import org.apache.openejb.config.AppModule;
+import org.apache.openejb.config.EjbModule;
+import org.apache.openejb.jee.EjbJar;
+import org.apache.openejb.jee.EjbLocalRef;
+import org.apache.openejb.jee.EjbRef;
+import org.apache.openejb.jee.EjbReference;
+import org.apache.openejb.jee.EnterpriseBean;
+import org.apache.openejb.jee.EntityBean;
+import org.apache.openejb.jee.Query;
+
+public class EntityBeanUsageConverter implements Converter {
+
+	private IJDTFacade facade;
+	
+	public EntityBeanUsageConverter(IJDTFacade facade) {
+		super();
+		this.facade = facade;
+	}
+
+	public void convert(AppModule module) {
+		List<EjbModule> ejbModules = module.getEjbModules();
+		for (EjbModule ejbModule : ejbModules) {
+			convert(ejbModule);
+		}
+	}
+
+	private void convert(EjbModule ejbModule) {
+		EjbJar ejbJar = ejbModule.getEjbJar();
+		EnterpriseBean[] enterpriseBeans = ejbJar.getEnterpriseBeans();
+		
+		for (EnterpriseBean enterpriseBean : enterpriseBeans) {
+			if (dependsOnEntityBean(ejbJar, enterpriseBean)) {
+				addEntityManagerFactoryField(enterpriseBean);
+			}
+			
+			if (! (enterpriseBean instanceof EntityBean)) {
+				continue;
+			}
+			
+			EntityBean entityBean = (EntityBean) enterpriseBean;
+			String beanClass = entityBean.getEjbClass();
+			String home = entityBean.getHome();
+			
+			
+			if (home == null || home.length() == 0) {
+				home = entityBean.getLocalHome();
+			}
+			
+			List<String[]> createSignatures = facade.getSignatures(home, "create");
+			for (String[] createSignature : createSignatures) {
+				facade.convertMethodToConstructor(beanClass, "ejbCreate", createSignature);
+				facade.changeInvocationsToConstructor(home, "create", createSignature, beanClass);
+			}
+			
+			List<Query> queries = entityBean.getQuery();
+			for (Query query : queries) {
+				String ejbQl = query.getEjbQl();
+				String methodName = query.getQueryMethod().getMethodName();
+				List<String> paramList = query.getQueryMethod().getMethodParams().getMethodParam();
+				String[] signature = paramList.toArray(new String[paramList.size()]);
+				
+				String returnType = facade.getMethodReturnType(home, methodName, signature);
+				StringBuffer code = new StringBuffer();
+				code.append("javax.persistence.EntityManager entityManager = entityManagerFactory.createEntityManager();\r\n");
+				code.append("javax.persistence.Query query = entityManager.createQuery(\"");
+				code.append(ejbQl);
+				code.append("\");\r\n");
+				
+				// add a cast for the return
+//				code.append("(");
+//				code.append(returnType);
+//				code.append(") (");
+				
+				if (facade.isTypeCollection(returnType)) {
+					code.append("query.getResultList()");
+				} else {
+					code.append("query.getSingleResult()");
+				}
+				
+				code.append(";\r\n");
+				facade.changeInvocationsTo(home, methodName, signature, code.toString());
+			}
+		}
+	}
+	
+	private boolean dependsOnEntityBean(EjbJar ejbJar, EnterpriseBean enterpriseBean) {
+		Collection<EjbRef> ejbRefs = enterpriseBean.getEjbRef();
+		for (EjbReference ejbRef : ejbRefs) {
+			String ejbLink = ejbRef.getEjbLink();
+			
+			EnterpriseBean refBean = ejbJar.getEnterpriseBean(ejbLink);
+			if (refBean != null && refBean instanceof EntityBean) {
+				return true;
+			}
+		}
+
+		Collection<EjbLocalRef> ejbLocalRefs = enterpriseBean.getEjbLocalRef();
+		for (EjbReference ejbRef : ejbLocalRefs) {
+			String ejbLink = ejbRef.getEjbLink();
+			
+			EnterpriseBean refBean = ejbJar.getEnterpriseBean(ejbLink);
+			if (refBean != null && refBean instanceof EntityBean) {
+				return true;
+			}
+		}
+		
+		return false;
+	}
+	
+	private void addEntityManagerFactoryField(EnterpriseBean enterpriseBean) {
+		facade.addField(enterpriseBean.getEjbClass(), "emf", EntityManagerFactory.class.getName());
+		Map<String, Object> properties = new HashMap<String, Object>();
+		properties.put("name", "OpenEJBPU");
+		facade.addFieldAnnotation(enterpriseBean.getEjbClass(), "emf", PersistenceUnit.class, properties);
+	}
+}

Modified: 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=711945&r1=711944&r2=711945&view=diff
==============================================================================
--- openejb/trunk/sandbox/openejb-eclipse-plugin/common/src/main/java/org/apache/openejb/plugins/common/IJDTFacade.java (original)
+++ openejb/trunk/sandbox/openejb-eclipse-plugin/common/src/main/java/org/apache/openejb/plugins/common/IJDTFacade.java Thu Nov  6 11:03:06 2008
@@ -18,6 +18,7 @@
 package org.apache.openejb.plugins.common;
 
 import java.lang.annotation.Annotation;
+import java.util.List;
 import java.util.Map;
 
 public interface IJDTFacade {
@@ -34,4 +35,11 @@
 	void addAnnotationToFieldsOfType(String targetClass, Class<?> annotation, Map<String, Object> properties);
 	void addInterface(String ejbClass, String interfaceClass);
 	void addWarning(String warning);
+	public void convertMethodToConstructor(String className, String methodName, String[] signature);
+	public void changeInvocationsToConstructor(String fromClass, final String fromMethodName, String[] fromSignature, final String toClass);
+	public void changeInvocationsTo(String fromClass, final String fromMethodName, String[] fromSignature, final String code);
+	public List<String[]> getSignatures(String type, String methodName);
+	public void addCodeToStartOfMethod(String className, String methodName, String[] signature, String code);
+	public void addCodeToEndOfMethod(String className, String methodName, String[] signature, String code);
+	boolean isTypeCollection(String returnType);
 }

Modified: openejb/trunk/sandbox/openejb-eclipse-plugin/common/src/test/java/org/apache/openejb/plugins/common/JDTFacadeStub.java
URL: http://svn.apache.org/viewvc/openejb/trunk/sandbox/openejb-eclipse-plugin/common/src/test/java/org/apache/openejb/plugins/common/JDTFacadeStub.java?rev=711945&r1=711944&r2=711945&view=diff
==============================================================================
--- openejb/trunk/sandbox/openejb-eclipse-plugin/common/src/test/java/org/apache/openejb/plugins/common/JDTFacadeStub.java (original)
+++ openejb/trunk/sandbox/openejb-eclipse-plugin/common/src/test/java/org/apache/openejb/plugins/common/JDTFacadeStub.java Thu Nov  6 11:03:06 2008
@@ -2,6 +2,7 @@
 
 import java.lang.annotation.Annotation;
 import java.util.Iterator;
+import java.util.List;
 import java.util.Map;
 
 public class JDTFacadeStub implements IJDTFacade {
@@ -156,4 +157,33 @@
 
 	}
 
+	public void convertMethodToConstructor(String className, String methodName, String[] signature) {
+	}
+
+	public void changeInvocationsToConstructor(String fromClass, final String fromMethodName, String[] fromSignature, final String toClass) {
+	}
+
+	public List<String[]> getSignatures(String type, String methodName) {
+		return null;
+	}
+
+	public void changeInvocationsTo(String fromClass, String fromMethodName, String[] fromSignature, String code) {
+		throw new UnsupportedOperationException();
+	}
+
+	public void addCodeToEndOfMethod(String className, String methodName, String[] signature, String code) {
+		// TODO Auto-generated method stub
+		
+	}
+
+	public void addCodeToStartOfMethod(String className, String methodName, String[] signature, String code) {
+		// TODO Auto-generated method stub
+		
+	}
+
+	public boolean isTypeCollection(String returnType) {
+		// TODO Auto-generated method stub
+		return false;
+	}
+
 }

Modified: openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.apache.openejb.builder/src/main/java/org/apache/openejb/builder/IncrementalProjectBuilder.java
URL: http://svn.apache.org/viewvc/openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.apache.openejb.builder/src/main/java/org/apache/openejb/builder/IncrementalProjectBuilder.java?rev=711945&r1=711944&r2=711945&view=diff
==============================================================================
--- openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.apache.openejb.builder/src/main/java/org/apache/openejb/builder/IncrementalProjectBuilder.java (original)
+++ openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.apache.openejb.builder/src/main/java/org/apache/openejb/builder/IncrementalProjectBuilder.java Thu Nov  6 11:03:06 2008
@@ -22,6 +22,7 @@
 import java.util.List;
 import java.util.Map;
 
+import org.apache.openejb.devtools.core.CompilationUnitCache;
 import org.eclipse.core.resources.IMarker;
 import org.eclipse.core.resources.IProject;
 import org.eclipse.core.resources.IResource;
@@ -48,7 +49,7 @@
 	protected IProject[] build(int kind, Map args, IProgressMonitor monitor) throws CoreException {
 		getProject().deleteMarkers("org.apache.openejb.builder.dependsonMarker", true, IResource.DEPTH_INFINITE);
 		
-		CompilationUnitCache cache = new CompilationUnitCache();
+		CompilationUnitCache cache = new CompilationUnitCache(JavaCore.create(getProject()));
 		try {
 			SingletonDependencyFinder finder = new SingletonDependencyFinder(getProject());
 			finder.findDependencies();

Modified: openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.apache.openejb.builder/src/main/java/org/apache/openejb/builder/SingletonDependencyFinder.java
URL: http://svn.apache.org/viewvc/openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.apache.openejb.builder/src/main/java/org/apache/openejb/builder/SingletonDependencyFinder.java?rev=711945&r1=711944&r2=711945&view=diff
==============================================================================
--- openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.apache.openejb.builder/src/main/java/org/apache/openejb/builder/SingletonDependencyFinder.java (original)
+++ openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.apache.openejb.builder/src/main/java/org/apache/openejb/builder/SingletonDependencyFinder.java Thu Nov  6 11:03:06 2008
@@ -25,6 +25,7 @@
 import java.util.Map;
 import java.util.Set;
 
+import org.apache.openejb.devtools.core.CompilationUnitCache;
 import org.eclipse.core.resources.IProject;
 import org.eclipse.core.runtime.CoreException;
 import org.eclipse.core.runtime.PlatformObject;
@@ -74,7 +75,7 @@
 	protected Map<String, String[]> singletons = new HashMap<String, String[]>();
 	protected Map<String, Dependency[]> dependencies = new HashMap<String, Dependency[]>();
 	private IJavaProject javaProject;
-	private CompilationUnitCache compilationUnitCache = new CompilationUnitCache();
+	private CompilationUnitCache compilationUnitCache = new CompilationUnitCache(javaProject);
 
 	public void findDependencies() throws SingletonDependencyFinderException {
 		findSingletonsAndInterfaces();

Added: openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.apache.openejb.devtools.core/src/main/java/org/apache/openejb/devtools/core/BlockModifier.java
URL: http://svn.apache.org/viewvc/openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.apache.openejb.devtools.core/src/main/java/org/apache/openejb/devtools/core/BlockModifier.java?rev=711945&view=auto
==============================================================================
--- openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.apache.openejb.devtools.core/src/main/java/org/apache/openejb/devtools/core/BlockModifier.java (added)
+++ openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.apache.openejb.devtools.core/src/main/java/org/apache/openejb/devtools/core/BlockModifier.java Thu Nov  6 11:03:06 2008
@@ -0,0 +1,26 @@
+/*
+ * 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.devtools.core;
+
+import org.eclipse.jdt.core.dom.Block;
+
+public interface BlockModifier {
+
+	void modify(Block block);
+
+}

Copied: openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.apache.openejb.devtools.core/src/main/java/org/apache/openejb/devtools/core/CompilationUnitCache.java (from r701860, openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.apache.openejb.builder/src/main/java/org/apache/openejb/builder/CompilationUnitCache.java)
URL: http://svn.apache.org/viewvc/openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.apache.openejb.devtools.core/src/main/java/org/apache/openejb/devtools/core/CompilationUnitCache.java?p2=openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.apache.openejb.devtools.core/src/main/java/org/apache/openejb/devtools/core/CompilationUnitCache.java&p1=openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.apache.openejb.builder/src/main/java/org/apache/openejb/builder/CompilationUnitCache.java&r1=701860&r2=711945&rev=711945&view=diff
==============================================================================
--- openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.apache.openejb.builder/src/main/java/org/apache/openejb/builder/CompilationUnitCache.java (original)
+++ openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.apache.openejb.devtools.core/src/main/java/org/apache/openejb/devtools/core/CompilationUnitCache.java Thu Nov  6 11:03:06 2008
@@ -15,25 +15,50 @@
  * limitations under the License.
  */
 
-package org.apache.openejb.builder;
+package org.apache.openejb.devtools.core;
 
+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 org.eclipse.core.filebuffers.FileBuffers;
+import org.eclipse.core.filebuffers.ITextFileBuffer;
+import org.eclipse.core.filebuffers.ITextFileBufferManager;
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IPath;
 import org.eclipse.jdt.core.ICompilationUnit;
+import org.eclipse.jdt.core.IJavaProject;
 import org.eclipse.jdt.core.IMethod;
 import org.eclipse.jdt.core.IType;
+import org.eclipse.jdt.core.JavaModelException;
 import org.eclipse.jdt.core.dom.AST;
 import org.eclipse.jdt.core.dom.ASTParser;
 import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jdt.core.dom.ITypeBinding;
 import org.eclipse.jdt.core.dom.MethodDeclaration;
+import org.eclipse.jdt.core.dom.SingleVariableDeclaration;
+import org.eclipse.jdt.core.dom.Type;
 import org.eclipse.jdt.core.dom.TypeDeclaration;
+import org.eclipse.jface.text.IDocument;
+import org.eclipse.ltk.core.refactoring.Change;
+import org.eclipse.ltk.core.refactoring.CompositeChange;
+import org.eclipse.ltk.core.refactoring.TextFileChange;
+import org.eclipse.text.edits.TextEdit;
 
 public class CompilationUnitCache {
 
 	Map<ICompilationUnit, CompilationUnit> cache = new HashMap<ICompilationUnit, CompilationUnit>();
+	private IJavaProject javaProject;
 	
+	public CompilationUnitCache(IJavaProject javaProject) {
+		super();
+		this.javaProject = javaProject;
+	}
+
 	public CompilationUnit getCompilationUnit(ICompilationUnit compilationUnit) {
 		if (cache.containsKey(compilationUnit)) {
 			return cache.get(compilationUnit);
@@ -44,6 +69,7 @@
 		parser.setSource(compilationUnit);
 		parser.setResolveBindings(true);
 		CompilationUnit cu = (CompilationUnit) parser.createAST(null);
+		cu.recordModifications();
 		
 		cache.put(compilationUnit, cu);
 		return cu;
@@ -82,4 +108,119 @@
 		return null;
 	}
 
+	public CompilationUnit getCompilationUnit(String cls) {
+		try {
+			IType type = javaProject.findType(cls);
+			ICompilationUnit compilationUnit = type.getCompilationUnit();
+
+			return getCompilationUnit(compilationUnit);
+		} catch (JavaModelException e) {
+		}
+		
+		return null;
+	}
+
+	public Change getChange() {
+		CompositeChange compositeChange = new CompositeChange(Messages.getString("org.apache.openejb.helper.annotation.compositChangeString")); //$NON-NLS-1$
+
+		Iterator<CompilationUnit> iterator = cache.values().iterator();
+		while (iterator.hasNext()) {
+			try {
+				CompilationUnit cu = iterator.next();
+				ITextFileBufferManager bufferManager = FileBuffers.getTextFileBufferManager();
+				IPath path = cu.getJavaElement().getPath();
+				bufferManager.connect(path, null);
+
+				ITextFileBuffer textFileBuffer = bufferManager.getTextFileBuffer(path);
+				IDocument document = textFileBuffer.getDocument();
+
+				TextEdit edit = cu.rewrite(document, javaProject.getOptions(true));
+				TextFileChange dc = new TextFileChange(path.toString(), (IFile) cu.getJavaElement().getResource());
+				dc.setTextType("java"); //$NON-NLS-1$
+				dc.setEdit(edit);
+				dc.setSaveMode(TextFileChange.FORCE_SAVE);
+
+				compositeChange.add(dc);
+			} catch (CoreException e) {
+			}
+		}
+
+		return compositeChange;
+	}
+
+	public TypeDeclaration getTypeDeclaration(String targetClass) {
+		try {
+			IType type = javaProject.findType(targetClass);
+			return getTypeDeclaration(type);
+		} catch (JavaModelException e) {
+		}
+		
+		return null;
+	}
+
+	public MethodDeclaration getMethodDeclaration(String fullyQualifiedClassName, String methodName, String[] signature) {
+		TypeDeclaration typeDeclaration = getTypeDeclaration(fullyQualifiedClassName);
+		
+		MethodDeclaration m = null;
+
+		MethodDeclaration[] methods = typeDeclaration.getMethods();
+		Iterator<MethodDeclaration> iterator = Arrays.asList(methods).iterator();
+		while (iterator.hasNext()) {
+			MethodDeclaration method = iterator.next();
+
+			if (method.getName().toString().equals(methodName) && (signature == null || signatureMatches(method, signature))) {
+				m = method;
+			}
+		}
+		return m;
+	}
+	
+	private boolean signatureMatches(MethodDeclaration method, String[] signature) {
+		if (signature.length != method.parameters().size()) {
+			return false;
+		}
+
+		for (int i = 0; i < signature.length; i++) {
+			SingleVariableDeclaration var = (SingleVariableDeclaration) method.parameters().get(i);
+			Type type = var.getType();
+
+			ITypeBinding typeBinding = type.resolveBinding();
+
+			if (!(typeBinding.getQualifiedName().toString().equals(signature[i]))) {
+				return false;
+			}
+		}
+
+		return true;
+	}
+
+	public List<String[]> getSignatures(String type, String methodName) {
+		List<String[]> result = new ArrayList<String[]>();
+		
+		TypeDeclaration typeDeclaration = getTypeDeclaration(type);
+		MethodDeclaration[] methods = typeDeclaration.getMethods();
+		for (MethodDeclaration methodDeclaration : methods) {
+			if (methodDeclaration.getName().toString().equals(methodName)) {
+				String[] signature = getSignature(methodDeclaration);
+				result.add(signature);
+			}
+		}
+		
+		return result;
+	}
+
+	private String[] getSignature(MethodDeclaration methodDeclaration) {
+		List<String> params = new ArrayList<String>();
+		
+		for (int i = 0; i < methodDeclaration.parameters().size(); i++) {
+			SingleVariableDeclaration var = (SingleVariableDeclaration) methodDeclaration.parameters().get(i);
+			Type type = var.getType();
+
+			ITypeBinding typeBinding = type.resolveBinding();
+			String param = typeBinding.getQualifiedName().toString();
+			params.add(param);
+		}
+		
+		return params.toArray(new String[params.size()]);
+	}
 }

Propchange: openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.apache.openejb.devtools.core/src/main/java/org/apache/openejb/devtools/core/CompilationUnitCache.java
------------------------------------------------------------------------------
    svn:mergeinfo = 

Added: openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.apache.openejb.devtools.core/src/main/java/org/apache/openejb/devtools/core/ConvertMethodInvocationToCode.java
URL: http://svn.apache.org/viewvc/openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.apache.openejb.devtools.core/src/main/java/org/apache/openejb/devtools/core/ConvertMethodInvocationToCode.java?rev=711945&view=auto
==============================================================================
--- openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.apache.openejb.devtools.core/src/main/java/org/apache/openejb/devtools/core/ConvertMethodInvocationToCode.java (added)
+++ openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.apache.openejb.devtools.core/src/main/java/org/apache/openejb/devtools/core/ConvertMethodInvocationToCode.java Thu Nov  6 11:03:06 2008
@@ -0,0 +1,143 @@
+/*
+ * 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.devtools.core;
+
+import java.lang.reflect.Field;
+import java.lang.reflect.Method;
+import java.util.List;
+
+import org.eclipse.jdt.core.IMethod;
+import org.eclipse.jdt.core.JavaModelException;
+import org.eclipse.jdt.core.dom.ASTNode;
+import org.eclipse.jdt.core.dom.ASTVisitor;
+import org.eclipse.jdt.core.dom.Block;
+import org.eclipse.jdt.core.dom.Expression;
+import org.eclipse.jdt.core.dom.ExpressionStatement;
+import org.eclipse.jdt.core.dom.MethodInvocation;
+import org.eclipse.jdt.core.dom.Statement;
+import org.eclipse.jdt.core.dom.VariableDeclarationFragment;
+
+public class ConvertMethodInvocationToCode implements BlockModifier {
+
+	private final IMethod fromMethod;
+	private final String code;
+	public ConvertMethodInvocationToCode(IMethod fromMethod, String code) {
+		this.fromMethod = fromMethod;
+		this.code = code;
+	}
+
+	private Block parseCode(String code) {
+		return JDTUtils.parseBlock(code);
+	}
+
+	public void modify(Block block) {
+		block.accept(new ASTVisitor() {
+
+			@SuppressWarnings("unchecked")
+			@Override
+			public boolean visit(MethodInvocation node) {
+					IMethod invokedMethod = (IMethod) node.resolveMethodBinding().getJavaElement();
+					
+					try {
+						if (invokedMethod.getElementName().equals(fromMethod.getElementName())
+							&& invokedMethod.getSignature().equals(fromMethod.getSignature())){
+
+							Block newBlock = parseCode(code);
+							
+							ASTNode target = node.getParent();
+							
+							if (target instanceof VariableDeclarationFragment) {
+								target = (Statement) target.getParent();
+							}
+							
+							Block block = getBlock(target);
+							
+							int index = 0;
+							
+							for (int i = 0; i < block.statements().size(); i++) {
+								if (block.statements().get(i).equals(target)) {
+									index = i;
+									break;
+								}
+							}
+							
+							List statements = ASTNode.copySubtrees(node.getAST(), newBlock.statements());
+							
+							for (int i = statements.size() - 1; i >= 0; i--) {
+								block.statements().add(index, statements.get(i));
+							}
+							
+							int expressionIndex = index + statements.size() - 1;
+							boolean assignmentAdded = false;
+							
+							if (node.getParent() instanceof VariableDeclarationFragment) {
+								Statement expressionStatement = (Statement) block.statements().get(expressionIndex);
+								
+								if (expressionStatement instanceof ExpressionStatement) {
+									VariableDeclarationFragment vdf = (VariableDeclarationFragment) node.getParent();
+									Expression expression = (Expression) ASTNode.copySubtree(node.getAST(), ((ExpressionStatement) expressionStatement).getExpression());
+									vdf.setInitializer(expression);
+									block.statements().remove(expressionIndex);
+									assignmentAdded = true;
+								}
+							} 
+							
+							if (! assignmentAdded) {
+								block.statements().remove(expressionIndex + 1);
+							}
+						}
+					} catch (JavaModelException e) {
+						e.printStackTrace();
+					}
+
+				return true;
+			}
+
+			@SuppressWarnings("unchecked")
+			private Block getBlock(ASTNode target) {
+				ASTNode parent = target.getParent();
+				if (parent instanceof Block) {
+					return (Block) parent;
+				}
+				
+				Block newBlock = target.getAST().newBlock();
+				newBlock.statements().add(ASTNode.copySubtree(target.getAST(), target));
+				Field[] declaredFields = parent.getClass().getDeclaredFields();
+				for (Field field : declaredFields) {
+					if (!(field.getType().isAssignableFrom(Statement.class))) {
+						continue;
+					}
+					
+					try {
+						field.setAccessible(true);
+						if (field.get(parent).equals(target)) {
+							String setterName = "set" + field.getName().substring(0, 1).toUpperCase() + field.getName().substring(1);
+							Method setter = parent.getClass().getDeclaredMethod(setterName, field.getType());
+							if (setter != null) {
+								setter.invoke(parent, newBlock);
+							}
+						}
+					} catch (Exception e) {
+					}
+				}
+				
+				return newBlock;
+			}
+		});
+	}
+}

Added: openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.apache.openejb.devtools.core/src/main/java/org/apache/openejb/devtools/core/ConvertMethodInvocationToConstructor.java
URL: http://svn.apache.org/viewvc/openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.apache.openejb.devtools.core/src/main/java/org/apache/openejb/devtools/core/ConvertMethodInvocationToConstructor.java?rev=711945&view=auto
==============================================================================
--- openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.apache.openejb.devtools.core/src/main/java/org/apache/openejb/devtools/core/ConvertMethodInvocationToConstructor.java (added)
+++ openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.apache.openejb.devtools.core/src/main/java/org/apache/openejb/devtools/core/ConvertMethodInvocationToConstructor.java Thu Nov  6 11:03:06 2008
@@ -0,0 +1,87 @@
+/*
+ * 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.devtools.core;
+
+import java.util.List;
+
+import org.eclipse.jdt.core.IMethod;
+import org.eclipse.jdt.core.JavaModelException;
+import org.eclipse.jdt.core.dom.ASTNode;
+import org.eclipse.jdt.core.dom.ASTVisitor;
+import org.eclipse.jdt.core.dom.Block;
+import org.eclipse.jdt.core.dom.ClassInstanceCreation;
+import org.eclipse.jdt.core.dom.MethodInvocation;
+import org.eclipse.jdt.core.dom.Type;
+import org.eclipse.jdt.core.dom.VariableDeclarationFragment;
+import org.eclipse.jdt.core.dom.VariableDeclarationStatement;
+
+public final class ConvertMethodInvocationToConstructor implements BlockModifier {
+	private final String toClass;
+	private final IMethod fromMethod;
+
+	public ConvertMethodInvocationToConstructor(IMethod fromMethod, String toClass) {
+		this.toClass = toClass;
+		this.fromMethod = fromMethod;
+	}
+
+	public void modify(Block block) {
+		block.accept(new ASTVisitor() {
+
+			@SuppressWarnings("unchecked")
+			@Override
+			public boolean visit(MethodInvocation node) {
+					IMethod invokedMethod = (IMethod) node.resolveMethodBinding().getJavaElement();
+					
+					try {
+						if (invokedMethod.getElementName().equals(fromMethod.getElementName())
+							&& invokedMethod.getSignature().equals(fromMethod.getSignature())){
+
+							ASTNode varDeclarationStmt = node.getParent().getParent();
+							if (varDeclarationStmt instanceof VariableDeclarationStatement) {
+								VariableDeclarationStatement vds = (VariableDeclarationStatement) varDeclarationStmt;
+								
+								// change the type
+								Type returnType = JDTUtils.createQualifiedType(vds.getAST(), toClass);
+								vds.setType(returnType);
+							}
+							
+							ASTNode varDeclarationFragment = node.getParent();
+							if (varDeclarationFragment instanceof VariableDeclarationFragment) {
+								VariableDeclarationFragment vdf = (VariableDeclarationFragment) varDeclarationFragment;
+								
+								ClassInstanceCreation newClassInstanceCreation = vdf.getAST().newClassInstanceCreation();
+								Type newType = JDTUtils.createQualifiedType(vdf.getAST(), toClass);
+								newClassInstanceCreation.setType(newType);
+								List arguments = newClassInstanceCreation.arguments();
+								arguments.clear();
+								
+								MethodInvocation initializer = (MethodInvocation) vdf.getInitializer();
+								List newArguments = ASTNode.copySubtrees(newClassInstanceCreation.getAST(), initializer.arguments());
+								arguments.addAll(newArguments);
+									
+								vdf.setInitializer(newClassInstanceCreation);
+							}
+						}
+					} catch (JavaModelException e) {
+						e.printStackTrace();
+					}
+
+				return true;
+			}
+		});
+	}
+}

Modified: openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.apache.openejb.devtools.core/src/main/java/org/apache/openejb/devtools/core/JDTFacade.java
URL: http://svn.apache.org/viewvc/openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.apache.openejb.devtools.core/src/main/java/org/apache/openejb/devtools/core/JDTFacade.java?rev=711945&r1=711944&r2=711945&view=diff
==============================================================================
--- openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.apache.openejb.devtools.core/src/main/java/org/apache/openejb/devtools/core/JDTFacade.java (original)
+++ openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.apache.openejb.devtools.core/src/main/java/org/apache/openejb/devtools/core/JDTFacade.java Thu Nov  6 11:03:06 2008
@@ -26,23 +26,17 @@
 import java.util.Map;
 
 import org.apache.openejb.plugins.common.IJDTFacade;
-import org.eclipse.core.filebuffers.FileBuffers;
-import org.eclipse.core.filebuffers.ITextFileBuffer;
-import org.eclipse.core.filebuffers.ITextFileBufferManager;
-import org.eclipse.core.resources.IFile;
 import org.eclipse.core.resources.IProject;
 import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IPath;
 import org.eclipse.core.runtime.PlatformObject;
-import org.eclipse.jdt.core.ICompilationUnit;
 import org.eclipse.jdt.core.IJavaElement;
 import org.eclipse.jdt.core.IJavaProject;
+import org.eclipse.jdt.core.IMethod;
 import org.eclipse.jdt.core.IType;
 import org.eclipse.jdt.core.JavaCore;
 import org.eclipse.jdt.core.JavaModelException;
 import org.eclipse.jdt.core.dom.AST;
 import org.eclipse.jdt.core.dom.ASTNode;
-import org.eclipse.jdt.core.dom.ASTParser;
 import org.eclipse.jdt.core.dom.Annotation;
 import org.eclipse.jdt.core.dom.ArrayInitializer;
 import org.eclipse.jdt.core.dom.Block;
@@ -51,7 +45,6 @@
 import org.eclipse.jdt.core.dom.Expression;
 import org.eclipse.jdt.core.dom.FieldDeclaration;
 import org.eclipse.jdt.core.dom.IExtendedModifier;
-import org.eclipse.jdt.core.dom.ITypeBinding;
 import org.eclipse.jdt.core.dom.ImportDeclaration;
 import org.eclipse.jdt.core.dom.MemberValuePair;
 import org.eclipse.jdt.core.dom.MethodDeclaration;
@@ -69,25 +62,22 @@
 import org.eclipse.jdt.core.dom.Modifier.ModifierKeyword;
 import org.eclipse.jdt.core.search.IJavaSearchConstants;
 import org.eclipse.jdt.core.search.IJavaSearchScope;
+import org.eclipse.jdt.core.search.MethodReferenceMatch;
 import org.eclipse.jdt.core.search.SearchEngine;
 import org.eclipse.jdt.core.search.SearchMatch;
 import org.eclipse.jdt.core.search.SearchParticipant;
 import org.eclipse.jdt.core.search.SearchPattern;
 import org.eclipse.jdt.core.search.SearchRequestor;
-import org.eclipse.jface.text.IDocument;
 import org.eclipse.ltk.core.refactoring.Change;
-import org.eclipse.ltk.core.refactoring.CompositeChange;
-import org.eclipse.ltk.core.refactoring.TextFileChange;
-import org.eclipse.text.edits.TextEdit;
 
 /**
  * Add annotations to source files in an Eclipse Java project
  * 
  */
-@SuppressWarnings("unchecked") //$NON-NLS-1$
+@SuppressWarnings("unchecked")//$NON-NLS-1$
 public class JDTFacade implements IJDTFacade {
 
-	private class BasicSearchRequestor extends SearchRequestor {
+	public class BasicSearchRequestor extends SearchRequestor {
 		private List<SearchMatch> matches = new ArrayList<SearchMatch>();
 
 		@Override
@@ -103,51 +93,24 @@
 	protected IJavaProject javaProject;
 	protected Map<String, CompilationUnit> cuMap = new HashMap<String, CompilationUnit>();
 	protected List<String> warnings = new ArrayList<String>();
+	public CompilationUnitCache compilationUnitCache;
 
 	/**
 	 * Creates a new annotation facade
 	 * 
-	 * @param project
-	 *            Eclipse project to work on
+	 * @param project Eclipse project to work on
 	 */
 	public JDTFacade(IProject project) {
 		this.javaProject = JavaCore.create(project);
-	}
-
-	/**
-	 * Gets the compilation unit for the specified class If this compilation
-	 * unit hasn't already been requested, it will be parsed, and the resulting
-	 * compilation unit will be cached.
-	 * 
-	 * @param cls
-	 *            Class to search for
-	 * @return Compilation unit containing specified class
-	 * @throws JavaModelException
-	 */
-	protected CompilationUnit getCompilationUnit(String cls) throws JavaModelException {
-		IType type = javaProject.findType(cls);
-		ICompilationUnit compilationUnit = type.getCompilationUnit();
-
-		String path = compilationUnit.getPath().toString();
-
-		if (cuMap.keySet().contains(path)) {
-			return cuMap.get(path);
-		}
-
-		CompilationUnit cu = parse(compilationUnit);
-		cuMap.put(path, cu);
-
-		return cu;
+		compilationUnitCache = new CompilationUnitCache(javaProject);
 	}
 
 	/**
 	 * Adds a class to the list of imports for a compilation unit. This method
 	 * will check to see if the class has already been imported
 	 * 
-	 * @param classToImport
-	 *            The fully qualified name of the class to import
-	 * @param compilationUnit
-	 *            The compilation unit to add the import to
+	 * @param classToImport The fully qualified name of the class to import
+	 * @param compilationUnit The compilation unit to add the import to
 	 */
 	void addImportToCompilationUnit(String classToImport, CompilationUnit compilationUnit) {
 		if (!isClassImported(classToImport, compilationUnit)) {
@@ -179,31 +142,12 @@
 		return name;
 	}
 
-	private Type createQualifiedType(AST ast, String targetClass) {
-		String[] parts = targetClass.split("\\."); //$NON-NLS-1$
-
-		Type type = null;
-
-		for (int i = 0; i < parts.length; i++) {
-			SimpleName name = ast.newSimpleName(parts[i]);
-			if (i == 0) {
-				type = ast.newSimpleType(name);
-			} else {
-				type = ast.newQualifiedType(type, name);
-			}
-		}
-
-		return type;
-	}
-
 	/**
 	 * Determines whether the specified class has been imported in the
 	 * compilation unit
 	 * 
-	 * @param importedClass
-	 *            The imported (or not) class
-	 * @param compilationUnit
-	 *            The compilation unit to check
+	 * @param importedClass The imported (or not) class
+	 * @param compilationUnit The compilation unit to check
 	 * @return Whether of not the class has been imported
 	 */
 	private boolean isClassImported(String importedClass, CompilationUnit compilationUnit) {
@@ -221,34 +165,6 @@
 		return false;
 	}
 
-	/**
-	 * Parses the specified compilation unit to obtain an AST
-	 * 
-	 * @param compilationUnit
-	 *            The compilation unit to parse
-	 * @return The parsed compilation unit AST object
-	 */
-	CompilationUnit parse(ICompilationUnit compilationUnit) {
-		ASTParser parser = ASTParser.newParser(AST.JLS3);
-		parser.setKind(ASTParser.K_COMPILATION_UNIT);
-		parser.setSource(compilationUnit);
-		parser.setResolveBindings(true);
-		CompilationUnit cu = (CompilationUnit) parser.createAST(null);
-
-		cu.recordModifications();
-		return cu;
-	}
-
-	private Block parseBlock(String block) {
-		ASTParser parser = ASTParser.newParser(AST.JLS3);
-		parser.setKind(ASTParser.K_STATEMENTS);
-		parser.setSource(block.toCharArray());
-		parser.setResolveBindings(true);
-
-		Block val = (Block) parser.createAST(null);
-		return val;
-	}
-
 	/*
 	 * (non-Javadoc)
 	 * 
@@ -257,8 +173,8 @@
 	 */
 	public void addClassAnnotation(String targetClass, Class<? extends java.lang.annotation.Annotation> annotation, Map<String, Object> properties) {
 		try {
-			CompilationUnit cu = getCompilationUnit(targetClass);
-			BodyDeclaration typeDeclaration = getTypeDeclaration(cu, targetClass);
+			CompilationUnit cu = compilationUnitCache.getCompilationUnit(targetClass);
+			BodyDeclaration typeDeclaration = compilationUnitCache.getTypeDeclaration(targetClass);
 
 			if (isAnnotationAlreadyUsedOnDeclaration(annotation, typeDeclaration)) {
 				warnings.add(String.format(Messages.getString("org.apache.openejb.helper.annotation.warnings.1"), annotation.getCanonicalName(), targetClass)); //$NON-NLS-1$
@@ -289,40 +205,13 @@
 	}
 
 	/**
-	 * Finds the type declaration for the specified class in a compilation unit
-	 * 
-	 * @param compilationUnit
-	 *            Compilation unit to search
-	 * @param targetClass
-	 *            Type to find
-	 * @return
-	 * @throws CoreException
-	 */
-	protected TypeDeclaration getTypeDeclaration(CompilationUnit compilationUnit, String targetClass) throws CoreException {
-		IType type = javaProject.findType(targetClass);
-
-		TypeDeclaration[] typeDeclarations = (TypeDeclaration[]) compilationUnit.types().toArray(new TypeDeclaration[0]);
-		for (TypeDeclaration typeDeclaration : typeDeclarations) {
-			if (typeDeclaration.getName().toString().equals(type.getElementName())) {
-				return typeDeclaration;
-			}
-		}
-
-		return null;
-	}
-
-	/**
 	 * Creates a new annotation object to be added to the AST, with the
 	 * specified properties
 	 * 
-	 * @param ast
-	 *            The AST to create the annotation for
-	 * @param annotation
-	 *            The type of annotation to create
-	 * @param properties
-	 *            The properties for the annotation to add
-	 * @param cu
-	 *            Compilation Unit
+	 * @param ast The AST to create the annotation for
+	 * @param annotation The type of annotation to create
+	 * @param properties The properties for the annotation to add
+	 * @param cu Compilation Unit
 	 * @return The created annotation AST object
 	 * @throws JavaModelException
 	 */
@@ -432,10 +321,8 @@
 
 	public void addMethodAnnotation(String fullyQualifiedClassName, String methodName, String[] signature, Class<?> annotationClass, Map<String, Object> properties) {
 		try {
-			CompilationUnit cu = getCompilationUnit(fullyQualifiedClassName);
-			TypeDeclaration typeDeclaration = getTypeDeclaration(cu, fullyQualifiedClassName);
-
-			MethodDeclaration method = getMethodDeclaration(typeDeclaration, methodName, signature);
+			CompilationUnit cu = compilationUnitCache.getCompilationUnit(fullyQualifiedClassName);
+			MethodDeclaration method = compilationUnitCache.getMethodDeclaration(fullyQualifiedClassName, methodName, signature);
 			if (method == null) {
 				return;
 			}
@@ -449,45 +336,24 @@
 	}
 
 	private MethodDeclaration getMethodDeclaration(TypeDeclaration typeDeclaration, String methodName, String[] signature) {
-		MethodDeclaration m = null;
-
-		MethodDeclaration[] methods = typeDeclaration.getMethods();
-		Iterator<MethodDeclaration> iterator = Arrays.asList(methods).iterator();
-		while (iterator.hasNext()) {
-			MethodDeclaration method = iterator.next();
+		try {
+			IType type = javaProject.findType(typeDeclaration.resolveBinding().getQualifiedName());
+			IMethod method = type.getMethod(methodName, signature);
 
-			if (method.getName().toString().equals(methodName) && (signature == null || signatureMatches(method, signature))) {
-				m = method;
-			}
+			return compilationUnitCache.getMethodDeclaration(method);
+		} catch (JavaModelException e) {
 		}
-		return m;
+		
+		return null;
 	}
 
-	private boolean signatureMatches(MethodDeclaration method, String[] signature) {
-
-		if (signature.length != method.parameters().size()) {
-			return false;
-		}
-
-		for (int i = 0; i < signature.length; i++) {
-			SingleVariableDeclaration var = (SingleVariableDeclaration) method.parameters().get(i);
-			Type type = var.getType();
-
-			ITypeBinding typeBinding = type.resolveBinding();
-
-			if (!(typeBinding.getQualifiedName().toString().equals(signature[i]))) {
-				return false;
-			}
-		}
-
-		return true;
-	}
+	
 
 	public void addFieldAnnotation(String targetClass, String targetField, Class<?> annotation, Map<String, Object> properties) {
 		try {
-			CompilationUnit cu = getCompilationUnit(targetClass);
+			CompilationUnit cu = compilationUnitCache.getCompilationUnit(targetClass);
 
-			TypeDeclaration typeDeclaration = getTypeDeclaration(cu, targetClass);
+			TypeDeclaration typeDeclaration = compilationUnitCache.getTypeDeclaration(targetClass);
 			FieldDeclaration[] fields = typeDeclaration.getFields();
 
 			Iterator<FieldDeclaration> iterator = Arrays.asList(fields).iterator();
@@ -512,42 +378,17 @@
 	}
 
 	public Change getChange() {
-		CompositeChange compositeChange = new CompositeChange(Messages.getString("org.apache.openejb.helper.annotation.compositChangeString")); //$NON-NLS-1$
-
-		Iterator<CompilationUnit> iterator = cuMap.values().iterator();
-		while (iterator.hasNext()) {
-			try {
-				CompilationUnit cu = iterator.next();
-				ITextFileBufferManager bufferManager = FileBuffers.getTextFileBufferManager();
-				IPath path = cu.getJavaElement().getPath();
-				bufferManager.connect(path, null);
-
-				ITextFileBuffer textFileBuffer = bufferManager.getTextFileBuffer(path);
-				IDocument document = textFileBuffer.getDocument();
-
-				TextEdit edit = cu.rewrite(document, javaProject.getOptions(true));
-				TextFileChange dc = new TextFileChange(path.toString(), (IFile) cu.getJavaElement().getResource());
-				dc.setTextType("java"); //$NON-NLS-1$
-				dc.setEdit(edit);
-				dc.setSaveMode(TextFileChange.FORCE_SAVE);
-
-				compositeChange.add(dc);
-			} catch (CoreException e) {
-			}
-		}
-
-		return compositeChange;
+		return compilationUnitCache.getChange();
 	}
 
 	public String[] getWarnings() {
 		return warnings.toArray(new String[0]);
 	}
 
-	@SuppressWarnings("unchecked") //$NON-NLS-1$
+	@SuppressWarnings("unchecked")//$NON-NLS-1$
 	public void removeInterface(String targetClass, String interfaceToRemove) {
 		try {
-			CompilationUnit cu = getCompilationUnit(targetClass);
-			TypeDeclaration typeDeclaration = getTypeDeclaration(cu, targetClass);
+			TypeDeclaration typeDeclaration = compilationUnitCache.getTypeDeclaration(targetClass);
 
 			Iterator iter = typeDeclaration.superInterfaceTypes().iterator();
 			while (iter.hasNext()) {
@@ -562,15 +403,14 @@
 				}
 
 			}
-		} catch (CoreException e) {
+		} catch (Exception e) {
 			warnings.add(String.format(Messages.getString("org.apache.openejb.helper.annotation.warnings.5"), interfaceToRemove, targetClass)); //$NON-NLS-1$
 		}
 	}
 
 	public void removeAbstractModifierFromClass(String targetClass) {
 		try {
-			CompilationUnit cu = getCompilationUnit(targetClass);
-			BodyDeclaration typeDeclaration = getTypeDeclaration(cu, targetClass);
+			BodyDeclaration typeDeclaration = compilationUnitCache.getTypeDeclaration(targetClass);
 			removeAbstractModifier(typeDeclaration.modifiers());
 		} catch (Exception e) {
 			warnings.add(String.format(Messages.getString("org.apache.openejb.helper.annotation.warnings.6"), targetClass)); //$NON-NLS-1$
@@ -592,31 +432,29 @@
 	public void removeAbstractModifierFromMethod(String targetClass, String methodName, String[] signature, String methodBody) {
 		try {
 			String code = methodBody;
-			
-			CompilationUnit compilationUnit = getCompilationUnit(targetClass);
-			TypeDeclaration typeDeclaration = getTypeDeclaration(compilationUnit, targetClass);
+
+			TypeDeclaration typeDeclaration = compilationUnitCache.getTypeDeclaration(targetClass);
 			MethodDeclaration methodDeclaration = getMethodDeclaration(typeDeclaration, methodName, signature);
 			removeAbstractModifier(methodDeclaration.modifiers());
-			
+
 			List parameters = methodDeclaration.parameters();
 			for (int i = 0; i < parameters.size(); i++) {
 				SingleVariableDeclaration parameter = (SingleVariableDeclaration) parameters.get(i);
 				code = code.replaceAll("\\$\\{" + Integer.toString(i) + "\\}", parameter.resolveBinding().getName()); //$NON-NLS-1$ //$NON-NLS-2$
 			}
-			
-			Block block = parseBlock(code);
+
+			Block block = JDTUtils.parseBlock(code);
 			block = (Block) ASTNode.copySubtree(methodDeclaration.getAST(), block);
 
 			methodDeclaration.setBody((Block) block);
-		} catch (CoreException e) {
+		} catch (Exception e) {
 			warnings.add(String.format(Messages.getString("org.apache.openejb.helper.annotation.warnings.7"), targetClass, methodName)); //$NON-NLS-1$
 		}
 	}
 
 	public boolean classImplements(String targetClass, String targetInterface) {
 		try {
-			CompilationUnit cu = getCompilationUnit(targetClass);
-			TypeDeclaration typeDeclaration = getTypeDeclaration(cu, targetClass);
+			TypeDeclaration typeDeclaration = compilationUnitCache.getTypeDeclaration(targetClass);
 
 			Iterator iter = typeDeclaration.superInterfaceTypes().iterator();
 			while (iter.hasNext()) {
@@ -631,7 +469,7 @@
 				}
 
 			}
-		} catch (CoreException e) {
+		} catch (Exception e) {
 			warnings.add(String.format(Messages.getString("org.apache.openejb.helper.annotation.warnings.8"), targetClass)); //$NON-NLS-1$
 		}
 
@@ -640,15 +478,15 @@
 
 	public String getSuperClass(String targetClass) {
 		try {
-			TypeDeclaration type = getTypeDeclaration(getCompilationUnit(targetClass), targetClass);
+			TypeDeclaration type = compilationUnitCache.getTypeDeclaration(targetClass);
 			Type superclassType = type.getSuperclassType();
-			
+
 			if (superclassType == null) {
 				return targetClass;
 			}
-			
+
 			return superclassType.resolveBinding().getQualifiedName();
-		} catch (CoreException e) {
+		} catch (Exception e) {
 			warnings.add(String.format(Messages.getString("org.apache.openejb.helper.annotation.warnings.9"), targetClass)); //$NON-NLS-1$
 		}
 
@@ -657,12 +495,10 @@
 
 	public String getMethodReturnType(String targetClass, String methodName, String[] signature) {
 		try {
-			CompilationUnit compilationUnit = getCompilationUnit(targetClass);
-			TypeDeclaration typeDeclaration = getTypeDeclaration(compilationUnit, targetClass);
-			MethodDeclaration methodDeclaration = getMethodDeclaration(typeDeclaration, methodName, signature);
+			MethodDeclaration methodDeclaration = compilationUnitCache.getMethodDeclaration(targetClass, methodName, signature);
 
 			return methodDeclaration.resolveBinding().getReturnType().getQualifiedName();
-		} catch (CoreException e) {
+		} catch (Exception e) {
 			warnings.add(String.format(Messages.getString("org.apache.openejb.helper.annotation.warnings.10"), targetClass, methodName)); //$NON-NLS-1$
 		}
 
@@ -671,19 +507,19 @@
 
 	public void addField(String targetClass, String fieldName, String fieldType) {
 		try {
-			CompilationUnit compilationUnit = getCompilationUnit(targetClass);
-			TypeDeclaration typeDeclaration = getTypeDeclaration(compilationUnit, targetClass);
+			CompilationUnit compilationUnit = compilationUnitCache.getCompilationUnit(targetClass);
+			TypeDeclaration typeDeclaration = compilationUnitCache.getTypeDeclaration(targetClass);
 
 			VariableDeclarationFragment variableDeclaration = typeDeclaration.getAST().newVariableDeclarationFragment();
 			variableDeclaration.setName(typeDeclaration.getAST().newSimpleName(fieldName));
 
 			FieldDeclaration fieldDeclaration = typeDeclaration.getAST().newFieldDeclaration(variableDeclaration);
-			Type type = createQualifiedType(compilationUnit.getAST(), fieldType);
+			Type type = JDTUtils.createQualifiedType(compilationUnit.getAST(), fieldType);
 			fieldDeclaration.setType(type);
 			Modifier privateModifier = fieldDeclaration.getAST().newModifier(ModifierKeyword.PRIVATE_KEYWORD);
 			fieldDeclaration.modifiers().add(privateModifier);
 			typeDeclaration.bodyDeclarations().add(fieldDeclaration);
-		} catch (CoreException e) {
+		} catch (Exception e) {
 			warnings.add(String.format(Messages.getString("org.apache.openejb.helper.annotation.warnings.11"), fieldName, targetClass)); //$NON-NLS-1$
 		}
 
@@ -730,15 +566,15 @@
 
 	public void addInterface(String targetClass, String interfaceClass) {
 		try {
-			CompilationUnit cu = getCompilationUnit(targetClass);
+			CompilationUnit cu = compilationUnitCache.getCompilationUnit(targetClass);
 			addImportToCompilationUnit(interfaceClass, cu);
 
-			TypeDeclaration typeDeclaration = getTypeDeclaration(cu, targetClass);
+			TypeDeclaration typeDeclaration = compilationUnitCache.getTypeDeclaration(targetClass);
 			AST ast = cu.getAST();
 			SimpleType interfaceType = ast.newSimpleType(createQualifiedName(ast, interfaceClass));
-			
+
 			typeDeclaration.superInterfaceTypes().add(interfaceType);
-		} catch (CoreException e) {
+		} catch (Exception e) {
 			warnings.add(String.format(Messages.getString("org.apache.openejb.helper.annotation.warnings.12"), interfaceClass, targetClass)); //$NON-NLS-1$
 		}
 	}
@@ -748,14 +584,12 @@
 	}
 
 	public void removeClassAnnotation(String targetClass, Class<?> cls) {
-		// TODO Auto-generated method stub
 		try {
-			CompilationUnit cu = getCompilationUnit(targetClass);
-			TypeDeclaration typeDeclaration = getTypeDeclaration(cu, targetClass);
-			
+			TypeDeclaration typeDeclaration = compilationUnitCache.getTypeDeclaration(targetClass);
+
 			List modifiers = typeDeclaration.modifiers();
 			Iterator iterator = modifiers.iterator();
-			
+
 			while (iterator.hasNext()) {
 				IExtendedModifier modifier = (IExtendedModifier) iterator.next();
 				if (modifier.isAnnotation()) {
@@ -765,16 +599,108 @@
 					}
 				}
 			}
-			
-		} catch (JavaModelException e) {
-			// TODO Auto-generated catch block
+
+		} catch (Exception e) {
 			e.printStackTrace();
-		} catch (CoreException e) {
-			// TODO Auto-generated catch block
+		}
+	}
+
+	public void convertMethodToConstructor(String className, String methodName, String[] signature) {
+		try {
+			TypeDeclaration typeDeclaration = compilationUnitCache.getTypeDeclaration(className);
+			MethodDeclaration methodDeclaration = compilationUnitCache.getMethodDeclaration(className, methodName, signature);
+			methodDeclaration.setConstructor(true);
+			SimpleName newMethodName = methodDeclaration.getAST().newSimpleName(typeDeclaration.getName().toString());
+			methodDeclaration.setName(newMethodName);
+		} catch (Exception e) {
+			e.printStackTrace();
+		}
+	}
+
+	public void changeInvocationsToConstructor(String fromClass, final String fromMethodName, String[] fromSignature, final String toClass) {
+		MethodDeclaration fromMethodDeclaration = compilationUnitCache.getMethodDeclaration(fromClass, fromMethodName, fromSignature);
+		final IMethod fromMethod = (IMethod) fromMethodDeclaration.resolveBinding().getJavaElement();
+
+		BlockModifier blockModifier = new ConvertMethodInvocationToConstructor(fromMethod, toClass);
+		modifyBlocks(fromMethod, blockModifier);
+	}
+
+	private void modifyBlocks(final IMethod fromMethod, BlockModifier blockModifier) {
+		try {
+			SearchEngine searchEngine = new SearchEngine();
+			SearchPattern pattern = SearchPattern.createPattern(fromMethod, IJavaSearchConstants.ALL_OCCURRENCES | IJavaSearchConstants.IGNORE_RETURN_TYPE);
+			SearchParticipant[] participants = new SearchParticipant[] { SearchEngine.getDefaultSearchParticipant() };
+			IJavaSearchScope scope = SearchEngine.createWorkspaceScope();
+
+			BasicSearchRequestor requestor = new BasicSearchRequestor();
+			searchEngine.search(pattern, participants, scope, requestor, null);
+
+			SearchMatch[] matches = requestor.getMatches();
+			for (SearchMatch match : matches) {
+				try {
+					if (!(match instanceof MethodReferenceMatch)) {
+						continue;
+					}
+
+					IMethod javaElement = (IMethod) ((PlatformObject) (match.getElement())).getAdapter(IJavaElement.class);
+					Block block = compilationUnitCache.getMethodDeclaration(javaElement).getBody();
+					blockModifier.modify(block);
+				} catch (Exception e) {
+					e.printStackTrace();
+				}
+			}
+		} catch (Exception e) {
 			e.printStackTrace();
 		}
+	}
+	
+	public List<String[]> getSignatures(String type, String methodName) {
+		return compilationUnitCache.getSignatures(type, methodName);
+	}
+
+	public void changeInvocationsTo(String fromClass, String fromMethodName, String[] fromSignature, String code) {
+		MethodDeclaration fromMethodDeclaration = compilationUnitCache.getMethodDeclaration(fromClass, fromMethodName, fromSignature);
+		final IMethod fromMethod = (IMethod) fromMethodDeclaration.resolveBinding().getJavaElement();
+
+		BlockModifier blockModifier = new ConvertMethodInvocationToCode(fromMethod, code);
+		modifyBlocks(fromMethod, blockModifier);
+	}
 
+	public void addCodeToEndOfMethod(String className, String methodName, String[] signature, String code) {
+		// TODO Auto-generated method stub
+		
+	}
+
+	public void addCodeToStartOfMethod(String className, String methodName, String[] signature, String code) {
+		// TODO Auto-generated method stub
 		
 	}
 
+	public boolean isTypeCollection(String typeName) {
+		if ("java.util.Collection".equals(typeName)) {
+			return true;
+		}
+		
+		try {
+			IType type = javaProject.findType(typeName);
+			if (type == null) {
+				return false;
+			}
+			
+			String[] superInterfaceNames = type.getSuperInterfaceNames();
+			for (String superInterface : superInterfaceNames) {
+				if ("java.util.Collection".equals(superInterface)) {
+					return true;
+				}
+				
+				if (isTypeCollection(superInterface)) {
+					return true;
+				}
+			}
+		} catch (JavaModelException e) {
+		}
+		
+		return false;
+	}
 }
+

Added: openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.apache.openejb.devtools.core/src/main/java/org/apache/openejb/devtools/core/JDTUtils.java
URL: http://svn.apache.org/viewvc/openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.apache.openejb.devtools.core/src/main/java/org/apache/openejb/devtools/core/JDTUtils.java?rev=711945&view=auto
==============================================================================
--- openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.apache.openejb.devtools.core/src/main/java/org/apache/openejb/devtools/core/JDTUtils.java (added)
+++ openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.apache.openejb.devtools.core/src/main/java/org/apache/openejb/devtools/core/JDTUtils.java Thu Nov  6 11:03:06 2008
@@ -0,0 +1,41 @@
+package org.apache.openejb.devtools.core;
+
+import org.eclipse.jdt.core.dom.AST;
+import org.eclipse.jdt.core.dom.ASTParser;
+import org.eclipse.jdt.core.dom.Block;
+import org.eclipse.jdt.core.dom.SimpleName;
+import org.eclipse.jdt.core.dom.Type;
+
+public class JDTUtils {
+
+	public static Type createQualifiedType(AST ast, String targetClass) {
+		String[] parts = targetClass.split("\\."); //$NON-NLS-1$
+
+		Type type = null;
+
+		for (int i = 0; i < parts.length; i++) {
+			SimpleName name = ast.newSimpleName(parts[i]);
+			if (i == 0) {
+				type = ast.newSimpleType(name);
+			} else {
+				type = ast.newQualifiedType(type, name);
+			}
+		}
+
+		return type;
+	}
+
+	public static Block parseBlock(String block) {
+		char[] source = block.toCharArray();
+
+		ASTParser parser = ASTParser.newParser(AST.JLS3);
+		parser.setKind(ASTParser.K_STATEMENTS);
+
+		parser.setSource(source);
+		parser.setResolveBindings(true);
+
+		Block val = (Block) parser.createAST(null);
+		return val;
+	}
+
+}

Modified: openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.apache.openejb.helper.annotation.test/src/main/java/org/apache/openejb/helper/annotation/fixtures/ProjectFixture.java
URL: http://svn.apache.org/viewvc/openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.apache.openejb.helper.annotation.test/src/main/java/org/apache/openejb/helper/annotation/fixtures/ProjectFixture.java?rev=711945&r1=711944&r2=711945&view=diff
==============================================================================
--- openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.apache.openejb.helper.annotation.test/src/main/java/org/apache/openejb/helper/annotation/fixtures/ProjectFixture.java (original)
+++ openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.apache.openejb.helper.annotation.test/src/main/java/org/apache/openejb/helper/annotation/fixtures/ProjectFixture.java Thu Nov  6 11:03:06 2008
@@ -17,6 +17,10 @@
 
 package org.apache.openejb.helper.annotation.fixtures;
 
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+
 import org.eclipse.core.resources.IFile;
 import org.eclipse.core.resources.IFolder;
 import org.eclipse.core.resources.IProject;
@@ -138,4 +142,10 @@
 		project.build(IncrementalProjectBuilder.CLEAN_BUILD, null);
 		project.build(IncrementalProjectBuilder.FULL_BUILD, null);
 	}
+
+	public String getStreamContent(InputStream is) throws IOException {
+		ByteArrayOutputStream os = new ByteArrayOutputStream();
+		new StreamFixture().streamCopy(is, os);
+		return new String(os.toByteArray());
+	}
 }

Modified: openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.apache.openejb.helper.annotation.test/src/main/java/org/apache/openejb/helper/annotation/tests/AddAnnotationTest.java
URL: http://svn.apache.org/viewvc/openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.apache.openejb.helper.annotation.test/src/main/java/org/apache/openejb/helper/annotation/tests/AddAnnotationTest.java?rev=711945&r1=711944&r2=711945&view=diff
==============================================================================
--- openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.apache.openejb.helper.annotation.test/src/main/java/org/apache/openejb/helper/annotation/tests/AddAnnotationTest.java (original)
+++ openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.apache.openejb.helper.annotation.test/src/main/java/org/apache/openejb/helper/annotation/tests/AddAnnotationTest.java Thu Nov  6 11:03:06 2008
@@ -17,9 +17,6 @@
  
 package org.apache.openejb.helper.annotation.tests;
 
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-import java.io.InputStream;
 import java.util.HashMap;
 import java.util.Map;
 
@@ -35,7 +32,6 @@
 
 import org.apache.openejb.devtools.core.JDTFacade;
 import org.apache.openejb.helper.annotation.fixtures.ProjectFixture;
-import org.apache.openejb.helper.annotation.fixtures.StreamFixture;
 import org.eclipse.core.runtime.CoreException;
 import org.eclipse.core.runtime.IProgressMonitor;
 import org.eclipse.ltk.core.refactoring.Change;
@@ -95,7 +91,7 @@
 	}
 
 	public void testShouldAddAnAnnotationToAJavaSourceFile() throws Exception {
-		addNewClassToProject("org.apache.openejb.test.TestBean1", getStreamContents(getClass().getResourceAsStream("Test1.txt"))); //$NON-NLS-1$ //$NON-NLS-2$
+		addNewClassToProject("org.apache.openejb.test.TestBean1", fixture.getStreamContent(getClass().getResourceAsStream("Test1.txt"))); //$NON-NLS-1$ //$NON-NLS-2$
 		JDTFacade facade = new JDTFacade(fixture.getProject());
 		facade.addClassAnnotation("org.apache.openejb.test.TestBean1", Stateless.class, null); //$NON-NLS-1$
 		
@@ -103,11 +99,11 @@
 		FakeProgressMonitor progressMonitor = new FakeProgressMonitor();
 		change.perform(progressMonitor);
 
-		assertEquals(getStreamContents(getClass().getResourceAsStream("ExpectedResult1.txt")), getClassContents("org.apache.openejb.test.TestBean1")); //$NON-NLS-1$ //$NON-NLS-2$
+		assertEquals(fixture.getStreamContent(getClass().getResourceAsStream("ExpectedResult1.txt")), getClassContents("org.apache.openejb.test.TestBean1")); //$NON-NLS-1$ //$NON-NLS-2$
 	}
 	
 	public void testShouldAddAnAnnotationToAJavaSourceFileAndNotAddAnImportIfTheImportAlreadyExists() throws Exception {
-		addNewClassToProject("org.apache.openejb.test.TestBean2", getStreamContents(getClass().getResourceAsStream("Test2.txt"))); //$NON-NLS-1$ //$NON-NLS-2$
+		addNewClassToProject("org.apache.openejb.test.TestBean2", fixture.getStreamContent(getClass().getResourceAsStream("Test2.txt"))); //$NON-NLS-1$ //$NON-NLS-2$
 		
 		JDTFacade facade = new JDTFacade(fixture.getProject());
 		facade.addClassAnnotation("org.apache.openejb.test.TestBean2", Stateless.class, null); //$NON-NLS-1$
@@ -116,11 +112,11 @@
 		FakeProgressMonitor progressMonitor = new FakeProgressMonitor();
 		change.perform(progressMonitor);
 		
-		assertEquals(getStreamContents(getClass().getResourceAsStream("ExpectedResult2.txt")), getClassContents("org.apache.openejb.test.TestBean2")); //$NON-NLS-1$ //$NON-NLS-2$
+		assertEquals(fixture.getStreamContent(getClass().getResourceAsStream("ExpectedResult2.txt")), getClassContents("org.apache.openejb.test.TestBean2")); //$NON-NLS-1$ //$NON-NLS-2$
 	}
 
 	public void testShouldAddAnAnnotationToAJavaSourceFileAndNotAddAnImportIfThePackageIsAlreadyImported() throws Exception {
-		addNewClassToProject("org.apache.openejb.test.TestBean3", getStreamContents(getClass().getResourceAsStream("Test3.txt"))); //$NON-NLS-1$ //$NON-NLS-2$
+		addNewClassToProject("org.apache.openejb.test.TestBean3", fixture.getStreamContent(getClass().getResourceAsStream("Test3.txt"))); //$NON-NLS-1$ //$NON-NLS-2$
 		JDTFacade facade = new JDTFacade(fixture.getProject());
 		facade.addClassAnnotation("org.apache.openejb.test.TestBean3", Stateless.class, null); //$NON-NLS-1$
 		
@@ -128,11 +124,11 @@
 		FakeProgressMonitor progressMonitor = new FakeProgressMonitor();
 		change.perform(progressMonitor);
 		
-		assertEquals(getStreamContents(getClass().getResourceAsStream("ExpectedResult3.txt")), getClassContents("org.apache.openejb.test.TestBean3")); //$NON-NLS-1$ //$NON-NLS-2$
+		assertEquals(fixture.getStreamContent(getClass().getResourceAsStream("ExpectedResult3.txt")), getClassContents("org.apache.openejb.test.TestBean3")); //$NON-NLS-1$ //$NON-NLS-2$
 	}
 
 	public void testShouldAddAnnotationWithProperties() throws Exception {
-		addNewClassToProject("org.apache.openejb.test.TestBean4", getStreamContents(getClass().getResourceAsStream("Test4.txt"))); //$NON-NLS-1$ //$NON-NLS-2$
+		addNewClassToProject("org.apache.openejb.test.TestBean4", fixture.getStreamContent(getClass().getResourceAsStream("Test4.txt"))); //$NON-NLS-1$ //$NON-NLS-2$
 		Map<String,Object> properties = new HashMap<String,Object>();
 		properties.put("name", "Test"); //$NON-NLS-1$ //$NON-NLS-2$
 
@@ -143,11 +139,11 @@
 		FakeProgressMonitor progressMonitor = new FakeProgressMonitor();
 		change.perform(progressMonitor);
 		
-		assertEquals(getStreamContents(getClass().getResourceAsStream("ExpectedResult4.txt")), getClassContents("org.apache.openejb.test.TestBean4")); //$NON-NLS-1$ //$NON-NLS-2$
+		assertEquals(fixture.getStreamContent(getClass().getResourceAsStream("ExpectedResult4.txt")), getClassContents("org.apache.openejb.test.TestBean4")); //$NON-NLS-1$ //$NON-NLS-2$
 	}
 
 	public void testShouldAddAnnotationWithEnumProperty() throws Exception {
-		addNewClassToProject("org.apache.openejb.test.TestBean5", getStreamContents(getClass().getResourceAsStream("Test5.txt"))); //$NON-NLS-1$ //$NON-NLS-2$
+		addNewClassToProject("org.apache.openejb.test.TestBean5", fixture.getStreamContent(getClass().getResourceAsStream("Test5.txt"))); //$NON-NLS-1$ //$NON-NLS-2$
 		Map<String,Object> properties = new HashMap<String,Object>();
 		properties.put("value", TransactionManagementType.BEAN); //$NON-NLS-1$
 
@@ -158,11 +154,11 @@
 		FakeProgressMonitor progressMonitor = new FakeProgressMonitor();
 		change.perform(progressMonitor);
 		
-		assertEquals(getStreamContents(getClass().getResourceAsStream("ExpectedResult5.txt")), getClassContents("org.apache.openejb.test.TestBean5")); //$NON-NLS-1$ //$NON-NLS-2$
+		assertEquals(fixture.getStreamContent(getClass().getResourceAsStream("ExpectedResult5.txt")), getClassContents("org.apache.openejb.test.TestBean5")); //$NON-NLS-1$ //$NON-NLS-2$
 	}
 
 	public void testShouldAddMethodAnnotationWithEnumProperty() throws Exception {
-		addNewClassToProject("org.apache.openejb.test.TestBean6", getStreamContents(getClass().getResourceAsStream("Test6.txt"))); //$NON-NLS-1$ //$NON-NLS-2$
+		addNewClassToProject("org.apache.openejb.test.TestBean6", fixture.getStreamContent(getClass().getResourceAsStream("Test6.txt"))); //$NON-NLS-1$ //$NON-NLS-2$
 
 		JDTFacade facade = new JDTFacade(fixture.getProject());
 		facade.addMethodAnnotation("org.apache.openejb.test.TestBean6", "echoHelloWorld", new String[] {"java.lang.String"}, ManyToMany.class, null); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
@@ -171,11 +167,11 @@
 		FakeProgressMonitor progressMonitor = new FakeProgressMonitor();
 		change.perform(progressMonitor);
 		
-		assertEquals(getStreamContents(getClass().getResourceAsStream("ExpectedResult6.txt")), getClassContents("org.apache.openejb.test.TestBean6")); //$NON-NLS-1$ //$NON-NLS-2$
+		assertEquals(fixture.getStreamContent(getClass().getResourceAsStream("ExpectedResult6.txt")), getClassContents("org.apache.openejb.test.TestBean6")); //$NON-NLS-1$ //$NON-NLS-2$
 	}
 	
 	public void testShouldAddAnnotationWithClassAttributeWithStringPassedIn() throws Exception {
-		addNewClassToProject("org.apache.openejb.test.TestBean7", getStreamContents(getClass().getResourceAsStream("Test7.txt"))); //$NON-NLS-1$ //$NON-NLS-2$
+		addNewClassToProject("org.apache.openejb.test.TestBean7", fixture.getStreamContent(getClass().getResourceAsStream("Test7.txt"))); //$NON-NLS-1$ //$NON-NLS-2$
 
 		JDTFacade facade = new JDTFacade(fixture.getProject());
 		Map<String, Object> properties = new HashMap<String,Object>();
@@ -186,11 +182,11 @@
 		FakeProgressMonitor progressMonitor = new FakeProgressMonitor();
 		change.perform(progressMonitor);
 		
-		assertEquals(getStreamContents(getClass().getResourceAsStream("ExpectedResult7.txt")), getClassContents("org.apache.openejb.test.TestBean7")); //$NON-NLS-1$ //$NON-NLS-2$
+		assertEquals(fixture.getStreamContent(getClass().getResourceAsStream("ExpectedResult7.txt")), getClassContents("org.apache.openejb.test.TestBean7")); //$NON-NLS-1$ //$NON-NLS-2$
 	}
 
 	public void testShouldAddAnnotationWithNestedAttributes() throws Exception {
-		addNewClassToProject("org.apache.openejb.test.TestBean8", getStreamContents(getClass().getResourceAsStream("Test8.txt"))); //$NON-NLS-1$ //$NON-NLS-2$
+		addNewClassToProject("org.apache.openejb.test.TestBean8", fixture.getStreamContent(getClass().getResourceAsStream("Test8.txt"))); //$NON-NLS-1$ //$NON-NLS-2$
 
 		JDTFacade facade = new JDTFacade(fixture.getProject());
 		Map<String, Object> properties = new HashMap<String, Object>();
@@ -207,7 +203,7 @@
 		FakeProgressMonitor progressMonitor = new FakeProgressMonitor();
 		change.perform(progressMonitor);
 		
-		assertEquals(getStreamContents(getClass().getResourceAsStream("ExpectedResult8.txt")), getClassContents("org.apache.openejb.test.TestBean8")); //$NON-NLS-1$ //$NON-NLS-2$
+		assertEquals(fixture.getStreamContent(getClass().getResourceAsStream("ExpectedResult8.txt")), getClassContents("org.apache.openejb.test.TestBean8")); //$NON-NLS-1$ //$NON-NLS-2$
 	}
 	
 	/* (non-Javadoc)
@@ -227,10 +223,4 @@
 		fixture.addClassToProject(className, content);
 		fixture.reset();
 	}
-
-	private String getStreamContents(InputStream is) throws IOException {
-		ByteArrayOutputStream os = new ByteArrayOutputStream();
-		new StreamFixture().streamCopy(is, os);
-		return new String(os.toByteArray());
-	}
 }

Modified: openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.apache.openejb.helper.annotation.test/src/main/java/org/apache/openejb/helper/annotation/tests/AllTests.java
URL: http://svn.apache.org/viewvc/openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.apache.openejb.helper.annotation.test/src/main/java/org/apache/openejb/helper/annotation/tests/AllTests.java?rev=711945&r1=711944&r2=711945&view=diff
==============================================================================
--- openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.apache.openejb.helper.annotation.test/src/main/java/org/apache/openejb/helper/annotation/tests/AllTests.java (original)
+++ openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.apache.openejb.helper.annotation.test/src/main/java/org/apache/openejb/helper/annotation/tests/AllTests.java Thu Nov  6 11:03:06 2008
@@ -8,6 +8,8 @@
 	public static Test suite() {
 		TestSuite suite = new TestSuite();
 		suite.addTestSuite(AddAnnotationTest.class);
+		suite.addTestSuite(ConvertEjbCreateMethodToConstructorTest.class);
+		suite.addTestSuite(ConvertFinderMethodToCodeTest.class);
 		
 		return suite;
 	}

Added: openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.apache.openejb.helper.annotation.test/src/main/java/org/apache/openejb/helper/annotation/tests/ConvertEjbCreateMethodToConstructorTest.java
URL: http://svn.apache.org/viewvc/openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.apache.openejb.helper.annotation.test/src/main/java/org/apache/openejb/helper/annotation/tests/ConvertEjbCreateMethodToConstructorTest.java?rev=711945&view=auto
==============================================================================
--- openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.apache.openejb.helper.annotation.test/src/main/java/org/apache/openejb/helper/annotation/tests/ConvertEjbCreateMethodToConstructorTest.java (added)
+++ openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.apache.openejb.helper.annotation.test/src/main/java/org/apache/openejb/helper/annotation/tests/ConvertEjbCreateMethodToConstructorTest.java Thu Nov  6 11:03:06 2008
@@ -0,0 +1,69 @@
+/*
+ * 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.helper.annotation.tests;
+
+import junit.framework.TestCase;
+
+import org.apache.openejb.devtools.core.JDTFacade;
+import org.apache.openejb.helper.annotation.fixtures.ProjectFixture;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.ltk.core.refactoring.Change;
+
+public class ConvertEjbCreateMethodToConstructorTest extends TestCase {
+
+	private ProjectFixture fixture;
+
+	@Override
+	protected void setUp() throws Exception {
+		super.setUp();
+		fixture = new ProjectFixture();
+		fixture.reset();
+	}
+
+	@Override
+	protected void tearDown() throws Exception {
+		fixture.delete();
+		super.tearDown();
+	}
+
+	public void testShouldConvertEjbCreateMethodToAConstructor() throws Exception {
+		fixture.addClassToProject("uk.me.jrg.jee.store.ejb.ProductBean", fixture.getStreamContent(getClass().getResourceAsStream("Ejb21ProductBean.txt"))); //$NON-NLS-1$ //$NON-NLS-2$
+		JDTFacade facade = new JDTFacade(fixture.getProject());
+		facade.convertMethodToConstructor("uk.me.jrg.jee.store.ejb.ProductBean", "ejbCreate", new String[] { "java.lang.Integer", "java.lang.String", "java.lang.String", "java.lang.String"}); //$NON-NLS-1$
+		
+		Change change = facade.getChange();
+		change.perform(new NullProgressMonitor());
+
+		assertEquals(fixture.getStreamContent(getClass().getResourceAsStream("Expected30ProductBean.txt")), fixture.getClassContents("uk.me.jrg.jee.store.ejb.ProductBean")); //$NON-NLS-1$ //$NON-NLS-2$
+	}
+	
+	public void testShouldChangeUsesOfEjbCreateToUseConstructor() throws Exception {
+		fixture.addClassToProject("uk.me.jrg.jee.store.ejb.ProductBean", fixture.getStreamContent(getClass().getResourceAsStream("Ejb21ProductBean.txt"))); //$NON-NLS-1$ //$NON-NLS-2$
+		fixture.addClassToProject("uk.me.jrg.jee.store.ejb.ProductHome", fixture.getStreamContent(getClass().getResourceAsStream("Ejb21ProductHome.txt"))); //$NON-NLS-1$ //$NON-NLS-2$
+		fixture.addClassToProject("uk.me.jrg.jee.store.ejb.SessionBean", fixture.getStreamContent(getClass().getResourceAsStream("Ejb21SessionBean.txt"))); //$NON-NLS-1$ //$NON-NLS-2$
+		fixture.addClassToProject("uk.me.jrg.jee.store.ejb.Product", fixture.getStreamContent(getClass().getResourceAsStream("Ejb21Product.txt"))); //$NON-NLS-1$ //$NON-NLS-2$
+		
+		JDTFacade facade = new JDTFacade(fixture.getProject());
+		String[] signature = new String[] { "java.lang.Integer", "java.lang.String", "java.lang.String", "java.lang.String" };
+		facade.changeInvocationsToConstructor("uk.me.jrg.jee.store.ejb.ProductHome", "create", signature, "uk.me.jrg.jee.store.ejb.ProductBean");
+
+		Change change = facade.getChange();
+		change.perform(new NullProgressMonitor());
+
+		assertEquals(fixture.getStreamContent(getClass().getResourceAsStream("ExpectedSessionBean.txt")), fixture.getClassContents("uk.me.jrg.jee.store.ejb.SessionBean")); //$NON-NLS-1$ //$NON-NLS-2$
+	}
+}



Mime
View raw message