Author: jgallimore
Date: Thu Apr 30 13:16:27 2009
New Revision: 770216

URL: http://svn.apache.org/viewvc?rev=770216&view=rev
Log:
OEP-28, OEP-29 improve interface handling and added support for keeping the 
ejb-ref name for the @EJB annotation

Modified:
    
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/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/test/java/org/apache/openejb/plugins/common/JDTFacadeStub.java
    
openejb/trunk/sandbox/openejb-eclipse-plugin/common/src/test/java/org/apache/openejb/plugins/common/SessionBeanRemoteAnnotationAdderTest.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/src/main/java/org/apache/openejb/helper/annotation/wizards/EJBJarSelectionPage.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.apache.openejb.helper.annotation/src/main/resources/org/apache/openejb/helper/annotation/wizards/messages.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=770216&r1=770215&r2=770216&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 Apr 30 13:16:27 2009
@@ -33,6 +33,7 @@
        String getMethodReturnType(String targetClass, String methodName, 
String[] signature);
        void addField(String targetClass, String fieldName, String fieldType);
        void addAnnotationToFieldsOfType(String targetClass, Class<? extends 
Annotation> annotation, Map<String, Object> properties);
+       void addAnnotationToFieldsOfType(String destinationClass, String 
targetClass, Class<? extends Annotation> annotation, Map<String, Object> 
properties);
        void addInterface(String ejbClass, String interfaceClass);
        void addWarning(String warning);
        public void convertMethodToConstructor(String className, String 
methodName, String[] signature);

Modified: 
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=770216&r1=770215&r2=770216&view=diff
==============================================================================
--- 
openejb/trunk/sandbox/openejb-eclipse-plugin/common/src/main/java/org/apache/openejb/plugins/common/SessionBeanConverter.java
 (original)
+++ 
openejb/trunk/sandbox/openejb-eclipse-plugin/common/src/main/java/org/apache/openejb/plugins/common/SessionBeanConverter.java
 Thu Apr 30 13:16:27 2009
@@ -18,10 +18,10 @@
 
 import java.util.ArrayList;
 import java.util.Arrays;
+import java.util.Collection;
 import java.util.HashMap;
 import java.util.Iterator;
 import java.util.List;
-import java.util.Collection;
 import java.util.Map;
 
 import javax.annotation.security.DeclareRoles;
@@ -29,11 +29,10 @@
 import javax.annotation.security.PermitAll;
 import javax.annotation.security.RolesAllowed;
 import javax.annotation.security.RunAs;
+import javax.ejb.EJB;
 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;
@@ -47,6 +46,8 @@
 import org.apache.openejb.jee.ApplicationException;
 import org.apache.openejb.jee.AssemblyDescriptor;
 import org.apache.openejb.jee.EjbJar;
+import org.apache.openejb.jee.EjbLocalRef;
+import org.apache.openejb.jee.EjbRef;
 import org.apache.openejb.jee.EnterpriseBean;
 import org.apache.openejb.jee.InterceptorBinding;
 import org.apache.openejb.jee.MessageDrivenBean;
@@ -109,11 +110,36 @@
                        processTransactionManagement(bean, 
ejbJar.getAssemblyDescriptor());
                        processBeanSecurityIdentity(bean);
                        processDeclaredRoles(bean);
+                       processEjbRefs(bean);
                }
 
                processMethodPermissions(ejbJar);
        }
 
