[jbosstools-commits] JBoss Tools SVN: r22940 - in trunk/as/plugins: org.jboss.ide.eclipse.as.classpath.core/src/org/jboss/ide/eclipse/as/classpath/core/ejb3 and 2 other directories.

jbosstools-commits at lists.jboss.org jbosstools-commits at lists.jboss.org
Wed Jun 23 03:23:11 EDT 2010


Author: rob.stryker at jboss.com
Date: 2010-06-23 03:23:11 -0400 (Wed, 23 Jun 2010)
New Revision: 22940

Modified:
   trunk/as/plugins/org.jboss.ide.eclipse.as.classpath.core/src/org/jboss/ide/eclipse/as/classpath/core/ejb3/EJB30SupportVerifier.java
   trunk/as/plugins/org.jboss.ide.eclipse.as.classpath.core/src/org/jboss/ide/eclipse/as/classpath/core/ejb3/EJB3ClasspathContainer.java
   trunk/as/plugins/org.jboss.ide.eclipse.as.classpath.core/src/org/jboss/ide/eclipse/as/classpath/core/messages.properties
   trunk/as/plugins/org.jboss.ide.eclipse.as.classpath.ui/src/org/jboss/ide/eclipse/as/classpath/ui/ejb3/JBossEJB3LibrariesPage.java
   trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/util/IJBossRuntimeResourceConstants.java
   trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/util/IJBossToolingConstants.java
Log:
JBIDE-6249 - trunk


Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.classpath.core/src/org/jboss/ide/eclipse/as/classpath/core/ejb3/EJB30SupportVerifier.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.classpath.core/src/org/jboss/ide/eclipse/as/classpath/core/ejb3/EJB30SupportVerifier.java	2010-06-23 07:10:04 UTC (rev 22939)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.classpath.core/src/org/jboss/ide/eclipse/as/classpath/core/ejb3/EJB30SupportVerifier.java	2010-06-23 07:23:11 UTC (rev 22940)
@@ -17,6 +17,7 @@
 import org.eclipse.wst.server.core.IRuntime;
 import org.jboss.ide.eclipse.as.classpath.core.runtime.WebtoolsProjectJBossClasspathContainerInitializer.WebtoolsProjectJBossClasspathContainer;
 import org.jboss.ide.eclipse.as.core.server.IJBossServerRuntime;
