Author: rob.stryker(a)jboss.com
Date: 2007-08-17 17:40:11 -0400 (Fri, 17 Aug 2007)
New Revision: 3229
Added:
trunk/as/plugins/org.jboss.ide.eclipse.as.classpath.core/lib/
trunk/as/plugins/org.jboss.ide.eclipse.as.classpath.core/lib/javaee-5.0/
trunk/as/plugins/org.jboss.ide.eclipse.as.classpath.core/lib/javaee-5.0/jboss-javaee.jar
trunk/as/plugins/org.jboss.ide.eclipse.as.classpath.core/libsrc/
trunk/as/plugins/org.jboss.ide.eclipse.as.classpath.core/libsrc/javaee-5.0/
trunk/as/plugins/org.jboss.ide.eclipse.as.classpath.core/libsrc/javaee-5.0/jboss-javaee-sources.jar
trunk/as/plugins/org.jboss.ide.eclipse.as.classpath.core/src/org/jboss/ide/eclipse/as/classpath/core/jee/
trunk/as/plugins/org.jboss.ide.eclipse.as.classpath.core/src/org/jboss/ide/eclipse/as/classpath/core/jee/AbstractClasspathContainer.java
trunk/as/plugins/org.jboss.ide.eclipse.as.classpath.core/src/org/jboss/ide/eclipse/as/classpath/core/jee/AbstractClasspathContainerInitializer.java
trunk/as/plugins/org.jboss.ide.eclipse.as.classpath.core/src/org/jboss/ide/eclipse/as/classpath/core/jee/J2EE13ClasspathContainerInitializer.java
trunk/as/plugins/org.jboss.ide.eclipse.as.classpath.core/src/org/jboss/ide/eclipse/as/classpath/core/jee/J2EE14ClasspathContainerInitializer.java
trunk/as/plugins/org.jboss.ide.eclipse.as.classpath.core/src/org/jboss/ide/eclipse/as/classpath/core/jee/J2EE50ClasspathContainerInitializer.java
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.classpath.core/META-INF/MANIFEST.MF
trunk/as/plugins/org.jboss.ide.eclipse.as.classpath.core/plugin.xml
Log:
Initial re-implementation / cleanup of old j2ee libraries.
Preparation for fixing JBIDE-419
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.classpath.core/META-INF/MANIFEST.MF
===================================================================
---
trunk/as/plugins/org.jboss.ide.eclipse.as.classpath.core/META-INF/MANIFEST.MF 2007-08-17
18:12:02 UTC (rev 3228)
+++
trunk/as/plugins/org.jboss.ide.eclipse.as.classpath.core/META-INF/MANIFEST.MF 2007-08-17
21:40:11 UTC (rev 3229)
@@ -15,5 +15,7 @@
org.jboss.ide.eclipse.as.core
Eclipse-LazyStart: true
Export-Package: org.jboss.ide.eclipse.as.classpath.core,
- org.jboss.ide.eclipse.as.classpath.core.ejb3
+ org.jboss.ide.eclipse.as.classpath.core.ejb3,
+ org.jboss.ide.eclipse.as.classpath.core.jee,
+ org.jboss.ide.eclipse.as.classpath.core.runtime
Bundle-Vendor: JBoss, a division of Red Hat
Added:
trunk/as/plugins/org.jboss.ide.eclipse.as.classpath.core/lib/javaee-5.0/jboss-javaee.jar
===================================================================
(Binary files differ)
Property changes on:
trunk/as/plugins/org.jboss.ide.eclipse.as.classpath.core/lib/javaee-5.0/jboss-javaee.jar
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added:
trunk/as/plugins/org.jboss.ide.eclipse.as.classpath.core/libsrc/javaee-5.0/jboss-javaee-sources.jar
===================================================================
(Binary files differ)
Property changes on:
trunk/as/plugins/org.jboss.ide.eclipse.as.classpath.core/libsrc/javaee-5.0/jboss-javaee-sources.jar
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.classpath.core/plugin.xml
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.classpath.core/plugin.xml 2007-08-17
18:12:02 UTC (rev 3228)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.classpath.core/plugin.xml 2007-08-17
21:40:11 UTC (rev 3229)
@@ -55,6 +55,25 @@
class="org.jboss.ide.eclipse.as.classpath.core.runtime.ProjectRuntimeClasspathProvider$RuntimeClasspathContainerInitializer"
id="org.jboss.ide.eclipse.as.classpath.core.runtime.ProjectRuntimeInitializer">
</classpathContainerInitializer>
- </extension>
+ </extension>
+
+
+
+ <!-- J2EE Libraries -->
+ <extension
+ point="org.eclipse.jdt.core.classpathContainerInitializer">
+ <classpathContainerInitializer
+
class="org.jboss.ide.eclipse.as.classpath.core.jee.J2EE13ClasspathContainerInitializer"
+ id="org.jboss.ide.eclipse.as.classpath.core.j2ee-1.3">
+ </classpathContainerInitializer>
+ <classpathContainerInitializer
+
class="org.jboss.ide.eclipse.as.classpath.core.jee.J2EE14ClasspathContainerInitializer"
+ id="org.jboss.ide.eclipse.as.classpath.core.j2ee-1.4">
+ </classpathContainerInitializer>
+ <classpathContainerInitializer
+
class="org.jboss.ide.eclipse.as.classpath.core.jee.J2EE50ClasspathContainerInitializer"
+ id="org.jboss.ide.eclipse.as.classpath.core.javaee-5.0">
+ </classpathContainerInitializer>
+ </extension>
</plugin>
Added:
trunk/as/plugins/org.jboss.ide.eclipse.as.classpath.core/src/org/jboss/ide/eclipse/as/classpath/core/jee/AbstractClasspathContainer.java
===================================================================
---
trunk/as/plugins/org.jboss.ide.eclipse.as.classpath.core/src/org/jboss/ide/eclipse/as/classpath/core/jee/AbstractClasspathContainer.java
(rev 0)
+++
trunk/as/plugins/org.jboss.ide.eclipse.as.classpath.core/src/org/jboss/ide/eclipse/as/classpath/core/jee/AbstractClasspathContainer.java 2007-08-17
21:40:11 UTC (rev 3229)
@@ -0,0 +1,134 @@
+/*
+ * JBoss, a division of Red Hat
+ * Copyright 2006, Red Hat Middleware, LLC, and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+package org.jboss.ide.eclipse.as.classpath.core.jee;
+
+import java.io.File;
+import java.io.FileFilter;
+import java.io.IOException;
+import java.net.URL;
+import java.util.ArrayList;
+
+import org.eclipse.core.runtime.FileLocator;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.jdt.core.IClasspathContainer;
+import org.eclipse.jdt.core.IClasspathEntry;
+import org.eclipse.jdt.core.JavaCore;
+import org.jboss.ide.eclipse.as.classpath.core.ClasspathCorePlugin;
+
+public abstract class AbstractClasspathContainer implements IClasspathContainer {
+
+ public static final String LIB_FOLDER = "lib";
+ public static final String LIB_SOURCE_FOLDER = "libsrc";
+ public final static String CLASSPATH_CONTAINER_PREFIX =
"org.jboss.ide.eclipse.as.classpath.core";
+
+ protected IClasspathEntry[] entries;
+ protected IPath path;
+ protected String description;
+ protected String libFolder;
+
+ public AbstractClasspathContainer(IPath path, String description,
+ String libFolder) {
+ this.path = path;
+ this.description = description;
+ this.libFolder = libFolder;
+ }
+
+ public IClasspathEntry[] getClasspathEntries() {
+ if (entries == null) {
+ entries = computeEntries();
+ }
+ return entries;
+ }
+
+ public String getDescription() {
+ return this.description;
+ }
+
+ public int getKind() {
+ return IClasspathContainer.K_APPLICATION;
+ }
+
+ public IPath getPath() {
+ return this.path;
+ }
+
+ protected IClasspathEntry[] computeEntries() {
+ ArrayList entries = new ArrayList();
+
+ String baseDir = getBaseDir();
+ if (baseDir == null)
+ return new IClasspathEntry[0];
+
+ File libDir = new File(baseDir
+ + "/" + LIB_FOLDER + "/" + getLibFolder());//$NON-NLS-1$
//$NON-NLS-2$
+ File libSrcDir = new File(baseDir
+ + "/" + LIB_SOURCE_FOLDER + "/" + getLibFolder());//$NON-NLS-1$
//$NON-NLS-2$
+
+ // Lists every modules in the lib dir
+ File[] jars = libDir.listFiles(new FileFilter() {
+ public boolean accept(File file) {
+ return (file.toString().endsWith(".jar"));//$NON-NLS-1$
+ }
+ });
+
+ if (jars != null) {
+ for (int i = 0; i < jars.length; i++) {
+ File jarFile = jars[i];
+ String jarFileName = jarFile.getName();
+ File jarSrcFile = new File(libSrcDir, jarFileName);
+
+ IPath entryPath = new Path(jarFile.toString());
+
+ IPath sourceAttachementPath = null;
+ IPath sourceAttachementRootPath = null;
+
+ if (jarSrcFile.exists()) {
+ sourceAttachementPath = new Path(jarSrcFile.toString());
+ sourceAttachementRootPath = new Path("/");//$NON-NLS-1$
+ }
+
+ IClasspathEntry entry = JavaCore.newLibraryEntry(entryPath,
+ sourceAttachementPath, sourceAttachementRootPath, true);
+ entries.add(entry);
+ }
+ }
+
+ return (IClasspathEntry[]) entries.toArray(new IClasspathEntry[entries
+ .size()]);
+ }
+
+ protected String getLibFolder() {
+ return this.libFolder;
+ }
+
+ protected String getBaseDir() {
+ try {
+ URL installURL = FileLocator.toFileURL(ClasspathCorePlugin
+ .getDefault().getBundle().getEntry("/"));
+ return installURL.getFile().toString();
+ } catch (IOException ioe) {
+ // LOG THE ERROR (one day)
+ }
+ return null;
+ }
+}
Added:
trunk/as/plugins/org.jboss.ide.eclipse.as.classpath.core/src/org/jboss/ide/eclipse/as/classpath/core/jee/AbstractClasspathContainerInitializer.java
===================================================================
---
trunk/as/plugins/org.jboss.ide.eclipse.as.classpath.core/src/org/jboss/ide/eclipse/as/classpath/core/jee/AbstractClasspathContainerInitializer.java
(rev 0)
+++
trunk/as/plugins/org.jboss.ide.eclipse.as.classpath.core/src/org/jboss/ide/eclipse/as/classpath/core/jee/AbstractClasspathContainerInitializer.java 2007-08-17
21:40:11 UTC (rev 3229)
@@ -0,0 +1,68 @@
+/*
+ * JBoss, a division of Red Hat
+ * Copyright 2006, Red Hat Middleware, LLC, and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+package org.jboss.ide.eclipse.as.classpath.core.jee;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.jdt.core.ClasspathContainerInitializer;
+import org.eclipse.jdt.core.IClasspathContainer;
+import org.eclipse.jdt.core.IJavaProject;
+import org.eclipse.jdt.core.JavaCore;
+
+public abstract class AbstractClasspathContainerInitializer extends
ClasspathContainerInitializer {
+ public AbstractClasspathContainerInitializer() {
+ }
+
+ /**
+ * Description of the Method
+ *
+ * @param containerPath Description of the Parameter
+ * @param project Description of the Parameter
+ * @exception CoreException Description of the Exception
+ */
+ public void initialize(IPath containerPath, IJavaProject project) throws CoreException
{
+ int size = containerPath.segmentCount();
+ if (size > 0) {
+ if (containerPath.segment(0).equals(this.getClasspathContainerID())) {
+ AbstractClasspathContainer container =
this.createClasspathContainer(containerPath);
+ JavaCore.setClasspathContainer(containerPath, new IJavaProject[]
+ {project}, new IClasspathContainer[]
+ {container}, null);
+ }
+ }
+ }
+
+ /**
+ * Description of the Method
+ *
+ * @param path Description of the Parameter
+ * @return Description of the Return Value
+ */
+ protected abstract AbstractClasspathContainer createClasspathContainer(IPath path);
+
+ /**
+ * Gets the classpathContainerID attribute of the
AbstractClasspathContainerInitializer object
+ *
+ * @return The classpathContainerID value
+ */
+ protected abstract String getClasspathContainerID();
+}
Added:
trunk/as/plugins/org.jboss.ide.eclipse.as.classpath.core/src/org/jboss/ide/eclipse/as/classpath/core/jee/J2EE13ClasspathContainerInitializer.java
===================================================================
---
trunk/as/plugins/org.jboss.ide.eclipse.as.classpath.core/src/org/jboss/ide/eclipse/as/classpath/core/jee/J2EE13ClasspathContainerInitializer.java
(rev 0)
+++
trunk/as/plugins/org.jboss.ide.eclipse.as.classpath.core/src/org/jboss/ide/eclipse/as/classpath/core/jee/J2EE13ClasspathContainerInitializer.java 2007-08-17
21:40:11 UTC (rev 3229)
@@ -0,0 +1,52 @@
+/*
+ * JBoss, a division of Red Hat
+ * Copyright 2006, Red Hat Middleware, LLC, and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+package org.jboss.ide.eclipse.as.classpath.core.jee;
+
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.jdt.core.IJavaProject;
+
+public class J2EE13ClasspathContainerInitializer extends
+ AbstractClasspathContainerInitializer {
+
+ public String getDescription(IPath containerPath, IJavaProject project) {
+ return "J2EE 1.3 Classpath Container Initializer";//$NON-NLS-1$
+ }
+
+ protected AbstractClasspathContainer createClasspathContainer(IPath path) {
+ return new J2EE13ClasspathContainer(path);
+ }
+
+ protected String getClasspathContainerID() {
+ return J2EE13ClasspathContainer.CLASSPATH_CONTAINER;
+ }
+
+ public class J2EE13ClasspathContainer extends AbstractClasspathContainer {
+ public final static String SUFFIX = "j2ee-1.3";//$NON-NLS-1$
+ public final static String CLASSPATH_CONTAINER = CLASSPATH_CONTAINER_PREFIX
+ + "." + J2EE13ClasspathContainer.SUFFIX;//$NON-NLS-1$
+ public final static String DESCRIPTION = "J2EE 1.3 Libraries (JBoss-IDE)";
+
+ public J2EE13ClasspathContainer(IPath path) {
+ super(path, DESCRIPTION, SUFFIX);
+ }
+ }
+}
Added:
trunk/as/plugins/org.jboss.ide.eclipse.as.classpath.core/src/org/jboss/ide/eclipse/as/classpath/core/jee/J2EE14ClasspathContainerInitializer.java
===================================================================
---
trunk/as/plugins/org.jboss.ide.eclipse.as.classpath.core/src/org/jboss/ide/eclipse/as/classpath/core/jee/J2EE14ClasspathContainerInitializer.java
(rev 0)
+++
trunk/as/plugins/org.jboss.ide.eclipse.as.classpath.core/src/org/jboss/ide/eclipse/as/classpath/core/jee/J2EE14ClasspathContainerInitializer.java 2007-08-17
21:40:11 UTC (rev 3229)
@@ -0,0 +1,31 @@
+package org.jboss.ide.eclipse.as.classpath.core.jee;
+
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.jdt.core.IJavaProject;
+
+public class J2EE14ClasspathContainerInitializer extends
+ AbstractClasspathContainerInitializer {
+
+ public String getDescription(IPath containerPath, IJavaProject project) {
+ return "J2EE 1.4 Classpath Container Initializer";//$NON-NLS-1$
+ }
+
+ protected AbstractClasspathContainer createClasspathContainer(IPath path) {
+ return new J2EE14ClasspathContainer(path);
+ }
+
+ protected String getClasspathContainerID() {
+ return J2EE14ClasspathContainer.CLASSPATH_CONTAINER;
+ }
+
+ public class J2EE14ClasspathContainer extends AbstractClasspathContainer {
+ public final static String SUFFIX = "j2ee-1.4";//$NON-NLS-1$
+ public final static String CLASSPATH_CONTAINER = CLASSPATH_CONTAINER_PREFIX
+ + "." + J2EE14ClasspathContainer.SUFFIX;//$NON-NLS-1$
+ public final static String DESCRIPTION = "J2EE 1.4 Libraries (JBoss-IDE)";
+
+ public J2EE14ClasspathContainer(IPath path) {
+ super(path, DESCRIPTION, SUFFIX);
+ }
+ }
+}
Added:
trunk/as/plugins/org.jboss.ide.eclipse.as.classpath.core/src/org/jboss/ide/eclipse/as/classpath/core/jee/J2EE50ClasspathContainerInitializer.java
===================================================================
---
trunk/as/plugins/org.jboss.ide.eclipse.as.classpath.core/src/org/jboss/ide/eclipse/as/classpath/core/jee/J2EE50ClasspathContainerInitializer.java
(rev 0)
+++
trunk/as/plugins/org.jboss.ide.eclipse.as.classpath.core/src/org/jboss/ide/eclipse/as/classpath/core/jee/J2EE50ClasspathContainerInitializer.java 2007-08-17
21:40:11 UTC (rev 3229)
@@ -0,0 +1,31 @@
+package org.jboss.ide.eclipse.as.classpath.core.jee;
+
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.jdt.core.IJavaProject;
+
+public class J2EE50ClasspathContainerInitializer extends
+ AbstractClasspathContainerInitializer {
+
+ public String getDescription(IPath containerPath, IJavaProject project) {
+ return "J2EE 5.0 Classpath Container Initializer";//$NON-NLS-1$
+ }
+
+ protected AbstractClasspathContainer createClasspathContainer(IPath path) {
+ return new J2EE50ClasspathContainer(path);
+ }
+
+ protected String getClasspathContainerID() {
+ return J2EE50ClasspathContainer.CLASSPATH_CONTAINER;
+ }
+
+ public class J2EE50ClasspathContainer extends AbstractClasspathContainer {
+ public final static String SUFFIX = "javaee-5.0";//$NON-NLS-1$
+ public final static String CLASSPATH_CONTAINER = CLASSPATH_CONTAINER_PREFIX
+ + "." + J2EE50ClasspathContainer.SUFFIX;//$NON-NLS-1$
+ public final static String DESCRIPTION = "J2EE 5.0 Libraries (JBoss-IDE)";
+
+ public J2EE50ClasspathContainer(IPath path) {
+ super(path, DESCRIPTION, SUFFIX);
+ }
+ }
+}