Author: rob.stryker(a)jboss.com
Date: 2011-07-11 06:21:13 -0400 (Mon, 11 Jul 2011)
New Revision: 32808
Removed:
trunk/as/plugins/org.jboss.ide.eclipse.as.classpath.core/src/org/jboss/ide/eclipse/as/classpath/core/runtime/WebtoolsProjectJBossClasspathContainerInitializer.java
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.classpath.core/plugin.xml
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/runtime/ProjectRuntimeClasspathProvider.java
Log:
JBIDE-9324 removal of unneeded class, cleanup, removal of warnings
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 2011-07-11
10:20:00 UTC (rev 32807)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.classpath.core/plugin.xml 2011-07-11
10:21:13 UTC (rev 32808)
@@ -115,19 +115,8 @@
<factory
class="org.jboss.ide.eclipse.as.classpath.core.runtime.ProjectRuntimeClasspathProvider$Factory"/>
<type
class="org.eclipse.jst.common.project.facet.core.IClasspathProvider"/>
</adapter>
-
-
</extension>
-
- <extension
- point="org.eclipse.jdt.core.classpathContainerInitializer">
- <classpathContainerInitializer
-
class="org.jboss.ide.eclipse.as.classpath.core.runtime.WebtoolsProjectJBossClasspathContainerInitializer"
-
id="org.jboss.ide.eclipse.as.classpath.core.runtime.ProjectInitializer"/>
- </extension>
-
-
-
+
<extension
point="org.eclipse.jst.server.core.runtimeClasspathProviders">
<runtimeClasspathProvider
id="org.jboss.ide.eclipse.as.core.server.runtime.runtimeTarget"
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 2011-07-11
10:20:00 UTC (rev 32807)
+++
trunk/as/plugins/org.jboss.ide.eclipse.as.classpath.core/src/org/jboss/ide/eclipse/as/classpath/core/ejb3/EJB30SupportVerifier.java 2011-07-11
10:21:13 UTC (rev 32808)
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007 Red Hat, Inc.
+ * Copyright (c) 2011 Red Hat, Inc.
* Distributed under license by Red Hat, Inc. All rights reserved.
* This program is made available under the terms of the
* Eclipse Public License v1.0 which accompanies this distribution,
@@ -11,11 +11,10 @@
package org.jboss.ide.eclipse.as.classpath.core.ejb3;
+import java.io.FileNotFoundException;
+
import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.Path;
-import org.eclipse.jdt.core.IClasspathEntry;
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;
@@ -34,26 +33,24 @@
}
public static boolean verify(IRuntime rt) {
+ IJBossServerRuntime jbRuntime =
(IJBossServerRuntime)rt.loadAdapter(IJBossServerRuntime.class, null);
+ if( jbRuntime == null )
+ return false;
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;
+ if( rt.getRuntimeType().getVersion().equals(IJBossToolingConstants.V3_2))
+ return false;
- // one of ours. verify
- IPath path = new
Path("org.jboss.ide.eclipse.as.core.runtime.ProjectInitializer"); //$NON-NLS-1$
- path = path.append(rt.getId()).append("jst.ejb").append("3.0");
//$NON-NLS-1$ //$NON-NLS-2$
-
- WebtoolsProjectJBossClasspathContainer container =
- new WebtoolsProjectJBossClasspathContainer(path);
- IClasspathEntry[] entries = container.getClasspathEntries();
- if( entries.length == 0 ) return false;
- IPath p;
- for( int i = 0; i < entries.length; i++ ) {
- p = entries[i].getPath();
- if( !p.toFile().exists())
- return false;
+ IPath serverHome = rt.getLocation();
+ IPath configPath = jbRuntime.getConfigurationFullPath();
+
+ try {
+ if( rt.getRuntimeType().getVersion().equals(IJBossToolingConstants.V4_0))
+ EJB3ClasspathContainer.get40Jars(serverHome, configPath);
+ else if( rt.getRuntimeType().getVersion().equals(IJBossToolingConstants.V4_2))
+ EJB3ClasspathContainer.get42Jars(serverHome, configPath);
+ } catch(FileNotFoundException fnfe) {
+ return false;
}
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 2011-07-11
10:20:00 UTC (rev 32807)
+++
trunk/as/plugins/org.jboss.ide.eclipse.as.classpath.core/src/org/jboss/ide/eclipse/as/classpath/core/ejb3/EJB3ClasspathContainer.java 2011-07-11
10:21:13 UTC (rev 32808)
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007 Red Hat, Inc.
+ * Copyright (c) 2011 Red Hat, Inc.
* Distributed under license by Red Hat, Inc. All rights reserved.
* This program is made available under the terms of the
* Eclipse Public License v1.0 which accompanies this distribution,
@@ -119,8 +119,8 @@
return new IClasspathEntry[]{};
}
- protected static IClasspathEntry[] get40Jars(IPath homePath, IPath configPath) throws
FileNotFoundException {
- ArrayList list = new ArrayList();
+ public static IClasspathEntry[] get40Jars(IPath homePath, IPath configPath) throws
FileNotFoundException {
+ ArrayList<IClasspathEntry> list = new ArrayList<IClasspathEntry>();
// path roots
IPath deploy = configPath.append(DEPLOY);
@@ -141,8 +141,8 @@
return (IClasspathEntry[]) list.toArray(new IClasspathEntry[list.size()]);
}
- protected static IClasspathEntry[] get42Jars(IPath homePath, IPath configPath) throws
FileNotFoundException {
- ArrayList list = new ArrayList();
+ public static IClasspathEntry[] get42Jars(IPath homePath, IPath configPath) throws
FileNotFoundException {
+ ArrayList<IClasspathEntry> list = new ArrayList<IClasspathEntry>();
// path roots
IPath deploy = configPath.append(DEPLOY);
@@ -213,7 +213,6 @@
}
protected static IClasspathEntry getEntry(IPath path) throws FileNotFoundException {
- System.out.println("ls " + path.toOSString().substring(45)); //$NON-NLS-1$
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/runtime/ProjectRuntimeClasspathProvider.java
===================================================================
---
trunk/as/plugins/org.jboss.ide.eclipse.as.classpath.core/src/org/jboss/ide/eclipse/as/classpath/core/runtime/ProjectRuntimeClasspathProvider.java 2011-07-11
10:20:00 UTC (rev 32807)
+++
trunk/as/plugins/org.jboss.ide.eclipse.as.classpath.core/src/org/jboss/ide/eclipse/as/classpath/core/runtime/ProjectRuntimeClasspathProvider.java 2011-07-11
10:21:13 UTC (rev 32808)
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007 Red Hat, Inc.
+ * Copyright (c) 2011 Red Hat, Inc.
* Distributed under license by Red Hat, Inc. All rights reserved.
* This program is made available under the terms of the
* Eclipse Public License v1.0 which accompanies this distribution,
@@ -11,7 +11,7 @@
package org.jboss.ide.eclipse.as.classpath.core.runtime;
-import java.text.MessageFormat;
+import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
@@ -27,6 +27,8 @@
import org.eclipse.jdt.core.IClasspathEntry;
import org.eclipse.jdt.core.IJavaProject;
import org.eclipse.jdt.core.JavaCore;
+import org.eclipse.jdt.launching.IVMInstall;
+import org.eclipse.jdt.launching.JavaRuntime;
import org.eclipse.jst.common.project.facet.core.IClasspathProvider;
import org.eclipse.jst.common.project.facet.core.JavaFacet;
import org.eclipse.wst.common.project.facet.core.IProjectFacet;
@@ -36,7 +38,8 @@
import org.eclipse.wst.server.core.ServerCore;
import org.jboss.ide.eclipse.as.classpath.core.ClasspathCorePlugin;
import org.jboss.ide.eclipse.as.classpath.core.Messages;
-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.IWTPConstants;
/**
* This class acts as a front to add whatever entries are available
@@ -46,7 +49,6 @@
*
*/
public class ProjectRuntimeClasspathProvider implements IClasspathProvider {
- public static final String CONTAINER_ID =
"org.jboss.ide.eclipse.as.classpath.core.runtime.ProjectInitializer";
//$NON-NLS-1$
private IRuntimeComponent rc;
public ProjectRuntimeClasspathProvider() {
@@ -56,43 +58,59 @@
this.rc = rc;
}
- public List getClasspathEntries(final IProjectFacetVersion fv) {
- IPath path = null;
+ public List<IClasspathEntry> getClasspathEntries(final IProjectFacetVersion fv) {
if( fv.getProjectFacet().equals(JavaFacet.FACET)) {
- path = new Path(CONTAINER_ID);
- path = path.append(rc.getProperty("id")); //$NON-NLS-1$
- path = path.append(fv.getProjectFacet().getId());
- path = path.append(fv.getVersionString());
- IClasspathEntry[] entries =
- new WebtoolsProjectJBossClasspathContainer(path).getClasspathEntries();
- return Arrays.asList(entries);
+ return getJavaClasspathEntries();
} else if( isPrimaryFacet(fv.getProjectFacet()) ||
isSecondaryFacet(fv.getProjectFacet())) {
- String id = rc.getProperty("id"); //$NON-NLS-1$
- IPath containerPath = new
Path("org.eclipse.jst.server.core.container").append("org.jboss.ide.eclipse.as.core.server.runtime.runtimeTarget");
//$NON-NLS-1$ //$NON-NLS-2$
- path = containerPath.append(id);
+ return getClientAllClasspathEntry();
}
- if( path != null ) {
- IClasspathEntry cpentry = JavaCore.newContainerEntry(path);
- return Collections.singletonList(cpentry);
- }
return Collections.emptyList();
}
+ private List<IClasspathEntry> getJavaClasspathEntries() {
+ String runtimeId = rc.getProperty("id"); //$NON-NLS-1$
+ if( runtimeId != null ) {
+ IRuntime runtime = ServerCore.findRuntime(runtimeId);
+ if( runtime != null ) {
+ IJBossServerRuntime jbsRuntime =
(IJBossServerRuntime)runtime.loadAdapter(IJBossServerRuntime.class, null);
+ IVMInstall vmInstall = jbsRuntime.getVM();
+ if (vmInstall != null) {
+ String name = vmInstall.getName();
+ String typeId = vmInstall.getVMInstallType().getId();
+ IClasspathEntry[] entries = new IClasspathEntry[] {
+ JavaCore.newContainerEntry(new Path(JavaRuntime.JRE_CONTAINER)
+ .append(typeId).append(name))
+ };
+ return Arrays.asList(entries);
+ }
+ }
+ }
+ return new ArrayList<IClasspathEntry>();
+ }
+
+ private List<IClasspathEntry> getClientAllClasspathEntry() {
+ String id = rc.getProperty("id"); //$NON-NLS-1$
+ IPath containerPath = new Path("org.eclipse.jst.server.core.container")
//$NON-NLS-1$
+ .append("org.jboss.ide.eclipse.as.core.server.runtime.runtimeTarget");
//$NON-NLS-1$
+ IClasspathEntry cpentry = JavaCore.newContainerEntry(containerPath.append(id));
+ return Collections.singletonList(cpentry);
+ }
+
// Bad name, I know, but checks if this is
// an ear, war, ejb, or other top level facet
protected boolean isPrimaryFacet(IProjectFacet facet) {
- return
facet.getId().equals(WebtoolsProjectJBossClasspathContainerInitializer.FACET_WEB)
- || facet.getId().equals(WebtoolsProjectJBossClasspathContainerInitializer.FACET_EJB)
- || facet.getId().equals(WebtoolsProjectJBossClasspathContainerInitializer.FACET_EAR)
- ||
facet.getId().equals(WebtoolsProjectJBossClasspathContainerInitializer.FACET_CONNECTOR)
- ||
facet.getId().equals(WebtoolsProjectJBossClasspathContainerInitializer.FACET_APP_CLIENT);
+ return facet.getId().equals(IWTPConstants.FACET_WEB)
+ || facet.getId().equals(IWTPConstants.FACET_EJB)
+ || facet.getId().equals(IWTPConstants.FACET_EAR)
+ || facet.getId().equals(IWTPConstants.FACET_CONNECTOR)
+ || facet.getId().equals(IWTPConstants.FACET_APP_CLIENT);
}
// Also a bad name, but facets the server automatically knows
// how to provide classpath entries for
protected boolean isSecondaryFacet(IProjectFacet facet) {
- return
facet.getId().equals(WebtoolsProjectJBossClasspathContainerInitializer.FACET_JSF)
- || facet.getId().equals(WebtoolsProjectJBossClasspathContainerInitializer.FACET_JPA);
+ return facet.getId().equals(IWTPConstants.FACET_JSF)
+ || facet.getId().equals(IWTPConstants.FACET_JPA);
}
public static final class Factory implements IAdapterFactory {
@@ -128,10 +146,8 @@
if( rt == null )
throw new CoreException(
new Status( IStatus.ERROR, ClasspathCorePlugin.PLUGIN_ID,
- MessageFormat
- .format(
- Messages.ProjectRuntimeClasspathProvider_runtime_does_not_exist,
- path.segment(1))));
+ Messages.bind(Messages.ProjectRuntimeClasspathProvider_runtime_does_not_exist,
+ path.segment(1))));
}
public IClasspathEntry[] getClasspathEntries() {
@@ -139,7 +155,7 @@
}
public String getDescription() {
- return
MessageFormat.format(Messages.ProjectRuntimeClasspathProvider_all_jboss_libraries_description,
(rt == null ? "null" : rt.getName())); //$NON-NLS-1$
+ return
Messages.bind(Messages.ProjectRuntimeClasspathProvider_all_jboss_libraries_description,
(rt == null ? "null" : rt.getName())); //$NON-NLS-1$
}
public int getKind() {
Deleted:
trunk/as/plugins/org.jboss.ide.eclipse.as.classpath.core/src/org/jboss/ide/eclipse/as/classpath/core/runtime/WebtoolsProjectJBossClasspathContainerInitializer.java
===================================================================
---
trunk/as/plugins/org.jboss.ide.eclipse.as.classpath.core/src/org/jboss/ide/eclipse/as/classpath/core/runtime/WebtoolsProjectJBossClasspathContainerInitializer.java 2011-07-11
10:20:00 UTC (rev 32807)
+++
trunk/as/plugins/org.jboss.ide.eclipse.as.classpath.core/src/org/jboss/ide/eclipse/as/classpath/core/runtime/WebtoolsProjectJBossClasspathContainerInitializer.java 2011-07-11
10:21:13 UTC (rev 32808)
@@ -1,297 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 Red Hat, Inc.
- * Distributed under license by Red Hat, Inc. All rights reserved.
- * This program is made available under the terms of the
- * Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at
http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Red Hat, Inc. - initial API and implementation
- ******************************************************************************/
-
-package org.jboss.ide.eclipse.as.classpath.core.runtime;
-
-import java.text.MessageFormat;
-import java.util.ArrayList;
-import java.util.Arrays;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.Path;
-import org.eclipse.jdt.core.ClasspathContainerInitializer;
-import org.eclipse.jdt.core.IClasspathContainer;
-import org.eclipse.jdt.core.IClasspathEntry;
-import org.eclipse.jdt.core.IJavaProject;
-import org.eclipse.jdt.core.JavaCore;
-import org.eclipse.jdt.launching.IVMInstall;
-import org.eclipse.jdt.launching.JavaRuntime;
-import org.eclipse.jst.common.project.facet.core.JavaFacet;
-import org.eclipse.wst.common.project.facet.core.IProjectFacet;
-import org.eclipse.wst.common.project.facet.core.ProjectFacetsManager;
-import org.eclipse.wst.server.core.IRuntime;
-import org.eclipse.wst.server.core.ServerCore;
-import org.jboss.ide.eclipse.as.classpath.core.ClasspathConstants;
-import org.jboss.ide.eclipse.as.classpath.core.Messages;
-import org.jboss.ide.eclipse.as.core.server.IJBossServerRuntime;
-
-/**
- * This is a class that would ultimately try to respond to different facets
- * by providing different jars to the classpath, jars specific to the added
- * facet.
- *
- * It is currently only used by the EJB30SupportVerifier, or by
- * the ProjectRuntimeClasspathProvider (front) when the added facet
- * is jst.java.
- *
- * @author Rob Stryker
- *
- */
-public class WebtoolsProjectJBossClasspathContainerInitializer extends
- ClasspathContainerInitializer implements ClasspathConstants {
- public static IProjectFacet getSafeFacet(String id) {
- return ProjectFacetsManager.isProjectFacetDefined(id) ?
ProjectFacetsManager.getProjectFacet(id) : null;
- }
-
-// @Deprecated public static final IProjectFacet WEB_FACET = getSafeFacet(FACET_WEB);
-// @Deprecated public static final IProjectFacet EJB_FACET = getSafeFacet(FACET_EJB);
-// @Deprecated public static final IProjectFacet EAR_FACET = getSafeFacet(FACET_EAR);
-// @Deprecated public static final IProjectFacet UTILITY_FACET =
getSafeFacet(FACET_UTILITY);
-// @Deprecated public static final IProjectFacet CONNECTOR_FACET =
getSafeFacet(FACET_CONNECTOR);
-// @Deprecated public static final IProjectFacet APP_CLIENT_FACET =
getSafeFacet(FACET_APP_CLIENT);
-//
-// @Deprecated public static final IProjectFacet JSF_FACET = getSafeFacet(FACET_JSF);
-// @Deprecated public static final IProjectFacet JPA_FACET = getSafeFacet(FACET_JPA);
-
-
- public WebtoolsProjectJBossClasspathContainerInitializer() {
- // TODO Auto-generated constructor stub
- }
-
- public void initialize(IPath containerPath, IJavaProject project)
- throws CoreException {
- WebtoolsProjectJBossClasspathContainer container = new
WebtoolsProjectJBossClasspathContainer(containerPath);
-
- JavaCore.setClasspathContainer(containerPath,
- new IJavaProject[] {project}, new IClasspathContainer[] {container}, null);
- }
-
- public IClasspathEntry[] getEntries(IPath path) {
- return new WebtoolsProjectJBossClasspathContainer(path).getClasspathEntries();
- }
-
-
-
-
- public static class WebtoolsProjectJBossClasspathContainer implements
IClasspathContainer {
- private IPath path;
- private IClasspathEntry[] entries = null;
-
- public WebtoolsProjectJBossClasspathContainer(IPath path) {
- this.path = path;
- }
-
- public String getDescription() {
- if( path.segmentCount() < 4 ) return
Messages.WebtoolsProjectJBossClasspathContainerInitializer_jboss_runtimes;
- String pathSegments = path.segment(2) + " : " + path.segment(3);
//$NON-NLS-1$
- return
MessageFormat.format(Messages.WebtoolsProjectJBossClasspathContainerInitializer_jboss_runtimes_path,
pathSegments);
- }
-
- public int getKind() {
- return IClasspathContainer.K_APPLICATION;
- }
-
- public IPath getPath() {
- return path;
- }
-
-
-
- public IClasspathEntry[] getClasspathEntries() {
- if( entries == null ) {
- loadClasspathEntries();
- if( entries == null )
- return new IClasspathEntry[0];
- }
- return entries;
- }
-
- private void loadClasspathEntries() {
- if( path.segmentCount() < 4 ) return;
- String runtimeId = path.segment(1);
- String facetId = path.segment(2);
- String facetVersion = path.segment(3);
-
-
- if( runtimeId == null ) return;
-
- IRuntime runtime = ServerCore.findRuntime(runtimeId);
- if( runtime == null ) return;
-
- IJBossServerRuntime jbRuntime =
(IJBossServerRuntime)runtime.loadAdapter(IJBossServerRuntime.class, null);
-
- if( jbRuntime != null ) {
-
- String serverHome = runtime.getLocation().toOSString();
- String configName = jbRuntime.getJBossConfiguration();
-
- String jbossVersion = jbRuntime.getRuntime().getRuntimeType().getVersion();
-
- entries = loadClasspathEntries2(runtimeId, facetId, facetVersion,
- serverHome, configName, jbossVersion, jbRuntime);
- }
- }
-
- protected IClasspathEntry[] loadClasspathEntries2(String runtimeId, String facetId,
- String facetVersion, String serverHome, String configName, String jbVersion,
- IJBossServerRuntime jbsRuntime) {
- if( ProjectFacetsManager.getProjectFacet(facetId).equals(JavaFacet.FACET)) {
- return loadJREClasspathEntries(jbsRuntime);
- } else if(V5_0.equals(jbVersion)) {
- return loadClasspathEntriesDefault(facetId, facetVersion, serverHome, configName);
- } else if( V4_2.equals(jbVersion)) {
- return loadClasspathEntries42(facetId, facetVersion, serverHome, configName);
- } else if( V4_0.equals(jbVersion)) {
- return loadClasspathEntries40(facetId, facetVersion, serverHome, configName);
- } else if( V3_2.equals(jbVersion))
- return loadClasspathEntries32( facetId, facetVersion, serverHome, configName);
- return loadClasspathEntriesDefault(facetId, facetVersion, serverHome, configName);
- }
-
- protected boolean isEjb30(String facetId, String facetVersion) {
- if( facetId.equals(FACET_EJB) && facetVersion.equals(V3_0))
- return true;
- return false;
- }
-
- protected IClasspathEntry getEntry(IPath path) {
- return JavaRuntime.newArchiveRuntimeClasspathEntry(path).getClasspathEntry();
- }
- protected IClasspathEntry[] getEntries(IPath folder) {
- String[] files = folder.toFile().list();
- ArrayList<IClasspathEntry> list = new ArrayList<IClasspathEntry>();
- for( int i = 0; i < files.length; i++ ) {
- if( files[i].endsWith(EXT_JAR)) {
- list.add(getEntry(folder.append(files[i])));
- }
- }
- return list.toArray(new IClasspathEntry[list.size()]);
- }
- protected IClasspathEntry[] loadJREClasspathEntries(IJBossServerRuntime jbsRuntime) {
- IVMInstall vmInstall = jbsRuntime.getVM();
- if (vmInstall != null) {
- String name = vmInstall.getName();
- String typeId = vmInstall.getVMInstallType().getId();
- return new IClasspathEntry[] { JavaCore.newContainerEntry(new
Path(JavaRuntime.JRE_CONTAINER).append(typeId).append(name)) };
- }
- return null;
- }
-
- protected IClasspathEntry[] loadClasspathEntries42(String facetId, String facetVersion,
String serverHome, String configName) {
- IPath homePath = new Path(serverHome);
- IPath configPath = homePath.append(SERVER).append(configName);
- ArrayList<IClasspathEntry> list = new ArrayList<IClasspathEntry>();
- if (facetId.equals(FACET_WEB)) {
- IPath jsfDir = configPath.append(DEPLOY).append(JBOSS_WEB_DEPLOYER).append(JSF_LIB);
- list.add(getEntry(configPath.append(LIB).append(JSP_API_JAR)));
- list.add(getEntry(homePath.append(CLIENT).append(SERVLET_API_JAR)));
- list.add(getEntry(jsfDir.append(JSF_API_JAR)));
- list.add(getEntry(jsfDir.append(JSF_IMPL_JAR)));
- } else if( facetId.equals(FACET_EJB) && !isEjb30(facetId, facetVersion)) {
- list.add(getEntry(homePath.append(CLIENT).append(JBOSS_J2EE_JAR)));
- } else if( isEjb30(facetId, facetVersion)) {
- // path roots
- IPath deploy = configPath.append(DEPLOY);
- IPath deployer = deploy.append(EJB3_DEPLOYER);
- IPath aopDeployer = deploy.append(AOP_JDK5_DEPLOYER);
- IPath client = homePath.append(CLIENT);
-
- list.add(getEntry(configPath.append(LIB).append(JBOSS_EJB3X_JAR)));
- list.add(getEntry(deployer.append(JBOSS_EJB3_JAR)));
- list.add(getEntry(deployer.append(JBOSS_ANNOTATIONS_EJB3_JAR)));
-
- // aop
- list.add(getEntry(aopDeployer.append(AOP_JDK5_DEPLOYER)));
- list.add(getEntry(aopDeployer.append(JBOSS_ASPECT_LIBRARY_JDK5_0)));
-
- // hibernate
- list.add(getEntry(homePath.append(CLIENT).append(HIBERNATE_CLIENT_JAR)));
-
- // persistence jar
- list.add(getEntry(client.append(EJB3_PERSISTENCE_JAR)));
-
- } else if( facetId.equals(FACET_EAR)) {
- list.add(getEntry(homePath.append(CLIENT).append(JBOSS_J2EE_JAR)));
- } else if( facetId.equals(FACET_APP_CLIENT)) {
- list.add(getEntry(homePath.append(CLIENT).append(JBOSSALL_CLIENT_JAR)));
- }
- return list.toArray(new IClasspathEntry[list.size()]);
- }
-
- protected IClasspathEntry[] loadClasspathEntries40(String facetId, String facetVersion,
String serverHome, String configName) {
- IPath homePath = new Path(serverHome);
- IPath configPath = homePath.append(SERVER).append(configName);
- ArrayList<IClasspathEntry> list = new ArrayList<IClasspathEntry>();
- if (facetId.equals(FACET_WEB)) {
- IPath jsfDir =
configPath.append(DEPLOY).append(JBOSSWEB_TOMCAT55_SAR).append(JSF_LIB);
- list.add(getEntry(configPath.append(LIB).append(JAVAX_SERVLET_JSP_JAR)));
- list.add(getEntry(homePath.append(CLIENT).append(JAVAX_SERVLET_JAR)));
- list.addAll(Arrays.asList(getEntries(jsfDir)));
- } else if( facetId.equals(FACET_EJB) && !isEjb30(facetId, facetVersion)) {
- list.add(getEntry(homePath.append(CLIENT).append(JBOSS_J2EE_JAR)));
- } else if( isEjb30(facetId, facetVersion)) {
- // path roots
- IPath deploy = configPath.append(DEPLOY);
- IPath deployer = deploy.append(EJB3_DEPLOYER);
- IPath aopDeployer = deploy.append(AOP_JDK5_DEPLOYER);
-
- // ejb3
- list.add(getEntry(deployer.append(JBOSS_EJB3X_JAR)));
- list.add(getEntry(deployer.append(JBOSS_EJB3_JAR)));
- list.add(getEntry(deployer.append(JBOSS_ANNOTATIONS_EJB3_JAR)));
-
- // aop
- list.add(getEntry(aopDeployer.append(JBOSS_AOP_JDK5_JAR)));
- list.add(getEntry(aopDeployer.append(JBOSS_ASPECT_LIBRARY_JDK5_0)));
-
- // hibernate
- list.add(getEntry(homePath.append(CLIENT).append(HIBERNATE_CLIENT_JAR)));
-
- } else if( facetId.equals(FACET_EAR)) {
- list.add(getEntry(homePath.append(CLIENT).append(JBOSS_J2EE_JAR)));
- } else if( facetId.equals(FACET_APP_CLIENT)) {
- list.add(JavaRuntime.newArchiveRuntimeClasspathEntry(homePath.append(CLIENT).append(JBOSSALL_CLIENT_JAR)).getClasspathEntry());
- }
- return list.toArray(new IClasspathEntry[list.size()]);
- }
-
-
- protected IClasspathEntry[] loadClasspathEntries32(String facetId, String facetVersion,
String serverHome, String configName) {
- IPath homePath = new Path(serverHome);
- IPath configPath = homePath.append(SERVER).append(configName);
- ArrayList<IClasspathEntry> list = new ArrayList<IClasspathEntry>();
- if (facetId.equals(FACET_WEB)) {
- IPath p = configPath.append(DEPLOY).append(JBOSSWEB_TOMCAT_50_SAR);
- list.add(getEntry(p.append(JSP_API_JAR)));
- list.add(getEntry(p.append(SERVLET_API_JAR)));
- } else if( (facetId.equals(FACET_EJB) && !isEjb30(facetId, facetVersion))
- || facetId.equals(FACET_EAR) ) {
- list.add(getEntry(homePath.append(CLIENT).append(JBOSS_J2EE_JAR)));
- } else if( facetId.equals(FACET_APP_CLIENT)) {
- list.add(getEntry(homePath.append(CLIENT).append(JBOSSALL_CLIENT_JAR)));
- }
- return list.toArray(new IClasspathEntry[list.size()]);
- }
- protected IClasspathEntry[] loadClasspathEntriesDefault(String facetId, String
facetVersion, String serverHome, String configName) {
- return new IClasspathEntry[0];
- }
-
- protected IClasspathEntry[] pathsAsEntries(IPath[] paths) {
- IClasspathEntry[] entries = new IClasspathEntry[paths.length];
- for( int i = 0; i < paths.length; i++ )
- entries[i] = getEntry(paths[i]);
- return entries;
- }
-
- }
-
-}