+import org.jboss.ide.eclipse.as.core.util.IJBossToolingConstants;
 
 /**
  * 
@@ -24,7 +25,18 @@
  *
  */
 public class EJB30SupportVerifier {
+	protected static boolean definitelySupports(IRuntime rt) {
+		IJBossServerRuntime  jbRuntime = (IJBossServerRuntime)rt.loadAdapter(IJBossServerRuntime.class, null);
+		String jbossVersion = jbRuntime.getRuntime().getRuntimeType().getVersion();
+		if( jbossVersion.compareTo(IJBossToolingConstants.V5_0) < 0)
+			return false;
+		return true;
+	}
+	
 	public static boolean verify(IRuntime rt) {
+		if( definitelySupports(rt))
+			return true;
+		
 		IJBossServerRuntime ajbsr = (IJBossServerRuntime)rt.loadAdapter(IJBossServerRuntime.class, null);
 		//		 i refuse to verify. if they say they support, believe them
 		if( ajbsr == null ) return true;  

Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.classpath.core/src/org/jboss/ide/eclipse/as/classpath/core/ejb3/EJB3ClasspathContainer.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.classpath.core/src/org/jboss/ide/eclipse/as/classpath/core/ejb3/EJB3ClasspathContainer.java	2010-06-23 07:10:04 UTC (rev 22939)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.classpath.core/src/org/jboss/ide/eclipse/as/classpath/core/ejb3/EJB3ClasspathContainer.java	2010-06-23 07:23:11 UTC (rev 22940)
@@ -11,6 +11,7 @@
 
 package org.jboss.ide.eclipse.as.classpath.core.ejb3;
 
+import java.io.FileNotFoundException;
 import java.util.ArrayList;
 
 import org.eclipse.core.runtime.CoreException;
@@ -101,14 +102,18 @@
    }
 
    public IClasspathEntry[] getClasspathEntries() {
-      ArrayList entries = new ArrayList();
-      String id = jbossServer.getServer().getServerType().getRuntimeType().getId();
-      if( id.equals(AS_40)) return get40Jars();
-      if( id.equals(AS_42)) return get42Jars();
-      return (IClasspathEntry[]) entries.toArray(new IClasspathEntry[entries.size()]);
+	   try {
+	      String id = jbossServer.getServer().getServerType().getRuntimeType().getId();
+	      if( id.equals(AS_40)) return get40Jars(homePath, configPath);
+	      if( id.equals(AS_42)) return get42Jars(homePath, configPath);
+	      if( id.equals(AS_50)) return get50Jars(homePath, configPath);
+	      if( id.equals(AS_51)) return get51Jars(homePath, configPath);
+	      if( id.equals(AS_60)) return get60Jars(homePath, configPath);
+	   } catch( FileNotFoundException fnfe ) {}
+	   return new IClasspathEntry[]{};
    }
 
-   public IClasspathEntry[] get40Jars() {
+   protected static IClasspathEntry[] get40Jars(IPath homePath, IPath configPath)  throws FileNotFoundException {
 		ArrayList list = new ArrayList();
 
 		// path roots
@@ -128,9 +133,9 @@
 		// hibernate
 		list.add(getEntry(homePath.append(CLIENT).append(HIBERNATE_CLIENT_JAR)));
 		return (IClasspathEntry[]) list.toArray(new IClasspathEntry[list.size()]);
-   }
-   
-   public IClasspathEntry[] get42Jars() {
+  }
+  
+  protected static IClasspathEntry[] get42Jars(IPath homePath, IPath configPath) throws FileNotFoundException {
 		ArrayList list = new ArrayList();
 
 		// path roots
@@ -153,10 +158,58 @@
 		// persistence jar
 		list.add(getEntry(client.append(EJB3_PERSISTENCE_JAR)));
 		return (IClasspathEntry[]) list.toArray(new IClasspathEntry[list.size()]);
+  }
+   
+   protected static IClasspathEntry[] get50Jars(IPath homePath, IPath configPath)  throws FileNotFoundException {
+		IPath deployers = configPath.append(DEPLOYERS);
+		IPath deployer = deployers.append(EJB3_DEPLOYER);
+		IPath aopDeployer = deployers.append(AOP_JBOSS5_DEPLOYER);
+		IPath client = homePath.append(CLIENT);
+		ArrayList<IClasspathEntry> list = new ArrayList<IClasspathEntry>();
+		list.add(getEntry(aopDeployer.append(JBOSS5_ASPECT_LIBRARY_JAR)));
+		list.add(getEntry(deployer.append(JB5_EJB_DEPLOYER_JAR)));
+		list.add(getEntry(deployer.append(JB5_EJB_IIOP_JAR)));
+		list.add(getEntry(client.append(EJB3_PERSISTENCE_JAR)));
+		list.add(getEntry(client.append(jboss_ejb3_common_client)));
+		list.add(getEntry(client.append(jboss_ejb3_core_client)));
+		list.add(getEntry(client.append(jboss_ejb3_ext_api_impl)));
+		list.add(getEntry(client.append(jboss_ejb3_ext_api)));
+		list.add(getEntry(client.append(jboss_ejb3_proxy_client)));
+		list.add(getEntry(client.append(jboss_ejb3_proxy_clustered_client)));
+		list.add(getEntry(client.append(jboss_ejb3_security_client)));
+		list.add(getEntry(homePath.append(CLIENT).append(JB50_HIBERNATE_ANNOTATIONS_JAR)));
+		return (IClasspathEntry[]) list.toArray(new IClasspathEntry[list.size()]);
    }
-   
 
-	protected IClasspathEntry getEntry(IPath path) {
+   protected static IClasspathEntry[] get51Jars(IPath homePath, IPath configPath)  throws FileNotFoundException {
+		return get50Jars(homePath, configPath);
+   }
+
+   protected static IClasspathEntry[] get60Jars(IPath homePath, IPath configPath)  throws FileNotFoundException {
+		IPath deployers = configPath.append(DEPLOYERS);
+		IPath aopDeployer = deployers.append(AOP_JBOSS5_DEPLOYER);
+		IPath client = homePath.append(CLIENT);
+		ArrayList<IClasspathEntry> list = new ArrayList<IClasspathEntry>();
+		list.add(getEntry(aopDeployer.append(JBOSS6_AOP_ASPECTS_JAR)));
+		list.add(getEntry(aopDeployer.append(JBOSS6_AS_ASPECT_LIBRARY_JAR)));
+		list.add(getEntry(deployers.append(JB6_EJB3_ENDPOINT_DEPLOYER_JAR)));
+		list.add(getEntry(deployers.append(JB6_EJB3_METRICS_DEPLOYER_JAR)));
+		list.add(getEntry(client.append(jboss_ejb3_common_client)));
+		list.add(getEntry(client.append(jboss_ejb3_core_client)));
+		list.add(getEntry(client.append(jboss_ejb3_ext_api_impl)));
+		list.add(getEntry(client.append(jboss_ejb3_ext_api)));
+		list.add(getEntry(client.append(jboss6_ejb3_proxy_spi_client)));
+		list.add(getEntry(client.append(jboss6_ejb3_proxy_impl_client)));
+		list.add(getEntry(client.append(jboss_ejb3_proxy_clustered_client)));
+		list.add(getEntry(client.append(jboss_ejb3_security_client)));
+		list.add(getEntry(homePath.append(CLIENT).append(JB50_HIBERNATE_ANNOTATIONS_JAR)));
+		return (IClasspathEntry[]) list.toArray(new IClasspathEntry[list.size()]);
+   }   
+
+	protected static IClasspathEntry getEntry(IPath path) throws FileNotFoundException {
+		System.out.println("ls " + path.toOSString().substring(45));
+		if( !path.toFile().exists())
+			throw new FileNotFoundException();
 		return JavaRuntime.newArchiveRuntimeClasspathEntry(path).getClasspathEntry();
 	}
 

Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.classpath.core/src/org/jboss/ide/eclipse/as/classpath/core/messages.properties
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.classpath.core/src/org/jboss/ide/eclipse/as/classpath/core/messages.properties	2010-06-23 07:10:04 UTC (rev 22939)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.classpath.core/src/org/jboss/ide/eclipse/as/classpath/core/messages.properties	2010-06-23 07:23:11 UTC (rev 22940)
@@ -4,7 +4,7 @@
 DirectoryLibraryContainerInitializer_libraries_found_no_dir=Libraries found in [No directory specified]
 DirectoryLibraryContainerInitializer_libraries_found_in_dir=Libraries found in {0}
 EJB3ClasspathContainer_ejb3_description=JBoss EJB3 Libraries
-EJB3ClasspathContainer_ejb30_description=JBoss EJB 3.0 Libraries
+EJB3ClasspathContainer_ejb30_description=JBoss EJB 3.x Libraries
 J2EE13ClasspathContainerInitializer_description=J2EE 1.3 Libraries (JBoss Tools)
 J2EE14ClasspathContainerInitializer_description=J2EE 1.4 Libraries (JBoss Tools)
 J2EE50ClasspathContainerInitializer_description=J2EE 5.0 Libraries (JBoss Tools)

Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.classpath.ui/src/org/jboss/ide/eclipse/as/classpath/ui/ejb3/JBossEJB3LibrariesPage.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.classpath.ui/src/org/jboss/ide/eclipse/as/classpath/ui/ejb3/JBossEJB3LibrariesPage.java	2010-06-23 07:10:04 UTC (rev 22939)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.classpath.ui/src/org/jboss/ide/eclipse/as/classpath/ui/ejb3/JBossEJB3LibrariesPage.java	2010-06-23 07:23:11 UTC (rev 22940)
@@ -22,13 +22,16 @@
 package org.jboss.ide.eclipse.as.classpath.ui.ejb3;
 
 import java.text.MessageFormat;
+
 import org.eclipse.core.runtime.Path;
 import org.eclipse.jdt.core.IClasspathEntry;
 import org.eclipse.jdt.core.JavaCore;
 import org.eclipse.jdt.ui.wizards.IClasspathContainerPage;
+import org.eclipse.jface.viewers.ISelectionChangedListener;
+import org.eclipse.jface.viewers.SelectionChangedEvent;
+import org.eclipse.swt.widgets.Composite;
 import org.jboss.ide.eclipse.as.classpath.core.ejb3.EJB30SupportVerifier;
 import org.jboss.ide.eclipse.as.classpath.core.ejb3.EJB3ClasspathContainer;
-import org.jboss.ide.eclipse.as.classpath.ui.ClasspathUIPlugin;
 import org.jboss.ide.eclipse.as.classpath.ui.Messages;
 import org.jboss.ide.eclipse.as.core.server.internal.JBossServer;
 
@@ -49,31 +52,44 @@
       
    }
 
+   public void createControl(Composite parent) {
+	   super.createControl(parent);
+	   servers.addSelectionChangedListener(new ISelectionChangedListener() {
+		@Override
+		public void selectionChanged(SelectionChangedEvent event) {
+			validateSelection();
+		}
+	});
+   }
+   
+   
+   protected void validateSelection() {
+	   if( !jbossServerHasEJB3(jbossServer)) {
+		   String error = MessageFormat.format(
+					Messages.JBossEJB3LibrariesPage_ConfigurationDoesNotContainEJB3Libraries,
+					jbossServer.getServer().getName());
+		   setErrorMessage(error);
+		   getContainer().updateButtons();
+	   } else {
+		   setErrorMessage(null);
+	   }
+   }
+   
    private boolean jbossServerHasEJB3(JBossServer jbossServer) {
 	   return EJB30SupportVerifier.verify(jbossServer.getServer().getRuntime());
    }
 
    public boolean finish() {
-
-      if (jbossServer != null) {
-         if (jbossServerHasEJB3(jbossServer)) {
+      if (jbossServer != null && jbossServerHasEJB3(jbossServer)) {
             classpathEntry = JavaCore.newContainerEntry(new Path(EJB3ClasspathContainer.CONTAINER_ID)
                   .append(jbossServer.getServer().getName()), true);
             return true;
-         } else {
-            ClasspathUIPlugin
-                  .error(MessageFormat
-						.format(
-								Messages.JBossEJB3LibrariesPage_ConfigurationDoesNotContainEJB3Libraries,
-								jbossServer.getServer().getName()));
-         }
       }
-
       return false;
    }
 
    public boolean isPageComplete()  {
-      return jbossServer != null && isCurrentPage();
+      return jbossServer != null && isCurrentPage() && jbossServerHasEJB3(jbossServer);
    }
 
    public IClasspathEntry getSelection() {

Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/util/IJBossRuntimeResourceConstants.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/util/IJBossRuntimeResourceConstants.java	2010-06-23 07:10:04 UTC (rev 22939)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/util/IJBossRuntimeResourceConstants.java	2010-06-23 07:23:11 UTC (rev 22940)
@@ -37,12 +37,15 @@
 	public static final String JSF_LIB = "jsf-libs"; //$NON-NLS-1$
 	public static final String JBOSSWEB_TOMCAT55_SAR = "jbossweb-tomcat55.sar"; //$NON-NLS-1$
 	public static final String JBOSSWEB_SAR = "jbossweb.sar"; //$NON-NLS-1$
+	public static final String JSTL_JAR = "jstl.jar"; //$NON-NLS-1$
 	public static final String JBOSS_WEB_SERVICE_JAR = "jboss-web-service.jar";  //$NON-NLS-1$
-	public static final String JSTL_JAR = "jstl.jar";  //$NON-NLS-1$
 	public static final String EJB3_DEPLOYER = "ejb3.deployer"; //$NON-NLS-1$
+	public static final String JB6_EJB3_ENDPOINT_DEPLOYER_JAR = "jboss-ejb3-endpoint-deployer.jar";//$NON-NLS-1$
+	public static final String JB6_EJB3_METRICS_DEPLOYER_JAR = "jboss-ejb3-metrics-deployer.jar";//$NON-NLS-1$
 	public static final String WEBBEANS_DEPLOYER = "webbeans.deployer"; //$NON-NLS-1$
 	public static final String AS5_AOP_DEPLOYER = "jboss-aop-jboss5.deployer"; //$NON-NLS-1$
 	public static final String AOP_JDK5_DEPLOYER = "jboss-aop-jdk50.deployer"; //$NON-NLS-1$
+	public static final String AOP_JBOSS5_DEPLOYER = "jboss-aop-jboss5.deployer"; //$NON-NLS-1$
 	public static final String JBOSS_AOP_JDK5_JAR = "jboss-aop-jdk50.jar"; //$NON-NLS-1$
 	public static final String JBOSS_WEB_DEPLOYER = "jboss-web.deployer"; //$NON-NLS-1$
 	public static final String REST_EASY_DEPLOYER = "resteasy.deployer"; //$NON-NLS-1$
@@ -55,8 +58,26 @@
 	public static final String JBOSS_EJB3_JAR = "jboss-ejb3.jar"; //$NON-NLS-1$
 	public static final String JBOSS_ANNOTATIONS_EJB3_JAR = "jboss-annotations-ejb3.jar"; //$NON-NLS-1$
 	public static final String EJB3_PERSISTENCE_JAR = "ejb3-persistence.jar"; //$NON-NLS-1$
+	public static final String JB5_EJB_DEPLOYER_JAR = "jboss-ejb3-deployer.jar"; //$NON-NLS-1$
+	public static final String JB5_EJB_IIOP_JAR = "jboss-ejb3-iiop.jar"; //$NON-NLS-1$
+	public static final String jboss_ejb3_common_client = "jboss-ejb3-common-client.jar";//$NON-NLS-1$
+	public static final String jboss_ejb3_core_client = "jboss-ejb3-core-client.jar";//$NON-NLS-1$
+	public static final String jboss_ejb3_ext_api_impl = "jboss-ejb3-ext-api-impl.jar";//$NON-NLS-1$
+	public static final String jboss_ejb3_ext_api = "jboss-ejb3-ext-api.jar";//$NON-NLS-1$
+	public static final String jboss_ejb3_proxy_client = "jboss-ejb3-proxy-client.jar";//$NON-NLS-1$
+	public static final String jboss6_ejb3_proxy_spi_client = "jboss-ejb3-proxy-spi-client.jar";//$NON-NLS-1$
+	public static final String jboss6_ejb3_proxy_impl_client = "jboss-ejb3-proxy-impl-client.jar";//$NON-NLS-1$
+	
+	public static final String jboss_ejb3_proxy_clustered_client = "jboss-ejb3-proxy-clustered-client.jar";//$NON-NLS-1$
+	public static final String jboss_ejb3_security_client = "jboss-ejb3-security-client.jar";//$NON-NLS-1$
+
 	public static final String JBOSS_ASPECT_LIBRARY_JDK5_0 = "jboss-aspect-library-jdk50.jar"; //$NON-NLS-1$
+	public static final String JBOSS5_ASPECT_LIBRARY_JAR = "jboss-aspect-library.jar"; //$NON-NLS-1$
+	public static final String JBOSS6_AOP_ASPECTS_JAR = "jboss-aop-aspects.jar"; //$NON-NLS-1$
+	public static final String JBOSS6_AS_ASPECT_LIBRARY_JAR = "jboss-as-aspects-jboss-aspect-library.jar"; //$NON-NLS-1$
+	
 	public static final String HIBERNATE_CLIENT_JAR = "hibernate-client.jar";  //$NON-NLS-1$
+	public static final String JB50_HIBERNATE_ANNOTATIONS_JAR = "hibernate-annotations.jar"; //$NON-NLS-1$
 	public static final String JBOSSALL_CLIENT_JAR = "jbossall-client.jar"; //$NON-NLS-1$
 	public static final String JBOSSWEB_TOMCAT_50_SAR = "jbossweb-tomcat50.sar"; //$NON-NLS-1$
 	public static final String JSR299_API_JAR = "jsr299-api.jar"; //$NON-NLS-1$

Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/util/IJBossToolingConstants.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/util/IJBossToolingConstants.java	2010-06-23 07:10:04 UTC (rev 22939)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/util/IJBossToolingConstants.java	2010-06-23 07:23:11 UTC (rev 22940)
@@ -41,6 +41,8 @@
 	public static final String V4_0 = "4.0"; //$NON-NLS-1$
 	public static final String V4_2 = "4.2"; //$NON-NLS-1$
 	public static final String V5_0 = "5.0"; //$NON-NLS-1$
+	public static final String V5_1 = "5.1"; //$NON-NLS-1$
+	public static final String V6_0 = "6.0"; //$NON-NLS-1$
 	
 	
 	/* Files or folders inside the TOOLING */



More information about the jbosstools-commits mailing list