+       private void processEjbRefs(EnterpriseBean bean) {
+               Collection<EjbRef> ejbRefs = bean.getEjbRef();
+               for (EjbRef ejbRef : ejbRefs) {
+                       String iface = ejbRef.getRemote();
+                       String name = ejbRef.getName();
+
+                       Map<String, Object> properties = new HashMap<String, 
Object>();
+                       properties.put("name", name);
+                       
+                       
annotationHelper.addAnnotationToFieldsOfType(bean.getEjbClass(), iface, 
EJB.class, properties);
+               }
+               
+               Collection<EjbLocalRef> localEjbRefs = bean.getEjbLocalRef();
+               for (EjbLocalRef ejbRef : localEjbRefs) {
+                       String iface = ejbRef.getLocal();
+                       String name = ejbRef.getName();
+
+                       Map<String, Object> properties = new HashMap<String, 
Object>();
+                       properties.put("name", name);
+                       
+                       
annotationHelper.addAnnotationToFieldsOfType(bean.getEjbClass(), iface, 
EJB.class, properties);
+               }
+       }
+
        /**
         * Generates transaction management annotations for an Enterprise Bean
         * @param bean The enterprise bean to generate annotations for

Modified: 
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=770216&r1=770215&r2=770216&view=diff
==============================================================================
--- 
openejb/trunk/sandbox/openejb-eclipse-plugin/common/src/main/java/org/apache/openejb/plugins/common/SessionBeanInterfaceModifier.java
 (original)
+++ 
openejb/trunk/sandbox/openejb-eclipse-plugin/common/src/main/java/org/apache/openejb/plugins/common/SessionBeanInterfaceModifier.java
 Thu Apr 30 13:16:27 2009
@@ -28,11 +28,20 @@
 public class SessionBeanInterfaceModifier implements Converter {
 
        private IJDTFacade facade;
+       private boolean useHome;
 
        public SessionBeanInterfaceModifier(IJDTFacade facade) {
                super();
                this.facade = facade;
        }
+       
+       public boolean isUseHome() {
+               return useHome;
+       }
+
+       public void setUseHome(boolean useHome) {
+               this.useHome = useHome;
+       }
 
        public void convert(AppModule module) {
                List<EjbModule> ejbModules = module.getEjbModules();
@@ -52,16 +61,18 @@
 
                 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$
+                if (! useHome) {
+                                       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$
+                                       }
                                }
                        }
                }

Modified: 
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=770216&r1=770215&r2=770216&view=diff
==============================================================================
--- 
openejb/trunk/sandbox/openejb-eclipse-plugin/common/src/main/java/org/apache/openejb/plugins/common/SessionBeanRemoteAnnotationAdder.java
 (original)
+++ 
openejb/trunk/sandbox/openejb-eclipse-plugin/common/src/main/java/org/apache/openejb/plugins/common/SessionBeanRemoteAnnotationAdder.java
 Thu Apr 30 13:16:27 2009
@@ -34,10 +34,19 @@
 public class SessionBeanRemoteAnnotationAdder implements Converter {
 
        private IJDTFacade facade;
+       private boolean useHome = false;
 
        public SessionBeanRemoteAnnotationAdder(IJDTFacade facade) {
                this.facade = facade;
        }
+       
+       public boolean isUseHome() {
+               return useHome;
+       }
+
+       public void setUseHome(boolean useHome) {
+               this.useHome = useHome;
+       }
 
        public void convert(AppModule module) {
                List<EjbModule> ejbModules = module.getEjbModules();
@@ -61,11 +70,11 @@
                String ejbClass = sessionBean.getEjbClass();
 
                if (sessionBean instanceof RemoteBean) {
-                       if (sessionBean.getRemote() != null && 
sessionBean.getRemote().length() > 0) {
+                       if (isUseHome() == false && sessionBean.getRemote() != 
null && sessionBean.getRemote().length() > 0) {
                                
facade.addClassAnnotation(sessionBean.getRemote(), Remote.class, null);
                        }
 
-                       if (sessionBean.getHome() != null && 
sessionBean.getHome().length() > 0) {
+                       if (isUseHome() && sessionBean.getHome() != null && 
sessionBean.getHome().length() > 0) {
                                Map<String, Object> props = new HashMap<String, 
Object>();
                                props.put("value", sessionBean.getHome()); 
//$NON-NLS-1$
 
@@ -73,4 +82,6 @@
                        }
                }
        }
+       
+       
 }

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=770216&r1=770215&r2=770216&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 Apr 30 13:16:27 2009
@@ -203,4 +203,19 @@
                return false;
        }
 
+       public void addAnnotationToFieldsOfType(String destinationClass, String 
targetClass, Class<? extends Annotation> annotation, Map<String, Object> 
properties) {
+               StringBuffer buffer = new StringBuffer();
+               buffer.append("[ADD ANNOTATIONS TO FIELDS OF TYPE] Destination 
Class:");
+               buffer.append(destinationClass);
+               buffer.append("\nTarget field type: ");
+               buffer.append(targetClass);
+               buffer.append("\nAnnotation: ");
+               buffer.append(annotation.getCanonicalName());
+               buffer.append("\nProperies: {\n");
+               writeMapToBuffer(properties, buffer, 1);
+               buffer.append("}\n");
+               
+               System.out.println(buffer.toString());          
+       }
+
 }

Modified: 
openejb/trunk/sandbox/openejb-eclipse-plugin/common/src/test/java/org/apache/openejb/plugins/common/SessionBeanRemoteAnnotationAdderTest.java
URL: 
http://svn.apache.org/viewvc/openejb/trunk/sandbox/openejb-eclipse-plugin/common/src/test/java/org/apache/openejb/plugins/common/SessionBeanRemoteAnnotationAdderTest.java?rev=770216&r1=770215&r2=770216&view=diff
==============================================================================
--- 
openejb/trunk/sandbox/openejb-eclipse-plugin/common/src/test/java/org/apache/openejb/plugins/common/SessionBeanRemoteAnnotationAdderTest.java
 (original)
+++ 
openejb/trunk/sandbox/openejb-eclipse-plugin/common/src/test/java/org/apache/openejb/plugins/common/SessionBeanRemoteAnnotationAdderTest.java
 Thu Apr 30 13:16:27 2009
@@ -38,8 +38,6 @@
 
                 Map<String, Object> remoteHomeProps = new HashMap<String, 
Object>();
                 remoteHomeProps.put("value", "org.superbiz.StoreHome");
-
-                one(facade).addClassAnnotation("org.superbiz.StoreBean", 
RemoteHome.class, remoteHomeProps);
             }
         });
 

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=770216&r1=770215&r2=770216&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 Apr 30 13:16:27 2009
@@ -29,6 +29,7 @@
 import org.eclipse.core.resources.IProject;
 import org.eclipse.core.runtime.CoreException;
 import org.eclipse.core.runtime.PlatformObject;
+import org.eclipse.jdt.core.IField;
 import org.eclipse.jdt.core.IJavaElement;
 import org.eclipse.jdt.core.IJavaProject;
 import org.eclipse.jdt.core.IMethod;
@@ -181,6 +182,7 @@
                                return;
                        }
 
+                       
addImportToCompilationUnit(annotation.getCanonicalName(), cu);
                        Annotation modifier = createModifier(cu.getAST(), 
annotation, properties, cu);
                        typeDeclaration.modifiers().add(0, modifier);
                } catch (Exception e) {
@@ -196,7 +198,8 @@
                        }
 
                        Annotation annotationModifer = (Annotation) modifier;
-                       if 
(annotationModifer.getTypeName().toString().equals(annotation.getCanonicalName()))
 {
+                       if 
(annotationModifer.getTypeName().toString().equals(annotation.getCanonicalName())
+                                       || 
annotationModifer.getTypeName().toString().equals(annotation.getSimpleName())) {
                                return true;
                        }
                }
@@ -225,7 +228,7 @@
                addImportToCompilationUnit(annotation.getCanonicalName(), cu);
 
                Annotation result = null;
-               Name annotationTypeName = 
ast.newSimpleName(annotationType.getElementName());
+               Name annotationTypeName = 
isClassImported(annotation.getCanonicalName(), cu) ? 
ast.newSimpleName(annotationType.getElementName()) : createQualifiedName(ast, 
annotationType.getFullyQualifiedName()); 
 
                if (properties != null) {
                        result = ast.newNormalAnnotation();
@@ -332,10 +335,10 @@
                                return;
                        }
                        
+                       
addImportToCompilationUnit(annotationClass.getCanonicalName(), cu);
+                       
                        Annotation modifier = createModifier(cu.getAST(), 
annotationClass, properties, cu);
                        method.modifiers().add(0, modifier);
-
-                       
addImportToCompilationUnit(annotationClass.getCanonicalName(), cu);
                } catch (CoreException e) {
                        
warnings.add(String.format(Messages.getString("org.apache.openejb.helper.annotation.warnings.3"),
 annotationClass.getCanonicalName(), methodName, fullyQualifiedClassName)); 
//$NON-NLS-1$
                }
@@ -369,18 +372,17 @@
                                        continue;
                                }
 
-                               if 
(isAnnotationAlreadyUsedOnDeclaration(annotation, field)) {
-                                       
warnings.add(String.format(Messages.getString("org.apache.openejb.helper.annotation.warnings.1"),
 annotation.getCanonicalName(), targetClass + "." + targetField)); //$NON-NLS-1$
-                                       return;
-                               }
-
-                               
                                VariableDeclarationFragment varibleDeclaration 
= (VariableDeclarationFragment) field.fragments().get(0);
                                if 
(varibleDeclaration.getName().toString().equals(targetField)) {
-                                       Annotation modifier = 
createModifier(cu.getAST(), annotation, properties, cu);
-                                       field.modifiers().add(0, modifier);
+                                       if 
(isAnnotationAlreadyUsedOnDeclaration(annotation, field)) {
+                                               
warnings.add(String.format(Messages.getString("org.apache.openejb.helper.annotation.warnings.1"),
 annotation.getCanonicalName(), targetClass + "." + targetField)); //$NON-NLS-1$
+                                               return;
+                                       }
 
                                        
addImportToCompilationUnit(annotation.getCanonicalName(), cu);
+                                       
+                                       Annotation modifier = 
createModifier(cu.getAST(), annotation, properties, cu);
+                                       field.modifiers().add(0, modifier);
                                }
                        }
 
@@ -714,5 +716,36 @@
                
                return false;
        }
+
+       public void addAnnotationToFieldsOfType(String destinationClass, String 
targetClass, Class<? extends java.lang.annotation.Annotation> annotation, 
Map<String, Object> properties) {
+               try {
+                       CompilationUnit cu = 
compilationUnitCache.getCompilationUnit(destinationClass);
+                       TypeDeclaration typeDeclaration = 
compilationUnitCache.getTypeDeclaration(destinationClass);
+                       FieldDeclaration[] fields = typeDeclaration.getFields();
+
+                       Iterator<FieldDeclaration> iterator = 
Arrays.asList(fields).iterator();
+                       while (iterator.hasNext()) {
+                               FieldDeclaration field = iterator.next();
+                               if (field.fragments().size() == 0) {
+                                       continue;
+                               }
+
+                               VariableDeclarationFragment varibleDeclaration 
= (VariableDeclarationFragment) field.fragments().get(0);
+                               if 
(field.getType().resolveBinding().getQualifiedName().toString().equals(targetClass))
 {
+                                       if 
(isAnnotationAlreadyUsedOnDeclaration(annotation, field)) {
+                                               
warnings.add(String.format(Messages.getString("org.apache.openejb.helper.annotation.warnings.1"),
 annotation.getCanonicalName(), targetClass + "." + 
varibleDeclaration.getName().toString())); //$NON-NLS-1$
+                                               return;
+                                       }
+                                       
+                                       Annotation modifier = 
createModifier(cu.getAST(), annotation, properties, cu);
+                                       field.modifiers().add(0, modifier);
+
+                                       
addImportToCompilationUnit(annotation.getCanonicalName(), cu);
+                               }
+                       }
+               } catch (JavaModelException e) {
+                       // TODO: some warning here
+               }
+       }
 }
 

Modified: 
openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.apache.openejb.helper.annotation/src/main/java/org/apache/openejb/helper/annotation/wizards/EJBJarSelectionPage.java
URL: 
http://svn.apache.org/viewvc/openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.apache.openejb.helper.annotation/src/main/java/org/apache/openejb/helper/annotation/wizards/EJBJarSelectionPage.java?rev=770216&r1=770215&r2=770216&view=diff
==============================================================================
--- 
openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.apache.openejb.helper.annotation/src/main/java/org/apache/openejb/helper/annotation/wizards/EJBJarSelectionPage.java
 (original)
+++ 
openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.apache.openejb.helper.annotation/src/main/java/org/apache/openejb/helper/annotation/wizards/EJBJarSelectionPage.java
 Thu Apr 30 13:16:27 2009
@@ -50,7 +50,8 @@
        private Text ejbJarXmlText;
        private Text openEjbJarXmlText;
        private Button ejb3Interfaces;
-       private Button remoteAndRemoteHomeAnnotations;
+       private Button remoteAnnotations;
+       private Button useHomeInterfaces;
        private Button convertEntityBeansToPojos;
        private Button generateEntityManagerCode;
        
@@ -140,11 +141,23 @@
                        }
                });
                
-               remoteAndRemoteHomeAnnotations = new Button(container, 
SWT.CHECK);
-               remoteAndRemoteHomeAnnotations.setLayoutData(checkData);
-               
remoteAndRemoteHomeAnnotations.setText(Messages.getString("org.apache.openejb.helper.annotation.wizards.ejbJarSelectionWzd.button.addRemoteAnnotations"));
 //$NON-NLS-1$
-               remoteAndRemoteHomeAnnotations.setSelection(true);
-               remoteAndRemoteHomeAnnotations.addSelectionListener(new 
SelectionAdapter() {
+               remoteAnnotations = new Button(container, SWT.CHECK);
+               remoteAnnotations.setLayoutData(checkData);
+               
remoteAnnotations.setText(Messages.getString("org.apache.openejb.helper.annotation.wizards.ejbJarSelectionWzd.button.addRemoteAnnotations"));
 //$NON-NLS-1$
+               remoteAnnotations.setSelection(true);
+               remoteAnnotations.addSelectionListener(new SelectionAdapter() {
+                       @Override
+                       public void widgetSelected(SelectionEvent e) {
+                               super.widgetSelected(e);
+                               checkPage();
+                       }
+               });
+               
+               useHomeInterfaces = new Button(container, SWT.CHECK);
+               useHomeInterfaces.setLayoutData(checkData);
+               
useHomeInterfaces.setText(Messages.getString("org.apache.openejb.helper.annotation.wizards.ejbJarSelectionWzd.button.useHomeInterface"));
 //$NON-NLS-1$
+               useHomeInterfaces.setSelection(true);
+               useHomeInterfaces.addSelectionListener(new SelectionAdapter() {
                        @Override
                        public void widgetSelected(SelectionEvent e) {
                                super.widgetSelected(e);
@@ -236,11 +249,13 @@
                        generateEntityManagerCode.setEnabled(true);
                }
                
+               useHomeInterfaces.setEnabled(ejb3Interfaces.getSelection() || 
remoteAnnotations.getSelection());
+               
                refactoring.setEjbJarXmlFile(ejbJarXmlFile);
                refactoring.setOpenEjbJarXmlFile(openEjbJarXmlFile);
                
refactoring.setConvertEntityBeansToPojos(convertEntityBeansToPojos.getSelection());
                refactoring.setEjb3Interfaces(ejb3Interfaces.getSelection());
-               
refactoring.setRemoteAndRemoteHomeAnnotations(remoteAndRemoteHomeAnnotations.getSelection());
+               
refactoring.setRemoteAnnotations(remoteAnnotations.getSelection());
                
refactoring.setGenerateEntityManagerCode(generateEntityManagerCode.getSelection());
                
                if (refactoring.getProject() == null) {

Modified: 
openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.apache.openejb.helper.annotation/src/main/java/org/apache/openejb/helper/annotation/wizards/EJBMigrationRefactoring.java
URL: 
http://svn.apache.org/viewvc/openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.apache.openejb.helper.annotation/src/main/java/org/apache/openejb/helper/annotation/wizards/EJBMigrationRefactoring.java?rev=770216&r1=770215&r2=770216&view=diff
==============================================================================
--- 
openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.apache.openejb.helper.annotation/src/main/java/org/apache/openejb/helper/annotation/wizards/EJBMigrationRefactoring.java
 (original)
+++ 
openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.apache.openejb.helper.annotation/src/main/java/org/apache/openejb/helper/annotation/wizards/EJBMigrationRefactoring.java
 Thu Apr 30 13:16:27 2009
@@ -50,7 +50,8 @@
        protected RefactoringStatus status;
        private final IWorkspaceRoot workspaceRoot;
        protected boolean ejb3Interfaces;
-       protected boolean remoteAndRemoteHomeAnnotations;
+       protected boolean remoteAnnotations;
+       protected boolean useHomeInterface;
        protected boolean convertEntityBeansToPojos;
        protected boolean generateEntityManagerCode;
        
@@ -116,11 +117,15 @@
                        converterList.add(new 
EjbReferencesConverter(jdtFacade));
                        
                        if (ejb3Interfaces) {
-                               converterList.add(new 
SessionBeanInterfaceModifier(jdtFacade));
+                               SessionBeanInterfaceModifier converter = new 
SessionBeanInterfaceModifier(jdtFacade);
+                               converter.setUseHome(useHomeInterface);
+                               converterList.add(converter);
                        }
                        
-                       if (remoteAndRemoteHomeAnnotations) {
-                               converterList.add(new 
SessionBeanRemoteAnnotationAdder(jdtFacade));
+                       if (remoteAnnotations) {
+                               SessionBeanRemoteAnnotationAdder converter = 
new SessionBeanRemoteAnnotationAdder(jdtFacade);
+                               converter.setUseHome(useHomeInterface);
+                               converterList.add(converter);
                        }
                        
                        if (convertEntityBeansToPojos) {
@@ -196,12 +201,12 @@
                this.ejb3Interfaces = ejb3Interfaces;
        }
 
-       public boolean isRemoteAndRemoteHomeAnnotations() {
-               return remoteAndRemoteHomeAnnotations;
+       public boolean isRemoteAnnotations() {
+               return remoteAnnotations;
        }
 
-       public void setRemoteAndRemoteHomeAnnotations(boolean 
remoteAndRemoteHomeAnnotations) {
-               this.remoteAndRemoteHomeAnnotations = 
remoteAndRemoteHomeAnnotations;
+       public void setRemoteAnnotations(boolean 
remoteAndRemoteHomeAnnotations) {
+               this.remoteAnnotations = remoteAndRemoteHomeAnnotations;
        }
 
        public boolean isConvertEntityBeansToPojos() {
@@ -219,4 +224,12 @@
        public void setGenerateEntityManagerCode(boolean 
generateEntityManagerCode) {
                this.generateEntityManagerCode = generateEntityManagerCode;
        }
+
+       public boolean isUseHomeInterface() {
+               return useHomeInterface;
+       }
+
+       public void setUseHomeInterface(boolean useHomeInterface) {
+               this.useHomeInterface = useHomeInterface;
+       }
 }

Modified: 
openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.apache.openejb.helper.annotation/src/main/resources/org/apache/openejb/helper/annotation/wizards/messages.properties
URL: 
http://svn.apache.org/viewvc/openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.apache.openejb.helper.annotation/src/main/resources/org/apache/openejb/helper/annotation/wizards/messages.properties?rev=770216&r1=770215&r2=770216&view=diff
==============================================================================
--- 
openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.apache.openejb.helper.annotation/src/main/resources/org/apache/openejb/helper/annotation/wizards/messages.properties
 (original)
+++ 
openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.apache.openejb.helper.annotation/src/main/resources/org/apache/openejb/helper/annotation/wizards/messages.properties
 Thu Apr 30 13:16:27 2009
@@ -28,7 +28,8 @@
 
org.apache.openejb.helper.annotation.wizards.ejbJarSelectionWzd.label.openEjbJarXml=openejb-jar.xml
 location (optional)
 
org.apache.openejb.helper.annotation.wizards.ejbJarSelectionWzd.selectionListener.filename.2=Select
 openejb-jar.xml file
 
org.apache.openejb.helper.annotation.wizards.ejbJarSelectionWzd.button.alterSessionBeanIface=Alter
 session bean interfaces
-org.apache.openejb.helper.annotation.wizards.ejbJarSelectionWzd.button.addRemoteAnnotations=Add
 @Remote and @RemoteHome annotations
+org.apache.openejb.helper.annotation.wizards.ejbJarSelectionWzd.button.addRemoteAnnotations=Add
 @Remote / @RemoteHome / @Local / @LocalHome annotations
+org.apache.openejb.helper.annotation.wizards.ejbJarSelectionWzd.button.useHomeInterface=Use
 home interface
 
org.apache.openejb.helper.annotation.wizards.ejbJarSelectionWzd.button.convertEntityBeans=Convert
 entity beans to POJOs
 
org.apache.openejb.helper.annotation.wizards.ejbJarSelectionWzd.button.generateEntityFactoryCode=Generate
 entity manager code
 
org.apache.openejb.helper.annotation.wizards.projectSelectionWzd.pageErrorMsg.1=Please
 select a project


Reply via email to