Skip to main content

This CGIT instance is deprecated, and repositories have been moved to Gitlab or Github. See the repository descriptions for specific locations.

summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/org.eclipse.jst.j2ee/j2eeplugin/org/eclipse/jst')
-rw-r--r--plugins/org.eclipse.jst.j2ee/j2eeplugin/org/eclipse/jst/j2ee/internal/J2EEModulePostImportHandler.java31
-rw-r--r--plugins/org.eclipse.jst.j2ee/j2eeplugin/org/eclipse/jst/j2ee/internal/J2EEModulePostImportHelper.java158
-rw-r--r--plugins/org.eclipse.jst.j2ee/j2eeplugin/org/eclipse/jst/j2ee/internal/ResourceTypeReaderHelper.java174
-rw-r--r--plugins/org.eclipse.jst.j2ee/j2eeplugin/org/eclipse/jst/j2ee/internal/deploy/DeployerRegistry.java194
-rw-r--r--plugins/org.eclipse.jst.j2ee/j2eeplugin/org/eclipse/jst/j2ee/internal/deploy/DeployerRegistryReader.java89
-rw-r--r--plugins/org.eclipse.jst.j2ee/j2eeplugin/org/eclipse/jst/j2ee/internal/deploy/FatalDeployerException.java63
-rw-r--r--plugins/org.eclipse.jst.j2ee/j2eeplugin/org/eclipse/jst/j2ee/internal/deploy/J2EEDeployHelper.java145
-rw-r--r--plugins/org.eclipse.jst.j2ee/j2eeplugin/org/eclipse/jst/j2ee/internal/deploy/J2EEDeployOperation.java234
-rw-r--r--plugins/org.eclipse.jst.j2ee/j2eeplugin/org/eclipse/jst/j2ee/internal/deploy/J2EEDeployer.java58
-rw-r--r--plugins/org.eclipse.jst.j2ee/j2eeplugin/org/eclipse/jst/j2ee/internal/deployables/EnterpriseApplicationDeployableAdapterUtil.java208
-rw-r--r--plugins/org.eclipse.jst.j2ee/j2eeplugin/org/eclipse/jst/j2ee/internal/deployables/FlexibleProjectServerUtil.java38
-rw-r--r--plugins/org.eclipse.jst.j2ee/j2eeplugin/org/eclipse/jst/j2ee/internal/deployables/J2EEDeployableFactory.java205
-rw-r--r--plugins/org.eclipse.jst.j2ee/j2eeplugin/org/eclipse/jst/j2ee/internal/deployables/J2EEFlexProjDeployable.java1036
-rw-r--r--plugins/org.eclipse.jst.j2ee/j2eeplugin/org/eclipse/jst/j2ee/internal/plugin/IJ2EEModuleConstants.java32
-rw-r--r--plugins/org.eclipse.jst.j2ee/j2eeplugin/org/eclipse/jst/j2ee/internal/plugin/IJ2EEPreferences.java23
-rw-r--r--plugins/org.eclipse.jst.j2ee/j2eeplugin/org/eclipse/jst/j2ee/internal/plugin/J2EEGroupInitializer.java47
-rw-r--r--plugins/org.eclipse.jst.j2ee/j2eeplugin/org/eclipse/jst/j2ee/internal/plugin/J2EEPlugin.java691
-rw-r--r--plugins/org.eclipse.jst.j2ee/j2eeplugin/org/eclipse/jst/j2ee/internal/plugin/J2EEPluginResourceHandler.java76
-rw-r--r--plugins/org.eclipse.jst.j2ee/j2eeplugin/org/eclipse/jst/j2ee/internal/plugin/J2EEPreferences.java437
-rw-r--r--plugins/org.eclipse.jst.j2ee/j2eeplugin/org/eclipse/jst/j2ee/internal/plugin/LibCopyBuilder.java506
-rw-r--r--plugins/org.eclipse.jst.j2ee/j2eeplugin/org/eclipse/jst/j2ee/internal/validation/AWorkbenchMOFHelper.java92
-rw-r--r--plugins/org.eclipse.jst.j2ee/j2eeplugin/org/eclipse/jst/j2ee/internal/validation/ApplicationClientHelper.java90
-rw-r--r--plugins/org.eclipse.jst.j2ee/j2eeplugin/org/eclipse/jst/j2ee/internal/validation/DependencyUtil.java242
-rw-r--r--plugins/org.eclipse.jst.j2ee/j2eeplugin/org/eclipse/jst/j2ee/internal/validation/EarHelper.java112
-rw-r--r--plugins/org.eclipse.jst.j2ee/j2eeplugin/org/eclipse/jst/j2ee/internal/validation/J2EEValidationHelper.java108
-rw-r--r--plugins/org.eclipse.jst.j2ee/j2eeplugin/org/eclipse/jst/j2ee/internal/validation/ManifestLineValidator.java105
-rw-r--r--plugins/org.eclipse.jst.j2ee/j2eeplugin/org/eclipse/jst/j2ee/internal/validation/ProjectValidationHelper.java86
-rw-r--r--plugins/org.eclipse.jst.j2ee/j2eeplugin/org/eclipse/jst/j2ee/internal/validation/ResourceUtil.java61
-rw-r--r--plugins/org.eclipse.jst.j2ee/j2eeplugin/org/eclipse/jst/j2ee/internal/validation/UIApplicationClientHelper.java27
-rw-r--r--plugins/org.eclipse.jst.j2ee/j2eeplugin/org/eclipse/jst/j2ee/internal/validation/UIApplicationClientMessageConstants.java25
-rw-r--r--plugins/org.eclipse.jst.j2ee/j2eeplugin/org/eclipse/jst/j2ee/internal/validation/UIApplicationClientValidator.java82
-rw-r--r--plugins/org.eclipse.jst.j2ee/j2eeplugin/org/eclipse/jst/j2ee/internal/validation/UIEarHelper.java27
-rw-r--r--plugins/org.eclipse.jst.j2ee/j2eeplugin/org/eclipse/jst/j2ee/internal/validation/UIEarValidator.java755
33 files changed, 0 insertions, 6257 deletions
diff --git a/plugins/org.eclipse.jst.j2ee/j2eeplugin/org/eclipse/jst/j2ee/internal/J2EEModulePostImportHandler.java b/plugins/org.eclipse.jst.j2ee/j2eeplugin/org/eclipse/jst/j2ee/internal/J2EEModulePostImportHandler.java
deleted file mode 100644
index d99420ee2..000000000
--- a/plugins/org.eclipse.jst.j2ee/j2eeplugin/org/eclipse/jst/j2ee/internal/J2EEModulePostImportHandler.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are 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:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-/*
- * Created on Jun 9, 2003
- *
- * To change the template for this generated file go to
- * Window>Preferences>Java>Code Generation>Code and Comments
- */
-package org.eclipse.jst.j2ee.internal;
-
-import org.eclipse.core.resources.IProject;
-
-/**
- * @author jsholl
- *
- * To change the template for this generated type comment go to Window>Preferences>Java>Code
- * Generation>Code and Comments
- */
-public interface J2EEModulePostImportHandler {
-
- public void moduleImported(IProject moduleProject);
-
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.jst.j2ee/j2eeplugin/org/eclipse/jst/j2ee/internal/J2EEModulePostImportHelper.java b/plugins/org.eclipse.jst.j2ee/j2eeplugin/org/eclipse/jst/j2ee/internal/J2EEModulePostImportHelper.java
deleted file mode 100644
index 1f8398793..000000000
--- a/plugins/org.eclipse.jst.j2ee/j2eeplugin/org/eclipse/jst/j2ee/internal/J2EEModulePostImportHelper.java
+++ /dev/null
@@ -1,158 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are 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:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-/*
- * Created on Jun 9, 2003
- *
- * To change the template for this generated file go to
- * Window>Preferences>Java>Code Generation>Code and Comments
- */
-package org.eclipse.jst.j2ee.internal;
-
-import java.util.ArrayList;
-
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IConfigurationElement;
-import org.eclipse.core.runtime.IExtension;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.jst.j2ee.internal.plugin.J2EEPluginResourceHandler;
-
-
-/**
- * @author jsholl
- *
- * To change the template for this generated type comment go to Window>Preferences>Java>Code
- * Generation>Code and Comments
- */
-public class J2EEModulePostImportHelper {
-
- private static final String WEB = J2EEPluginResourceHandler.J2EEModulePostImportHelper_0;
- private static final String EJB = J2EEPluginResourceHandler.J2EEModulePostImportHelper_1;
- private static final String APP_CLIENT = J2EEPluginResourceHandler.J2EEModulePostImportHelper_2;
- private static final String CONNECTOR = J2EEPluginResourceHandler.J2EEModulePostImportHelper_3;
-
- private static IConfigurationElement[] webExtensions = null;
- private static IConfigurationElement[] ejbExtensions = null;
- private static IConfigurationElement[] appClientExtensions = null;
- private static IConfigurationElement[] connectorExtensions = null;
-
- private static boolean firstTimeLoading = true;
-
- public static void notifyWebExtensions(IProject project) {
- if (webExtensions == null) {
- loadConfiguration(WEB);
- }
- notifyExtensions(webExtensions, project);
- }
-
- public static void notifyEjbExtensions(IProject project) {
- if (ejbExtensions == null) {
- loadConfiguration(EJB);
- }
- notifyExtensions(ejbExtensions, project);
- }
-
- public static void notifyAppClientExtensions(IProject project) {
- if (appClientExtensions == null) {
- loadConfiguration(APP_CLIENT);
- }
- notifyExtensions(appClientExtensions, project);
- }
-
- public static void notifyConnectorExtensions(IProject project) {
- if (connectorExtensions == null) {
- loadConfiguration(CONNECTOR);
- }
- notifyExtensions(connectorExtensions, project);
- }
-
- private static void notifyExtensions(IConfigurationElement[] postImportElement, IProject project) {
- for (int i = 0; i < postImportElement.length; i++) {
- try {
- J2EEModulePostImportHandler postCreate = (J2EEModulePostImportHandler) postImportElement[i].createExecutableExtension("className"); //$NON-NLS-1$
- postCreate.moduleImported(project);
- } catch (CoreException e) {
- e.printStackTrace();
- }
- }
- }
-
- private static void loadConfiguration(final String loadingModuleType) {
- boolean shouldLogErrors = firstTimeLoading;
- firstTimeLoading = false;
-
- IExtension[] importExtensions =Platform.getExtensionRegistry().getExtensionPoint("J2EEModulePostImport").getExtensions(); //$NON-NLS-1$
-
- ArrayList interestedExtensions = new ArrayList();
- for (int i = 0; i < importExtensions.length; i++) {
- IExtension extension = importExtensions[i];
- IConfigurationElement[] configElements = extension.getConfigurationElements();
- boolean isExtensionInterested = false;
- IConfigurationElement postImportElement = null;
- int moduleCount = 0;
- for (int j = 0; j < configElements.length; j++) {
- try {
- IConfigurationElement element = configElements[j];
- if (element.getName().equalsIgnoreCase("postImport")) { //$NON-NLS-1$
- postImportElement = element;
- } else if (element.getName().equalsIgnoreCase(("module"))) { //$NON-NLS-1$
- moduleCount++;
- if (!isExtensionInterested) {
- String moduleType = element.getAttribute("type"); //$NON-NLS-1$
- if (WEB == loadingModuleType && WEB.equalsIgnoreCase(moduleType)) {
- isExtensionInterested = true;
- } else if (EJB == loadingModuleType && EJB.equalsIgnoreCase(moduleType)) {
- isExtensionInterested = true;
- } else if (APP_CLIENT == loadingModuleType && APP_CLIENT.equalsIgnoreCase(moduleType)) {
- isExtensionInterested = true;
- } else if (CONNECTOR == loadingModuleType && CONNECTOR.equalsIgnoreCase(moduleType)) {
- isExtensionInterested = true;
- }
- }
- }
- } catch (Exception e) {
- if (shouldLogErrors) {
- e.printStackTrace();
- }
- }
- }
-
- //if no module types are defined the default is to listen to all of them.
- if (!isExtensionInterested && 0 == moduleCount) {
- isExtensionInterested = true;
- }
-
- if (isExtensionInterested) {
- try {
- //try instantiating the class before adding it to the list.
- postImportElement.createExecutableExtension("className"); //$NON-NLS-1$
- interestedExtensions.add(postImportElement);
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
- }
-
- IConfigurationElement[] configElements = new IConfigurationElement[interestedExtensions.size()];
- for (int i = 0; i < configElements.length; i++) {
- configElements[i] = (IConfigurationElement) interestedExtensions.get(i);
- }
- if (WEB == loadingModuleType) {
- webExtensions = configElements;
- } else if (EJB == loadingModuleType) {
- ejbExtensions = configElements;
- } else if (APP_CLIENT == loadingModuleType) {
- appClientExtensions = configElements;
- } else if (CONNECTOR == loadingModuleType) {
- connectorExtensions = configElements;
- }
- }
-}
diff --git a/plugins/org.eclipse.jst.j2ee/j2eeplugin/org/eclipse/jst/j2ee/internal/ResourceTypeReaderHelper.java b/plugins/org.eclipse.jst.j2ee/j2eeplugin/org/eclipse/jst/j2ee/internal/ResourceTypeReaderHelper.java
deleted file mode 100644
index c6494bfa1..000000000
--- a/plugins/org.eclipse.jst.j2ee/j2eeplugin/org/eclipse/jst/j2ee/internal/ResourceTypeReaderHelper.java
+++ /dev/null
@@ -1,174 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are 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:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-/*
- * Created on 10-Oct-03
- *
- * To change the template for this generated file go to
- * Window&gt;Preferences&gt;Java&gt;Code Generation&gt;Code and Comments
- */
-package org.eclipse.jst.j2ee.internal;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-
-import org.eclipse.core.runtime.IConfigurationElement;
-import org.eclipse.core.runtime.IExtension;
-import org.eclipse.core.runtime.IExtensionPoint;
-import org.eclipse.core.runtime.IExtensionRegistry;
-import org.eclipse.core.runtime.Platform;
-
-/**
- * @author sapnam
- *
- * This helper class was created for ResourceRefTypeReader and ResourceEnvRefTypeReader to read all
- * valid types from extensions of each and to return a array of String to populate the Ref 'Type'
- * fields.
- */
-public class ResourceTypeReaderHelper {
- private static String extensionPoint;
- private static String typeAttributeName;
- private static final String USAGE_TYPE = "type"; //$NON-NLS-1$
- private static final String USAGE_ATTRIBUTE_NAME = "usage"; //$NON-NLS-1$
- private static final String USAGE_COMMON = "Common"; //$NON-NLS-1$
- private static final String USAGE_EJB = "EJB Jar"; //$NON-NLS-1$
- private static final String SERVER_TARGET_IDS_ATTRIBUTE_NAME = "target-server-ids"; //$NON-NLS-1$
- private static final String SERVER_TARGET_IDS_SEPARATOR = ","; //$NON-NLS-1$
- private boolean isEJBJar;
-
- public static final int RESOURCE_REF = 0;
- public static final int RESOURCE_ENV_REF = 1;
-
- private static final String[] EXTENSION_POINTS = {"org.eclipse.jst.j2ee.resourceRefType", "org.eclipse.jst.j2ee.resourceEnvRefType"};//$NON-NLS-1$ //$NON-NLS-2$
-
- public static String[] getAllReferences(int refType, String serverTargetID, boolean isEJBJar, String[] baseItems) {
- String extensionPointLocal = EXTENSION_POINTS[refType];
- ResourceTypeReaderHelper reader = new ResourceTypeReaderHelper(extensionPointLocal, USAGE_TYPE, isEJBJar);
- String[] extendedItems = null == serverTargetID ? reader.getResTypes() : reader.getResTypes(serverTargetID);
- String[] allItems = null;
- if (null == extendedItems || 0 == extendedItems.length) {
- allItems = baseItems;
- } else {
- allItems = new String[baseItems.length + extendedItems.length];
- System.arraycopy(baseItems, 0, allItems, 0, baseItems.length);
- System.arraycopy(extendedItems, 0, allItems, baseItems.length, extendedItems.length);
- }
- Arrays.sort(allItems);
- return allItems;
- }
-
-
- private ResourceTypeReaderHelper(String extPoint, String typeAttName, boolean ejbJar) {
- extensionPoint = extPoint;
- typeAttributeName = typeAttName;
- isEJBJar = ejbJar;
- }
-
- private IExtensionPoint getExtensionPoint() {
- IExtensionRegistry registry = Platform.getExtensionRegistry();
- IExtensionPoint exPoint = registry.getExtensionPoint(extensionPoint);
- return exPoint;
- }
-
- private ArrayList processExtensions() {
- IExtension[] allExtensions = getExtensionPoint().getExtensions();
- ArrayList tempTypes = new ArrayList();
- for (int x = 0; x < allExtensions.length; ++x) {
- IExtension config = allExtensions[x];
- IConfigurationElement[] cElems = config.getConfigurationElements();
- for (int i = 0; i < cElems.length; i++) {
- if (getValidTypes(cElems[i]) != null) {
- tempTypes.add(getValidTypes(cElems[i]));
- }
- }
- }
- return tempTypes;
- }
-
-
- /**
- * @return an array of string containing valid Resource Ref or Resource Env Ref types.
- */
- public String[] getResTypes() {
- ArrayList types = processExtensions();
- String[] allTypes = new String[types.size()];
- for (int z = 0; z < types.size(); z++) {
- allTypes[z] = (String) types.get(z);
- }
- return allTypes;
- }
-
- private ArrayList processExtensions(String targetServer) {
- IExtension[] allExtensions = getExtensionPoint().getExtensions();
- ArrayList tempTypes = new ArrayList();
- for (int x = 0; x < allExtensions.length; ++x) {
- IExtension config = allExtensions[x];
- IConfigurationElement[] cElems = config.getConfigurationElements();
- for (int i = 0; i < cElems.length; i++) {
- if (getValidTypes(cElems[i], targetServer) != null) {
- tempTypes.add(getValidTypes(cElems[i], targetServer));
- }
- }
- }
- return tempTypes;
- }
-
- /**
- * @param element
- * A configuration element.
- * @return A valid Type
- */
- private Object getValidTypes(IConfigurationElement element, String targetServer) {
- String elementServerIDs = element.getAttribute(SERVER_TARGET_IDS_ATTRIBUTE_NAME);
- if (null == elementServerIDs || isValidTargeted(elementServerIDs, targetServer)) {
- String usage = element.getAttribute(USAGE_ATTRIBUTE_NAME);
- if (usage.equals(USAGE_COMMON)) {
- return element.getAttribute(typeAttributeName);
- } else if (isEJBJar && usage.equals(USAGE_EJB)) {
- return element.getAttribute(typeAttributeName);
- }
- }
- return null;
- }
-
- /**
- * @param element
- * A configuration element.
- * @return A valid Type
- */
- private Object getValidTypes(IConfigurationElement element) {
- return getValidTypes(element, null);
- }
-
- /**
- * @return an array of string containing valid Resource Ref or Resource Env Ref types.
- */
- public String[] getResTypes(String targetServer) {
- ArrayList types = processExtensions(targetServer);
- String[] allTypes = new String[types.size()];
- for (int z = 0; z < types.size(); z++) {
- allTypes[z] = (String) types.get(z);
- }
- return allTypes;
- }
-
- private boolean isValidTargeted(String attribute, String targetServerId) {
- if (attribute == null || targetServerId == null)
- return false;
- if (attribute.trim().equalsIgnoreCase(targetServerId.trim()))
- return true;
- if (attribute.indexOf(targetServerId.trim() + SERVER_TARGET_IDS_SEPARATOR) >= 0)
- return true;
- if (attribute.trim().length() > (targetServerId.trim().length() + 1) && attribute.substring(attribute.trim().length() - targetServerId.length()).equalsIgnoreCase(targetServerId.trim()))
- return true;
- return false;
- }
-
-}
diff --git a/plugins/org.eclipse.jst.j2ee/j2eeplugin/org/eclipse/jst/j2ee/internal/deploy/DeployerRegistry.java b/plugins/org.eclipse.jst.j2ee/j2eeplugin/org/eclipse/jst/j2ee/internal/deploy/DeployerRegistry.java
deleted file mode 100644
index d07999503..000000000
--- a/plugins/org.eclipse.jst.j2ee/j2eeplugin/org/eclipse/jst/j2ee/internal/deploy/DeployerRegistry.java
+++ /dev/null
@@ -1,194 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are 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:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-/*
- * Created on Mar 30, 2004
- *
- * To change the template for this generated file go to
- * Window - Preferences - Java - Code Generation - Code and Comments
- */
-package org.eclipse.jst.j2ee.internal.deploy;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.runtime.IConfigurationElement;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.jem.util.emf.workbench.ProjectUtilities;
-import org.eclipse.jst.j2ee.internal.project.J2EEProjectUtilities;
-import org.eclipse.jst.j2ee.model.IModelProvider;
-import org.eclipse.jst.j2ee.model.ModelProviderManager;
-import org.eclipse.wst.common.componentcore.ComponentCore;
-import org.eclipse.wst.common.componentcore.internal.util.ComponentUtilities;
-import org.eclipse.wst.common.componentcore.resources.IVirtualComponent;
-import org.eclipse.wst.server.core.IRuntime;
-
-/**
- * @author cbridgha
- *
- * To change the template for this generated type comment go to Window - Preferences - Java - Code
- * Generation - Code and Comments
- */
-public class DeployerRegistry {
- /**
- *
- */
- private static DeployerRegistry INSTANCE;
- private HashMap deployModuleExtensions = new HashMap();
-
- public DeployerRegistry() {
- super();
- }
-
- /**
- * @param deployer
- * @param serverTarget
- * @param natureID
- */
- public void register(IConfigurationElement deployer, List serverTargets, List natures) {
- HashMap targetDeployers;
- for (Iterator iter = natures.iterator(); iter.hasNext();) {
- String natureID = (String) iter.next();
- for (Iterator iterator = serverTargets.iterator(); iterator.hasNext();) {
- String runtimeID = (String) iterator.next();
- targetDeployers = getDeployModuleExtensions(natureID);
- getTargetDeployers(targetDeployers, runtimeID).add(deployer);
- }
- }
- }
-
- private List getDeployers(String natureID, String serverTarget) {
- HashMap targetDeployers = getDeployModuleExtensions(natureID);
- return getTargetDeployers(targetDeployers, serverTarget);
- }
-
- public static DeployerRegistry instance() {
- if (INSTANCE == null) {
- INSTANCE = new DeployerRegistry();
- readRegistry();
- }
- return INSTANCE;
- }
-
- /**
- *
- */
- private static void readRegistry() {
- DeployerRegistryReader reader = new DeployerRegistryReader();
- reader.readRegistry();
- }
-
- /**
- * @return a list of IVirtualComponent's
- */
- public static List getSelectedModules(Object[] mySelections) {
- List modules = new ArrayList();
- for (int i = 0; i < mySelections.length; i++) {
- Object object = mySelections[i];
- if (object instanceof EObject) {
- object = ProjectUtilities.getProject(object);
- }
- if (object instanceof IProject) {
- IVirtualComponent component = ComponentCore.createComponent((IProject)object);
- IModelProvider modelProvider = null;
-
- modelProvider = ModelProviderManager.getModelProvider(component.getProject());
- if (modelProvider == null)
- continue;
- // we just happen to know it
- EObject root = (EObject) modelProvider.getModelObject();
-
- if (root == null || modules.contains(component))
- continue;
- // Order Ears first...
- if (J2EEProjectUtilities.isEARProject(component.getProject()))
- modules.add(0, component);
- else
- modules.add(component);
-
- }
- }
- return modules;
- }
-
- /**
- * @param targetDeployers
- * @param serverTarget
- */
- private List getTargetDeployers(HashMap targetDeployers, String serverTarget) {
- if (targetDeployers.get(serverTarget) == null)
- targetDeployers.put(serverTarget, new ArrayList());
- return (List) targetDeployers.get(serverTarget);
- }
-
- /**
- * @param natureID
- * @return
- */
- private HashMap getDeployModuleExtensions(String natureID) {
- if (getDeployModuleExtensions().get(natureID) == null)
- getDeployModuleExtensions().put(natureID, new HashMap());
- return (HashMap) getDeployModuleExtensions().get(natureID);
- }
-
- /**
- * @return Returns the deployExtensions.
- */
- public HashMap getDeployModuleExtensions() {
- return deployModuleExtensions;
- }
-
- /**
- * @param deployExtensions
- * The deployExtensions to set.
- */
- public void setDeployModuleExtensions(HashMap deployExtensions) {
- this.deployModuleExtensions = deployExtensions;
- }
-
- /**
- * @param module
- * @param runtime
- * @return
- */
- public List getDeployModuleExtensions(EObject module, IRuntime runtime) {
- IVirtualComponent comp = ComponentUtilities.findComponent(module);
- return getDeployModuleExtensions(comp.getProject(), runtime);
- }
-
- /**
- * @param module
- * @param runtime
- * @return
- */
- public List getDeployModuleExtensions(IProject project, IRuntime runtime) {
- String typeID = ""; //$NON-NLS-1$
- if (J2EEProjectUtilities.isEARProject(project))
- typeID = J2EEProjectUtilities.ENTERPRISE_APPLICATION;
- else if (J2EEProjectUtilities.isApplicationClientProject(project))
- typeID = J2EEProjectUtilities.APPLICATION_CLIENT;
- else if (J2EEProjectUtilities.isDynamicWebProject(project))
- typeID = J2EEProjectUtilities.DYNAMIC_WEB;
- else if (J2EEProjectUtilities.isStaticWebProject(project))
- typeID = J2EEProjectUtilities.STATIC_WEB;
- else if (J2EEProjectUtilities.isEJBProject(project))
- typeID = J2EEProjectUtilities.EJB;
- else if (J2EEProjectUtilities.isJCAProject(project))
- typeID = J2EEProjectUtilities.JCA;
- else if (J2EEProjectUtilities.isUtilityProject(project))
- typeID = J2EEProjectUtilities.UTILITY;
- String runtimeID = runtime.getRuntimeType().getId();
- return getDeployers(typeID, runtimeID);
- }
-
-}
diff --git a/plugins/org.eclipse.jst.j2ee/j2eeplugin/org/eclipse/jst/j2ee/internal/deploy/DeployerRegistryReader.java b/plugins/org.eclipse.jst.j2ee/j2eeplugin/org/eclipse/jst/j2ee/internal/deploy/DeployerRegistryReader.java
deleted file mode 100644
index c384cfc85..000000000
--- a/plugins/org.eclipse.jst.j2ee/j2eeplugin/org/eclipse/jst/j2ee/internal/deploy/DeployerRegistryReader.java
+++ /dev/null
@@ -1,89 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are 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:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-/*
- * Created on Mar 29, 2004
- *
- * To change the template for this generated file go to
- * Window - Preferences - Java - Code Generation - Code and Comments
- */
-package org.eclipse.jst.j2ee.internal.deploy;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.core.runtime.IConfigurationElement;
-import org.eclipse.jem.util.RegistryReader;
-import org.eclipse.jst.j2ee.internal.plugin.J2EEPlugin;
-
-/**
- * @author cbridgha
- *
- * To change the template for this generated type comment go to Window - Preferences - Java - Code
- * Generation - Code and Comments
- */
-public class DeployerRegistryReader extends RegistryReader {
- /**
- * @param registry
- * @param plugin
- * @param extensionPoint
- */
- static final String J2EE_DEPLOYER_EXTENSION_POINT = "DeployerExtension"; //$NON-NLS-1$
- static final String TARGET_SERVER_RUNTIME_ID = "runtime_server_id"; //$NON-NLS-1$
- static final String RUNTIME = "runtime"; //$NON-NLS-1$
- static final String DEPLOYER = "deployer"; //$NON-NLS-1$
- public static final String DEPLOYER_CLASS = "deployer_class"; //$NON-NLS-1$
- static final String MODULE_TYPE_NATURE_ID = "module_nature_id"; //$NON-NLS-1$
- static final String NATURE = "nature"; //$NON-NLS-1$
- static final String COMPONENT_TYPE_ID = "component_type"; //$NON-NLS-1$
- static final String COMPONENT = "component"; //$NON-NLS-1$
-
- public DeployerRegistryReader() {
- super(J2EEPlugin.PLUGIN_ID, J2EE_DEPLOYER_EXTENSION_POINT);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.wst.common.frameworks.internal.RegistryReader#readElement(org.eclipse.core.runtime.IConfigurationElement)
- */
- public boolean readElement(IConfigurationElement element) {
- if (!element.getName().equals(DEPLOYER))
- return false;
- List runtimeList = new ArrayList();
- List natureandcomponents = new ArrayList();
- IConfigurationElement[] runtimes = element.getChildren(RUNTIME);
- for (int i = 0; i < runtimes.length; i++) {
- IConfigurationElement runtime = runtimes[i];
- String serverTarget = runtime.getAttribute(TARGET_SERVER_RUNTIME_ID);
- runtimeList.add(serverTarget);
- }
- IConfigurationElement[] natures = element.getChildren(NATURE);
- for (int i = 0; i < natures.length; i++) {
- IConfigurationElement nature = natures[i];
- String natureID = nature.getAttribute(MODULE_TYPE_NATURE_ID);
- natureandcomponents.add(natureID);
- }
- IConfigurationElement[] components = element.getChildren(COMPONENT);
- for (int i = 0; i < components.length; i++) {
- IConfigurationElement component = components[i];
- String compType = component.getAttribute(COMPONENT_TYPE_ID);
- natureandcomponents.add(compType);
- }
-
- String deployer = element.getAttribute(DEPLOYER_CLASS);
- if (deployer != null) {
- DeployerRegistry.instance().register(element, runtimeList, natureandcomponents);
- return true;
- }
- return false;
- }
-
-}
diff --git a/plugins/org.eclipse.jst.j2ee/j2eeplugin/org/eclipse/jst/j2ee/internal/deploy/FatalDeployerException.java b/plugins/org.eclipse.jst.j2ee/j2eeplugin/org/eclipse/jst/j2ee/internal/deploy/FatalDeployerException.java
deleted file mode 100644
index 4ad2fe783..000000000
--- a/plugins/org.eclipse.jst.j2ee/j2eeplugin/org/eclipse/jst/j2ee/internal/deploy/FatalDeployerException.java
+++ /dev/null
@@ -1,63 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are 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:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-/*
- * Created on Mar 30, 2004
- *
- * To change the template for this generated file go to
- * Window - Preferences - Java - Code Generation - Code and Comments
- */
-package org.eclipse.jst.j2ee.internal.deploy;
-
-/**
- * @author cbridgha
- *
- * To change the template for this generated type comment go to Window - Preferences - Java - Code
- * Generation - Code and Comments
- */
-public class FatalDeployerException extends Exception {
- /**
- * Warning clean-up 12/05/2005
- */
- private static final long serialVersionUID = -7991505439979201757L;
-
- /**
- *
- */
- public FatalDeployerException() {
- super();
- // TODO Auto-generated constructor stub
- }
-
- /**
- * @param message
- */
- public FatalDeployerException(String message) {
- super(message);
- // TODO Auto-generated constructor stub
- }
-
- /**
- * @param message
- * @param cause
- */
- public FatalDeployerException(String message, Throwable cause) {
- super(message, cause);
- // TODO Auto-generated constructor stub
- }
-
- /**
- * @param cause
- */
- public FatalDeployerException(Throwable cause) {
- super(cause);
- // TODO Auto-generated constructor stub
- }
-}
diff --git a/plugins/org.eclipse.jst.j2ee/j2eeplugin/org/eclipse/jst/j2ee/internal/deploy/J2EEDeployHelper.java b/plugins/org.eclipse.jst.j2ee/j2eeplugin/org/eclipse/jst/j2ee/internal/deploy/J2EEDeployHelper.java
deleted file mode 100644
index 2168ead88..000000000
--- a/plugins/org.eclipse.jst.j2ee/j2eeplugin/org/eclipse/jst/j2ee/internal/deploy/J2EEDeployHelper.java
+++ /dev/null
@@ -1,145 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are 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:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-/*
- * Created on Aug 4, 2004
- */
-package org.eclipse.jst.j2ee.internal.deploy;
-
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.jst.j2ee.application.Application;
-import org.eclipse.jst.j2ee.client.ApplicationClient;
-import org.eclipse.jst.j2ee.componentcore.EnterpriseArtifactEdit;
-import org.eclipse.jst.j2ee.ejb.EJBJar;
-import org.eclipse.jst.j2ee.internal.project.J2EEProjectUtilities;
-import org.eclipse.jst.j2ee.jca.Connector;
-import org.eclipse.jst.j2ee.webapplication.WebApp;
-import org.eclipse.wst.common.componentcore.ComponentCore;
-import org.eclipse.wst.common.componentcore.internal.util.ComponentUtilities;
-import org.eclipse.wst.common.componentcore.resources.IVirtualComponent;
-import org.eclipse.wst.common.internal.emf.utilities.ICommandContext;
-
-/**
- * @author cbridgha
- *
- */
-public class J2EEDeployHelper {
-
- /**
- * @param resource
- * @param context
- * @returns first EJBJar found in the project
- */
- public static EJBJar getEJBJar(IResource resource, ICommandContext context) {
- EnterpriseArtifactEdit edit = null;
- try {
- if (resource instanceof IProject) {
- IVirtualComponent comp = ComponentCore.createComponent((IProject)resource);
- if (J2EEProjectUtilities.isEJBProject(comp.getProject())) {
- edit = (EnterpriseArtifactEdit)ComponentUtilities.getArtifactEditForRead(comp);
- return (EJBJar)edit.getDeploymentDescriptorRoot();
- }
- }
- } finally {
- if (edit != null)
- edit.dispose();
- }
- return null;
- }
-
- /**
- * @param resource
- * @param context
- * @return
- */
- public static Application getApplication(IResource resource, ICommandContext context) {
- EnterpriseArtifactEdit edit = null;
- try {
- if (resource instanceof IProject) {
- IVirtualComponent comp = ComponentCore.createComponent((IProject)resource);
- if (J2EEProjectUtilities.isEARProject(comp.getProject())) {
- edit = (EnterpriseArtifactEdit)ComponentUtilities.getArtifactEditForRead(comp);
- return (Application)edit.getDeploymentDescriptorRoot();
- }
- }
- } finally {
- if (edit != null)
- edit.dispose();
- }
- return null;
- }
-
- /**
- * @param resource
- * @param context
- * @return
- */
- public static ApplicationClient getAppClient(IResource resource, ICommandContext context) {
- EnterpriseArtifactEdit edit = null;
- try {
- if (resource instanceof IProject) {
- IVirtualComponent comp = ComponentCore.createComponent((IProject)resource);
- if (J2EEProjectUtilities.isApplicationClientProject(comp.getProject())) {
- edit = (EnterpriseArtifactEdit)ComponentUtilities.getArtifactEditForRead(comp);
- return (ApplicationClient)edit.getDeploymentDescriptorRoot();
- }
- }
- } finally {
- if (edit != null)
- edit.dispose();
- }
- return null;
- }
-
- /**
- * @param resource
- * @param context
- * @return
- */
- public static WebApp getWebApp(IResource resource, ICommandContext context) {
- EnterpriseArtifactEdit edit = null;
- try {
- if (resource instanceof IProject) {
- IVirtualComponent comp = ComponentCore.createComponent((IProject)resource);
- if (J2EEProjectUtilities.isDynamicWebProject(comp.getProject())) {
- edit = (EnterpriseArtifactEdit)ComponentUtilities.getArtifactEditForRead(comp);
- return (WebApp)edit.getDeploymentDescriptorRoot();
- }
- }
- } finally {
- if (edit != null)
- edit.dispose();
- }
- return null;
- }
-
- /**
- * @param resource
- * @param context
- * @return
- */
- public static Connector getConnector(IResource resource, ICommandContext context) {
- EnterpriseArtifactEdit edit = null;
- try {
- if (resource instanceof IProject) {
- IVirtualComponent comp = ComponentCore.createComponent((IProject)resource);
- if (J2EEProjectUtilities.isJCAProject(comp.getProject())) {
- edit = (EnterpriseArtifactEdit)ComponentUtilities.getArtifactEditForRead(comp);
- return (Connector)edit.getDeploymentDescriptorRoot();
- }
- }
- } finally {
- if (edit != null)
- edit.dispose();
- }
- return null;
- }
-}
diff --git a/plugins/org.eclipse.jst.j2ee/j2eeplugin/org/eclipse/jst/j2ee/internal/deploy/J2EEDeployOperation.java b/plugins/org.eclipse.jst.j2ee/j2eeplugin/org/eclipse/jst/j2ee/internal/deploy/J2EEDeployOperation.java
deleted file mode 100644
index 41a744d30..000000000
--- a/plugins/org.eclipse.jst.j2ee/j2eeplugin/org/eclipse/jst/j2ee/internal/deploy/J2EEDeployOperation.java
+++ /dev/null
@@ -1,234 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are 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:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-/*
- * Created on Apr 1, 2004
- *
- * To change the template for this generated file go to
- * Window - Preferences - Java - Code Generation - Code and Comments
- */
-package org.eclipse.jst.j2ee.internal.deploy;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.core.runtime.IConfigurationElement;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.MultiStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.jem.util.emf.workbench.ProjectUtilities;
-import org.eclipse.jem.util.logger.proxy.Logger;
-import org.eclipse.jst.j2ee.internal.plugin.J2EEPlugin;
-import org.eclipse.jst.j2ee.internal.plugin.J2EEPluginResourceHandler;
-import org.eclipse.jst.j2ee.internal.project.J2EEProjectUtilities;
-import org.eclipse.jst.j2ee.model.IModelProvider;
-import org.eclipse.jst.j2ee.model.ModelProviderManager;
-import org.eclipse.wst.common.componentcore.ComponentCore;
-import org.eclipse.wst.common.componentcore.resources.IVirtualComponent;
-import org.eclipse.wst.common.frameworks.datamodel.AbstractDataModelOperation;
-import org.eclipse.wst.common.internal.emf.utilities.CommandContext;
-import org.eclipse.wst.common.internal.emf.utilities.ICommand;
-import org.eclipse.wst.common.internal.emf.utilities.ICommandContext;
-import org.eclipse.wst.server.core.IRuntime;
-
-/**
- * @author cbridgha
- *
- * To change the template for this generated type comment go to Window - Preferences - Java - Code
- * Generation - Code and Comments
- */
-public class J2EEDeployOperation extends AbstractDataModelOperation {
-
- private Object[] selection;
- private IStatus multiStatus;
- private IProject currentProject;
-
- /**
- *
- */
- public J2EEDeployOperation(Object[] deployableObjects) {
- super();
- selection = deployableObjects;
- // TODO Auto-generated constructor stub
- }
-
- public IStatus redo(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
- // TODO Auto-generated method stub
- return null;
- }
-
- public IStatus undo(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
- // TODO Auto-generated method stub
- return null;
- }
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.wst.common.frameworks.internal.operation.WTPOperation#execute(org.eclipse.core.runtime.IProgressMonitor)
- */
- public IStatus execute(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
- DeployerRegistry reg = DeployerRegistry.instance();
- List components = getSelectedModules(selection);
- monitor.beginTask(J2EEPluginResourceHandler.J2EEDeployOperation_UI_0, components.size());
- for (int i = 0; i < components.size(); i++) {
- IVirtualComponent component = null;
- component = (IVirtualComponent) components.get(i);
- IProject proj = component.getProject();
- IRuntime runtime = null;
- try {
- runtime = J2EEProjectUtilities.getServerRuntime(proj);
- }
- catch (CoreException e) {
- J2EEPlugin.getDefault().getLog().log(e.getStatus());
- }
- if (runtime == null)
- continue;
- List visitors = reg.getDeployModuleExtensions(proj, runtime);
- deploy(visitors, component, monitor);
- monitor.worked(1);
- }
- return getMultiStatus();
- }
-
- /**
- * @param visitors
- * @param module
- */
- private void deploy(List visitors, IVirtualComponent component, IProgressMonitor monitor) {
- IProject proj = component.getProject();
- for (int i = 0; i < visitors.size(); i++) {
- if (!(visitors.get(i) instanceof IConfigurationElement))
- continue;
- ICommand dep = null;
- try {
- dep = (ICommand) ((IConfigurationElement) visitors.get(i)).createExecutableExtension(DeployerRegistryReader.DEPLOYER_CLASS);
- } catch (Exception e) {
- e.printStackTrace();
- continue;
- }
-
- if (dep == null) continue;
- dep.init(selection);
-
- monitor.setTaskName(J2EEPluginResourceHandler.getString(J2EEPluginResourceHandler.J2EEDeployOperation_1_UI_, new Object[]{proj.getName(), dep.getClass().getName()}));
- try {
- IModelProvider modelProvider = ModelProviderManager.getModelProvider(proj);
- // we just happen to know it
- EObject eObject = (EObject) modelProvider.getModelObject();
-
- if(eObject == null) continue;
-
- ICommandContext ctx = new CommandContext(monitor, null, eObject.eResource().getResourceSet());
-
- dep.execute(proj, null, ctx);
- addOKStatus(dep.getClass().getName());
- } catch (CoreException ex) {
- Logger.getLogger().logError(ex);
- Throwable statusException = (ex.getStatus().getException() != null) ? ex.getStatus().getException() : ex;
- addErrorStatus(ex.getStatus(), dep.getClass().getName(), statusException);
- continue;
- }
- }
- }
-
- /**
- * @param proj
- * @param name
- */
- private void addOKStatus(String DeployerName) {
-
- IStatus statusLocal = new Status(IStatus.OK, " ", IStatus.OK, (J2EEPluginResourceHandler.getString("J2EEDeployOperation_2_UI_", new Object[]{DeployerName})), null); //$NON-NLS-1$ //$NON-NLS-2$
- //TODO
- getMultiStatus().add(statusLocal);
-
- }
-
- /**
- * @param exceptionStatus
- * @param proj
- * @param name
- */
- private void addErrorStatus(IStatus exceptionStatus, String DeployerName, Throwable ex) {
-
- Throwable mainCause = null;
- if (exceptionStatus instanceof MultiStatus) {
- IStatus[] stati = ((MultiStatus) exceptionStatus).getChildren();
- for (int i = 0; 1 < stati.length; i++) {
- addErrorStatus(stati[i], DeployerName, stati[i].getException());
- }
- }
- mainCause = (ex.getCause() != null) ? ex.getCause() : ex;
-
- //String errorNotes = (mainCause != null && mainCause.getMessage() != null) ? mainCause.getMessage() : "";
-
- String message = J2EEPluginResourceHandler.bind(J2EEPluginResourceHandler.J2EEDeployOperation_3_UI_,DeployerName, ""); //$NON-NLS-1$
- IStatus statusLocal = new Status(IStatus.ERROR, J2EEPlugin.getPlugin().getPluginID(), IStatus.ERROR, message, mainCause); //$NON-NLS-1$
- getMultiStatus().add(statusLocal);
-
-
-
- }
-
- private IStatus getMainStatus(IProject proj) {
-
- IStatus aStatus = new MultiStatus(J2EEPlugin.getPlugin().getPluginID(), IStatus.OK, J2EEPluginResourceHandler.getString(J2EEPluginResourceHandler.J2EEDeployOperation_4_UI_, new Object[]{proj.getName()}), null);
-
- return aStatus;
- }
-
- /**
- * @return Returns the multiStatus.
- */
- public MultiStatus getMultiStatus() {
- if (multiStatus == null)
- multiStatus = getMainStatus(currentProject);
- return (MultiStatus)multiStatus;
- }
-
- /**
- * @param multiStatus
- * The multiStatus to set.
- */
- public void setMultiStatus(IStatus newStatus) {
- this.multiStatus = newStatus;
- }
-
- protected List getSelectedModules(Object[] mySelections) {
- List components = new ArrayList();
- for (int i = 0; i < mySelections.length; i++) {
- Object object = mySelections[i];
- if (object instanceof EObject) {
- object = ProjectUtilities.getProject(object);
- currentProject = (IProject)object;
- }
- if (object instanceof IProject) {
- currentProject = (IProject)object;
- IVirtualComponent component = ComponentCore.createComponent((IProject)object);
- if (components.contains(component)){
- continue;
- }
- // Order Ears first...
- if (J2EEProjectUtilities.isEARProject(component.getProject())) {
- components.add(0,component);
- }
- else {
- components.add(component);
- }
- }
- }
- return components;
- }
-}
diff --git a/plugins/org.eclipse.jst.j2ee/j2eeplugin/org/eclipse/jst/j2ee/internal/deploy/J2EEDeployer.java b/plugins/org.eclipse.jst.j2ee/j2eeplugin/org/eclipse/jst/j2ee/internal/deploy/J2EEDeployer.java
deleted file mode 100644
index b6ad428d8..000000000
--- a/plugins/org.eclipse.jst.j2ee/j2eeplugin/org/eclipse/jst/j2ee/internal/deploy/J2EEDeployer.java
+++ /dev/null
@@ -1,58 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are 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:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jst.j2ee.internal.deploy;
-
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.jst.j2ee.application.Application;
-import org.eclipse.jst.j2ee.client.ApplicationClient;
-import org.eclipse.jst.j2ee.ejb.EJBJar;
-import org.eclipse.jst.j2ee.jca.Connector;
-import org.eclipse.jst.j2ee.webapplication.WebApp;
-
-
-/*
- * Deployer interface for the J2EEDeploymentFramework
- */
-/**
- * @author cbridgha
- *
- * To change the template for this generated type comment go to Window - Preferences - Java - Code
- * Generation - Code and Comments
- * @deprecated - Change to use the org.eclipse.wst.common.emf.utilities.ICommand interface
- */
-public interface J2EEDeployer {
- /*
- * This will contain the multi-selection of objects to deploy. This selection could be used to
- * filter elements within a Module. Any other setup code should be done here...
- */
- void init(Object[] selection);
-
- /*
- * This will visit each extension's deploy operation on the deployable object. A Multi-Status
- * should be returned
- */
- IStatus visit(EJBJar deployable) throws FatalDeployerException;
-
- IStatus visit(ApplicationClient deployable) throws FatalDeployerException;
-
- IStatus visit(Application deployable) throws FatalDeployerException;
-
- IStatus visit(WebApp deployable) throws FatalDeployerException;
-
- IStatus visit(Connector deployable) throws FatalDeployerException;
-
- /*
- * Any cleanup should be done here...
- */
- void finish();
-
-
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.jst.j2ee/j2eeplugin/org/eclipse/jst/j2ee/internal/deployables/EnterpriseApplicationDeployableAdapterUtil.java b/plugins/org.eclipse.jst.j2ee/j2eeplugin/org/eclipse/jst/j2ee/internal/deployables/EnterpriseApplicationDeployableAdapterUtil.java
deleted file mode 100644
index f1467a2e6..000000000
--- a/plugins/org.eclipse.jst.j2ee/j2eeplugin/org/eclipse/jst/j2ee/internal/deployables/EnterpriseApplicationDeployableAdapterUtil.java
+++ /dev/null
@@ -1,208 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are 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:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jst.j2ee.internal.deployables;
-
-import java.util.Arrays;
-import java.util.Iterator;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.ecore.resource.Resource;
-import org.eclipse.jem.util.emf.workbench.ProjectUtilities;
-import org.eclipse.jst.j2ee.application.Application;
-import org.eclipse.jst.j2ee.internal.J2EEConstants;
-import org.eclipse.jst.j2ee.internal.project.J2EEProjectUtilities;
-import org.eclipse.wst.common.componentcore.ComponentCore;
-import org.eclipse.wst.common.componentcore.resources.IVirtualComponent;
-import org.eclipse.wst.common.componentcore.resources.IVirtualResource;
-import org.eclipse.wst.common.internal.emfworkbench.WorkbenchResourceHelper;
-import org.eclipse.wst.server.core.IModule;
-import org.eclipse.wst.server.core.IModuleArtifact;
-import org.eclipse.wst.server.core.ServerUtil;
-import org.eclipse.wst.server.core.util.NullModuleArtifact;
-
-/**
- * Creates the Object adapter for ear projects.
- */
-public class EnterpriseApplicationDeployableAdapterUtil {
-
- /**
- * Constructor for EnterpriseApplicationDeployableObjectAdapter.
- */
- public EnterpriseApplicationDeployableAdapterUtil() {
- super();
- }// EnterpriseApplicationDeployableObjectAdapter
-
- /**
- * Gets the object for a type of object.
- *
- * @param Object
- * obj - Object to adapt.
- */
- public static IModuleArtifact getModuleObject(Object obj) {
- if (obj instanceof Application)
- return getModuleObject((Application) obj);
- if (obj instanceof IProject)
- return getModuleObject((IProject) obj);
- if (obj instanceof IFile)
- return getModuleObject((IFile) obj);
- return null;
- }// getDeployableObject
-
- /**
- * Gets the deployable object for ear instance.
- *
- * @param Application
- * application - EAR instance.
- */
- protected static IModuleArtifact getModuleObject(Application application) {
- IModule dep = getModule(application);
- return createModuleObject(dep);
- }// getDeployableObject
-
- /**
- * Gets the deployable object for project instances.
- *
- * @param IProject
- * project - Project instance.
- * @return IModuleObject
- */
- protected static IModuleArtifact getModuleObject(IProject project) {
- IModule dep = getModule(project,null);
- return createModuleObject(dep);
- }// getModuleObject
-
- /**
- * Gets the deployable object for file instances.
- *
- * @param IFile
- * file - File instance.
- * @return IModuleObject
- */
- protected static IModuleArtifact getModuleObject(IFile file) {
- if (file.getProjectRelativePath().toString().endsWith(J2EEConstants.APPLICATION_DD_URI)) {
- {
- IVirtualResource[] resources = ComponentCore.createResources(file);
- IVirtualComponent component = null;
- if (resources[0] != null || resources.length <= 0)
- component = resources[0].getComponent();
- return createModuleObject(getModule(file.getProject(), component));
- }
- }// if
- return null;
- }// getModuleObject
-
- /**
- * Gets the deployable object.
- *
- * @param EObject
- * refObject - The current refObject.
- * @return IModule
- */
- protected static IModule getModule(EObject refObject) {
- IProject proj = ProjectUtilities.getProject(refObject);
- Resource servResource = refObject.eResource();
- IVirtualResource[] resources = null;
- try {
- IResource eclipeServResoruce = WorkbenchResourceHelper.getFile(servResource);
- resources = ComponentCore.createResources(eclipeServResoruce);
- } catch (Exception e) {
- e.printStackTrace();
- }
- IVirtualComponent component = null;
- if (resources[0] != null)
- component = resources[0].getComponent();
- return getModule(proj,component);
- }// getModule
-
-
-
- protected static IModule getModuleProject(IProject project, Iterator iterator) {
- IModule deployable = null;
- while (iterator.hasNext()) {
- Object next = iterator.next();
- if (next instanceof IModule) {
- deployable = (IModule) next;
- if (deployable.getProject().equals(project))
- return deployable;
- }
- }
- return null;
- }
-
- protected static IModule getModule(IProject project, IVirtualComponent component) {
- IModule deployable = null;
- Iterator iterator = Arrays.asList(ServerUtil.getModules(J2EEProjectUtilities.ENTERPRISE_APPLICATION)).iterator();
- String componentName = null;
- if (component != null)
- componentName = component.getName();
- else
- return getModuleProject(project, iterator);
- while (iterator.hasNext()) {
- Object next = iterator.next();
- if (next instanceof IModule) {
- deployable = (IModule) next;
- if (deployable.getName().equals(componentName)) {
- return deployable;
- }
- }
- }
- return null;
- }
-
- /**
- * Creates the deployable object.
- *
- * @param IModuleObject
- * deployable - The current module object.
- */
- protected static IModuleArtifact createModuleObject(IModule module) {
-
- if (module != null) {
- return new NullModuleArtifact(module);
- }
-
- return null;
- }// createDeployableObject
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.wst.server.core.IModuleArtifactAdapter#getId()
- */
- public String getId() {
- // TODO Auto-generated method stub
- return null;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.wst.server.core.IModuleArtifactAdapter#getObjectClassName()
- */
- public String getObjectClassName() {
- // TODO Auto-generated method stub
- return null;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.wst.server.core.IModuleArtifactAdapter#isPluginActivated()
- */
- public boolean isPluginActivated() {
- // TODO Auto-generated method stub
- return false;
- }
-
-}// EnterpriseApplicationDeployableObjectAdapter
diff --git a/plugins/org.eclipse.jst.j2ee/j2eeplugin/org/eclipse/jst/j2ee/internal/deployables/FlexibleProjectServerUtil.java b/plugins/org.eclipse.jst.j2ee/j2eeplugin/org/eclipse/jst/j2ee/internal/deployables/FlexibleProjectServerUtil.java
deleted file mode 100644
index 8330be32e..000000000
--- a/plugins/org.eclipse.jst.j2ee/j2eeplugin/org/eclipse/jst/j2ee/internal/deployables/FlexibleProjectServerUtil.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are 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:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jst.j2ee.internal.deployables;
-
-import org.eclipse.core.resources.IProject;
-import org.eclipse.jst.server.core.IJ2EEModule;
-import org.eclipse.wst.common.componentcore.internal.StructureEdit;
-import org.eclipse.wst.common.componentcore.internal.WorkbenchComponent;
-import org.eclipse.wst.server.core.IModule;
-import org.eclipse.wst.server.core.ServerUtil;
-
-public class FlexibleProjectServerUtil {
-
- public static IJ2EEModule getModuleDelegate(WorkbenchComponent component) {
- IModule module = getModule(component);
- return getModuleDelegate(module);
- }
-
- public static IModule getModule(IProject project) {
- return ServerUtil.getModule(project);
- }
-
- public static IJ2EEModule getModuleDelegate(IModule module) {
- return (IJ2EEModule) module.loadAdapter(IJ2EEModule.class, null);
- }
-
- public static IModule getModule(WorkbenchComponent component) {
- return getModule(StructureEdit.getContainingProject(component));
- }
-}
diff --git a/plugins/org.eclipse.jst.j2ee/j2eeplugin/org/eclipse/jst/j2ee/internal/deployables/J2EEDeployableFactory.java b/plugins/org.eclipse.jst.j2ee/j2eeplugin/org/eclipse/jst/j2ee/internal/deployables/J2EEDeployableFactory.java
deleted file mode 100644
index 9fec645ed..000000000
--- a/plugins/org.eclipse.jst.j2ee/j2eeplugin/org/eclipse/jst/j2ee/internal/deployables/J2EEDeployableFactory.java
+++ /dev/null
@@ -1,205 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are 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:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jst.j2ee.internal.deployables;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.Path;
-import org.eclipse.jem.util.logger.proxy.Logger;
-import org.eclipse.jst.j2ee.application.Application;
-import org.eclipse.jst.j2ee.application.Module;
-import org.eclipse.jst.j2ee.client.ApplicationClient;
-import org.eclipse.jst.j2ee.componentcore.util.EARArtifactEdit;
-import org.eclipse.jst.j2ee.ejb.EJBJar;
-import org.eclipse.jst.j2ee.internal.J2EEVersionConstants;
-import org.eclipse.jst.j2ee.internal.project.J2EEProjectUtilities;
-import org.eclipse.jst.j2ee.jca.Connector;
-import org.eclipse.jst.j2ee.webapplication.WebApp;
-import org.eclipse.wst.common.componentcore.ArtifactEdit;
-import org.eclipse.wst.common.componentcore.ComponentCore;
-import org.eclipse.wst.common.componentcore.ModuleCoreNature;
-import org.eclipse.wst.common.componentcore.internal.StructureEdit;
-import org.eclipse.wst.common.componentcore.internal.util.ComponentUtilities;
-import org.eclipse.wst.common.componentcore.internal.util.IModuleConstants;
-import org.eclipse.wst.common.componentcore.resources.IVirtualComponent;
-import org.eclipse.wst.common.componentcore.resources.IVirtualReference;
-import org.eclipse.wst.server.core.IModule;
-import org.eclipse.wst.server.core.model.ModuleDelegate;
-import org.eclipse.wst.server.core.util.ProjectModuleFactoryDelegate;
-
-/**
- * J2EE module factory.
- */
-public class J2EEDeployableFactory extends ProjectModuleFactoryDelegate {
- protected Map moduleDelegates = new HashMap(5);
-
- public static final String ID = "org.eclipse.jst.j2ee.server"; //$NON-NLS-1$
-
- public J2EEDeployableFactory() {
- super();
- }
-
- protected IModule[] createModules(IProject project) {
- try {
- if (project.exists()) {
- ModuleCoreNature nature = (ModuleCoreNature) project.getNature(IModuleConstants.MODULE_NATURE_ID);
- if (nature != null)
- return createModules(nature);
- }
- } catch (CoreException e) {
- Logger.getLogger().write(e);
- }
- return null;
- }
-
- protected IModule[] createModules(ModuleCoreNature nature) {
- IProject project = nature.getProject();
- try {
- IVirtualComponent comp = ComponentCore.createComponent(project);
- return createModuleDelegates(comp);
- } catch (Exception e) {
- Logger.getLogger().write(e);
- }
- return null;
- }
-
- public ModuleDelegate getModuleDelegate(IModule module) {
- return (ModuleDelegate) moduleDelegates.get(module);
- }
-
- protected IModule[] createModuleDelegates(IVirtualComponent component) {
- List projectModules = new ArrayList();
- try {
- if(J2EEProjectUtilities.isLegacyJ2EEProject(component.getProject())){
- IModule module = null;
- String type = J2EEProjectUtilities.getJ2EEProjectType(component.getProject());
- String version = J2EEProjectUtilities.getJ2EEProjectVersion(component.getProject());
- module = createModule(component.getDeployedName(), component.getDeployedName(), type, version, component.getProject());
- J2EEFlexProjDeployable moduleDelegate = new J2EEFlexProjDeployable(component.getProject(), component);
- moduleDelegates.put(module, moduleDelegate);
- projectModules.add(module);
-
- // Check to add any binary modules
- if (J2EEProjectUtilities.ENTERPRISE_APPLICATION.equals(type))
- projectModules.addAll(Arrays.asList(createBinaryModules(component)));
- } else {
- return null;
- }
- } catch (Exception e) {
- Logger.getLogger().write(e);
- }
- return (IModule[]) projectModules.toArray(new IModule[projectModules.size()]);
- }
-
- protected IModule[] createBinaryModules(IVirtualComponent component) {
- List projectModules = new ArrayList();
- EARArtifactEdit earEdit = null;
- try {
- Application app = null;
- IVirtualReference[] references = component.getReferences();
- for (int i=0; i<references.length; i++) {
- IVirtualComponent moduleComponent = references[i].getReferencedComponent();
- // Is referenced component a J2EE binary module archive or binary utility project?
- if (moduleComponent.isBinary()) {
- // create an ear edit, app only if the module is binary prevents exceptions when there
- // is no deployment descriptor in many cases see bug 174711
- if(earEdit == null){
- earEdit = EARArtifactEdit.getEARArtifactEditForRead(component.getProject());
- app = earEdit.getApplication();
- }
- // Check if module URI exists on EAR DD for binary j2ee archive
- Module j2eeModule = app.getFirstModule(references[i].getArchiveName());
- // If it is not a j2ee module and the component project is the ear, it is just an archive
- // and we can ignore as it will be processed by the EAR deployable.members() method
- if (j2eeModule == null && (moduleComponent.getProject() == component.getProject()))
- continue;
-
- String moduleVersion = null;
- String moduleType = null;
- // Handle the binary J2EE module case
- if(j2eeModule != null){
- ArtifactEdit moduleEdit = null;
- try {
- if (j2eeModule.isEjbModule()) {
- moduleEdit = ComponentUtilities.getArtifactEditForRead(moduleComponent, J2EEProjectUtilities.EJB);
- EJBJar ejbJar = (EJBJar) moduleEdit.getContentModelRoot();
- moduleType = J2EEProjectUtilities.EJB;
- moduleVersion = ejbJar.getVersion();
- }
- else if (j2eeModule.isWebModule()) {
- moduleEdit = ComponentUtilities.getArtifactEditForRead(moduleComponent, J2EEProjectUtilities.DYNAMIC_WEB);
- WebApp webApp = (WebApp) moduleEdit.getContentModelRoot();
- moduleType = J2EEProjectUtilities.DYNAMIC_WEB;
- moduleVersion = webApp.getVersion();
- }
- else if (j2eeModule.isConnectorModule()) {
- moduleEdit = ComponentUtilities.getArtifactEditForRead(moduleComponent, J2EEProjectUtilities.JCA);
- Connector connector = (Connector) moduleEdit.getContentModelRoot();
- moduleType = J2EEProjectUtilities.JCA;
- moduleVersion = connector.getVersion();
- }
- else if (j2eeModule.isJavaModule()) {
- moduleEdit = ComponentUtilities.getArtifactEditForRead(moduleComponent, J2EEProjectUtilities.APPLICATION_CLIENT);
- ApplicationClient appClient = (ApplicationClient) moduleEdit.getContentModelRoot();
- moduleType = J2EEProjectUtilities.APPLICATION_CLIENT;
- moduleVersion = appClient.getVersion();
- }
- } finally {
- if (moduleEdit!=null)
- moduleEdit.dispose();
- }
- } else { // Handle the binary utility component outside the EAR case.
- moduleVersion = J2EEProjectUtilities.UTILITY;
- moduleType = J2EEVersionConstants.VERSION_1_0_TEXT;
- }
-
- IModule nestedModule = createModule(moduleComponent.getDeployedName(), moduleComponent.getDeployedName(), moduleType, moduleVersion, moduleComponent.getProject());
- if (nestedModule!=null) {
- J2EEFlexProjDeployable moduleDelegate = new J2EEFlexProjDeployable(moduleComponent.getProject(), moduleComponent);
- moduleDelegates.put(nestedModule, moduleDelegate);
- projectModules.add(nestedModule);
- moduleDelegate.getURI(nestedModule);
- }
- }
- }
- } finally {
- if (earEdit!=null)
- earEdit.dispose();
- }
- return (IModule[]) projectModules.toArray(new IModule[projectModules.size()]);
- }
-
- /**
- * Returns the list of resources that the module should listen to
- * for state changes. The paths should be project relative paths.
- * Subclasses can override this method to provide the paths.
- *
- * @return a possibly empty array of paths
- */
- protected IPath[] getListenerPaths() {
- return new IPath[] {
- new Path(".project"), // nature
- new Path(StructureEdit.MODULE_META_FILE_NAME), // component
- new Path(".settings/org.eclipse.wst.common.project.facet.core.xml") // facets
- };
- }
-
- protected void clearCache() {
- moduleDelegates = new HashMap(5);
- }
-}
diff --git a/plugins/org.eclipse.jst.j2ee/j2eeplugin/org/eclipse/jst/j2ee/internal/deployables/J2EEFlexProjDeployable.java b/plugins/org.eclipse.jst.j2ee/j2eeplugin/org/eclipse/jst/j2ee/internal/deployables/J2EEFlexProjDeployable.java
deleted file mode 100644
index 27a810a6a..000000000
--- a/plugins/org.eclipse.jst.j2ee/j2eeplugin/org/eclipse/jst/j2ee/internal/deployables/J2EEFlexProjDeployable.java
+++ /dev/null
@@ -1,1036 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are 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:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jst.j2ee.internal.deployables;
-
-import java.io.File;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.net.URL;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Properties;
-import java.util.Set;
-
-import org.eclipse.core.resources.IContainer;
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.Path;
-import org.eclipse.jdt.core.IJavaProject;
-import org.eclipse.jdt.core.IPackageFragmentRoot;
-import org.eclipse.jem.workbench.utility.JemProjectUtilities;
-import org.eclipse.jst.j2ee.application.Application;
-import org.eclipse.jst.j2ee.classpathdep.ClasspathDependencyUtil;
-import org.eclipse.jst.j2ee.classpathdep.IClasspathDependencyConstants;
-import org.eclipse.jst.j2ee.componentcore.J2EEModuleVirtualArchiveComponent;
-import org.eclipse.jst.j2ee.componentcore.J2EEModuleVirtualComponent;
-import org.eclipse.jst.j2ee.componentcore.util.EARArtifactEdit;
-import org.eclipse.jst.j2ee.ejb.EJBJar;
-import org.eclipse.jst.j2ee.internal.EjbModuleExtensionHelper;
-import org.eclipse.jst.j2ee.internal.IEJBModelExtenderManager;
-import org.eclipse.jst.j2ee.internal.J2EEConstants;
-import org.eclipse.jst.j2ee.internal.classpathdep.ClasspathDependencyManifestUtil;
-import org.eclipse.jst.j2ee.internal.classpathdep.ClasspathDependencyVirtualComponent;
-import org.eclipse.jst.j2ee.internal.plugin.IJ2EEModuleConstants;
-import org.eclipse.jst.j2ee.internal.plugin.J2EEPlugin;
-import org.eclipse.jst.j2ee.internal.project.J2EEProjectUtilities;
-import org.eclipse.jst.server.core.IApplicationClientModule;
-import org.eclipse.jst.server.core.IConnectorModule;
-import org.eclipse.jst.server.core.IEJBModule;
-import org.eclipse.jst.server.core.IEnterpriseApplication;
-import org.eclipse.jst.server.core.IJ2EEModule;
-import org.eclipse.jst.server.core.IWebModule;
-import org.eclipse.wst.common.componentcore.ArtifactEdit;
-import org.eclipse.wst.common.componentcore.ComponentCore;
-import org.eclipse.wst.common.componentcore.internal.ComponentResource;
-import org.eclipse.wst.common.componentcore.internal.StructureEdit;
-import org.eclipse.wst.common.componentcore.internal.WorkbenchComponent;
-import org.eclipse.wst.common.componentcore.internal.resources.VirtualArchiveComponent;
-import org.eclipse.wst.common.componentcore.internal.util.ComponentUtilities;
-import org.eclipse.wst.common.componentcore.internal.util.IModuleConstants;
-import org.eclipse.wst.common.componentcore.resources.IVirtualComponent;
-import org.eclipse.wst.common.componentcore.resources.IVirtualFolder;
-import org.eclipse.wst.common.componentcore.resources.IVirtualReference;
-import org.eclipse.wst.server.core.IModule;
-import org.eclipse.wst.server.core.ServerUtil;
-import org.eclipse.wst.server.core.internal.ModuleFile;
-import org.eclipse.wst.server.core.internal.ModuleFolder;
-import org.eclipse.wst.server.core.model.IModuleFile;
-import org.eclipse.wst.server.core.model.IModuleFolder;
-import org.eclipse.wst.server.core.model.IModuleResource;
-import org.eclipse.wst.web.internal.deployables.ComponentDeployable;
-/**
- * J2EE module superclass.
- */
-public class J2EEFlexProjDeployable extends ComponentDeployable implements IJ2EEModule, IEnterpriseApplication, IApplicationClientModule, IConnectorModule, IEJBModule, IWebModule {
- protected static final IPath WEB_CLASSES_PATH = new Path(J2EEConstants.WEB_INF_CLASSES);
- protected static final IPath MANIFEST_PATH = new Path(J2EEConstants.MANIFEST_URI);
- protected static IPath WEBLIB = new Path(J2EEConstants.WEB_INF_LIB).makeAbsolute();
- protected IPackageFragmentRoot[] cachedSourceContainers;
- protected IContainer[] cachedOutputContainers;
- protected HashMap cachedOutputMappings;
- protected HashMap cachedSourceOutputPairs;
- protected List classpathComponentDependencyURIs = new ArrayList();
-
- /**
- * Constructor for J2EEFlexProjDeployable.
- *
- * @param project
- * @param aComponent
- */
- public J2EEFlexProjDeployable(IProject project, IVirtualComponent aComponent) {
- super(project, aComponent);
- }
-
-
- /**
- * Constructor for J2EEFlexProjDeployable.
- *
- * @param project
- */
- public J2EEFlexProjDeployable(IProject project) {
- super(project);
- }
-
- /**
- * Returns the root folders for the resources in this module.
- *
- * @return a possibly-empty array of resource folders
- */
- public IContainer[] getResourceFolders() {
- List result = new ArrayList();
- IVirtualComponent vc = ComponentCore.createComponent(getProject());
- if (vc != null) {
- IVirtualFolder vFolder = vc.getRootFolder();
- if (vFolder != null) {
- IContainer[] underlyingFolders = vFolder.getUnderlyingFolders();
- result.addAll(Arrays.asList(underlyingFolders));
- }
- }
- return (IContainer[]) result.toArray(new IContainer[result.size()]);
- }
-
- /**
- * Returns the root folders containing Java output in this module.
- *
- * @return a possibly-empty array of Java output folders
- */
- public IContainer[] getJavaOutputFolders() {
- if (cachedOutputContainers == null)
- cachedOutputContainers = getJavaOutputFolders(getProject());
- return cachedOutputContainers;
- }
-
- public IContainer[] getJavaOutputFolders(IProject project) {
- if (project == null)
- return new IContainer[0];
- return J2EEProjectUtilities.getOutputContainers(project);
- }
-
- protected boolean shouldIncludeUtilityComponent(IVirtualComponent virtualComp,IVirtualReference[] references, ArtifactEdit edit) {
- // If the component module is an EAR we know all archives are filtered out of virtual component members
- // and we will return only those archives which are not binary J2EE modules in the EAR DD. These J2EE modules will
- // be returned by getChildModules()
- if (J2EEProjectUtilities.isEARProject(component.getProject())) {
- return virtualComp != null && virtualComp.isBinary() && !isNestedJ2EEModule(virtualComp, references, (EARArtifactEdit)edit);
- } else {
- return super.shouldIncludeUtilityComponent(virtualComp, references, edit);
- }
- }
-
- protected void addUtilMember(IVirtualComponent parent, IVirtualReference reference, IPath runtimePath) {
- // do not add classpath dependencies whose runtime path (../) maps to the parent component or that represent
- // class folders
- if (!runtimePath.equals(IClasspathDependencyConstants.RUNTIME_MAPPING_INTO_CONTAINER_PATH)
- && !ClasspathDependencyUtil.isClassFolderReference(reference)) {
- super.addUtilMember(parent, reference, runtimePath);
- }
- }
-
- protected IModuleResource[] getBinaryModuleMembers() {
- IPath archivePath = ((J2EEModuleVirtualArchiveComponent)component).getWorkspaceRelativePath();
- ModuleFile mf = null;
- if (archivePath != null) { //In Workspace
- IFile utilFile = ResourcesPlugin.getWorkspace().getRoot().getFile(archivePath);
- mf = new ModuleFile(utilFile, utilFile.getName(), ((J2EEModuleVirtualArchiveComponent)component).getRuntimePath().makeRelative());
- } else {
- File extFile = ((J2EEModuleVirtualArchiveComponent)component).getUnderlyingDiskFile();
- mf = new ModuleFile(extFile, extFile.getName(), ((J2EEModuleVirtualArchiveComponent)component).getRuntimePath().makeRelative());
- }
- return new IModuleResource[] {mf};
- }
-
- public IModuleResource[] members() throws CoreException {
- members.clear();
- classpathComponentDependencyURIs.clear();
-
- // Handle binary components
- if (component instanceof J2EEModuleVirtualArchiveComponent)
- return getBinaryModuleMembers();
-
- if (J2EEProjectUtilities.isEARProject(component.getProject())) {
- // If an EAR, add classpath contributions for all referenced modules
- addReferencedComponentClasspathDependencies(component, false);
- } else {
- if (J2EEProjectUtilities.isDynamicWebProject(component.getProject())) {
- // If a web, add classpath contributions for all WEB-INF/lib modules
- addReferencedComponentClasspathDependencies(component, true);
- }
- if (canExportClasspathComponentDependencies(component)){
- saveClasspathDependencyURIs(component);
- }
- // Add all Java output folders that have publish/export attributes
- addClassFolderDependencies(component);
- }
-
- // If j2ee project structure is a single root structure, just return optimized members
- if (isSingleRootStructure()) {
- final IModuleResource[] resources = getOptimizedMembers();
- if (!classpathComponentDependencyURIs.isEmpty()) {
- for (int i = 0; i < resources.length; i++) {
- if (resources[i] instanceof IModuleFolder) {
- IModuleFolder folder = (IModuleFolder) resources[i];
- if (folder.getName().equals(J2EEConstants.META_INF)) {
- IModuleResource[] files = folder.members();
- for (int j = 0; j < files.length; j++) {
- files[j] = replaceManifestFile((IModuleFile) files[j]);
- }
- }
- }
- }
- }
- // add to any potentially mapped Java class folders
- for (int i = 0; i < resources.length; i++) {
- members.add(resources[i]);
- }
- return (IModuleResource[]) members.toArray(new IModuleResource[members.size()]);
- }
-
- cachedSourceContainers = J2EEProjectUtilities.getSourceContainers(getProject());
- try {
- IPath javaPath = Path.EMPTY;
- if (J2EEProjectUtilities.isDynamicWebProject(component.getProject()))
- javaPath = WEB_CLASSES_PATH;
-
- if (component != null) {
- IVirtualFolder vFolder = component.getRootFolder();
- IModuleResource[] mr = getMembers(vFolder, Path.EMPTY);
- int size = mr.length;
- for (int j = 0; j < size; j++) {
- members.add(mr[j]);
- }
- }
-
- IContainer[] javaCont = getJavaOutputFolders();
- int size = javaCont.length;
- for (int i = 0; i < size; i++) {
- //If the java output is in the scope of the virtual component, ignore to avoid duplicates
- if (ComponentCore.createResources(javaCont[i]).length > 0)
- continue;
- IModuleResource[] mr = getMembers(javaCont[i], javaPath, javaPath, javaCont);
- int size2 = mr.length;
- for (int j = 0; j < size2; j++) {
- members.add(mr[j]);
- }
- }
-
- if (component != null) {
- addUtilMembers(component);
- List consumableMembers = getConsumableReferencedMembers(component);
- if (!consumableMembers.isEmpty())
- members.addAll(consumableMembers);
- }
-
- IModuleResource[] mr = new IModuleResource[members.size()];
- members.toArray(mr);
- return mr;
- } finally {
- cachedSourceContainers = null;
- cachedOutputContainers = null;
- cachedOutputMappings = null;
- cachedSourceOutputPairs = null;
- }
- }
-
- protected IModuleFile createModuleFile(IFile file, IPath path) {
- // if this is the MANIFEST.MF file and we have classpath component dependencies,
- // update it
- return replaceManifestFile(super.createModuleFile(file, path));
- }
-
- protected IModuleFile replaceManifestFile(IModuleFile moduleFile) {
- final IFile file = (IFile) moduleFile.getAdapter(IFile.class);
- final IPath path = moduleFile.getModuleRelativePath();
- // if the MANIFEST.MF is being requested and we have classpath component dependencies,
- // dynamically generate a customized MANIFEST.MF and return that
- if (path.append(file.getName()).equals(MANIFEST_PATH) && !classpathComponentDependencyURIs.isEmpty()) {
- final IProject project = file.getProject();
- final IPath workingLocation = project.getWorkingLocation(J2EEPlugin.PLUGIN_ID);
- // create path to temp MANIFEST.MF
- final IPath tempManifestPath = workingLocation.append(MANIFEST_PATH);
- final File fsFile = tempManifestPath.toFile();
- if (!fsFile.exists()) {
- // create parent dirs for temp MANIFEST.MF
- final File parent = fsFile.getParentFile();
- if (!parent.exists()) {
- if (!parent.mkdirs()) {
- return moduleFile;
- }
- }
- }
- // create temp MANIFEST.MF using util method
- try {
- ClasspathDependencyManifestUtil.updateManifestClasspath(file, classpathComponentDependencyURIs, new FileOutputStream(fsFile));
- // create new ModuleFile that points to temp MANIFEST.MF
- return new ModuleFile(fsFile, file.getName(), path);
- } catch (IOException ioe) {
- return moduleFile;
- }
- }
- return moduleFile;
- }
-
- protected IModuleResource[] handleJavaPath(IPath path, IPath javaPath, IPath curPath, IContainer[] javaCont, IModuleResource[] mr, IContainer cc) throws CoreException {
- if (curPath.equals(javaPath)) {
- int size = javaCont.length;
- for (int i = 0; i < size; i++) {
- IModuleResource[] mr2 = getMembers(javaCont[i], path.append(cc.getName()), null, null);
- IModuleResource[] mr3 = new IModuleResource[mr.length + mr2.length];
- System.arraycopy(mr, 0, mr3, 0, mr.length);
- System.arraycopy(mr2, 0, mr3, mr.length, mr2.length);
- mr = mr3;
- }
- } else {
- boolean containsFolder = false;
- String name = javaPath.segment(curPath.segmentCount());
- int size = mr.length;
- for (int i = 0; i < size && !containsFolder; i++) {
- if (mr[i] instanceof IModuleFolder) {
- IModuleFolder mf2 = (IModuleFolder) mr[i];
- if (name.equals(mf2.getName())) {
- containsFolder = true;
- }
- }
- }
-
- if (!containsFolder && javaCont.length > 0) {
- ModuleFolder mf2 = new ModuleFolder(javaCont[0], name, curPath);
- IModuleResource[] mrf = new IModuleResource[0];
- size = javaCont.length;
- for (int i = 0; i < size; i++) {
- IModuleResource[] mrf2 = getMembers(javaCont[i], javaPath, null, null);
- IModuleResource[] mrf3 = new IModuleResource[mrf.length + mrf2.length];
- System.arraycopy(mrf, 0, mrf3, 0, mrf.length);
- System.arraycopy(mrf2, 0, mrf3, mrf.length, mrf2.length);
- mrf = mrf3;
- }
-
- mf2.setMembers(mrf);
-
- IModuleResource[] mr3 = new IModuleResource[mr.length + 1];
- System.arraycopy(mr, 0, mr3, 0, mr.length);
- mr3[mr.length] = mf2;
- mr = mr3;
- }
- }
- return mr;
- }
-
- /**
- * Returns the classpath as a list of absolute IPaths.
- *
- * @return an array of paths
- */
- public IPath[] getClasspath() {
- List paths = new ArrayList();
- IJavaProject proj = JemProjectUtilities.getJavaProject(getProject());
- URL[] urls = JemProjectUtilities.getClasspathAsURLArray(proj);
- for (int i = 0; i < urls.length; i++) {
- URL url = urls[i];
- paths.add(Path.fromOSString(url.getPath()));
- }
- return (IPath[]) paths.toArray(new IPath[paths.size()]);
- }
-
- public String getJNDIName(String ejbName) {
- if (!J2EEProjectUtilities.isEJBProject(component.getProject()))
- return null;
- EjbModuleExtensionHelper modHelper = null;
- EJBJar jar = null;
- ArtifactEdit ejbEdit = null;
- try {
- ejbEdit = ComponentUtilities.getArtifactEditForRead(component);
- if (ejbEdit != null) {
- jar = (EJBJar) ejbEdit.getContentModelRoot();
- modHelper = IEJBModelExtenderManager.INSTANCE.getEJBModuleExtension(null);
- return modHelper == null ? null : modHelper.getJNDIName(jar, jar.getEnterpriseBeanNamed(ejbName));
- }
- } catch (Exception e) {
- e.printStackTrace();
- } finally {
- if (ejbEdit != null)
- ejbEdit.dispose();
- }
- return null;
- }
-
- /**
- * This method will handle a number of J2EE related scenarios. If this is an ear and a child module is passed in,
- * the URI for that child module will be returned. If no child module was passed, the URI of the EAR is returned.
- * If this is a child component and the module passed in is the EAR, we grab the module uri for this compared to that
- * EAR. If no ear module is passed in we look for one and use it and return URI relative to found EAR. If no EAR's
- * are found the URI is returned in a default manner.
- *
- * @return URI string
- */
- public String getURI(IModule module) {
- // If the component is an ear and the module passed in is a child module
- if (component!=null && module!=null && J2EEProjectUtilities.isEARProject(component.getProject()))
- return getContainedURI(module);
-
- IVirtualComponent ear = null;
- String aURI = null;
- // If the component is a child module and the module passed in is the ear
- if (module != null && J2EEProjectUtilities.isEARProject(module.getProject()))
- ear = ComponentCore.createComponent(module.getProject());
- // else if the component is a child module and the module passed in is null, search for first ear
- else if (module==null && component != null) {
- IProject[] earProjects = J2EEProjectUtilities.getReferencingEARProjects(component.getProject());
- if (earProjects.length>0)
- ear = ComponentCore.createComponent(earProjects[0]);
- }
- // We have a valid ear and the component is a valid child
- if (ear != null && component != null) {
- EARArtifactEdit earEdit = null;
- try {
- earEdit = EARArtifactEdit.getEARArtifactEditForRead(ear);
- if (earEdit != null)
- aURI = earEdit.getModuleURI(component);
- } catch (Exception e) {
- e.printStackTrace();
- } finally {
- if (earEdit != null)
- earEdit.dispose();
- }
- }
- // We have an ear component and no child module
- else if (component!=null && J2EEProjectUtilities.isEARProject(component.getProject())) {
- aURI = component.getDeployedName()+IJ2EEModuleConstants.EAR_EXT;
- }
- // We have child components but could not find valid ears
- else if (component != null && J2EEProjectUtilities.isDynamicWebProject(component.getProject())) {
- if (module != null) {
- IVirtualComponent webComp = ComponentCore.createComponent(component.getProject());
- String extension = IJ2EEModuleConstants.JAR_EXT;
- if (J2EEProjectUtilities.isDynamicWebProject(module.getProject())) {
- extension = IJ2EEModuleConstants.WAR_EXT;
- } else if (J2EEProjectUtilities.isJCAProject(module.getProject())) {
- extension = IJ2EEModuleConstants.RAR_EXT;
- }
- IVirtualReference reference = webComp.getReference(module.getProject().getName());
- if(reference != null){
- aURI = ComponentUtilities.getDeployUriOfComponent(reference, extension);
- } else {
- aURI = webComp.getDeployedName() + extension;
- }
- }
- else {
- aURI = component.getDeployedName() + IJ2EEModuleConstants.WAR_EXT;
- }
- }
- else if (component!=null && (J2EEProjectUtilities.isEJBProject(component.getProject()) || J2EEProjectUtilities.isApplicationClientProject(component.getProject()))) {
- aURI = component.getDeployedName()+IJ2EEModuleConstants.JAR_EXT;
- }
- else if (component!=null && J2EEProjectUtilities.isJCAProject(component.getProject())) {
- aURI = component.getDeployedName()+IJ2EEModuleConstants.RAR_EXT;
- }
-
- if (aURI !=null && aURI.length()>1 && aURI.startsWith("/")) //$NON-NLS-1$
- aURI = aURI.substring(1);
- return aURI;
- }
-
- protected boolean isBinaryModuleArchive(IModule module) {
- if (module!=null && module.getName().endsWith(IJ2EEModuleConstants.JAR_EXT) || module.getName().endsWith(IJ2EEModuleConstants.WAR_EXT) ||
- module.getName().endsWith(IJ2EEModuleConstants.RAR_EXT)) {
- if (component!=null && J2EEProjectUtilities.isEARProject(component.getProject()))
- return true;
- }
- return false;
- }
-
- private String getContainedURI(IModule module) {
- if (component instanceof J2EEModuleVirtualArchiveComponent || isBinaryModuleArchive(module))
- return new Path(module.getName()).lastSegment();
-
- IVirtualComponent comp = ComponentCore.createComponent(module.getProject());
- String aURI = null;
- if (comp!=null && component!=null && J2EEProjectUtilities.isEARProject(component.getProject())) {
- EARArtifactEdit earEdit = null;
- try {
- earEdit = EARArtifactEdit.getEARArtifactEditForRead(component);
- if (earEdit != null)
- aURI = earEdit.getModuleURI(comp);
- } catch (Exception e) {
- e.printStackTrace();
- } finally {
- if (earEdit != null)
- earEdit.dispose();
- }
- }
- if (aURI !=null && aURI.length()>1 && aURI.startsWith("/")) //$NON-NLS-1$
- aURI = aURI.substring(1);
- return aURI;
- }
-
- /**
- * This method returns the context root property from the deployable project's .component file
- */
- public String getContextRoot() {
- Properties props = component.getMetaProperties();
- if(props.containsKey(J2EEConstants.CONTEXTROOT))
- return props.getProperty(J2EEConstants.CONTEXTROOT);
- return component.getName();
- }
-
- /**
- * This method is applicable for a web deployable. The module passed in should either be null or
- * the EAR module the web deployable is contained in. It will return the context root from the EAR
- * if it has one or return the .component value in the web project if it is standalone.
- *
- * @param module
- * @return contextRoot String
- */
- public String getContextRoot(IModule earModule) {
- IProject deployProject = component.getProject();
- String contextRoot = null;
- if (earModule == null)
- return getContextRoot();
- else if (J2EEProjectUtilities.isEARProject(earModule.getProject()) && J2EEProjectUtilities.isDynamicWebProject(deployProject)) {
- EARArtifactEdit edit = null;
- try {
- edit = EARArtifactEdit.getEARArtifactEditForRead(earModule.getProject());
- contextRoot = edit.getWebContextRoot(deployProject);
- } finally {
- if (edit!=null)
- edit.dispose();
- }
- }
- return contextRoot;
- }
-
- /**
- * Find the source container, if any, for the given file.
- *
- * @param file
- * @return IPackageFragmentRoot sourceContainer for IFile
- */
- protected IPackageFragmentRoot getSourceContainer(IFile file) {
- if (file == null)
- return null;
- IPackageFragmentRoot[] srcContainers = getSourceContainers();
- for (int i=0; i<srcContainers.length; i++) {
- IPath srcPath = srcContainers[i].getPath();
- if (srcPath.isPrefixOf(file.getFullPath()))
- return srcContainers[i];
- }
- return null;
- }
-
- /**
- * Either returns value from cache or stores result as value in cache for the corresponding
- * output container for the given source container.
- *
- * @param sourceContainer
- * @return IContainer output container for given source container
- */
- protected IContainer getOutputContainer(IPackageFragmentRoot sourceContainer) {
- if (sourceContainer == null)
- return null;
-
- HashMap pairs = getCachedSourceOutputPairs();
- IContainer output = (IContainer) pairs.get(sourceContainer);
- if (output == null) {
- output = J2EEProjectUtilities.getOutputContainer(getProject(), sourceContainer);
- pairs.put(sourceContainer,output);
- }
- return output;
- }
-
- private IPackageFragmentRoot[] getSourceContainers() {
- if (cachedSourceContainers != null)
- return cachedSourceContainers;
- return J2EEProjectUtilities.getSourceContainers(getProject());
- }
-
- protected List getConsumableReferencedMembers(IVirtualComponent vc) throws CoreException {
- List consumableMembers = new ArrayList();
- IVirtualReference[] refComponents = vc.getReferences();
- for (int i = 0; i < refComponents.length; i++) {
- IVirtualReference reference = refComponents[i];
- if (reference != null && reference.getDependencyType()==IVirtualReference.DEPENDENCY_TYPE_CONSUMES) {
- IVirtualComponent consumedComponent = reference.getReferencedComponent();
- if (consumedComponent!=null && isProjectOfType(consumedComponent.getProject(),IModuleConstants.JST_UTILITY_MODULE)) {
- if (consumedComponent != null && consumedComponent.getRootFolder()!=null) {
- IVirtualFolder vFolder = consumedComponent.getRootFolder();
- IModuleResource[] mr = getMembers(vFolder, reference.getRuntimePath().makeRelative());
- int size = mr.length;
- for (int j = 0; j < size; j++) {
- if (!members.contains(mr[j]))
- members.add(mr[j]);
- }
- addUtilMembers(consumedComponent);
- List childConsumableMembers = getConsumableReferencedMembers(consumedComponent);
- if (!childConsumableMembers.isEmpty())
- members.addAll(childConsumableMembers);
- }
-
- IContainer[] javaCont = getJavaOutputFolders(consumedComponent.getProject());
- int size = javaCont.length;
- for (int j = 0; j < size; j++) {
- IModuleResource[] mr = getMembers(javaCont[j], reference.getRuntimePath(), reference.getRuntimePath(), javaCont);
- int size2 = mr.length;
- for (int k = 0; k < size2; k++) {
- if (!members.contains(mr[k]))
- members.add(mr[k]);
- }
- }
- }
- }
- }
- return consumableMembers;
- }
-
- protected IModule gatherModuleReference(IVirtualComponent component, IVirtualComponent targetComponent ) {
- IModule module = super.gatherModuleReference(component, targetComponent);
- // Handle binary module components
- if (targetComponent instanceof J2EEModuleVirtualArchiveComponent) {
- if (J2EEProjectUtilities.isEARProject(component.getProject()) || targetComponent.getProject()!=component.getProject())
- module = ServerUtil.getModule(J2EEDeployableFactory.ID+":"+targetComponent.getName()); //$NON-NLS-1$
- }
- return module;
- }
-
- /**
- * Determine if the component is nested J2EE module on the application.xml of this EAR
- * @param aComponent
- * @return boolean is passed in component a nested J2EE module on this EAR
- */
- private boolean isNestedJ2EEModule(IVirtualComponent aComponent, IVirtualReference[] references, EARArtifactEdit edit) {
- if (edit==null)
- return false;
- Application app = edit.getApplication();
- if (app == null) { // if no application.xml, return false
- return false;
- }
- IVirtualReference reference = getReferenceNamed(references,aComponent.getName());
- // Ensure module URI exists on EAR DD for binary archive
- return app.getFirstModule(reference.getArchiveName()) != null;
- }
-
- protected IVirtualReference getReferenceNamed(IVirtualReference[] references, String name) {
- for (int i=0; i<references.length; i++) {
- if (references[i].getReferencedComponent().getName().equals(name))
- return references[i];
- }
- return null;
- }
-
- protected ArtifactEdit getComponentArtifactEditForRead() {
- return EARArtifactEdit.getEARArtifactEditForRead(component.getProject());
- }
-
- /**
- * The references for J2EE module deployment are only those child modules of EARs or web modules
- */
- protected IVirtualReference[] getReferences(IVirtualComponent aComponent) {
- if (aComponent == null || aComponent.isBinary()) {
- return new IVirtualReference[] {};
- } else if (J2EEProjectUtilities.isDynamicWebProject(aComponent.getProject())) {
- return getWebLibModules((J2EEModuleVirtualComponent)aComponent);
- } else if (J2EEProjectUtilities.isEARProject(aComponent.getProject())) {
- return super.getReferences(aComponent);
- } else {
- return new IVirtualReference[] {};
- }
- }
-
- /**
- * This method will return the list of dependent modules which are utility jars in the web lib
- * folder of the deployed path of the module. It will not return null.
- *
- * @return array of the web library dependent modules
- */
- private IVirtualReference[] getWebLibModules(J2EEModuleVirtualComponent comp) {
- List result = new ArrayList();
- IVirtualReference[] refComponents = comp.getNonManifestReferences();
- // Check the deployed path to make sure it has a lib parent folder and matchs the web.xml
- // base path
- for (int i = 0; i < refComponents.length; i++) {
- if (refComponents[i].getRuntimePath().equals(WEBLIB))
- result.add(refComponents[i]);
- }
- return (IVirtualReference[]) result.toArray(new IVirtualReference[result.size()]);
- }
-
- /*
- * Add any classpath component dependencies from this component
- */
- private void addReferencedComponentClasspathDependencies(final IVirtualComponent component, final boolean web) {
- final IVirtualReference[] refs = component.getReferences();
- final Set absolutePaths = new HashSet();
- for (int i = 0; i < refs.length; i++) {
- final IVirtualReference reference = refs[i];
- final IPath runtimePath = reference.getRuntimePath();
- final IVirtualComponent referencedComponent = reference.getReferencedComponent();
-
- // if we are adding to a web project, only process references with the /WEB-INF/lib runtime path
- if (web && !runtimePath.equals(WEBLIB)) {
- continue;
- }
-
- // if the reference cannot export dependencies, skip
- if (!canExportClasspathComponentDependencies(referencedComponent)) {
- continue;
- }
-
- if (!referencedComponent.isBinary() && referencedComponent instanceof J2EEModuleVirtualComponent) {
- final IVirtualReference[] cpRefs = ((J2EEModuleVirtualComponent) referencedComponent).getJavaClasspathReferences();
- for (int j = 0; j < cpRefs.length; j++) {
- final IVirtualReference cpRef = cpRefs[j];
- IPath cpRefRuntimePath = cpRef.getRuntimePath();
-
- if (cpRef.getReferencedComponent() instanceof ClasspathDependencyVirtualComponent) {
- // want to avoid adding dups
- ClasspathDependencyVirtualComponent cpComp = (ClasspathDependencyVirtualComponent) cpRef.getReferencedComponent();
- // don't want to process class folder refs here
- if (cpComp.isClassFolder()) {
- continue;
- }
- if (cpRefRuntimePath.equals(IClasspathDependencyConstants.RUNTIME_MAPPING_INTO_CONTAINER_PATH)) {
- // runtime path within deployed app will be runtime path of parent component
- cpRefRuntimePath = runtimePath;
- }
- final IPath absolutePath = ClasspathDependencyUtil.getClasspathVirtualReferenceLocation(cpRef);
- if (absolutePaths.contains(absolutePath)) {
- // have already added a member for this archive
- continue;
- } else {
- addUtilMember(component, cpRef, cpRefRuntimePath);
- absolutePaths.add(absolutePath);
- }
- }
- }
- }
- }
- }
-
- private boolean canExportClasspathComponentDependencies(IVirtualComponent component) {
- final IProject project = component.getProject();
- // check for valid project type
- if (J2EEProjectUtilities.isEJBProject(project)
- || J2EEProjectUtilities.isDynamicWebProject(project)
- || J2EEProjectUtilities.isJCAProject(project)
- || J2EEProjectUtilities.isUtilityProject(project)) {
- return true;
- }
- return false;
- }
-
- private void saveClasspathDependencyURIs(IVirtualComponent component) {
- if (!component.isBinary() && component instanceof J2EEModuleVirtualComponent) {
- final IVirtualReference[] cpRefs = ((J2EEModuleVirtualComponent) component).getJavaClasspathReferences();
- for (int j = 0; j < cpRefs.length; j++) {
- final IVirtualReference cpRef = cpRefs[j];
- // if we are adding to an EAR project, only process references with the root mapping
- if (!cpRef.getRuntimePath().equals(IClasspathDependencyConstants.RUNTIME_MAPPING_INTO_CONTAINER_PATH)) {
- // fails the runtime path test
- continue;
- }
- if (cpRef.getReferencedComponent() instanceof VirtualArchiveComponent) {
- classpathComponentDependencyURIs.add(cpRef.getArchiveName());
- }
- }
- }
- }
-
- private void addClassFolderDependencies(final IVirtualComponent component) throws CoreException {
- if (!component.isBinary() && component instanceof J2EEModuleVirtualComponent) {
- final IVirtualReference[] cpRefs = ((J2EEModuleVirtualComponent) component).getJavaClasspathReferences();
- for (int i = 0; i < cpRefs.length; i++) {
- final IVirtualReference cpRef = cpRefs[i];
- final IPath runtimePath = cpRef.getRuntimePath();
- final IVirtualComponent comp = cpRef.getReferencedComponent();
- if (comp instanceof ClasspathDependencyVirtualComponent) {
- final ClasspathDependencyVirtualComponent cpComp = (ClasspathDependencyVirtualComponent) comp;
- if (cpComp.isClassFolder()) {
- IPath targetPath = null;
- if (runtimePath.equals(IClasspathDependencyConstants.RUNTIME_MAPPING_INTO_COMPONENT_PATH)) {
- targetPath = Path.EMPTY;
- } else if (runtimePath.equals(IClasspathDependencyConstants.WEB_INF_CLASSES_PATH)) {
- targetPath = WEB_CLASSES_PATH;
- } else {
- continue;
- }
- final IContainer container = cpComp.getClassFolder();
- final IModuleResource[] mr = getMembers(container, targetPath, targetPath, new IContainer[]{container});
- for (int j = 0; j < mr.length; j++) {
- members.add(mr[j]);
- }
- }
- }
- }
- }
- }
-
- /**
- * Returns <code>true</code> if this module has a simple structure based on a
- * single root folder, and <code>false</code> otherwise.
- * <p>
- * In a single root structure, all files that are contained within the root folder
- * are part of the module, and are already in the correct module structure. No
- * module resources exist outside of this single folder.
- *
- * For J2EE, this method will check if the project is already in J2EE spec standard output form.
- * The project must follow certain rules, but in general, the project's content roots must be source folders
- * and the output folder must also be the the content root folder.
- * </p>
- *
- * @return <code>true</code> if this module has a single root structure, and
- * <code>false</code> otherwise
- */
- public boolean isSingleRootStructure() {
- StructureEdit edit = null;
- try {
- edit = StructureEdit.getStructureEditForRead(getProject());
- if (edit == null || edit.getComponent() == null)
- return false;
- WorkbenchComponent wbComp = edit.getComponent();
- List resourceMaps = wbComp.getResources();
-
- if (J2EEProjectUtilities.isEARProject(getProject())) {
- // Always return false for EARs so that members for EAR are always calculated and j2ee modules
- // are filtered out
- return false;
- } else if (J2EEProjectUtilities.isDynamicWebProject(getProject())) {
- // Ensure there are only basic component resource mappings -- one for the content folder
- // and any for src folders mapped to WEB-INF/classes
- if (hasDefaultWebResourceMappings(resourceMaps)) {
- // Verify only one java output folder
- if (getJavaOutputFolders().length==1) {
- // Verify the java output folder is to <content root>/WEB-INF/classes
- IPath javaOutputPath = getJavaOutputFolders()[0].getProjectRelativePath();
- IPath compRootPath = component.getRootFolder().getUnderlyingFolder().getProjectRelativePath();
- if (compRootPath.append(J2EEConstants.WEB_INF_CLASSES).equals(javaOutputPath))
- return true;
- }
- }
- return false;
- } else if (J2EEProjectUtilities.isEJBProject(getProject()) || J2EEProjectUtilities.isJCAProject(getProject())
- || J2EEProjectUtilities.isApplicationClientProject(getProject()) || J2EEProjectUtilities.isUtilityProject(getProject())) {
- // Ensure there are only source folder component resource mappings to the root content folder
- if (isRootResourceMapping(resourceMaps,false)) {
- // Verify only one java outputfolder
- if (getJavaOutputFolders().length==1) {
- // At this point for utility projects, this project is optimized, we can just use the output folder
- if (J2EEProjectUtilities.isUtilityProject(getProject()))
- return true;
- // Verify the java output folder is the same as one of the content roots
- IPath javaOutputPath = getJavaOutputFolders()[0].getProjectRelativePath();
- IContainer[] rootFolders = component.getRootFolder().getUnderlyingFolders();
- for (int i=0; i<rootFolders.length; i++) {
- IPath compRootPath = rootFolders[i].getProjectRelativePath();
- if (javaOutputPath.equals(compRootPath))
- return true;
- }
- }
- }
- return false;
- }
- return true;
- } finally {
- if (edit !=null)
- edit.dispose();
- }
- }
-
- /**
- * Ensure that any component resource mappings are for source folders and
- * that they map to the root content folder
- *
- * @param resourceMaps
- * @return boolean
- */
- private boolean isRootResourceMapping(List resourceMaps, boolean isForEAR) {
- // If the list is empty, return false
- if (resourceMaps.size()<1)
- return false;
-
- for (int i=0; i<resourceMaps.size(); i++) {
- ComponentResource resourceMap = (ComponentResource) resourceMaps.get(i);
- // Verify it maps to "/" for the content root
- if (!resourceMap.getRuntimePath().equals(Path.ROOT))
- return false;
- // If this is not for an EAR, verify it is also a src container
- if (!isForEAR) {
- IPath sourcePath = getProject().getFullPath().append(resourceMap.getSourcePath());
- if (!isSourceContainer(sourcePath))
- return false;
- }
- }
- return true;
- }
-
- /**
- * Checks if the path argument is to a source container for the project.
- *
- * @param a workspace relative full path
- * @return is path a source container?
- */
- private boolean isSourceContainer(IPath path) {
- IPackageFragmentRoot[] srcContainers = getSourceContainers();
- for (int i=0; i<srcContainers.length; i++) {
- if (srcContainers[i].getPath().equals(path))
- return true;
- }
- return false;
- }
-
- /**
- * Ensure the default web setup is correct with one resource map and any number of java
- * resource maps to WEB-INF/classes
- *
- * @param resourceMaps
- * @return boolean
- */
- private boolean hasDefaultWebResourceMappings(List resourceMaps) {
- int rootValidMaps = 0;
- int javaValidRoots = 0;
-
- // If there aren't at least 2 maps, return false
- if (resourceMaps.size()<2)
- return false;
-
- IPath webInfClasses = new Path(J2EEConstants.WEB_INF_CLASSES).makeAbsolute();
- for (int i=0; i<resourceMaps.size(); i++) {
- ComponentResource resourceMap = (ComponentResource) resourceMaps.get(i);
- IPath sourcePath = getProject().getFullPath().append(resourceMap.getSourcePath());
-
- // Verify if the map is for the content root
- if (resourceMap.getRuntimePath().equals(Path.ROOT)) {
- rootValidMaps++;
- // Verify if the map is for a java src folder and is mapped to "WEB-INF/classes"
- } else if (resourceMap.getRuntimePath().equals(webInfClasses) && isSourceContainer(sourcePath)) {
- javaValidRoots++;
- // Otherwise we bail because we have a non optimized map
- } else {
- return false;
- }
- }
- // Make sure only one of the maps is the content root, and that at least one is for the java folder
- return rootValidMaps==1 && javaValidRoots>0;
- }
-
- /**
- * This method is added for performance reasons.
- * It assumes the virtual component is not using any flexible features and is in a standard J2EE format
- * with one component root folder and an output folder the same as its content folder. This will bypass
- * the virtual component API and just return the module resources as they are on disk.
- *
- * @return array of ModuleResources
- * @throws CoreException
- */
- private IModuleResource[] getOptimizedMembers() throws CoreException {
- if (component != null) {
- // For java utility modules, we can just use the output container, at this point we know there is only one
- if (J2EEProjectUtilities.isUtilityProject(getProject())) {
- return getModuleResources(Path.EMPTY, getJavaOutputFolders()[0]);
- }
- // For J2EE modules, we use the contents of the content root
- else {
- IVirtualFolder vFolder = component.getRootFolder();
- return getModuleResources(Path.EMPTY, vFolder.getUnderlyingFolder());
- }
- }
- return new IModuleResource[] {};
- }
-
- /**
- * This method will return from cache or add to cache whether or not an output container
- * is mapped in the virtual component.
- *
- * @param outputContainer
- * @return if output container is mapped
- */
- private boolean isOutputContainerMapped(IContainer outputContainer) {
- if (outputContainer == null)
- return false;
-
- HashMap outputMaps = getCachedOutputMappings();
- Boolean result = (Boolean) outputMaps.get(outputContainer);
- if (result == null) {
- // If there are any component resources for the container, we know it is mapped
- if (ComponentCore.createResources(outputContainer).length > 0)
- result = Boolean.TRUE;
- // Otherwise it is not mapped
- else
- result = Boolean.FALSE;
- // Cache the result in the map for this output container
- outputMaps.put(outputContainer, result);
- }
- return result.booleanValue();
- }
-
- /**
- * Lazy initialize the cached output mappings
- * @return HashMap
- */
- private HashMap getCachedOutputMappings() {
- if (cachedOutputMappings==null)
- cachedOutputMappings = new HashMap();
- return cachedOutputMappings;
- }
-
- /**
- * Lazy initialize the cached source - output pairings
- * @return HashMap
- */
- private HashMap getCachedSourceOutputPairs() {
- if (cachedSourceOutputPairs==null)
- cachedSourceOutputPairs = new HashMap();
- return cachedSourceOutputPairs;
- }
-
- /**
- * This file should be added to the members list from the virtual component maps only if:
- * a) it is not in a source folder
- * b) it is in a source folder, and the corresponding output folder is a mapped component resource
- *
- * @return boolean should file be added to members
- */
- protected boolean shouldAddComponentFile(IFile file) {
- IPackageFragmentRoot sourceContainer = getSourceContainer(file);
- // If the file is not in a source container, return true
- if (sourceContainer==null) {
- return true;
- // Else if it is a source container and the output container is mapped in the component, return true
- // Otherwise, return false.
- } else {
- IContainer outputContainer = getOutputContainer(sourceContainer);
- return outputContainer!=null && isOutputContainerMapped(outputContainer);
- }
- }
-}
diff --git a/plugins/org.eclipse.jst.j2ee/j2eeplugin/org/eclipse/jst/j2ee/internal/plugin/IJ2EEModuleConstants.java b/plugins/org.eclipse.jst.j2ee/j2eeplugin/org/eclipse/jst/j2ee/internal/plugin/IJ2EEModuleConstants.java
deleted file mode 100644
index 28a0a96aa..000000000
--- a/plugins/org.eclipse.jst.j2ee/j2eeplugin/org/eclipse/jst/j2ee/internal/plugin/IJ2EEModuleConstants.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2005, 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are 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:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jst.j2ee.internal.plugin;
-
-import org.eclipse.wst.common.componentcore.internal.util.IModuleConstants;
-
-public interface IJ2EEModuleConstants extends IModuleConstants {
-
- public static final String J2EE_PLUGIN_ID = "org.eclipse.jst.j2ee"; //$NON-NLS-1$
-
- public static final String EAR_EXT = ".ear"; //$NON-NLS-1$
- public static final String JAR_EXT = ".jar"; //$NON-NLS-1$
- public static final String WAR_EXT = ".war"; //$NON-NLS-1$
- public static final String RAR_EXT = ".rar"; //$NON-NLS-1$
-
- public static final String JST_EAR_TEMPLATE = "template.jst.ear"; //$NON-NLS-1$
- public static final String JST_UTILITY_TEMPLATE = "template.jst.utility"; //$NON-NLS-1$
- public static final String JST_APPCLIENT_TEMPLATE = "template.jst.appclient"; //$NON-NLS-1$
- public static final String JST_EJB_TEMPLATE = "template.jst.ejb"; //$NON-NLS-1$
- public static final String JST_JCA_TEMPLATE = "template.jst.connector"; //$NON-NLS-1$
- public static final String JST_WEB_TEMPLATE = "template.jst.web"; //$NON-NLS-1$
- public static final String WST_WEB_TEMPLATE = "template.wst.web"; //$NON-NLS-1$
- public static final String JST_COMPONENT_FILE = "org.eclipse.wst.common.component";//$NON-NLS-1$
-}
diff --git a/plugins/org.eclipse.jst.j2ee/j2eeplugin/org/eclipse/jst/j2ee/internal/plugin/IJ2EEPreferences.java b/plugins/org.eclipse.jst.j2ee/j2eeplugin/org/eclipse/jst/j2ee/internal/plugin/IJ2EEPreferences.java
deleted file mode 100644
index a0c2f8a3e..000000000
--- a/plugins/org.eclipse.jst.j2ee/j2eeplugin/org/eclipse/jst/j2ee/internal/plugin/IJ2EEPreferences.java
+++ /dev/null
@@ -1,23 +0,0 @@
-/***************************************************************************************************
- * Copyright (c) 2003, 2004 IBM Corporation and others. All rights reserved. This program and the
- * accompanying materials are 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: IBM Corporation - initial API and implementation
- **************************************************************************************************/
-package org.eclipse.jst.j2ee.internal.plugin;
-
-
-public interface IJ2EEPreferences {
-
- String PREF_J2EEWEBCONTENT = "org.eclipse.jst.j2ee.internal.preference.j2eeWebContentName"; //$NON-NLS-1$
- String PREF_STATICWEBCONTENT = "org.eclipse.jst.j2ee.internal.preference.staticWebContentName"; //$NON-NLS-1$
- String PREF_JAVASOURCE = "org.eclipse.jst.j2ee.internal.preference.javaSourceName"; //$NON-NLS-1$
- String DEFAULT_J2EEWEBCONTENT = "WebContent"; //$NON-NLS-1$
- String DEFAULT_STATICWEBCONTENT = "WebContent"; //$NON-NLS-1$
- String DEFAULT_JAVASOURCE = "JavaSource"; //$NON-NLS-1$
- String SERVER_TARGET_SUPPORT = "org.eclipse.jst.j2ee.internal.preference.servertargetsupport"; //$NON-NLS-1$
-
-
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.jst.j2ee/j2eeplugin/org/eclipse/jst/j2ee/internal/plugin/J2EEGroupInitializer.java b/plugins/org.eclipse.jst.j2ee/j2eeplugin/org/eclipse/jst/j2ee/internal/plugin/J2EEGroupInitializer.java
deleted file mode 100644
index 69cb751b5..000000000
--- a/plugins/org.eclipse.jst.j2ee/j2eeplugin/org/eclipse/jst/j2ee/internal/plugin/J2EEGroupInitializer.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are 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:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-/*
- * Created on Dec 4, 2003
- *
- * To change the template for this generated file go to
- * Window&gt;Preferences&gt;Java&gt;Code Generation&gt;Code and Comments
- */
-package org.eclipse.jst.j2ee.internal.plugin;
-
-import org.eclipse.core.resources.IProject;
-import org.eclipse.wst.common.frameworks.internal.enablement.IGroupInitializer;
-
-
-/**
- * @author schacher
- *
- * To change the template for this generated type comment go to
- * Window&gt;Preferences&gt;Java&gt;Code Generation&gt;Code and Comments
- */
-public class J2EEGroupInitializer implements IGroupInitializer {
-
- /**
- *
- */
- public J2EEGroupInitializer() {
- super();
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.wst.common.frameworks.internal.group.IGroupInitializer#isGroupEnabled(org.eclipse.core.resources.IProject)
- */
- public boolean isGroupEnabled(IProject project) {
- return true;
- }
-
-}
diff --git a/plugins/org.eclipse.jst.j2ee/j2eeplugin/org/eclipse/jst/j2ee/internal/plugin/J2EEPlugin.java b/plugins/org.eclipse.jst.j2ee/j2eeplugin/org/eclipse/jst/j2ee/internal/plugin/J2EEPlugin.java
deleted file mode 100644
index 58b5c1245..000000000
--- a/plugins/org.eclipse.jst.j2ee/j2eeplugin/org/eclipse/jst/j2ee/internal/plugin/J2EEPlugin.java
+++ /dev/null
@@ -1,691 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are 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:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jst.j2ee.internal.plugin;
-
-
-import java.io.IOException;
-import java.lang.reflect.InvocationTargetException;
-import java.net.MalformedURLException;
-import java.net.URL;
-import java.text.MessageFormat;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Locale;
-import java.util.MissingResourceException;
-import java.util.ResourceBundle;
-import java.util.Vector;
-
-import org.eclipse.core.internal.boot.PlatformURLConnection;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IResourceChangeEvent;
-import org.eclipse.core.resources.IResourceStatus;
-import org.eclipse.core.resources.IWorkspace;
-import org.eclipse.core.resources.IWorkspaceRunnable;
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IAdapterManager;
-import org.eclipse.core.runtime.IConfigurationElement;
-import org.eclipse.core.runtime.IExtension;
-import org.eclipse.core.runtime.IExtensionPoint;
-import org.eclipse.core.runtime.IExtensionRegistry;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.NullProgressMonitor;
-import org.eclipse.core.runtime.OperationCanceledException;
-import org.eclipse.core.runtime.Path;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.emf.common.util.ResourceLocator;
-import org.eclipse.emf.ecore.resource.Resource;
-import org.eclipse.jdt.core.ElementChangedEvent;
-import org.eclipse.jdt.core.IJavaModel;
-import org.eclipse.jdt.core.IJavaProject;
-import org.eclipse.jdt.core.JavaCore;
-import org.eclipse.jem.util.UIContextDetermination;
-import org.eclipse.jem.util.logger.LogEntry;
-import org.eclipse.jem.util.logger.proxy.Logger;
-import org.eclipse.jem.workbench.utility.JemProjectUtilities;
-import org.eclipse.jst.j2ee.application.ApplicationFactory;
-import org.eclipse.jst.j2ee.application.ApplicationPackage;
-import org.eclipse.jst.j2ee.application.internal.impl.ApplicationFactoryImpl;
-import org.eclipse.jst.j2ee.applicationclient.internal.modulecore.util.AppClientEditAdapterFactory;
-import org.eclipse.jst.j2ee.common.internal.impl.J2EEResourceFactoryRegistry;
-import org.eclipse.jst.j2ee.commonarchivecore.internal.helpers.ArchiveInit;
-import org.eclipse.jst.j2ee.core.internal.plugin.CatalogJ2EEXmlDtDEntityResolver;
-import org.eclipse.jst.j2ee.internal.common.VirtualArchiveComponentAdapterFactory;
-import org.eclipse.jst.j2ee.internal.common.classpath.J2EEComponentClasspathUpdater;
-import org.eclipse.jst.j2ee.internal.modulecore.util.EarEditAdapterFactory;
-import org.eclipse.jst.j2ee.internal.validation.ResourceUtil;
-import org.eclipse.jst.j2ee.internal.xml.J2EEXmlDtDEntityResolver;
-import org.eclipse.jst.j2ee.refactor.listeners.J2EEElementChangedListener;
-import org.eclipse.jst.j2ee.refactor.listeners.ProjectRefactoringListener;
-import org.eclipse.wst.common.componentcore.internal.ArtifactEditModel;
-import org.eclipse.wst.common.componentcore.internal.impl.ReferencedComponentXMIResourceFactory;
-import org.eclipse.wst.common.componentcore.internal.impl.WTPResourceFactoryRegistry;
-import org.eclipse.wst.common.componentcore.internal.resources.VirtualArchiveComponent;
-import org.eclipse.wst.common.frameworks.internal.WTPPlugin;
-import org.eclipse.wst.common.frameworks.internal.operations.IHeadlessRunnableWithProgress;
-import org.eclipse.wst.common.internal.emf.resource.ReferencedXMIFactoryImpl;
-import org.eclipse.wst.common.internal.emf.utilities.DOMUtilities;
-import org.eclipse.wst.common.internal.emfworkbench.integration.EditModel;
-import org.eclipse.wst.validation.internal.operations.ValidatorManager;
-import org.eclipse.wst.validation.internal.plugin.ValidationPlugin;
-import org.osgi.framework.Bundle;
-import org.osgi.framework.BundleContext;
-import java.lang.Throwable;
-
-/**
- * This is a top-level class of the j2ee plugin.
- *
- * @see AbstractUIPlugin for additional information on UI plugins
- */
-
-public class J2EEPlugin extends WTPPlugin implements ResourceLocator {
-
- public static final String PLUGIN_ID = "org.eclipse.jst.j2ee"; //$NON-NLS-1$
- public static final String UI_PLUGIN_ID = "org.eclipse.jst.j2ee.ui"; //$NON-NLS-1$
- protected final IPath iconsFolder = new Path(Platform.getBundle(PLUGIN_ID).getEntry("icons").getPath()); //$NON-NLS-1$
- // LibDir Change Listener
- public static final String LIBDIRCHANGE_BUILDER_ID = "org.eclipse.jst.j2ee.web.LibDirBuilder"; //$NON-NLS-1$
- // LibCopy builder ID
- public static final String LIBCOPY_BUILDER_ID = PLUGIN_ID + ".LibCopyBuilder"; //$NON-NLS-1$
- // Validation part of the plugin
- public static final String VALIDATION_BUILDER_ID = ValidationPlugin.VALIDATION_BUILDER_ID; // plugin
-// private static final String KEY_PREFIX = "%"; //$NON-NLS-1$
-// private static final String KEY_DOUBLE_PREFIX = "%%"; //$NON-NLS-1$
- // id
- // of
- // the
- // validation
- // builder//$NON-NLS-1$
- //Global ResourceSet (somewhat global)
- private static boolean defaultIsWorkspaceRelativeSchema = false;
-
- private List fextendedEditModels;
- private static IPath location;
-
- public static IStatus OK_STATUS = new Status(IStatus.OK, PLUGIN_ID, 0, "OK", null); //$NON-NLS-1$
-
- public static final String[] ICON_DIRS = new String[]{"icons/full/obj16", //$NON-NLS-1$
- "icons/full/cview16", //$NON-NLS-1$
- "icons/full/ctool16", //$NON-NLS-1$
- "icons/full/clcl16", //$NON-NLS-1$
- "icons/full/ovr16", //$NON-NLS-1$
- "icons/full/extra", //$NON-NLS-1$
- "icons/full/wizban", //$NON-NLS-1$
- "icons", //$NON-NLS-1$
- ""}; //$NON-NLS-1$
-
- protected static Boolean EJB_AVAILABLE = null;
- private static Boolean HAS_DEV_ROLE;
-
- private J2EEPreferences preferences = null;
- public static J2EEPlugin INSTANCE;
-
- private static LogEntry _entry;
-
- /**
- * Create the J2EE plugin and cache its default instance
- */
- public J2EEPlugin() {
- super();
- if (INSTANCE == null)
- INSTANCE = this;
- try {
- resourceBundle = ResourceBundle.getBundle("org.eclipse.jst.j2ee"); //$NON-NLS-1$
- } catch (MissingResourceException x) {
- resourceBundle = null;
-
- }
- }
-
- /**
- * Insert the method's description here. Creation date: (7/16/2001 7:38:56 PM)
- *
- * @return boolean
- */
- public static boolean defaultIsWorkspaceRelativeSchema() {
- return defaultIsWorkspaceRelativeSchema;
- }
-
- /**
- * Get the one application factory.
- */
- public ApplicationFactory getApplicationFactory() {
- return (ApplicationFactory) getApplicationPackage().getEFactoryInstance();
- }
-
- /**
- * Get the one ejb package.
- */
- public ApplicationPackage getApplicationPackage() {
- return ApplicationFactoryImpl.getPackage();
- }
-
- /**
- * Get the plugin singleton.
- */
- static public J2EEPlugin getDefault() {
- return INSTANCE;
- }
-
- /*
- * Javadoc copied from interface.
- */
- public URL getBaseURL() {
- return getBundle().getEntry("/"); //$NON-NLS-1$
- }
-
-
- public Object[] getJ2EEWebProjectMigrationExtensions() {
-
- IExtensionRegistry registry = Platform.getExtensionRegistry();
- IExtensionPoint pct = registry.getExtensionPoint("J2EEWebProjectMigrationExtension"); //$NON-NLS-1$
- List ret = new Vector();
- if (pct != null) {
- IExtension[] extension = pct.getExtensions();
- for (int l = 0; l < extension.length; ++l) {
- IExtension config = extension[l];
-
- IConfigurationElement[] cElems = config.getConfigurationElements();
- for (int i = 0; i < cElems.length; i++) {
- IConfigurationElement d = cElems[i];
- if (d.getName().equals("migration")) { //$NON-NLS-1$
- try {
- Object me = d.createExecutableExtension("run"); //$NON-NLS-1$
-
- ret.add(me);
- } catch (Exception ex) {
- // ignore this extension, keep going
- }
- }
- }
- }
- }
- return ret.toArray();
- }
-
- public EditModel getExtendedEditModel(String editModelKey) {
-
- IExtensionRegistry registry = Platform.getExtensionRegistry();
- IExtensionPoint pct = registry.getExtensionPoint("EditModelExtension"); //$NON-NLS-1$
-
- IExtension[] extension = pct.getExtensions();
- for (int l = 0; l < extension.length; ++l) {
- IExtension config = extension[l];
-
- IConfigurationElement[] cElems = config.getConfigurationElements();
- for (int i = 0; i < cElems.length; i++) {
- IConfigurationElement d = cElems[i];
- if (d.getName().equals("editmodel") && editModelKey.equals(d.getAttribute("key"))) //$NON-NLS-1$ //$NON-NLS-2$
- { // editmodel class
- try {
- return (EditModel) d.createExecutableExtension("run"); //$NON-NLS-1$
-
- } catch (Exception ex) {
- return null;
- }
- }
- }
- }
-
- return null;
- }
-
- public List getExtendedEditModels() {
-
- if (fextendedEditModels != null)
- return fextendedEditModels;
- List editModels = new ArrayList();
- IExtensionRegistry registry = Platform.getExtensionRegistry();
- IExtensionPoint pct = registry.getExtensionPoint("EditModelExtension"); //$NON-NLS-1$
-
- IExtension[] extension = pct.getExtensions();
- for (int l = 0; l < extension.length; ++l) {
- IExtension config = extension[l];
-
- IConfigurationElement[] cElems = config.getConfigurationElements();
- for (int i = 0; i < cElems.length; i++) {
- IConfigurationElement d = cElems[i];
- if (d.getName().equals("editmodel")) //$NON-NLS-1$
- {
- // editmodel class
- try {
- editModels.add(d.createExecutableExtension("run")); //$NON-NLS-1$
-
- } catch (Exception ex) {
- return null;
- }
- }
- }
- }
- fextendedEditModels = editModels;
- return fextendedEditModels;
- }
-
- /**
- * This gets a .gif from the icons folder.
- */
- public static URL getImageURL(String key, Bundle bundle) {
- String gif = "/" + key + ".gif"; //$NON-NLS-1$ //$NON-NLS-2$
- IPath path = null;
- for (int i = 0; i < ICON_DIRS.length; i++) {
- path = new Path(ICON_DIRS[i]).append(gif);
- if (Platform.find(bundle,path) == null)
- continue;
- try {
- return new URL( bundle.getEntry("/"), path.toString()); //$NON-NLS-1$
- } catch (MalformedURLException exception) {
- org.eclipse.jem.util.logger.proxy.Logger.getLogger().logWarning(J2EEPluginResourceHandler.getString("Load_Image_Error_", new Object[]{key})); //$NON-NLS-1$
- exception.printStackTrace();
- continue;
- }
- }
- return null;
- }
-
- /**
- * This gets a .gif from the icons folder.
- */
- public Object getImage(String key) {
- return getImageURL(key,this.getBundle());
- }
-
- public static IPath getInstallLocation() {
- if (location == null) {
- URL url = getInstallURL();
- try {
- String installLocation = ((PlatformURLConnection) url.openConnection()).getURLAsLocal().getFile();
- location = new Path(installLocation);
- } catch (IOException e) {
- org.eclipse.jem.util.logger.proxy.Logger.getLogger().logWarning(J2EEPluginResourceHandler.getString("Install_Location_Error_", new Object[]{url}) + e); //$NON-NLS-1$
- }
- }
- return location;
- }
-
- public static URL getInstallURL() {
- return getDefault().getBundle().getEntry("/"); //$NON-NLS-1$
- }
-
- protected static IJavaModel getJavaModel() {
- return JemProjectUtilities.getJavaModel();
- }
-
- protected static IJavaModel getJavaModel(IProject aProject) {
- if (aProject != null)
- return JemProjectUtilities.getJavaModel();
- return null;
- }
-
- public static IJavaProject getJavaProject(IProject project) {
- IJavaModel model = getJavaModel(project);
- if (model != null)
- return model.getJavaProject(project.getName());
- return null;
- }
-
- public static LogEntry getLogEntry() {
- if (_entry == null)_entry = new LogEntry();
- else _entry.reset();
-
- // Always set the log entry's Locale before you use it
- // because the user can reset it on the fly.
- _entry.setLocaleOfOrigin(Locale.getDefault().toString());
- return _entry;
- }
-
-
- /**
- * Retrieves a hashtable of a logger's preferences initially from the
- * com.ibm.etools.logging.util.loggingDefaults extension point if specified in the
- * com.ibm.etools.logging.util plugin.xml file. If specified, the
- * com.ibm.etools.logging.util.loggingOptions extension point preferences in the parameter
- * plugin's plugin.xml file are returned.
- *
- * The logger's preferences are stored in the return hashtable using the static instance
- * variables in LoggerStateHashKeys as keys.
- *
- * @param plugin
- * the Plugin polled for their logger's preferences in the plugin.xml file
- * @return hashtable of a logger's preferences
- */
- /*
- * public java.util.Hashtable getMsgLoggerConfig(org.eclipse.core.runtime.Plugin plugin) {
- * return (new PluginHelperImpl().getMsgLoggerConfig(plugin)); }
- */
- /**
- * Get the singleton instance.
- */
- public static J2EEPlugin getPlugin() {
- return INSTANCE;
- }
-
- /**
- * Return the plugin directory location- the directory that all the plugins are located in (i.e.
- * d:\installdir\plugin)
- */
- public static IPath getPluginLocation(String pluginId) {
- //IExtensionRegistry registry = Platform.getExtensionRegistry();
- Bundle bundle = Platform.getBundle(pluginId);
- if (bundle != null) {
- try {
- IPath installPath = new Path(bundle.getEntry("/").toExternalForm()).removeTrailingSeparator(); //$NON-NLS-1$
- String installStr = Platform.asLocalURL(new URL(installPath.toString())).getFile();
- return new Path(installStr);
- } catch (IOException e) {
- };
- }
- return null;
- }
-
- protected void initializeDefaultPluginPreferences() {
- getJ2EEPreferences().initializeDefaultPreferences();
- }
-
- public static IWorkspace getWorkspace() {
- return ResourcesPlugin.getWorkspace();
- }
-
- /**
- * If this is called from an operation, in response to some other exception that was caught,
- * then the client code should throw {@link com.ibm.etools.wft.util.WFTWrappedException};
- * otherwise this can still be used to signal some other error condition within the operation,
- * or to throw a core exception in a context other than executing an operation
- *
- * Create a new IStatus of type ERROR using the J2EEPlugin ID. aCode is just an internal code.
- */
- public static IStatus newErrorStatus(int aCode, String aMessage, Throwable exception) {
- return newStatus(IStatus.ERROR, aCode, aMessage, exception);
- }
-
- /**
- * If this is called from an operation, in response to some other exception that was caught,
- * then the client code should throw {@link com.ibm.etools.wft.util.WFTWrappedException};
- * otherwise this can still be used to signal some other error condition within the operation,
- * or to throw a core exception in a context other than executing an operation
- *
- * Create a new IStatus of type ERROR, code OPERATION_FAILED, using the J2EEPlugin ID
- */
- public static IStatus newErrorStatus(String aMessage, Throwable exception) {
- return newErrorStatus(0, aMessage, exception);
- }
-
- /**
- * If this is called from an operation, in response to some other exception that was caught,
- * then the client code should throw {@link com.ibm.etools.wft.util.WFTWrappedException};
- * otherwise this can still be used to signal some other error condition within the operation.
- *
- * Create a new IStatus of type ERROR, code OPERATION_FAILED, using the J2EEPlugin ID
- */
- public static IStatus newOperationFailedStatus(String aMessage, Throwable exception) {
- return newStatus(IStatus.ERROR, IResourceStatus.OPERATION_FAILED, aMessage, exception);
- }
-
- /**
- * Create a new IStatus with a severity using the J2EEPlugin ID. aCode is just an internal code.
- */
- public static IStatus newStatus(int severity, int aCode, String aMessage, Throwable exception) {
- return new Status(severity, PLUGIN_ID, aCode, aMessage, exception);
- }
-
- /*
- * Javadoc copied from interface.
- */
- public String getString(String key) {
- try {
- return Platform.getResourceString(getBundle(), key);
- } catch (MissingResourceException ex) {
- //TODO Don't throw error - just show unresolved key
- //Logger.getLogger().logError(ex);
- return '!' + key + '!';
- }
- }
-
- /*
- * Javadoc copied from interface.
- */
- public String getString(String key, Object[] substitutions) {
- return MessageFormat.format(getString(key), substitutions);
- }
-
- /**
- * Insert the method's description here. Creation date: (7/16/2001 7:38:56 PM)
- *
- * @param newDefaultIsWorkspaceRelativeSchema
- * boolean
- */
- public static void setDefaultIsWorkspaceRelativeSchema(boolean newDefaultIsWorkspaceRelativeSchema) {
- defaultIsWorkspaceRelativeSchema = newDefaultIsWorkspaceRelativeSchema;
- }
-
- /**
- * This method should be used to determine if the EJB UI support is currently packaged in the
- * image.
- */
- public static boolean isEJBSupportAvailable() {
- if (EJB_AVAILABLE == null) {
- //TODO We need a better mechanism for the detection of the EJB support.
- //IPluginDescriptor desc =
- // Platform.getPluginRegistry().getPluginDescriptor("org.eclipse.jst.j2ee.internal.internal.ejb.ui");
- // //$NON-NLS-1$
- // EJB_AVAILABLE = new Boolean(desc != null);
- EJB_AVAILABLE = Boolean.TRUE;
- }
- return EJB_AVAILABLE.booleanValue();
- }
-
- /**
- * This method should be used to determine if the workbench is running in UI or Headless
- *
- * @deprecated use {@link org.eclipse.wst.common.frameworks.internal.UIContextDetermination}
- */
- public static boolean isHeadless() {
- return UIContextDetermination.getCurrentContext() == UIContextDetermination.HEADLESS_CONTEXT;
- }
-
-
- public void start(BundleContext context) throws Exception {
- super.start(context);
-
- J2EEXmlDtDEntityResolver.INSTANCE = new CatalogJ2EEXmlDtDEntityResolver();
- DOMUtilities.setDefaultEntityResolver(J2EEXmlDtDEntityResolver.INSTANCE);
- //Have to do the next line immediately to fix timing problems with factory registration
- ArchiveInit.init(false);
-
- //ModuleMaps are the maps from modules in an ear project to the j2ee projects for the
- // modules
- org.eclipse.jst.j2ee.internal.earcreation.modulemap.ModulemapInit.init(false);
- ensureFactoryRegistration();
- ValidatorManager.setResourceUtilClass(ResourceUtil.class);
- IAdapterManager manager = Platform.getAdapterManager();
- manager.registerAdapters(new EarEditAdapterFactory(), ArtifactEditModel.class);
- manager.registerAdapters(new AppClientEditAdapterFactory(), ArtifactEditModel.class);
- manager.registerAdapters(new VirtualArchiveComponentAdapterFactory(), VirtualArchiveComponent.class );
-
- final ProjectRefactoringListener listener = new ProjectRefactoringListener();//ProjectDependencyCache.getCache());
- // register the project rename/delete refactoring listener
- ResourcesPlugin.getWorkspace().addResourceChangeListener(listener,
- IResourceChangeEvent.POST_CHANGE | IResourceChangeEvent.PRE_DELETE);
-
- // register the IElementChangedLister that updates the .component file in
- // response to .classpath changes
- JavaCore.addElementChangedListener(new J2EEElementChangedListener(), ElementChangedEvent.POST_CHANGE);
-
- ResourcesPlugin.getWorkspace().addResourceChangeListener(J2EEComponentClasspathUpdater.getInstance(), IResourceChangeEvent.POST_CHANGE | IResourceChangeEvent.PRE_CLOSE | IResourceChangeEvent.PRE_DELETE);
- }
-
- public void stop(BundleContext context) throws Exception {
- super.stop(context);
- ResourcesPlugin.getWorkspace().removeResourceChangeListener(J2EEComponentClasspathUpdater.getInstance());
- try {
- org.eclipse.core.runtime.Platform.getJobManager().join( J2EEElementChangedListener.PROJECT_COMPONENT_UPDATE_JOB_FAMILY,
- new NullProgressMonitor() );
- } catch (OperationCanceledException e) {
- Logger.getLogger().logError(e.getMessage());
- } catch (InterruptedException e) {
- Logger.getLogger().logError(e.getMessage());
- }
- }
-
- /*
- * need to make sure the correct factories get loaded when we are in the UI
- */
- private void ensureFactoryRegistration() {
- //Inside the workbench we do not want the global override defined here.
- ensureDefaultReferencedXMIResourceFactoryRegistration();
- }
-
- /**
- *
- */
- private void ensureDefaultReferencedXMIResourceFactoryRegistration() {
- J2EEResourceFactoryRegistry reg1 = J2EEResourceFactoryRegistry.INSTANCE;
- WTPResourceFactoryRegistry reg2 = WTPResourceFactoryRegistry.INSTANCE;
- ReferencedXMIFactoryImpl factory = new ReferencedComponentXMIResourceFactory();
- reg1.getExtensionToFactoryMap().put(Resource.Factory.Registry.DEFAULT_EXTENSION, factory);
- reg2.getExtensionToFactoryMap().put(Resource.Factory.Registry.DEFAULT_EXTENSION, factory);
- // add xmi because other plugins are registering it globally
- reg1.getExtensionToFactoryMap().put("xmi", factory); //$NON-NLS-1$
- reg2.getExtensionToFactoryMap().put("xmi", factory); //$NON-NLS-1$
- }
-
- /**
- * This is currently just a convenience api for the AAW to turn off unwanted actions. It will
- * currently be initialized based on the existence of the AAW plugin.
- */
- public static boolean hasDevelopmentRole() {
- if (HAS_DEV_ROLE == null) {
- Bundle desc = Platform.getBundle("org.eclipse.jst.j2ee.assembly"); //$NON-NLS-1$
- HAS_DEV_ROLE = desc != null ? Boolean.FALSE : Boolean.TRUE;
- }
- return HAS_DEV_ROLE.booleanValue();
- }
-
- public static IWorkspaceRunnable getWorkspaceRunnable(final IHeadlessRunnableWithProgress op) {
- return new IWorkspaceRunnable() {
- public void run(IProgressMonitor monitor) throws CoreException {
- try {
- op.run(monitor);
- } catch (InvocationTargetException e) {
- throw new CoreException(newErrorStatus(0, e.getMessage(), e));
- } catch (InterruptedException e) {
- throw new CoreException(newErrorStatus(0, e.getMessage(), e));
- }
- }
- };
- }
-
- public String getPluginID() {
- return PLUGIN_ID;
- }
-
- /**
- * @return Returns the preferences.
- */
- public J2EEPreferences getJ2EEPreferences() {
- if (this.preferences == null)
- this.preferences = new J2EEPreferences(this);
- return this.preferences;
- }
- public String getString(String key, boolean translate) {
- // TODO For now... translate not supported
- return getString(key);
- }
-
- public String getString(String key, Object[] substitutions, boolean translate) {
- // TODO For now... translate not supported
- return getString(key,substitutions);
- }
-
-
- /**
- * Record an error against this plugin's log.
- *
- * @param aCode
- * @param aMessage
- * @param anException
- */
- public static void logError(int aCode, String aMessage,
- Throwable anException) {
- getDefault().getLog().log(
- createErrorStatus(aCode, aMessage, anException));
- }
-
- /**
- *
- * Record a message against this plugin's log.
- *
- * @param severity
- * @param aCode
- * @param aMessage
- * @param exception
- */
- public static void log(int severity, int aCode, String aMessage,
- Throwable exception) {
- log(createStatus(severity, aCode, aMessage, exception));
- }
-
- /**
- *
- * Record a status against this plugin's log.
- *
- * @param aStatus
- */
- public static void log(IStatus aStatus) {
- getDefault().getLog().log(aStatus);
- }
-
- /**
- * Create a status associated with this plugin.
- *
- * @param severity
- * @param aCode
- * @param aMessage
- * @param exception
- * @return A status configured with this plugin's id and the given parameters.
- */
- public static IStatus createStatus(int severity, int aCode,
- String aMessage, Throwable exception) {
- return new Status(severity, PLUGIN_ID, aCode,
- aMessage != null ? aMessage : "No message.", exception); //$NON-NLS-1$
- }
-
- /**
- *
- * @param aCode
- * @param aMessage
- * @param exception
- * @return A status configured with this plugin's id and the given parameters.
- */
- public static IStatus createErrorStatus(int aCode, String aMessage,
- Throwable exception) {
- return createStatus(IStatus.ERROR, aCode, aMessage != null ? aMessage : exception.toString(), exception);
- }
-
- public static IStatus createStatus(int severity, String message, Throwable exception) {
- return new Status(severity, PLUGIN_ID, message, exception);
- }
-
- public static IStatus createStatus(int severity, String message) {
- return createStatus(severity, message, null);
- }
-
- public static void logError(Throwable exception) {
- Platform.getLog(Platform.getBundle(PLUGIN_ID)).log( createStatus(IStatus.ERROR, exception.getMessage(), exception));
- }
-
- public static void logError(CoreException exception) {
- Platform.getLog(Platform.getBundle(PLUGIN_ID)).log( exception.getStatus() );
- }
-
-}
diff --git a/plugins/org.eclipse.jst.j2ee/j2eeplugin/org/eclipse/jst/j2ee/internal/plugin/J2EEPluginResourceHandler.java b/plugins/org.eclipse.jst.j2ee/j2eeplugin/org/eclipse/jst/j2ee/internal/plugin/J2EEPluginResourceHandler.java
deleted file mode 100644
index f83263995..000000000
--- a/plugins/org.eclipse.jst.j2ee/j2eeplugin/org/eclipse/jst/j2ee/internal/plugin/J2EEPluginResourceHandler.java
+++ /dev/null
@@ -1,76 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are 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:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jst.j2ee.internal.plugin;
-
-
-import org.eclipse.osgi.util.NLS;
-
-public class J2EEPluginResourceHandler extends NLS {
-
- private static final String BUNDLE_NAME = "j2eewtpplugin";//$NON-NLS-1$
-
- private J2EEPluginResourceHandler() {
- // Do not instantiate
- }
-
- public static String __Considering_delta_INFO_;
- public static String WARNING_METAFOLDER_MISSING_UI_;
- public static String Not_a_J2EE_project_UI_;
- public static String CoreException_could_not_initialize_Web_Service_class_path_variables_ERROR_;
- public static String Error_opening_archive_for_export_2;
- public static String J2EEDeployOperation_2_UI_;
- public static String No_library_folder_UI_;
- public static String J2EEDeployOperation_UI_Null_Status;
- public static String RAR_File;
- public static String NESTED_JAVA_OUTPUT_ERROR;
- public static String J2EEModulePostImportHelper_3;
- public static String J2EEModulePostImportHelper_2;
- public static String J2EEModulePostImportHelper_1;
- public static String J2EEModulePostImportHelper_0;
- public static String Some_source_types_have______in_their_name_ERROR_;
- public static String J2EEDeployOperation_UI_1;
- public static String J2EEDeployOperation_UI_0;
- public static String _UI_ParamValue_type;
- public static String J2EEDeployOperation_1_UI_;
- public static String An_error_occurred_while_sa_ERROR_;
- public static String WARNING_FILE_MISSING_UI_;
- public static String Cannot_load_EJBJar_because_model_is_null_UI_;
- public static String __Bad_builder_order_for_project_INFO_;
- public static String No_source_types_UI_;
- public static String EJBProjectResources_getEJBJar_EJBEditModel__UI_;
- public static String __No_imported_classes_folder__quitting_INFO_;
- public static String The_following_resources_ne_UI_;
- public static String J2EEDeployOperation_4_UI_;
- public static String __Full_first_build_INFO_;
- public static String Error_occurred_saving_the_manifest_7;
- public static String Cannot_load_EJBFile_because_ejbNature_asEJBJarFile___returns_null_UI_;
- public static String __Delta_build_INFO_;
- public static String __Start_build_project_INFO_;
- public static String Cannot_load_EJBFile_because_EJBNatureRuntime_is_null_UI_;
- public static String Minimizing_project_UI_;
- public static String Error_getting_project_nature_runtime_6;
- public static String Creating_Connector_Project_5;
- public static String Error_getting_project_nature_runtime_3;
- public static String J2EEDeployOperation_3_UI_;
- public static String Unable_to_save_read_only_f_ERROR_;
- public static String Could_not_find_root_object_ERROR_;
- public static String Cannot_run_J2EEUIWorkingCo_ERROR_;
- public static String Cannot_load_EJBFile_because_EJBEditModel_is_null_UI_;
- public static String Error_occurred_loading_ra_xml__4;
-
- static {
- NLS.initializeMessages(BUNDLE_NAME, J2EEPluginResourceHandler.class);
- }
-
- public static String getString(String key, Object[] args) {
- return NLS.bind(key, args);
- }
-}
diff --git a/plugins/org.eclipse.jst.j2ee/j2eeplugin/org/eclipse/jst/j2ee/internal/plugin/J2EEPreferences.java b/plugins/org.eclipse.jst.j2ee/j2eeplugin/org/eclipse/jst/j2ee/internal/plugin/J2EEPreferences.java
deleted file mode 100644
index dfd6ff151..000000000
--- a/plugins/org.eclipse.jst.j2ee/j2eeplugin/org/eclipse/jst/j2ee/internal/plugin/J2EEPreferences.java
+++ /dev/null
@@ -1,437 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are 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:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-/*
- * Created on Jan 26, 2004
- *
- * To change the template for this generated file go to Window - Preferences - Java - Code
- * Generation - Code and Comments
- */
-package org.eclipse.jst.j2ee.internal.plugin;
-
-import org.eclipse.core.runtime.Plugin;
-import org.eclipse.core.runtime.Preferences;
-import org.eclipse.jst.common.frameworks.CommonFrameworksPlugin;
-import org.eclipse.jst.j2ee.internal.J2EEVersionConstants;
-import org.eclipse.wst.project.facet.IProductConstants;
-import org.eclipse.wst.project.facet.ProductManager;
-
-
-/**
- * @author mdelder
- */
-public class J2EEPreferences {
-
- public interface Keys {
-
-
- /**
- * @deprecated, use CommonFrameworksPlugin.DEFAULT_SOURCE_FOLDER or use
- * getJavaSourceFolderName()
- * do not call J2EEPlugin.getJ2EEPreferences.getString(JAVA_SOURCE)
- * @since 2.0
- */
- static final String JAVA_SOURCE = "org.eclipse.jst.j2ee.preference.javaSourceName"; //$NON-NLS-1$
-
- static final String SERVER_TARGET_SUPPORT = "org.eclipse.jst.j2ee.preference.servertargetsupport"; //$NON-NLS-1$
- static final String CREATE_EJB_CLIENT_JAR = "org.eclipse.jst.j2ee.preference.createClientJar"; //$NON-NLS-1$
- static final String J2EE_VERSION = "org.eclipse.jst.j2ee.ui.preference.j2eeVersion"; //$NON-NLS-1$
- static final String EJB_CLIENT_JAR_CP_COMPATIBILITY = "org.eclipse.jst.j2ee.preference.clientjar.cp.compatibility"; //$NON-NLS-1$
- static final String INCREMENTAL_DEPLOYMENT_SUPPORT = "org.eclipse.jst.j2ee.ui.preference.incrementalDeployment"; //$NON-NLS-1$
-
- final static String USE_EAR_LIBRARIES = "org.eclipse.jst.j2ee.preferences.useEARLibraries";//$NON-NLS-1$
- final static String USE_WEB_APP_LIBRARIES = "org.eclipse.jst.j2ee.preferences.useWebAppLibraries";//$NON-NLS-1$
- final static String USE_EAR_LIBRARIES_JDT_EXPORT = "org.eclipse.jst.j2ee.preferences.useEARLibrariesJDTExport";//$NON-NLS-1$
-
- /**
- * @deprecated,
- * but should it be deprecated ? is j2ee_web_content a better name than web_content_folder ?
- * @since 2.0
- */
- static final String J2EE_WEB_CONTENT = "org.eclipse.jst.j2ee.preference.j2eeWebContentName"; //$NON-NLS-1$
- /**
- * @deprecated, static web content is got from ProductManager
- * @since 2.0
- */
- static final String STATIC_WEB_CONTENT = "org.eclipse.jst.j2ee.preference.staticWebContentName"; //$NON-NLS-1$
- /**
- * @since 2.0
- */
- static final String APPLICATION_CONTENT_FOLDER = IProductConstants.APPLICATION_CONTENT_FOLDER;
- /**
- * @since 2.0
- */
- static final String WEB_CONTENT_FOLDER = IProductConstants.WEB_CONTENT_FOLDER;
- /**
- * @since 2.0
- */
- static final String EJB_CONTENT_FOLDER = IProductConstants.EJB_CONTENT_FOLDER;
- /**
- * @since 2.0
- */
- static final String APP_CLIENT_CONTENT_FOLDER = IProductConstants.APP_CLIENT_CONTENT_FOLDER;
- /**
- * @since 2.0
- */
- static final String JCA_CONTENT_FOLDER = IProductConstants.JCA_CONTENT_FOLDER;
-
- /**
- * @since 2.0
- */
- static final String ADD_TO_EAR_BY_DEFAULT = IProductConstants.ADD_TO_EAR_BY_DEFAULT;
- /**
- * @since 2.0
- */
- static final String APPLICATION_GENERATE_DD = "application_generate_dd"; //$NON-NLS-1$
- /**
- * @since 2.0
- */
- static final String DYNAMIC_WEB_GENERATE_DD = "dynamic_web_generate_dd"; //$NON-NLS-1$
- /**
- * @since 2.0
- */
- static final String EJB_GENERATE_DD = "ejb_generate_dd"; //$NON-NLS-1$
- /**
- * @since 2.0
- */
- static final String APP_CLIENT_GENERATE_DD = "app_client_generate_dd"; //$NON-NLS-1$
- /**
- * @since 3.0
- */
- static String ID_PERSPECTIVE_HIERARCHY_VIEW = "perspective_hierarchy_view_id"; //$NON-NLS-1$
-
- }
-
- public interface Values {
- final static String J2EE_VERSION_1_2 = "J2EE_1_2"; //$NON-NLS-1$
- final static String J2EE_VERSION_1_3 = "J2EE_1_3"; //$NON-NLS-1$
- final static String J2EE_VERSION_1_4 = "J2EE_1_4"; //$NON-NLS-1$
-
- /**
- * @deprecated, see initializeDefaultPreferences() it uses ProductManager
- */
- final static String J2EE_WEB_CONTENT = ProductManager.getProperty(IProductConstants.WEB_CONTENT_FOLDER);
- /**
- * @deprecated, see initializeDefaultPreferences() it uses ProductManager
- */
- final static String STATIC_WEB_CONTENT = ProductManager.getProperty(IProductConstants.WEB_CONTENT_FOLDER);
- /**
- * @deprecated, use CommonFrameworksPlugin.DEFAULT_SOURCE_FOLDER
- */
- final static String JAVA_SOURCE = CommonFrameworksPlugin.getDefault().getPluginPreferences().getString(CommonFrameworksPlugin.DEFAULT_SOURCE_FOLDER);
- }
-
- public interface Defaults {
-
- /**
- * @deprecated, see initializeDefaultPreferences() it uses ProductManager
- */
- final static String J2EE_WEB_CONTENT = Values.J2EE_WEB_CONTENT;
- /**
- * @deprecated, see initializeDefaultPreferences() it uses ProductManager
- */
- final static String STATIC_WEB_CONTENT = Values.STATIC_WEB_CONTENT;
- /**
- * @deprecated, see DEFAULT_SOURCE_FOLDER
- */
- final static String JAVA_SOURCE = Values.JAVA_SOURCE;
- final static String J2EE_VERSION = Values.J2EE_VERSION_1_4;
- final static int J2EE_VERSION_ID = J2EEVersionConstants.J2EE_1_4_ID;
- final static boolean CREATE_EJB_CLIENT_JAR = false;
- final static boolean EJB_CLIENT_JAR_CP_COMPATIBILITY = true;
- final static boolean INCREMENTAL_DEPLOYMENT_SUPPORT = true;
- final static boolean USE_EAR_LIBRARIES_JDT_EXPORT = false;
- final static String ID_PERSPECTIVE_HIERARCHY_VIEW = "org.eclipse.ui.navigator.ProjectExplorer"; //$NON-NLS-1$
- }
-
- private Plugin owner = null;
- private Preferences preferences = null;
- private boolean persistOnChange = false;
-
- public J2EEPreferences(Plugin owner) {
- this.owner = owner;
- }
-
- protected void initializeDefaultPreferences() {
-
- getPreferences().setDefault(Keys.J2EE_VERSION, Defaults.J2EE_VERSION);
- getPreferences().setDefault(Keys.CREATE_EJB_CLIENT_JAR, Defaults.CREATE_EJB_CLIENT_JAR);
- getPreferences().setDefault(Keys.EJB_CLIENT_JAR_CP_COMPATIBILITY, Defaults.EJB_CLIENT_JAR_CP_COMPATIBILITY);
- getPreferences().setDefault(Keys.INCREMENTAL_DEPLOYMENT_SUPPORT, Defaults.INCREMENTAL_DEPLOYMENT_SUPPORT);
-
- // since 2.0
- getPreferences().setDefault(Keys.J2EE_WEB_CONTENT, ProductManager.getProperty(IProductConstants.WEB_CONTENT_FOLDER));
- getPreferences().setDefault(Keys.STATIC_WEB_CONTENT, ProductManager.getProperty(IProductConstants.WEB_CONTENT_FOLDER));
- // since 2.0
- getPreferences().setDefault(Keys.JAVA_SOURCE, CommonFrameworksPlugin.getDefault().getPluginPreferences().getString(CommonFrameworksPlugin.DEFAULT_SOURCE_FOLDER));
- // done in CommonFrameworksPref..Initializer
- //getPreferences().setDefault(Keys.DEFAULT_SOURCE_FOLDER, ProductManager.getProperty(IProductConstants.DEFAULT_SOURCE_FOLDER));
- getPreferences().setDefault(Keys.APPLICATION_CONTENT_FOLDER, ProductManager.getProperty(IProductConstants.APPLICATION_CONTENT_FOLDER));
- getPreferences().setDefault(Keys.WEB_CONTENT_FOLDER, ProductManager.getProperty(IProductConstants.WEB_CONTENT_FOLDER));
- getPreferences().setDefault(Keys.APP_CLIENT_CONTENT_FOLDER, ProductManager.getProperty(IProductConstants.APP_CLIENT_CONTENT_FOLDER));
- getPreferences().setDefault(Keys.EJB_CONTENT_FOLDER, ProductManager.getProperty(IProductConstants.EJB_CONTENT_FOLDER));
- getPreferences().setDefault(Keys.JCA_CONTENT_FOLDER, ProductManager.getProperty(IProductConstants.JCA_CONTENT_FOLDER));
- getPreferences().setDefault(Keys.ADD_TO_EAR_BY_DEFAULT, ProductManager.getProperty(IProductConstants.ADD_TO_EAR_BY_DEFAULT));
- // done in CommonFrameworksPref..Initializer
- //getPreferences().setDefault(Keys.OUTPUT_FOLDER, ProductManager.getProperty(IProductConstants.OUTPUT_FOLDER));
-
- // since 2.0, for java ee projects
- getPreferences().setDefault(Keys.APPLICATION_GENERATE_DD, false);
- // for ee5 jee web projects default it to true so that we can create servlets, otherwise false
- getPreferences().setDefault(Keys.DYNAMIC_WEB_GENERATE_DD, true);
- getPreferences().setDefault(Keys.EJB_GENERATE_DD, false);
- getPreferences().setDefault(Keys.APP_CLIENT_GENERATE_DD, false);
-
- getPreferences().setDefault(Keys.USE_EAR_LIBRARIES, true);
- getPreferences().setDefault(Keys.USE_WEB_APP_LIBRARIES, true);
- getPreferences().setDefault(Keys.USE_EAR_LIBRARIES_JDT_EXPORT, Defaults.USE_EAR_LIBRARIES_JDT_EXPORT);
- String perspectiveID = ProductManager.getProperty(IProductConstants.ID_PERSPECTIVE_HIERARCHY_VIEW);
- getPreferences().setDefault(Keys.ID_PERSPECTIVE_HIERARCHY_VIEW, (perspectiveID != null) ? perspectiveID : Defaults.ID_PERSPECTIVE_HIERARCHY_VIEW);
- }
-
-
- public String getSetting(String key){
- return getPreferences().getString(key);
- }
-
- public void setSetting(String key, String value){
- getPreferences().setValue(key, value);
- firePreferenceChanged();
- }
-
- public boolean getUseEARLibraries() {
- return getPreferences().getBoolean(Keys.USE_EAR_LIBRARIES);
- }
-
- public void setUseEARLibraries(boolean value) {
- getPreferences().setValue(Keys.USE_EAR_LIBRARIES, value);
- firePreferenceChanged();
- }
-
- public boolean getUseEARLibrariesJDTExport() {
- return getPreferences().getBoolean(Keys.USE_EAR_LIBRARIES_JDT_EXPORT);
- }
-
- public void setUseEARLibrariesJDTExport(boolean value) {
- getPreferences().setValue(Keys.USE_EAR_LIBRARIES_JDT_EXPORT, value);
- firePreferenceChanged();
- }
-
- public boolean getUseWebLibaries() {
- return getPreferences().getBoolean(Keys.USE_WEB_APP_LIBRARIES);
- }
-
- public void setUseWebLibraries(boolean value) {
- getPreferences().setValue(Keys.USE_WEB_APP_LIBRARIES, value);
- firePreferenceChanged();
- }
-
-
- public String getJ2EEWebContentFolderName() {
- //return getPreferences().getString(Keys.J2EE_WEB_CONTENT);
- //but should it be deprecated ? is j2ee_web_content a better name than web_content_folder ?
- return getPreferences().getString(Keys.WEB_CONTENT_FOLDER);
-
- }
-
- /**
- * @return
- * @deprecated
- */
- public String getStaticWebContentFolderName() {
- return getPreferences().getString(Keys.STATIC_WEB_CONTENT);
- }
-
- public String getJavaSourceFolderName() {
- //return getPreferences().getString(Keys.JAVA_SOURCE);
- // TODO is JAVA_SOURCE a better name or is DEFAULT_SOURCE...
- return CommonFrameworksPlugin.getDefault().getPluginPreferences().getString(CommonFrameworksPlugin.DEFAULT_SOURCE_FOLDER);
- }
-
- public String getHighestJ2EEVersionSetting() {
- return getPreferences().getString(Keys.J2EE_VERSION);
- }
-
- public boolean isServerTargetingEnabled() {
- return getPreferences().getBoolean(Keys.SERVER_TARGET_SUPPORT);
- }
-
- ///
- public void setJ2EEWebContentFolderName(String value) {
- //getPreferences().setValue(Keys.J2EE_WEB_CONTENT, value);
- // TODO but should it be deprecated ? is j2ee_web_content a better name than web_content_folder ?
- getPreferences().setValue(Keys.WEB_CONTENT_FOLDER, value);
- firePreferenceChanged();
- }
-
- /**
- * @param value
- * @deprecated
- */
- public void setStaticWebContentFolderName(String value) {
- getPreferences().setValue(Keys.STATIC_WEB_CONTENT, value);
- firePreferenceChanged();
- }
-
- public void setJavaSourceFolderName(String value) {
- //getPreferences().setValue(Keys.JAVA_SOURCE, value);
- // TODO is JAVA_SOURCE a better name or is DEFAULT_SOURCE...
- CommonFrameworksPlugin.getDefault().getPluginPreferences().setValue(CommonFrameworksPlugin.DEFAULT_SOURCE_FOLDER, value);
- CommonFrameworksPlugin.getDefault().savePluginPreferences();
- firePreferenceChanged();
- }
-
- public void setHighestJ2EEVersionSetting(String value) {
- getPreferences().setValue(Keys.J2EE_VERSION, value);
- firePreferenceChanged();
- }
-
- public void setServerTargetingEnabled(boolean value) {
- getPreferences().setValue(Keys.SERVER_TARGET_SUPPORT, value);
- firePreferenceChanged();
- }
-
- public void setIncrementalDeploymentEnabled(boolean value) {
- getPreferences().setValue(Keys.INCREMENTAL_DEPLOYMENT_SUPPORT, value);
- firePreferenceChanged();
- }
-
- public boolean isIncrementalDeploymentEnabled() {
- return getPreferences().getBoolean(Keys.INCREMENTAL_DEPLOYMENT_SUPPORT);
- }
-
- /**
- * @return one of J2EEVersionConstants.J2EE_VERSION_X_X (@see J2EEVersionConstants)
- */
- public int getHighestJ2EEVersionID() {
- String versionPreference = getHighestJ2EEVersionSetting();
- if (Values.J2EE_VERSION_1_2.equals(versionPreference))
- return J2EEVersionConstants.J2EE_1_2_ID;
- else if (Values.J2EE_VERSION_1_3.equals(versionPreference))
- return J2EEVersionConstants.J2EE_1_3_ID;
- else
- return J2EEVersionConstants.J2EE_1_4_ID;
- }
-
- public void firePreferenceChanged() {
- if (isPersistOnChange())
- persist();
- }
-
- public void persist() {
- getOwner().savePluginPreferences();
- }
-
- /**
- * @return Returns the persistOnChange.
- */
- public boolean isPersistOnChange() {
- return this.persistOnChange;
- }
-
- /**
- * @param persistOnChange
- * The persistOnChange to set.
- */
- public void setPersistOnChange(boolean persistOnChange) {
- this.persistOnChange = persistOnChange;
- }
-
- private Preferences getPreferences() {
- if (this.preferences == null)
- this.preferences = getOwner().getPluginPreferences();
- return this.preferences;
- }
-
- /**
- * @return Returns the owner.
- */
- private Plugin getOwner() {
- return this.owner;
- }
-
- /**
- * Returns the default value for the boolean-valued property
- * with the given name.
- * Returns the default-default value (<code>false</code>) if there
- * is no default property with the given name, or if the default
- * value cannot be treated as a boolean.
- * The given name must not be <code>null</code>.
- *
- * @param name the name of the property
- * @return the default value of the named property
- */
- public boolean getDefaultBoolean(String name) {
- return getPreferences().getDefaultBoolean(name);
- }
- /**
- * Returns the current value of the boolean-valued property with the
- * given name.
- * The given name must not be <code>null</code>.
- *
- * @param name the name of the property
- * @return the boolean-valued property
- */
- public boolean getBoolean(String name) {
- return getPreferences().getBoolean(name);
- }
-
- /**
- * Sets the current value of the boolean-valued property with the
- * given name. The given name must not be <code>null</code>.
- * @param name the name of the property
- * @param value the new current value of the property
- */
- public void setValue(String name, boolean value) {
- getPreferences().setValue(name, value);
- firePreferenceChanged();
- }
-
- /**
- * Returns the default value for the string-valued property
- * with the given name.
- * Returns the default-default value (the empty string <code>""</code>)
- * is no default property with the given name, or if the default
- * value cannot be treated as a string.
- * The given name must not be <code>null</code>.
- *
- * @param name the name of the property
- * @return the default value of the named property
- */
- public String getDefaultString(String name) {
- return getPreferences().getDefaultString(name);
- }
-
- /**
- * Returns the current value of the string-valued property with the
- * given name.
- * Returns the default-default value (the empty string <code>""</code>)
- * if there is no property with the given name.
- * The given name must not be <code>null</code>.
- *
- * @param name the name of the property
- * @return the string-valued property
- */
- public String getString(String name) {
- return getPreferences().getString(name);
- }
-
- /**
- * Sets the current value of the string-valued property with the
- * given name. The given name must not be <code>null</code>.
- * @param name the name of the property
- * @param value the new current value of the property
- */
- public void setValue(String name, String value) {
- getPreferences().setValue(name, value);
- firePreferenceChanged();
- }
-
-}
diff --git a/plugins/org.eclipse.jst.j2ee/j2eeplugin/org/eclipse/jst/j2ee/internal/plugin/LibCopyBuilder.java b/plugins/org.eclipse.jst.j2ee/j2eeplugin/org/eclipse/jst/j2ee/internal/plugin/LibCopyBuilder.java
deleted file mode 100644
index 7bad42f05..000000000
--- a/plugins/org.eclipse.jst.j2ee/j2eeplugin/org/eclipse/jst/j2ee/internal/plugin/LibCopyBuilder.java
+++ /dev/null
@@ -1,506 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are 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:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jst.j2ee.internal.plugin;
-
-
-import java.io.File;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Map;
-
-import org.eclipse.core.resources.IContainer;
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IFolder;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.resources.IResourceDelta;
-import org.eclipse.core.resources.IResourceDeltaVisitor;
-import org.eclipse.core.resources.IResourceVisitor;
-import org.eclipse.core.resources.IncrementalProjectBuilder;
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.jem.workbench.utility.JemProjectUtilities;
-
-/**
- * An example incremental project builder that copies additional class files from a library package
- * fragment root folder into a Java project's output directory.
- *
- * General parameters:
- * <ul>
- * <li>The project should be a Java project.</li>
- * <li>The class files are in the "imported_classes" folder of the project.</li>
- * <li>This builder should run <b>after </b> the Java builder.</li>
- * <li>Full build should copy class files from a secondary library folder into the output folder
- * maintaining package hierarchy; existing class files must never be overwritten.</li>
- * <li>Only *.class files should be copied (not other resource files).</li>
- * <li>Incremental build and auto-build should will perform the copy when there is an add/change in
- * the "imported_classes" folder.</li>
- * <li>Changing the project's output folder should be handled.</li>
- * </ul>
- * Note: the builder is not currently invoking the Minimize helper, it is relying on the copy to not
- * replace existing class files, and the build path order to ensure that compiled classes override
- * imported ones.
- *
- * @deprecated This class is only used for backwards compatibility
- */
-public class LibCopyBuilder extends IncrementalProjectBuilder {
- /**
- * Internal debug tracing.
- */
- static boolean DEBUG = false;
-
- /**
- * Builder id of this incremental project builder.
- */
- public static final String BUILDER_ID = J2EEPlugin.LIBCOPY_BUILDER_ID;
-
- /**
- * The path where we expect to find the .class files to be copied.
- */
- public static final String IMPORTED_CLASSES_PATH = "imported_classes"; //$NON-NLS-1$
-
- /**
- * The path of the output folder that we last copied class files into, or <code>null</code> if
- * this builder has not built this project before.
- */
-// private IPath lastOutputPath = null;
-
- private List sourceContainers;
-
-// private boolean needOutputRefresh;
-
- /**
- * Creates a new instance of the library copying builder.
- * <p>
- * All incremental project builders are required to have a public 0-argument constructor.
- * </p>
- */
- public LibCopyBuilder() {
- super();
- }
-
-
- /**
- *
- * The <code>LibCopyBuilder</code> implementation of this
- * <code>IncrementalProjectBuilder</code> method copies additional class files into the output
- * folder.
- * <p>
- * [Issue: the implementation should report progress.]
- * </p>
- * <p>
- * [Issue: the implementation should probably use a workspace runnable.]
- * </p>
- */
- protected IProject[] build(int kind, Map args, IProgressMonitor monitor) throws CoreException {
- // this builder is unnecessary in WTP 1.5
- return null;
-// sourceContainers = null;
-// needOutputRefresh = false;
-// if (DEBUG) {
-// System.out.println(BUILDER_ID + J2EEPluginResourceHandler.__Start_build_project_INFO_ + getProject().getName());
-// }
-//
-// boolean builderOrderOK = checkBuilderOrdering();
-//
-// if (DEBUG && !builderOrderOK) {
-// System.out.println(BUILDER_ID + J2EEPluginResourceHandler.__Bad_builder_order_for_project_INFO_ + getProject().getName());
-// }
-//
-// IFolder[] classFolders = getClassesFolders();
-// if (classFolders.length == 0) {
-// // no files to copy
-// if (DEBUG)
-// System.out.println(BUILDER_ID + J2EEPluginResourceHandler.__No_imported_classes_folder__quitting_INFO_);
-// return null;
-// }
-//
-// IJavaProject jproject = JavaCore.create(getProject());
-// if (jproject == null) {
-// // not a java project (anymore?)
-// return null;
-// }
-//
-// IPath outputPath = jproject.getOutputLocation();
-// IFolder outputFolder = getProject().getParent().getFolder(outputPath);
-// if (outputPath.equals(lastOutputPath)) {
-// if (kind == INCREMENTAL_BUILD || kind == AUTO_BUILD) {
-// processDelta(getDelta(getProject()), outputFolder, monitor, classFolders);
-// refreshOutputIfNecessary(outputFolder);
-// return null;
-// }
-// }
-//
-// if (DEBUG) {
-// System.out.println(BUILDER_ID + J2EEPluginResourceHandler.__Full_first_build_INFO_);
-// }
-// copyAllClassFolders(monitor, classFolders, outputFolder);
-// lastOutputPath = outputPath;
-// refreshOutputIfNecessary(outputFolder);
-// return null;
- }
-
- /**
- *
- */
-// private void refreshOutputIfNecessary(IFolder outputFolder) throws CoreException {
-// if (needOutputRefresh && outputFolder != null && outputFolder.exists())
-// outputFolder.refreshLocal(IResource.DEPTH_INFINITE, null);
-// }
-
- private void copyAllClassFolders(IProgressMonitor monitor, IFolder[] classFolders, IFolder outputFolder) throws CoreException {
- for (int i = 0; i < classFolders.length; i++) {
- if (!classFolders[i].equals(outputFolder))
- copyClassFiles(classFolders[i], outputFolder, monitor);
- }
-
- }
-
-
- /**
- * Process an incremental build delta.
- *
- * @return <code>true</code> if the delta requires a copy
- * @param dest
- * the destination folder; may or may not exist
- * @param monitor
- * the progress monitor, or <code>null</code> if none
- * @exception CoreException
- * if something goes wrong
- */
- protected void processDelta(IResourceDelta delta, final IFolder outputFolder, final IProgressMonitor monitor, final IFolder[] classesFolders) {
- if (DEBUG) {
- System.out.println(BUILDER_ID + J2EEPluginResourceHandler.__Considering_delta_INFO_ + delta);
- }
- IResourceDeltaVisitor visitor = new IResourceDeltaVisitor() {
- private List copiedClassFolders = new ArrayList(classesFolders.length);
-
- public boolean visit(IResourceDelta subdelta) throws CoreException {
- IResource resource = subdelta.getResource();
- if (resource.getType() == IResource.FILE) {
- IFolder classesFolder = retrieveClassesFolder(resource, classesFolders);
- if (classesFolder != null && !copiedClassFolders.contains(classesFolder)) {
- int kind = subdelta.getKind();
- switch (kind) {
- case IResourceDelta.ADDED :
- case IResourceDelta.CHANGED :
- if (DEBUG) {
- System.out.println(BUILDER_ID + J2EEPluginResourceHandler.__Delta_build_INFO_ + subdelta);
- }
- copyClassFiles(classesFolder, outputFolder, monitor);
- break;
- case IResourceDelta.REMOVED :
- deleteCorrespondingFile((IFile) resource, classesFolder, outputFolder, monitor);
- break;
- case IResourceDelta.ADDED_PHANTOM :
- break;
- case IResourceDelta.REMOVED_PHANTOM :
- break;
- }
-
- }
- } else if (resource.getType() == IResource.FOLDER && resource.equals(outputFolder)) {
- copyAllClassFolders(null, classesFolders, outputFolder);
- return false;
- }
- return true;
- }
- };
- if (delta != null) {
- try {
- delta.accept(visitor);
- } catch (CoreException e) {
- // should not happen
- }
- }
- }
-
- /**
- * @param file
- * @param classesFolder
- * @param outputFolder
- * @param monitor
- */
- protected void deleteCorrespondingFile(IFile file, IFolder classesFolder, IFolder outputFolder, IProgressMonitor monitor) throws CoreException {
- IPath path = file.getFullPath();
- int segCount = classesFolder.getFullPath().segmentCount();
- path = path.removeFirstSegments(segCount);
- IFile javaFile = findCorrespondingJavaFile(path);
- if (javaFile != null && javaFile.exists())
- return; //There is nothing to do because the file in the output location is from the
- // java compilation not the copy.
- IFile outFile = outputFolder.getFile(path);
- if (outFile.exists())
- outFile.delete(true, false, monitor);
- }
-
-
- /**
- * Method retrieveClassesFolder.
- *
- * @param resource
- * @return IFolder
- */
- protected IFolder retrieveClassesFolder(IResource resource, IFolder[] classesFolders) {
- for (int i = 0; i < classesFolders.length; i++) {
- if (classesFolders[i].getName().equals(resource.getProjectRelativePath().segment(0)))
- return classesFolders[i];
- }
- return null;
- }
-
-
- /**
- * Checks whether this builder is configured to run <b>after </b> the Java builder.
- *
- * @return <code>true</code> if the builder order is correct, and <code>false</code>
- * otherwise
- * @exception CoreException
- * if something goes wrong
- */
-// private boolean checkBuilderOrdering() throws CoreException {
- // determine relative builder position from project's buildspec
-// ICommand[] cs = getProject().getDescription().getBuildSpec();
-// int myIndex = -1;
-// int javaBuilderIndex = -1;
-// for (int i = 0; i < cs.length; i++) {
-// if (cs[i].getBuilderName().equals(JavaCore.BUILDER_ID)) {
-// javaBuilderIndex = i;
-// } else if (cs[i].getBuilderName().equals(BUILDER_ID)) {
-// myIndex = i;
-// }
-// }
-// return myIndex > javaBuilderIndex;
-// }
-
- /**
- * Copies class files from the given source folder to the given destination folder. The
- * destination folder will be created if required, but only if at least one class file is
- * copied.
- *
- * @param source
- * the source folder; must exist
- * @param dest
- * the destination folder; may or may not exist
- * @param monitor
- * the progress monitor, or <code>null</code> if none
- * @exception CoreException
- * if something goes wrong
- */
- private void copyClassFiles(IFolder source, final IFolder dest, final IProgressMonitor monitor) throws CoreException {
- if (DEBUG) {
- System.out.println(BUILDER_ID + ": Begin copying class files from " + source.getFullPath() + " to " + dest.getFullPath()); //$NON-NLS-1$ //$NON-NLS-2$
- }
-
- final int sourcePathLength = source.getFullPath().segmentCount();
-
- class Visitor implements IResourceVisitor {
- public boolean visit(IResource res) throws CoreException {
- if (res.getType() == IResource.FILE) {
- IFile file = (IFile) res;
-
- // compute relative path from source folder to this file
- IPath filePath = file.getFullPath();
- IPath dpath = filePath.removeFirstSegments(sourcePathLength);
- IFile targetFile = dest.getFile(dpath);
- copyFile(file, targetFile, dpath, monitor);
- }
- return true;
- }
- }
-
- try {
- source.accept(new Visitor());
- } catch (CoreException e) {
- // should not happen
- }
-
- }
-
- /**
- * Copies the given file to the given destination file. Does nothing if the destination file
- * already exists.
- *
- * @param source
- * the source file; must exist
- * @param dest
- * the destination file; may or may not exist; never overwritten
- * @param monitor
- * the progress monitor, or <code>null</code> if none
- * @exception CoreException
- * if something goes wrong
- */
- private void copyFile(IFile source, IFile dest, IPath fileRelativePath, IProgressMonitor monitor) throws CoreException {
- if (pruneForJavaSource(source, fileRelativePath, monitor))
- return; //no copy necessary.
- File sourceFile = null, destFile = null;
- if (source.exists())
- sourceFile = source.getLocation().toFile();
- if (dest.exists())
- destFile = dest.getLocation().toFile();
-
- if (destFile != null && sourceFile != null) {
- if (DEBUG)
- System.out.println(BUILDER_ID + ": " + dest.getFullPath() + " already exists."); //$NON-NLS-1$ //$NON-NLS-2$
- if (destFile.lastModified() == sourceFile.lastModified())
- return;
- dest.setContents(source.getContents(false), true, false, monitor); //we have to force
- // b/c set the mod
- // stamp makes it
- // think it is out of
- // synch.
- synchronizeModificationStamps(sourceFile, destFile);
- return;
- }
- if (DEBUG) {
- System.out.println(BUILDER_ID + ": Creating " + dest.getFullPath()); //$NON-NLS-1$
- }
-
- IContainer parent = dest.getParent();
- if (parent.getType() == IResource.FOLDER) {
- mkdirs((IFolder) parent, monitor);
- }
- dest.create(source.getContents(false), false, monitor);
- destFile = dest.getLocation().toFile();
- synchronizeModificationStamps(sourceFile, destFile);
- dest.setDerived(true);
- }
-
- /**
- * Return true if a corresponding .java file is found. Remove the .class file from the
- * imported_classes folder (i.e., delete the source file).
- *
- * @param source
- * @param monitor
- * @return
- */
- private boolean pruneForJavaSource(IFile classFile, IPath fileRelativePath, IProgressMonitor monitor) throws CoreException {
- if (classFile.exists()) {
- IFile javaFile = findCorrespondingJavaFile(fileRelativePath);
- if (javaFile != null && javaFile.exists()) {
- ResourcesPlugin.getWorkspace().validateEdit(new IFile[]{javaFile}, null);
- classFile.delete(true, false, monitor);
- return true;
- }
- }
- return false;
- }
-
-
- /**
- * @param classFilePath
- * @return
- */
- private IFile findCorrespondingJavaFile(IPath classFilePath) {
- IPath javaPath = convertToJavaPath(classFilePath);
- List sourceFolders = getSourceContainers();
- IContainer cont;
- IFile javaFile;
- for (int i = 0; i < sourceFolders.size(); i++) {
- cont = (IContainer) sourceFolders.get(i);
- javaFile = cont.getFile(javaPath);
- if (javaFile.exists())
- return javaFile;
- }
- return null;
- }
-
-
- private List getSourceContainers() {
- if (sourceContainers == null)
- sourceContainers = JemProjectUtilities.getSourceContainers(getProject());
- return sourceContainers;
- }
-
-
- /**
- * @param classFile
- * @return
- */
- private IPath convertToJavaPath(IPath classFilePath) {
- IPath javaPath = classFilePath.removeFileExtension();
- //handle inner classes...look for outermost java file
- String fileName = classFilePath.lastSegment();
- int innerIndex = fileName.indexOf('$');
- if (innerIndex > -1) {
- javaPath = javaPath.removeLastSegments(1);
- javaPath = javaPath.append(fileName.substring(0, innerIndex));
- }
- javaPath = javaPath.addFileExtension("java"); //$NON-NLS-1$
- return javaPath;
- }
-
-
- /**
- * @param source
- * @param dest
- */
- private void synchronizeModificationStamps(File sourceFile, File destFile) {
- if (destFile != null && sourceFile != null) {
- destFile.setLastModified(sourceFile.lastModified());
-// needOutputRefresh = true;
- }
- }
-
-
- /**
- * Creates the given folder, and its containing folders, if required. Does nothing if the given
- * folder already exists.
- *
- * @param folder
- * the folder to create
- * @param monitor
- * the progress monitor, or <code>null</code> if none
- * @exception CoreException
- * if something goes wrong
- */
- private void mkdirs(IFolder folder, IProgressMonitor monitor) throws CoreException {
- if (folder.exists()) {
- return;
- }
- IContainer parent = folder.getParent();
- if (!parent.exists() && parent.getType() == IResource.FOLDER) {
- mkdirs((IFolder) parent, monitor);
- }
- folder.create(false, true, monitor);
- }
-
-// private IFolder[] getClassesFolders() {
-// IProject project = getProject();
-// IJavaProject javaProj = JemProjectUtilities.getJavaProject(project);
-// if (javaProj == null)
-// return new IFolder[0];
-// List result = null;
-// IClasspathEntry[] entries;
-// try {
-// entries = javaProj.getResolvedClasspath(true);
-// } catch (JavaModelException e) {
-// return new IFolder[0];
-// }
-// for (int i = 0; i < entries.length; i++) {
-// IClasspathEntry entry = entries[i];
-// if (entry.getEntryKind() == IClasspathEntry.CPE_LIBRARY) {
-// IPath path = entry.getPath();
-// IResource res = project.getWorkspace().getRoot().findMember(path);
-// if (res != null && res.isAccessible() && res.getType() == IResource.FOLDER && res.getProject().equals(project)) {
-// if (result == null)
-// result = new ArrayList(1);
-// result.add(res);
-// }
-// }
-// }
-// if (result == null)
-// return new IFolder[0];
-// return (IFolder[]) result.toArray(new IFolder[result.size()]);
-// }
-}
diff --git a/plugins/org.eclipse.jst.j2ee/j2eeplugin/org/eclipse/jst/j2ee/internal/validation/AWorkbenchMOFHelper.java b/plugins/org.eclipse.jst.j2ee/j2eeplugin/org/eclipse/jst/j2ee/internal/validation/AWorkbenchMOFHelper.java
deleted file mode 100644
index 7b5fc7da6..000000000
--- a/plugins/org.eclipse.jst.j2ee/j2eeplugin/org/eclipse/jst/j2ee/internal/validation/AWorkbenchMOFHelper.java
+++ /dev/null
@@ -1,92 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are 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:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jst.j2ee.internal.validation;
-
-
-import java.util.logging.Level;
-
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IProjectDescription;
-import org.eclipse.core.resources.IProjectNature;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.jem.internal.plugin.JavaEMFNature;
-import org.eclipse.jem.util.logger.LogEntry;
-import org.eclipse.jem.util.logger.proxy.Logger;
-import org.eclipse.jst.j2ee.internal.plugin.J2EEPlugin;
-import org.eclipse.wst.common.internal.emfworkbench.WorkbenchResourceHelper;
-import org.eclipse.wst.validation.internal.operations.WorkbenchContext;
-
-
-/**
- * Abstract base class for registration of symbolic model names, and also provides the mechanism for
- * registering the load model method which loads a specific type of MOF model, as identified by the
- * symbolic model name.
- */
-public abstract class AWorkbenchMOFHelper extends WorkbenchContext {
- public IResource getResource(Object obj) {
- IResource res = null;
- if ((obj != null) && (obj instanceof EObject)) {
- JavaEMFNature nature = getMOFNature(getProject());
- if (nature != null) {
- EObject ro = (EObject) obj;
- res = WorkbenchResourceHelper.getFile(ro.eResource());
- }
- }
-
- if ((res == null) || (!res.exists())) {
- return super.getResource(obj);
- }
-
- return res;
- }
-
- public JavaEMFNature getMOFNature(IProject project) {
- if (project == null) {
- return null;
- }
-
- IProjectDescription desc = null;
- try {
- desc = project.getDescription();
- } catch (CoreException exc) {
- Logger logger = J2EEPlugin.getDefault().getMsgLogger();
- if (logger.isLoggingLevel(Level.FINE)) {
- LogEntry entry = J2EEPlugin.getLogEntry();
- entry.setSourceID("WorkbenchContext.getMOFNature(IProject)"); //$NON-NLS-1$
- entry.setTargetException(exc);
- logger.write(Level.FINE, entry);
- }
- return null;
- }
-
- String[] natureIds = desc.getNatureIds();
- for (int i = 0; i < natureIds.length; i++) {
- try {
- IProjectNature nature = project.getNature(natureIds[i]);
- if (nature instanceof JavaEMFNature) {
- return (JavaEMFNature) nature;
- }
- } catch (CoreException exc) {
- // log and attempt next nature
- Logger logger = J2EEPlugin.getDefault().getMsgLogger();
- if (logger.isLoggingLevel(Level.FINE)) {
- LogEntry entry = J2EEPlugin.getLogEntry();
- entry.setSourceID("WorkbenchContext.getMOFNature(IProject)"); //$NON-NLS-1$
- entry.setTargetException(exc);
- logger.write(Level.FINE, entry);
- }
- }
- }
- return null;
- }
-}
diff --git a/plugins/org.eclipse.jst.j2ee/j2eeplugin/org/eclipse/jst/j2ee/internal/validation/ApplicationClientHelper.java b/plugins/org.eclipse.jst.j2ee/j2eeplugin/org/eclipse/jst/j2ee/internal/validation/ApplicationClientHelper.java
deleted file mode 100644
index dd0c8e38a..000000000
--- a/plugins/org.eclipse.jst.j2ee/j2eeplugin/org/eclipse/jst/j2ee/internal/validation/ApplicationClientHelper.java
+++ /dev/null
@@ -1,90 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are 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:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jst.j2ee.internal.validation;
-
-
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.jem.util.logger.proxy.Logger;
-import org.eclipse.jst.j2ee.applicationclient.componentcore.util.AppClientArtifactEdit;
-import org.eclipse.jst.j2ee.commonarchivecore.internal.ApplicationClientFile;
-import org.eclipse.jst.j2ee.commonarchivecore.internal.exception.OpenFailureException;
-import org.eclipse.jst.j2ee.model.internal.validation.ApplicationClientMessageConstants;
-import org.eclipse.wst.common.componentcore.ArtifactEdit;
-import org.eclipse.wst.common.componentcore.ComponentCore;
-import org.eclipse.wst.common.componentcore.internal.util.ComponentUtilities;
-import org.eclipse.wst.common.componentcore.resources.IVirtualComponent;
-import org.eclipse.wst.validation.internal.operations.WorkbenchReporter;
-
-
-/**
- * Insert the type's description here. Creation date: (4/9/2001 11:22:53 AM)
- *
- * @author: Administrator
- */
-public class ApplicationClientHelper extends J2EEValidationHelper {
-
- protected ApplicationClientFile appClientFile;
-
- /**
- * ApplicationClientHelper constructor comment.
- */
- public ApplicationClientHelper() {
- super();
- registerModel(ApplicationClientMessageConstants.APPCLIENT_MODEL_NAME, "loadApplicationClientFile"); //$NON-NLS-1$
- }
-
- /**
- * Given a resource, return its non-eclipse-specific location. If this resource, or type of
- * resource, isn't handled by this helper, return null.
- */
- public String getPortableName(IResource resource) {
- if (!(resource instanceof IFile)) {
- return null;
- }
-
- return "application-client.xml"; //$NON-NLS-1$
- }
-
- /**
- * Get the AppClient file for validation
- */
-
- public EObject loadApplicationClientFile() {
-
- IVirtualComponent comp = ComponentCore.createComponent(getProject());
- ArtifactEdit edit = ComponentUtilities.getArtifactEditForRead(comp);
-
- try {
- appClientFile = (ApplicationClientFile)((AppClientArtifactEdit) edit).asArchive(false);
- return appClientFile;
- } catch (OpenFailureException e1) {
- Logger.getLogger().log(e1);
- }finally {
- if (edit != null) {
- edit.dispose();
- }
- }
- return null;
- }
-
- public void cleanup(WorkbenchReporter reporter) {
- closeApplicationClientFile();
- super.cleanup(reporter);
- }
-
- public void closeApplicationClientFile() {
- if (appClientFile != null)
- appClientFile.close();
- }
-}
diff --git a/plugins/org.eclipse.jst.j2ee/j2eeplugin/org/eclipse/jst/j2ee/internal/validation/DependencyUtil.java b/plugins/org.eclipse.jst.j2ee/j2eeplugin/org/eclipse/jst/j2ee/internal/validation/DependencyUtil.java
deleted file mode 100644
index d13fc560b..000000000
--- a/plugins/org.eclipse.jst.j2ee/j2eeplugin/org/eclipse/jst/j2ee/internal/validation/DependencyUtil.java
+++ /dev/null
@@ -1,242 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are 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:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jst.j2ee.internal.validation;
-
-import java.util.HashSet;
-import java.util.Set;
-import java.util.logging.Level;
-
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.jdt.core.IJavaModel;
-import org.eclipse.jdt.core.IJavaProject;
-import org.eclipse.jdt.core.JavaCore;
-import org.eclipse.jdt.core.JavaModelException;
-import org.eclipse.jem.util.logger.LogEntry;
-import org.eclipse.jem.util.logger.proxy.Logger;
-import org.eclipse.jst.j2ee.internal.plugin.J2EEPlugin;
-
-/**
- * This singleton keeps an internal record of project dependencies. That is, every IProject can
- * depend on, and be depended on by, other IProjects. Ditto IJavaProject. This class is updated when
- * a project(s) classpath changes.
- */
-public final class DependencyUtil {
- private static final IProject[] EMPTY_PROJECTS = new IProject[0];
- private static final IJavaProject[] EMPTY_JAVAPROJECTS = new IJavaProject[0];
-
- private static Set _tempSet = null;
-
- /**
- * This is a set for temporary calculations.
- */
- private static Set getTempSet() {
- if (_tempSet == null) {
- _tempSet = new HashSet();
- } else {
- _tempSet.clear();
- }
- return _tempSet;
- }
-
- /**
- * Return an array of open IProjects which depend on the given IProject parameter.
- */
- public static IProject[] getDependentProjects(IProject project) {
- if (project == null) {
- return EMPTY_PROJECTS;
- }
-
- IProject[] allProjects = project.getWorkspace().getRoot().getProjects();
- Set tempSet = getTempSet();
- for (int i = 0; i < allProjects.length; i++) {
- IProject p = allProjects[i];
- IProject[] requires = getRequiredProjects(p);
- for (int j = 0; j < requires.length; j++) {
- IProject r = requires[j];
- if (project.equals(r)) {
- tempSet.add(p);
- break;
- }
- }
- }
- IProject[] dependency = new IProject[tempSet.size()];
- tempSet.toArray(dependency);
- return dependency;
- }
-
- /**
- * Return an array of open IProjects which the given IProject parameter depends on.
- */
- public static IProject[] getRequiredProjects(IProject project) {
- if (project == null) {
- return EMPTY_PROJECTS;
- }
-
- // Check that each project in this list exists and is open
- try {
- IProject[] refProjects = project.getReferencedProjects();
- if ((refProjects == null) || (refProjects.length == 0)) {
- return EMPTY_PROJECTS;
- }
-
- IProject[] temp = new IProject[refProjects.length];
- int count = 0;
- for (int i = 0; i < refProjects.length; i++) {
- IProject rProject = refProjects[i];
- if (rProject.exists() && rProject.isOpen()) {
- temp[count++] = rProject;
- }
- }
-
- if (count == 0) {
- return EMPTY_PROJECTS;
- }
-
- if (count == temp.length) {
- return temp;
- }
-
- IProject[] result = new IProject[count];
- System.arraycopy(temp, 0, result, 0, count);
- return result;
- } catch (CoreException exc) {
- Logger logger = J2EEPlugin.getDefault().getMsgLogger();
- if (logger.isLoggingLevel(Level.SEVERE)) {
- LogEntry entry = J2EEPlugin.getLogEntry();
- entry.setSourceID("DependencyCache::getRequiredProjects(" + project.getName() + ")"); //$NON-NLS-1$ //$NON-NLS-2$
- entry.setTargetException(exc);
- logger.write(Level.SEVERE, exc);
- }
-
- return EMPTY_PROJECTS;
- }
- }
-
- /**
- * Return an array of open IJavaProjects which depend on the given IJavaProject parameter.
- */
- public static IJavaProject[] getDependentJavaProjects(IJavaProject javaproject) {
- if (javaproject == null) {
- return EMPTY_JAVAPROJECTS;
- }
-
- // calculate the dependencies now.
- try {
- IJavaProject[] allProjects = javaproject.getJavaModel().getJavaProjects();
- Set tempSet = getTempSet();
- for (int i = 0; i < allProjects.length; i++) {
- IJavaProject p = allProjects[i];
- IJavaProject[] requires = getRequiredJavaProjects(p);
- for (int j = 0; j < requires.length; j++) {
- IJavaProject r = requires[j];
- if (javaproject.equals(r)) {
- tempSet.add(p);
- break;
- }
- }
- }
- IJavaProject[] dependency = new IJavaProject[tempSet.size()];
- tempSet.toArray(dependency);
- return dependency;
- } catch (JavaModelException exc) {
- Logger logger = J2EEPlugin.getDefault().getMsgLogger();
- if (logger.isLoggingLevel(Level.SEVERE)) {
- LogEntry entry = J2EEPlugin.getLogEntry();
- entry.setSourceID("DependencyCache::getDependentJavaProjects(" + javaproject.getProject().getName() + ")"); //$NON-NLS-1$ //$NON-NLS-2$
- entry.setTargetException(exc);
- logger.write(Level.SEVERE, exc);
- }
-
- return EMPTY_JAVAPROJECTS;
- }
- }
-
- /**
- * Return an array of open IJavaProjects which the given IJavaProject parameter depends on.
- */
- public static IJavaProject[] getRequiredJavaProjects(IJavaProject javaproject) {
- if (javaproject == null) {
- return EMPTY_JAVAPROJECTS;
- }
-
- try {
- IJavaModel jm = javaproject.getJavaModel();
- if (jm == null) {
- Logger logger = J2EEPlugin.getDefault().getMsgLogger();
- if (logger.isLoggingLevel(Level.SEVERE)) {
- LogEntry entry = J2EEPlugin.getLogEntry();
- entry.setSourceID("DependencyCache::getRequiredJavaProjects(" + javaproject.getProject().getName() + ")"); //$NON-NLS-1$ //$NON-NLS-2$
- //entry.setText("IJavaModel == null"); //$NON-NLS-1$
- logger.write(Level.SEVERE, "IJavaModel == null"); //$NON-NLS-1$
- }
- return EMPTY_JAVAPROJECTS;
- }
-
- String[] requiredProjects = javaproject.getRequiredProjectNames();
- if ((requiredProjects == null) || (requiredProjects.length == 0)) {
- return EMPTY_JAVAPROJECTS;
- }
-
- IJavaProject[] temp = new IJavaProject[requiredProjects.length];
- int count = 0;
- for (int i = 0; i < requiredProjects.length; i++) {
- String projectName = requiredProjects[i];
- IJavaProject jp = jm.getJavaProject(projectName);
- try {
- if ((jp == null) || (!jp.getProject().exists())) {
- continue;
- }
- if (!jp.getProject().isAccessible()) {
- continue;
- }
-
- if (!jp.getProject().hasNature(JavaCore.NATURE_ID)) {
- continue;
- }
-
- temp[count++] = jp;
- } catch (CoreException exc) {
- Logger logger = J2EEPlugin.getDefault().getMsgLogger();
- if (logger.isLoggingLevel(Level.SEVERE)) {
- LogEntry entry = J2EEPlugin.getLogEntry();
- entry.setSourceID("DependencyCache::getRequiredJavaProjects(" + javaproject.getProject().getName() + ")"); //$NON-NLS-1$ //$NON-NLS-2$
- entry.setTargetException(exc);
- logger.write(Level.SEVERE, exc);
- }
- continue;
- }
- }
-
- if (count == 0) {
- return EMPTY_JAVAPROJECTS;
- }
-
- if (count == temp.length) {
- return temp;
- }
-
- IJavaProject[] result = new IJavaProject[count];
- System.arraycopy(temp, 0, result, 0, count);
- return result;
- } catch (JavaModelException exc) {
- Logger logger = J2EEPlugin.getDefault().getMsgLogger();
- if (logger.isLoggingLevel(Level.SEVERE)) {
- LogEntry entry = J2EEPlugin.getLogEntry();
- entry.setSourceID("DependencyCache::getRequiredJavaProjects(" + javaproject.getProject().getName() + ")"); //$NON-NLS-1$ //$NON-NLS-2$
- entry.setTargetException(exc);
- logger.write(Level.SEVERE, exc);
- }
-
- return EMPTY_JAVAPROJECTS;
- }
- }
-}
diff --git a/plugins/org.eclipse.jst.j2ee/j2eeplugin/org/eclipse/jst/j2ee/internal/validation/EarHelper.java b/plugins/org.eclipse.jst.j2ee/j2eeplugin/org/eclipse/jst/j2ee/internal/validation/EarHelper.java
deleted file mode 100644
index 426f84fc4..000000000
--- a/plugins/org.eclipse.jst.j2ee/j2eeplugin/org/eclipse/jst/j2ee/internal/validation/EarHelper.java
+++ /dev/null
@@ -1,112 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are 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:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jst.j2ee.internal.validation;
-
-
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.jem.util.logger.proxy.Logger;
-import org.eclipse.jst.j2ee.application.internal.impl.ApplicationImpl;
-import org.eclipse.jst.j2ee.commonarchivecore.internal.Archive;
-import org.eclipse.jst.j2ee.commonarchivecore.internal.EARFile;
-import org.eclipse.jst.j2ee.commonarchivecore.internal.exception.OpenFailureException;
-import org.eclipse.jst.j2ee.componentcore.EnterpriseArtifactEdit;
-import org.eclipse.jst.j2ee.internal.J2EEConstants;
-import org.eclipse.wst.common.componentcore.ArtifactEdit;
-import org.eclipse.wst.common.componentcore.ComponentCore;
-import org.eclipse.wst.common.componentcore.internal.util.ComponentUtilities;
-import org.eclipse.wst.common.componentcore.resources.IVirtualComponent;
-import org.eclipse.wst.validation.internal.operations.WorkbenchReporter;
-
-
-public class EarHelper extends J2EEValidationHelper {
-
- protected EARFile earFile;
- protected ArtifactEdit edit = null;
-
-
- /**
- * WarHelper constructor comment.
- */
- public EarHelper() {
- super();
-
- registerModel(J2EEConstants.EAR_MODEL_NAME, "loadEarFile"); //$NON-NLS-1$
- }
-
- public String getApplicationXMLFile() {
-
- return J2EEConstants.APPL_ID;
- }
-
- /**
- * Given a resource, return its non-eclipse-specific location. If this resource, or type of
- * resource, isn't handled by this helper, return null.
- */
- public String getPortableName(IResource resource) {
- if (!(resource instanceof IFile)) {
- return null;
- }
-
- return "application.xml"; //$NON-NLS-1$
- }
-
- public String getTargetObjectName(Object obj) {
- super.getTargetObjectName(obj);
-
- if (obj != null && obj instanceof EARFile) {
- return getApplicationXMLFile();
- }
- if (obj != null && obj instanceof ApplicationImpl) {
- return "application.xml"; //$NON-NLS-1$
- }
- return null;
- }
-
- /**
- * Get the WAR file for validation
- */
-
- public EObject loadEarFile() {
-
- IVirtualComponent comp = ComponentCore.createComponent(getProject());
- edit = ComponentUtilities.getArtifactEditForRead(comp);
-
- try {
- Archive archive = ((EnterpriseArtifactEdit) edit).asArchive(false, false);
- earFile = (EARFile)archive;
- return archive;
- } catch (OpenFailureException e1) {
- Logger.getLogger().log(e1);
- }
- return null;
- }
-
- public void closeEARFile() {
- if (earFile != null) {
- earFile.close();
- earFile = null;
- }
- }
-
- public void cleanup(WorkbenchReporter reporter) {
- if (edit != null) {
- edit.dispose();
- edit = null;
- }
- if (earFile != null) {
- earFile.close();
- earFile = null;
- }
- }
-}
diff --git a/plugins/org.eclipse.jst.j2ee/j2eeplugin/org/eclipse/jst/j2ee/internal/validation/J2EEValidationHelper.java b/plugins/org.eclipse.jst.j2ee/j2eeplugin/org/eclipse/jst/j2ee/internal/validation/J2EEValidationHelper.java
deleted file mode 100644
index b103ec71a..000000000
--- a/plugins/org.eclipse.jst.j2ee/j2eeplugin/org/eclipse/jst/j2ee/internal/validation/J2EEValidationHelper.java
+++ /dev/null
@@ -1,108 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are 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:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jst.j2ee.internal.validation;
-
-
-import org.eclipse.core.resources.IContainer;
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.ecore.resource.Resource;
-import org.eclipse.wst.common.internal.emfworkbench.WorkbenchResourceHelper;
-import org.eclipse.wst.validation.internal.operations.WorkbenchContext;
-
-
-public abstract class J2EEValidationHelper extends WorkbenchContext {
-
- /**
- * Constructor for J2EEValidationHelper.
- */
- public J2EEValidationHelper() {
- super();
- }
-
- /*
- * @see IWorkbenchContext#getFile(Object)
- */
- public IResource getResource(Object object) {
- Resource resource = null;
- if (object != null && object instanceof EObject)
- resource = ((EObject) object).eResource();
- if (resource != null)
- return WorkbenchResourceHelper.getFile(resource);
- return null;
- }
-
- /**
- * Given a resource, return its non-eclipse-specific location. If this resource, or type of
- * resource, isn't handled by this helper, return null.
- */
- protected String getFileName(IFile file, IContainer[] containers) {
- if ((file == null) || (containers == null)) {
- return null;
- }
-
- for (int c = 0; c < containers.length; c++) {
- IPath resourcePath = getContainerRelativePath(file, containers[c]);
- if (resourcePath != null) {
- // file has been found
- return resourcePath.toString();
- }
- }
-
- return null;
- }
-
- /**
- * Given a file name, return its corresponding IFile, if one exists. This method checks if the
- * IContainer passed in contains a file with the given file name. If the container does not have
- * the IFile, null is returned.
- */
- protected IFile getFile(String fileName, IContainer[] containers) {
- IFile clazzFile = null;
- if ((fileName == null) || (containers == null)) {
- return null;
- }
-
- for (int c = 0; c < containers.length; c++) {
- IContainer container = containers[c];
- IPath filePath = container.getProjectRelativePath();
- clazzFile = getProject().getFile(filePath.append(fileName));
-
- if (clazzFile.exists()) {
- return clazzFile;
- }
- }
-
- return null;
- }
-
-// protected IFile getXmlFile(String xmlFileName, J2EENature nature) {
-// if (nature == null) {
-// return null;
-// }
-// return nature.getMetaFolder().getFile(xmlFileName);
-// }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.wst.validation.internal.operations.IWorkbenchContext#getTargetObjectName(java.lang.Object)
- */
- public String getTargetObjectName(Object object) {
- if (object != null)
- return object.toString();
- return null;
- }
-
-
-}
diff --git a/plugins/org.eclipse.jst.j2ee/j2eeplugin/org/eclipse/jst/j2ee/internal/validation/ManifestLineValidator.java b/plugins/org.eclipse.jst.j2ee/j2eeplugin/org/eclipse/jst/j2ee/internal/validation/ManifestLineValidator.java
deleted file mode 100644
index d8ac09f89..000000000
--- a/plugins/org.eclipse.jst.j2ee/j2eeplugin/org/eclipse/jst/j2ee/internal/validation/ManifestLineValidator.java
+++ /dev/null
@@ -1,105 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are 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:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jst.j2ee.internal.validation;
-
-
-import java.io.BufferedInputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.util.ArrayList;
-import java.util.List;
-
-public class ManifestLineValidator extends Object {
- public static final int MAX_LINE_LENGTH = 72;
- protected int lineNumber;
- protected int currentByte;
- protected int byteCount;
- protected InputStream inputStream;
- protected List lineNumbers;
- protected boolean endsWithLineBreak = true;
-
- /**
- * Constructor for LineValidator.
- */
- public ManifestLineValidator(InputStream in) {
- super();
- inputStream = new BufferedInputStream(in);
- lineNumber = 0;
- }
-
- protected List getLineNumbers() {
- if (lineNumbers == null)
- lineNumbers = new ArrayList();
- return lineNumbers;
- }
-
- public int[] getLineNumbersExceedingLimit() {
- if (lineNumbers == null)
- return new int[0];
-
- int[] result = new int[lineNumbers.size()];
- for (int i = 0; i < lineNumbers.size(); i++) {
- Integer list_element = (Integer) lineNumbers.get(i);
- result[i] = list_element.intValue();
- }
- return result;
- }
-
- public void validate() throws IOException {
- readNext();
- while (currentByte != -1) {
- validateNextLine();
- }
- }
-
- public int getLineCount() {
- return lineNumber;
- }
-
- protected void readNext() throws IOException {
- currentByte = inputStream.read();
- }
-
- protected void validateNextLine() throws IOException {
- lineNumber++;
- byteCount = 0;
- boolean eolReached = false;
- while (currentByte != -1) {
- if (currentByte == '\r') {
- eolReached = true;
- readNext();
- if (currentByte == '\n') {
- readNext();
- }
- break;
- } else if (currentByte == '\n') {
- eolReached = true;
- readNext();
- break;
- } else {
- byteCount++;
- readNext();
- }
- }
- if (currentByte == -1 && !eolReached && byteCount > 0)
- endsWithLineBreak = false;
- if (byteCount > 72)
- getLineNumbers().add(new Integer(lineNumber));
- }
-
- public boolean endsWithLineBreak() {
- return endsWithLineBreak;
- }
-
- public boolean hasErrors() {
- return !endsWithLineBreak || (lineNumbers != null && !lineNumbers.isEmpty());
- }
-}
diff --git a/plugins/org.eclipse.jst.j2ee/j2eeplugin/org/eclipse/jst/j2ee/internal/validation/ProjectValidationHelper.java b/plugins/org.eclipse.jst.j2ee/j2eeplugin/org/eclipse/jst/j2ee/internal/validation/ProjectValidationHelper.java
deleted file mode 100644
index 4e5090fb2..000000000
--- a/plugins/org.eclipse.jst.j2ee/j2eeplugin/org/eclipse/jst/j2ee/internal/validation/ProjectValidationHelper.java
+++ /dev/null
@@ -1,86 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are 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:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jst.j2ee.internal.validation;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.core.resources.IContainer;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.jdt.core.IPackageFragmentRoot;
-import org.eclipse.jem.workbench.utility.JemProjectUtilities;
-import org.eclipse.jst.j2ee.internal.project.J2EEProjectUtilities;
-import org.eclipse.wst.common.componentcore.ComponentCore;
-import org.eclipse.wst.common.componentcore.resources.IVirtualComponent;
-import org.eclipse.wst.validation.internal.IProjectValidationHelper;
-
-public class ProjectValidationHelper implements IProjectValidationHelper {
-
- private static IContainer[] EMPTY_RESULT = new IContainer[] {};
- private static ProjectValidationHelper INSTANCE;
- private IContainer[] outputs;
- private IContainer[] sources;
-
- public static ProjectValidationHelper getInstance(){
- if (INSTANCE == null)
- INSTANCE = new ProjectValidationHelper();
- return INSTANCE;
- }
- public void disposeInstance(){
- INSTANCE = null;
- }
- private IContainer[] getCachedOutputContainers(IProject project) {
- if (outputs != null)
- return outputs;
- if (project == null || JemProjectUtilities.getJavaProject(project)==null) {
- outputs = EMPTY_RESULT;
- return EMPTY_RESULT;
- }
- IVirtualComponent comp = ComponentCore.createComponent(project);
- if (comp == null || !comp.exists()) {
- outputs = EMPTY_RESULT;
- return EMPTY_RESULT;
- }
- outputs = J2EEProjectUtilities.getOutputContainers(project);
- return outputs;
-
- }
- public IContainer[] getOutputContainers(IProject project) {
- return getInstance().getCachedOutputContainers(project);
- }
-
- private IContainer[] getCachedSourceContainers(IProject project) {
- if (sources != null)
- return sources;
- if (project == null || JemProjectUtilities.getJavaProject(project)==null) {
- sources = EMPTY_RESULT;
- return EMPTY_RESULT;
- }
- IVirtualComponent comp = ComponentCore.createComponent(project);
- if (comp == null || !comp.exists()) {
- sources = EMPTY_RESULT;
- return EMPTY_RESULT;
- }
- IPackageFragmentRoot[] roots = J2EEProjectUtilities.getSourceContainers(project);
- List result = new ArrayList();
- for (int i=0; i<roots.length; i++) {
- if (roots[i].getResource() != null && roots[i].getResource() instanceof IContainer)
- result.add(roots[i].getResource());
- }
- sources = (IContainer[]) result.toArray(new IContainer[result.size()]);
- return sources;
-
- }
- public IContainer[] getSourceContainers(IProject project) {
- return getInstance().getCachedSourceContainers(project);
- }
-
-}
diff --git a/plugins/org.eclipse.jst.j2ee/j2eeplugin/org/eclipse/jst/j2ee/internal/validation/ResourceUtil.java b/plugins/org.eclipse.jst.j2ee/j2eeplugin/org/eclipse/jst/j2ee/internal/validation/ResourceUtil.java
deleted file mode 100644
index da19e566d..000000000
--- a/plugins/org.eclipse.jst.j2ee/j2eeplugin/org/eclipse/jst/j2ee/internal/validation/ResourceUtil.java
+++ /dev/null
@@ -1,61 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are 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:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jst.j2ee.internal.validation;
-
-
-import java.util.Collection;
-import java.util.Iterator;
-
-import org.eclipse.emf.common.notify.Adapter;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.jem.internal.adapters.jdom.JDOMAdaptor;
-import org.eclipse.jem.internal.java.adapters.ReadAdaptor;
-import org.eclipse.wst.validation.internal.operations.IResourceUtil;
-import org.eclipse.wst.validation.internal.provisional.core.IMessage;
-
-
-public class ResourceUtil implements IResourceUtil {
- public ResourceUtil() {
- super();
- }
-
- public int getLineNo(Object object) {
- if (object == null) {
- return IMessage.LINENO_UNSET;
- }
-
- if (object instanceof EObject) { // Error discovered using MOF objects
-
- EObject ro = (EObject) object;
- JDOMAdaptor jdomAdapter = null;
-
- Collection c = ro.eAdapters();
- if (c != null) {
- Iterator iterator = c.iterator();
- while (iterator.hasNext()) {
- Adapter a = (Adapter) iterator.next();
- if ((a != null) && a.isAdapterForType(ReadAdaptor.TYPE_KEY) && (a instanceof JDOMAdaptor)) {
- jdomAdapter = (JDOMAdaptor) a;
- }
- }
- }
-
- if (jdomAdapter != null) {
- int lineNo = jdomAdapter.getLineNo();
- if (lineNo != JDOMAdaptor.INVALID_LINENO)
- return lineNo + 1;
- }
-
- }
-
- return IMessage.LINENO_UNSET;
- }
-}
diff --git a/plugins/org.eclipse.jst.j2ee/j2eeplugin/org/eclipse/jst/j2ee/internal/validation/UIApplicationClientHelper.java b/plugins/org.eclipse.jst.j2ee/j2eeplugin/org/eclipse/jst/j2ee/internal/validation/UIApplicationClientHelper.java
deleted file mode 100644
index cb352c1fe..000000000
--- a/plugins/org.eclipse.jst.j2ee/j2eeplugin/org/eclipse/jst/j2ee/internal/validation/UIApplicationClientHelper.java
+++ /dev/null
@@ -1,27 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are 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:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jst.j2ee.internal.validation;
-
-
-
-/**
- * Creates the helper for the WSAD application client validator.
- */
-public class UIApplicationClientHelper extends ApplicationClientHelper {
-
- /**
- * UIApplicationClientHelper
- */
- public UIApplicationClientHelper() {
- super();
- }// UIApplicationClientHelper
-
-}// UIApplicationClientHelper
diff --git a/plugins/org.eclipse.jst.j2ee/j2eeplugin/org/eclipse/jst/j2ee/internal/validation/UIApplicationClientMessageConstants.java b/plugins/org.eclipse.jst.j2ee/j2eeplugin/org/eclipse/jst/j2ee/internal/validation/UIApplicationClientMessageConstants.java
deleted file mode 100644
index 29bb967af..000000000
--- a/plugins/org.eclipse.jst.j2ee/j2eeplugin/org/eclipse/jst/j2ee/internal/validation/UIApplicationClientMessageConstants.java
+++ /dev/null
@@ -1,25 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are 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:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jst.j2ee.internal.validation;
-
-import org.eclipse.jst.j2ee.model.internal.validation.ApplicationClientMessageConstants;
-
-
-
-/**
- * Messages for the WSAD application client validator
- */
-public interface UIApplicationClientMessageConstants extends ApplicationClientMessageConstants {
-
- public static final String DOCTYPE_1_2 = "1.2"; //$NON-NLS-1$
- public static final String DOCTYPE_1_3 = "1.3"; //$NON-NLS-1$
- public static final String APPCLIENT_INVALID_DOC_TYPE_ERROR_ = "APPCLIENT_INVALID_DOC_TYPE_ERROR_"; //$NON-NLS-1$
-}// UIApplicationClientMessageConstants
diff --git a/plugins/org.eclipse.jst.j2ee/j2eeplugin/org/eclipse/jst/j2ee/internal/validation/UIApplicationClientValidator.java b/plugins/org.eclipse.jst.j2ee/j2eeplugin/org/eclipse/jst/j2ee/internal/validation/UIApplicationClientValidator.java
deleted file mode 100644
index 74ecc3469..000000000
--- a/plugins/org.eclipse.jst.j2ee/j2eeplugin/org/eclipse/jst/j2ee/internal/validation/UIApplicationClientValidator.java
+++ /dev/null
@@ -1,82 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are 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:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jst.j2ee.internal.validation;
-
-
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.jst.j2ee.internal.J2EEConstants;
-import org.eclipse.jst.j2ee.internal.project.J2EEProjectUtilities;
-import org.eclipse.jst.j2ee.model.internal.validation.ApplicationClientValidator;
-import org.eclipse.wst.common.componentcore.ComponentCore;
-import org.eclipse.wst.common.componentcore.resources.IVirtualComponent;
-import org.eclipse.wst.common.componentcore.resources.IVirtualFile;
-import org.eclipse.wst.validation.internal.core.ValidationException;
-import org.eclipse.wst.validation.internal.operations.IWorkbenchContext;
-import org.eclipse.wst.validation.internal.provisional.core.IReporter;
-import org.eclipse.wst.validation.internal.provisional.core.IValidationContext;
-
-
-/**
- * Creates the application client validator for WSAD
- */
-public class UIApplicationClientValidator extends ApplicationClientValidator implements UIApplicationClientMessageConstants {
-
-
- /**
- * Default constructor.
- */
- public UIApplicationClientValidator() {
- super();
- }// UIApplicationClientValidator
-
-
- /**
- * Does the validation.
- */
-
- public IStatus validateInJob(IValidationContext inHelper, IReporter inReporter)
- throws ValidationException {
- UIApplicationClientHelper helper = (UIApplicationClientHelper) inHelper;
- IProject proj = ((IWorkbenchContext) inHelper).getProject();
- IVirtualComponent virComp = ComponentCore.createComponent(proj);
- if(J2EEProjectUtilities.isApplicationClientProject(proj)) {
- IVirtualFile ddFile = virComp.getRootFolder().getFile(J2EEConstants.APP_CLIENT_DD_URI);
- if( ddFile.exists()) {
- status = super.validateInJob(helper, inReporter);
- }
- }
- //validateDocType(helper, editModel);
- return status;
- }
-
-
- /**
- * Checks if the nature is consistent with doc type.
- */
-// protected void validateDocType(UIApplicationClientHelper helper, AppClientEditModel editModel) {
-// if (editModel.getJ2EENature().getJ2EEVersion() >= J2EEVersionConstants.J2EE_1_3_ID && getAppClientDD().getVersionID() < J2EEVersionConstants.J2EE_1_3_ID) {
-// String[] params = new String[3];
-// params[0] = DOCTYPE_1_2;
-// params[1] = helper.getProject().getName();
-// params[2] = DOCTYPE_1_3;
-// addError(getBaseName(), APPCLIENT_INVALID_DOC_TYPE_ERROR_, params);
-// } else if (editModel.getJ2EENature().getJ2EEVersion() < J2EEVersionConstants.J2EE_1_3_ID && getAppClientDD().getVersionID() >= J2EEVersionConstants.J2EE_1_3_ID) {
-// String[] params = new String[3];
-// params[0] = DOCTYPE_1_3;
-// params[1] = helper.getProject().getName();
-// params[2] = DOCTYPE_1_2;
-// addError(getBaseName(), APPCLIENT_INVALID_DOC_TYPE_ERROR_, params);
-// }// if
-// }// validateDocTypeVsNature
-
-
-}
diff --git a/plugins/org.eclipse.jst.j2ee/j2eeplugin/org/eclipse/jst/j2ee/internal/validation/UIEarHelper.java b/plugins/org.eclipse.jst.j2ee/j2eeplugin/org/eclipse/jst/j2ee/internal/validation/UIEarHelper.java
deleted file mode 100644
index 623c8cb40..000000000
--- a/plugins/org.eclipse.jst.j2ee/j2eeplugin/org/eclipse/jst/j2ee/internal/validation/UIEarHelper.java
+++ /dev/null
@@ -1,27 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are 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:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jst.j2ee.internal.validation;
-
-
-
-/**
- * Insert the type's description here. Creation date: (9/10/2001 2:12:47 PM)
- *
- * @author: Administrator
- */
-public class UIEarHelper extends EarHelper {
- /**
- * UIEarHelper constructor comment.
- */
- public UIEarHelper() {
- super();
- }
-}
diff --git a/plugins/org.eclipse.jst.j2ee/j2eeplugin/org/eclipse/jst/j2ee/internal/validation/UIEarValidator.java b/plugins/org.eclipse.jst.j2ee/j2eeplugin/org/eclipse/jst/j2ee/internal/validation/UIEarValidator.java
deleted file mode 100644
index b3c1888b3..000000000
--- a/plugins/org.eclipse.jst.j2ee/j2eeplugin/org/eclipse/jst/j2ee/internal/validation/UIEarValidator.java
+++ /dev/null
@@ -1,755 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are 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:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jst.j2ee.internal.validation;
-
-
-
-import java.io.FileNotFoundException;
-import java.io.IOException;
-import java.io.InputStream;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-import org.eclipse.core.resources.IContainer;
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Path;
-import org.eclipse.core.runtime.jobs.ISchedulingRule;
-import org.eclipse.core.runtime.jobs.MultiRule;
-import org.eclipse.emf.common.command.Command;
-import org.eclipse.emf.common.util.EList;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.ecore.resource.Resource;
-import org.eclipse.emf.ecore.resource.URIConverter;
-import org.eclipse.jem.util.emf.workbench.WorkbenchURIConverter;
-import org.eclipse.jem.util.logger.proxy.Logger;
-import org.eclipse.jem.workbench.utility.JemProjectUtilities;
-import org.eclipse.jst.j2ee.application.EjbModule;
-import org.eclipse.jst.j2ee.application.Module;
-import org.eclipse.jst.j2ee.application.WebModule;
-import org.eclipse.jst.j2ee.classpathdep.ClasspathDependencyUtil;
-import org.eclipse.jst.j2ee.classpathdep.IClasspathDependencyConstants;
-import org.eclipse.jst.j2ee.common.EjbRef;
-import org.eclipse.jst.j2ee.common.MessageDestinationRef;
-import org.eclipse.jst.j2ee.common.ResourceEnvRef;
-import org.eclipse.jst.j2ee.common.ResourceRef;
-import org.eclipse.jst.j2ee.common.SecurityRoleRef;
-import org.eclipse.jst.j2ee.commonarchivecore.internal.Archive;
-import org.eclipse.jst.j2ee.commonarchivecore.internal.File;
-import org.eclipse.jst.j2ee.commonarchivecore.internal.ModuleFile;
-import org.eclipse.jst.j2ee.commonarchivecore.internal.ValidateXmlCommand;
-import org.eclipse.jst.j2ee.commonarchivecore.internal.exception.ManifestException;
-import org.eclipse.jst.j2ee.commonarchivecore.internal.helpers.ArchiveConstants;
-import org.eclipse.jst.j2ee.commonarchivecore.internal.helpers.ArchiveManifest;
-import org.eclipse.jst.j2ee.commonarchivecore.internal.util.ArchiveUtil;
-import org.eclipse.jst.j2ee.componentcore.EnterpriseArtifactEdit;
-import org.eclipse.jst.j2ee.componentcore.J2EEModuleVirtualComponent;
-import org.eclipse.jst.j2ee.componentcore.util.EARArtifactEdit;
-import org.eclipse.jst.j2ee.internal.J2EEConstants;
-import org.eclipse.jst.j2ee.internal.J2EEVersionConstants;
-import org.eclipse.jst.j2ee.internal.project.J2EEProjectUtilities;
-import org.eclipse.jst.j2ee.model.internal.validation.EARValidationMessageResourceHandler;
-import org.eclipse.jst.j2ee.model.internal.validation.EarValidator;
-import org.eclipse.jst.j2ee.webservice.wsclient.ServiceRef;
-import org.eclipse.osgi.util.NLS;
-import org.eclipse.wst.common.componentcore.ComponentCore;
-import org.eclipse.wst.common.componentcore.internal.impl.ModuleURIUtil;
-import org.eclipse.wst.common.componentcore.internal.util.IModuleConstants;
-import org.eclipse.wst.common.componentcore.resources.IVirtualComponent;
-import org.eclipse.wst.common.componentcore.resources.IVirtualFile;
-import org.eclipse.wst.common.componentcore.resources.IVirtualReference;
-import org.eclipse.wst.common.internal.emfworkbench.WorkbenchResourceHelper;
-import org.eclipse.wst.validation.internal.core.ValidationException;
-import org.eclipse.wst.validation.internal.operations.IWorkbenchContext;
-import org.eclipse.wst.validation.internal.operations.LocalizedMessage;
-import org.eclipse.wst.validation.internal.provisional.core.IMessage;
-import org.eclipse.wst.validation.internal.provisional.core.IReporter;
-import org.eclipse.wst.validation.internal.provisional.core.IValidationContext;
-import org.eclipse.wst.validation.internal.provisional.core.IValidatorJob;
-
-
-/**
- * Insert the type's description here. Creation date: (9/10/2001 2:11:02 PM)
- *
- * @author: Administrator
- */
-public class UIEarValidator extends EarValidator {
- public static final String VALIDATOR_ID = "org.eclipse.jst.j2ee.internal.validation.UIEarValidator"; //$NON-NLS-1$
- public static final String MANIFEST_GROUP_NAME = "WSAD.EAR.MANIFEST"; //$NON-NLS-1$
- public static final String DOCTYPE_1_2 = "1.2"; //$NON-NLS-1$
- public static final String DOCTYPE_1_3 = "1.3"; //$NON-NLS-1$
-
- protected UIEarHelper earHelper;
-// private EARArtifactEdit earEdit = null;
- private IProject project = null;
-
- /**
- * UIEarValidator constructor comment.
- */
- public UIEarValidator() {
- super();
- }
-
- public Command createValidateXMLCommand() {
-
- ValidateXmlCommand cmd = (ValidateXmlCommand) super.createValidateXMLCommand();
- cmd.setValidateNested(false);
- return cmd;
- }
-
- protected String getResourceName() {
- return ((EarHelper) _helper).getProject().getName();
- }
-
- protected void duplicateProjectMapError(String earProjectName, String moduleUri, String projectName) {
-
- String[] params = new String[3];
- params[0] = projectName;
- params[1] = earProjectName;
- params[2] = moduleUri;
- String msg = NLS.bind(EARValidationMessageResourceHandler.DUPLICATE_MODULE_FOR_PROJECT_NAME_ERROR_, params);
-
- addLocalizedError(msg, appDD);
- }
-
- /**
- *
- */
- protected void cleanUpSubTaskMessages(EObject ref) {
- String groupName = EJB_REF_GROUP_NAME;
- if (ref instanceof EjbRef)
- {
-// ref = (EjbRef) ref;
- }
- else if (ref instanceof ResourceRef) {
-// ref = (ResourceRef) ref;
- groupName = RES_REF_GROUP_NAME;
- } else if (ref instanceof ServiceRef) {
-// ref = (ServiceRef) ref;
- groupName = SERVICE_REF_GROUP_NAME;
- } else if (ref instanceof ResourceEnvRef) {
-// ref = (ResourceEnvRef) ref;
- groupName = RES_ENV_REF_GROUP_NAME;
- } else if (ref instanceof SecurityRoleRef) {
-// ref = (SecurityRoleRef) ref;
- groupName = SEC_ROLE_REF_GROUP_NAME;
- } else if (ref instanceof MessageDestinationRef) {
-// ref = (MessageDestinationRef) ref;
- groupName = MESSAGE_REF_GROUP_NAME;
- }
- Resource res = ref.eResource();
- if (res != null) {
- IFile file = WorkbenchResourceHelper.getFile(res);
- if (file != null)
- _reporter.removeMessageSubset(this, file, groupName);
- }
- }
-
- protected void cleanUpAllRefSubTaskMessages(Resource res) {
- if (res != null) {
- IFile file = WorkbenchResourceHelper.getFile(res);
- if (file != null)
- _reporter.removeMessageSubset(this, file, EJB_REF_GROUP_NAME);
- _reporter.removeMessageSubset(this, file, RES_REF_GROUP_NAME);
- _reporter.removeMessageSubset(this, file, SERVICE_REF_GROUP_NAME);
- _reporter.removeMessageSubset(this, file, SEC_ROLE_REF_GROUP_NAME);
- _reporter.removeMessageSubset(this, file, MESSAGE_REF_GROUP_NAME);
- _reporter.removeMessageSubset(this, file, RES_ENV_REF_GROUP_NAME);
- }
- }
-
- /**
- * Insert the method's description here. Creation date: (9/10/2001 2:56:32 PM)
- *
- * @return org.eclipse.wst.validation.internal.core.core.ear.workbenchimpl.UIEarHelper
- */
- public org.eclipse.jst.j2ee.internal.validation.UIEarHelper getEarHelper() {
- return earHelper;
- }
-
- protected void invalidClassPathEntryWarning(String entry, Archive anArchive) {
- String[] params = new String[2];
- params[0] = anArchive.getURI();
- params[1] = entry;
- String msg = NLS.bind(EARValidationMessageResourceHandler.INVALID_MANIFEST_CLASSPATH_ONE_WARN_, params);
- addLocalizedWarning(msg, getManifestFile(anArchive), MANIFEST_GROUP_NAME);
- }
-
- protected void invalidClassPathEntryWarning(String entry, String resolvedEntry, Archive anArchive) {
- String[] params = new String[3];
- params[0] = anArchive.getURI();
- params[1] = entry;
- params[2] = resolvedEntry;
- String msg = NLS.bind(EARValidationMessageResourceHandler.INVALID_MANIFEST_CLASSPATH_TWO_WARN_, params);
- addLocalizedWarning(msg, getManifestFile(anArchive), MANIFEST_GROUP_NAME);
- }
-
- protected void invalidDepedencyWarning(String entry, Archive anArchive, ModuleFile m) {
- String[] params = new String[3];
- params[0] = m.getURI();
- params[1] = entry;
- params[2] = anArchive.getURI();
- String msg = NLS.bind(EARValidationMessageResourceHandler.INVALID_MANIFEST_CLASSPATH_DEPENDENCY_WARN_, params);
-
- addLocalizedWarning(msg, getManifestFile(anArchive), MANIFEST_GROUP_NAME);
- }
-
- /**
- * Insert the method's description here. Creation date: (9/10/2001 2:56:32 PM)
- *
- * @param newEarHelper
- * org.eclipse.wst.validation.internal.core.core.ear.workbenchimpl.UIEarHelper
- */
- public void setEarHelper(org.eclipse.jst.j2ee.internal.validation.UIEarHelper newEarHelper) {
- earHelper = newEarHelper;
- }
-
- public IStatus validateInJob(IValidationContext inHelper, IReporter inReporter) throws org.eclipse.wst.validation.internal.core.ValidationException {
- IStatus status = IValidatorJob.OK_STATUS;
- IProject proj = ((IWorkbenchContext) inHelper).getProject();
- IVirtualComponent earModule = ComponentCore.createComponent(proj);
- if(J2EEProjectUtilities.isEARProject(proj)){
- IVirtualFile ddFile = earModule.getRootFolder().getFile(J2EEConstants.APPLICATION_DD_URI);
- if( ddFile.exists()) {
- status = super.validateInJob(inHelper, inReporter);
- validateModuleMaps(earModule);
- validateManifests();
- validateDuplicateClasspathComponentURIs(earModule);
- // validateUtilJarMaps(earEdit,earModule);
- // validateUriAlreadyExistsInEar(earEdit,earModule);
- // validateDocType(earEdit,earModule);
- }
- }
- return status;
- }
-
- public ISchedulingRule getSchedulingRule(IValidationContext helper) {
- ISchedulingRule combinedRule = null;
- IProject project = ((IWorkbenchContext) helper).getProject();
- IVirtualComponent comp = ComponentCore.createComponent( project );
- IFile appDeploymentDescriptor = null;
- if( comp != null ){
- IVirtualFile vf = comp.getRootFolder().getFile(new Path(J2EEConstants.APPLICATION_DD_URI));
- if( vf!= null ){
- appDeploymentDescriptor = vf.getUnderlyingFile();
- combinedRule = MultiRule.combine(appDeploymentDescriptor, combinedRule);
- }
- IVirtualReference[] refs = comp.getReferences();
- for( int i=0; i< refs.length; i++ ){
- IVirtualComponent refComp = refs[i].getReferencedComponent();
- if( refComp != null && !refComp.isBinary() ){
- String type = J2EEProjectUtilities.getJ2EEComponentType( refComp );
- IVirtualFile refDDFile = null;
- if( type.equals(IModuleConstants.JST_WEB_MODULE)){
- refDDFile = refComp.getRootFolder().getFile(new Path(J2EEConstants.WEBAPP_DD_URI));
- }else if ( type.equals(IModuleConstants.JST_CONNECTOR_MODULE)){
- refDDFile = refComp.getRootFolder().getFile(new Path(J2EEConstants.RAR_DD_URI));
- }else if( type.equals(IModuleConstants.JST_EJB_MODULE)){
- refDDFile = refComp.getRootFolder().getFile(new Path(J2EEConstants.EJBJAR_DD_URI));
- }else if( type.equals(IModuleConstants.JST_APPCLIENT_MODULE)){
- refDDFile = refComp.getRootFolder().getFile(new Path(J2EEConstants.APPLICATION_DD_URI));
- }
- if( refDDFile!= null ){
- IFile dd = refDDFile.getUnderlyingFile();
- combinedRule = MultiRule.combine(dd, combinedRule);
- }
- }
- }
-
- }
- return combinedRule;
- }
-
- public void validateDuplicateClasspathComponentURIs(final IVirtualComponent earComponent) {
- if (earFile == null) {
- return;
- }
- final Set moduleURIs = new HashSet();
- final List archives = earFile.getArchiveFiles();
- for (int i = 0; i < archives.size(); i++) {
- final Archive anArchive = (Archive) archives.get(i);
- moduleURIs.add(anArchive.getURI());
- }
-
- final Map archiveToPath = new HashMap();
- final IVirtualReference[] components = earComponent.getReferences();
- for (int i = 0; i < components.length; i++) {
- IVirtualReference reference = components[i];
- IVirtualComponent referencedComponent = reference.getReferencedComponent();
-
- // retrieve all Java classpath component dependencies
- if (referencedComponent instanceof J2EEModuleVirtualComponent) {
- final IVirtualReference[] cpRefs = ((J2EEModuleVirtualComponent) referencedComponent).getJavaClasspathReferences();
- for (int j = 0; j < cpRefs.length; j++) {
- final IVirtualReference ref = cpRefs[j];
- // only ../ runtime paths contribute to the EAR
- if (ref.getRuntimePath().equals(IClasspathDependencyConstants.RUNTIME_MAPPING_INTO_CONTAINER_PATH)) {
- String archiveName = ref.getArchiveName();
- String[] params = {referencedComponent.getProject().getName(), archiveName};
- if (moduleURIs.contains(archiveName)) {
- String msg = NLS.bind(EARValidationMessageResourceHandler.CLASSPATH_COMPONENT_URI_MATCHES_ARCHIVE_URI, params);
- addLocalizedError(msg, project);
- } else {
- IPath cpEntryPath= ClasspathDependencyUtil.getClasspathVirtualReferenceLocation(ref);
- if (cpEntryPath != null) {
- IPath existingPath = (IPath) archiveToPath.get(archiveName);
- if (existingPath != null && !existingPath.equals(cpEntryPath)) {
- String msg = NLS.bind(EARValidationMessageResourceHandler.DUPLICATE_CLASSPATH_COMPONENT_URI, params);
- addLocalizedError(msg, project);
- } else {
- archiveToPath.put(archiveName, cpEntryPath);
- }
- }
- }
- }
- }
- }
- }
- }
-
- public void validateManifests() throws ValidationException {
- if (earFile == null)
- return;
- List archives = earFile.getArchiveFiles();
- for (int i = 0; i < archives.size(); i++) {
-
- final Archive anArchive = (Archive) archives.get(i);
- IFile target = getManifestFile(anArchive);
- if (target != null)
- _reporter.removeMessageSubset(this, target, MANIFEST_GROUP_NAME);
- validateManifestCase(anArchive);
- validateManifestLines(anArchive);
- validateManifestClasspath(anArchive);
- }
- }
-
- public void validateManifestCase(Archive anArchive) {
- String mfuri = J2EEConstants.MANIFEST_URI;
-
- //Indicates a manifest file with the valid name exists,
- //nothing left to do
- if (anArchive.containsFile(mfuri))
- return;
-
- //Otherwise iterate the list of files
- //Ensure the archive is read-only first
- anArchive.getOptions().setIsReadOnly(true);
- List files = anArchive.getFiles();
- String uri = null;
- for (int i = 0; i < files.size(); i++) {
- File aFile = (File) files.get(i);
- uri = aFile.getURI();
- if (mfuri.equalsIgnoreCase(uri) && !mfuri.equals(uri)) {
- String[] params = {uri, anArchive.getURI()};
- IResource target = earHelper.getProject().getFile(J2EEConstants.MANIFEST_URI);
- String msg = NLS.bind(EARValidationMessageResourceHandler.INVALID_CASE_FOR_MANIFEST_ERROR_, params);
- addLocalizedError(msg, target);
- }
- }
-
- }
-
-
- public void validateManifestClasspath(Archive anArchive) throws ValidationException {
- ArchiveManifest manifest = null;
- try{
- manifest = anArchive.getManifest();
- }catch( ManifestException mf){
- //mf.printStackTrace();
- mf.getMessage();
- String[] args = new String[]{anArchive.getURI()};
- String tmp = NLS.bind(EARValidationMessageResourceHandler.ERROR_READING_MANIFEST_ERROR_, args);
-
- addLocalizedError(tmp, args);
- }
-
- if(manifest == null)
- return;
-
- String[] cp = manifest.getClassPathTokenized();
-
- for (int i = 0; i < cp.length; i++) {
- String uri = ArchiveUtil.deriveEARRelativeURI(cp[i], anArchive);
- if (uri == null) {
- invalidClassPathEntryWarning(cp[i], anArchive);
- continue;
- }
- File f = null;
- //IFile rf = null;
- try {
-// if (uri.endsWith(J2EEImportConstants.IMPORTED_JAR_SUFFIX)) {
- //TODO Needs work here to initialize rf as rf is an IFile and there is no way to get an IFile currently
-// IVirtualResource resource = component.getRootFolder().findMember(new Path(uri));
-// if (resource == null || !resource.exists()) {
-// invalidClassPathEntryWarning(cp[i], uri, anArchive);
-// }
-// }
-// else
- f = earFile.getFile(uri);
- } catch (java.io.FileNotFoundException ex) {
- invalidClassPathEntryWarning(cp[i], earFile.getURI(), anArchive);
- continue;
- }
- if (f != null && f.isArchive() && anArchive.isModuleFile()) {
- Archive archive = (Archive) f;
- ModuleFile m = (ModuleFile) anArchive;
- if (!ArchiveUtil.isValidDependency(archive, m))
- invalidDepedencyWarning(cp[i], archive, m);
- }
- }
- }
-
-
- protected void validateManifestLines(Archive anArchive) throws ValidationException {
- if (anArchive == null)
- return;
- InputStream is = null;
- try {
- is = anArchive.getInputStream(J2EEConstants.MANIFEST_URI);
- ManifestLineValidator lineVal = new ManifestLineValidator(is);
- lineVal.validate();
- addErrorsIfNecessary(anArchive, lineVal);
- } catch (FileNotFoundException ex) {
- return;
- } catch (IOException ex) {
- handleManifestException(ex, anArchive);
- } finally {
- if (is != null)
- try {
- is.close();
- } catch (IOException ex) {
- handleManifestException(ex, anArchive);
- }
- }
- }
-
- protected void addErrorsIfNecessary(Archive anArchive, ManifestLineValidator mfVal) {
- if (!mfVal.hasErrors())
- return;
- IFile target = getManifestFile(anArchive);
- if (!mfVal.endsWithLineBreak())
- addFileEndError(anArchive, mfVal, target);
- int[] lines = mfVal.getLineNumbersExceedingLimit();
- for (int i = 0; i < lines.length; i++) {
- addLineLengthError(anArchive, target, lines[i]);
- }
- }
-
- protected void addLineLengthError(Archive anArchive, IFile target, int lineNo) {
- String[] args = new String[2];
- args[0] = Integer.toString(lineNo);
- args[1] = anArchive.getURI();
-
- String tmp = NLS.bind(EARValidationMessageResourceHandler.MANIFEST_LINE_EXCEEDS_LENGTH_ERROR_, args);
-
- if( lineNo >= 0 ){
- addLocalizedError(tmp, target, MANIFEST_GROUP_NAME, lineNo );
- }else{
- addLocalizedError(tmp, target, MANIFEST_GROUP_NAME );
- }
-
- }
-
- protected void addFileEndError(Archive anArchive, ManifestLineValidator mfVal, IFile target) {
- String[] args = new String[]{anArchive.getURI()};
-
- String tmp = NLS.bind(EARValidationMessageResourceHandler.MANIFEST_LINE_END_ERROR_, args);
-
- if (target != null)
- addLocalizedError(tmp, getManifestFile(anArchive), MANIFEST_GROUP_NAME, mfVal.getLineCount());
- else
- addLocalizedError(tmp, null, MANIFEST_GROUP_NAME);
- }
-
- protected void handleManifestException(IOException ex, Archive anArchive) throws ValidationException {
- Logger.getLogger().logError(ex);
- String tmp = NLS.bind(EARValidationMessageResourceHandler.ERROR_READING_MANIFEST_ERROR_, new String[]{anArchive.getURI()});
- IMessage message = new LocalizedMessage(IMessage.HIGH_SEVERITY, tmp);
- throw new ValidationException(message, ex);
- }
-
- /**
- * Validates utiljar maps
- */
-// public void validateUtilJarMaps(EARArtifactEdit edit, IVirtualComponent workbenchModule) {
-// List utilJarModules = edit.getUtilityModuleReferences();
-// if (!utilJarModules.isEmpty() || !utilJarModules.isEmpty()) {
-// for (int i = 0; i < utilJarModules.size(); i++) {
-// IVirtualComponent aUtilJar = ((IVirtualReference) utilJarModules.get(i)).getReferencedComponent();
-// if (aUtilJar != null) {
-// IProject project = J2EEPlugin.getWorkspace().getRoot().getProject(aUtilJar.getProject().getName());
-// if (project != null) {
-// if (!project.exists()) {
-// String[] params = new String[]{project.getName(), aUtilJar.getRuntimePath().toString(), earHelper.getProject().getName()};
-// addWarning(getBaseName(), PROJECT_DOES_NOT_EXIST_WARN_, params);
-// } else {
-// //validateModuleProjectForValidServerTarget(project);
-// if (!project.isOpen()) {
-// String[] params = new String[]{project.getName()};
-// addWarning(getBaseName(), PROJECT_IS_CLOSED_WARN_, params);
-// }
-// }
-// }
-// }
-// }
-// }
-// validateDuplicateUtilJars(edit,workbenchModule);
-// validateUtilJarNameCollision(edit,workbenchModule);
-// validateUtilJarContainsNoSpaces(edit,workbenchModule);
-//
-// }// validateUtilJarMaps
-
- /**
- * Checks if the util jar contains spaces or not.
- *
- * @param EAREditModel
- * earEditModel - The ear editmodel.
- */
- protected void validateUtilJarContainsNoSpaces(EARArtifactEdit edit, IVirtualComponent module) {
- IVirtualReference[] utilJars = edit.getUtilityModuleReferences();
-
- if (utilJars == null)
- return;
-
- for (int i = 0; i < utilJars.length; i++) {
- IVirtualReference utilModule = utilJars[i];
- if (utilModule != null) {
- String uri = ModuleURIUtil.fullyQualifyURI(project).toString();
- if (uri != null && uri.indexOf(" ") != -1) { //$NON-NLS-1$
- String[] params = new String[1];
- params[0] = uri;
- String tmp = NLS.bind(EARValidationMessageResourceHandler.URI_CONTAINS_SPACES_ERROR_, params);
- addLocalizedError(tmp, appDD);
- }// if
- }// if
- }// for
-
- }// validateUtilJarContainsNoSpaces
-
- /**
- * Validates if the a util jar has the same name as another module.
- *
- * @param EAREditModel
- * earEditModel - The ear editmodel.
- */
-// protected void validateUtilJarNameCollision(EARArtifactEdit edit, IVirtualComponent module) {
-// List utilJars = edit.getUtilityModuleReferences();
-// if (utilJars == null)
-// return;
-// for (int i = 0; i < utilJars.size(); i++) {
-// UtilityJARMapping utilModule = (UtilityJARMapping) utilJars.get(i);
-//
-// if (utilModule != null) {
-// if (edit.uriExists(utilModule.getUri())) {
-//
-// String[] params = new String[]{utilModule.getUri(), module.getName()};
-// addError(getBaseName(), MESSAGE_UTIL_URI_NAME_COLLISION_ERROR_, params);
-//
-// } else if (utilModule.getProjectName() != null || utilModule.getProjectName().length() != 0) {
-// if (edit.uriExists(utilModule.getUri())) {
-// String[] params = new String[]{utilModule.getUri(), utilModule.getProjectName()};
-// addError(getBaseName(), MESSAGE_UTIL_PROJECT_NAME_COLLISION_ERROR_, params);
-// }
-// }
-// }
-// }
-// }
-
-
-
- /**
- * validate is there are duplicate util jars.
- *
- * @param EAREditModel
- * earEditModel - The ear editmodel
- */
- protected void validateDuplicateUtilJars(EARArtifactEdit edit, IVirtualComponent module) {
- IVirtualReference[] utilJars = edit.getUtilityModuleReferences();
- Set visitedUtilUri = new HashSet();
- if (utilJars == null)
- return;
- for (int i = 0; i < utilJars.length; i++) {
- IVirtualReference utilModule = utilJars[i];
- if (utilModule != null) {
- String uri = ModuleURIUtil.fullyQualifyURI(project).toString();
- if (visitedUtilUri.contains(uri)) {
- String compName = module.getName();
- duplicateUtilError(module.getName(),uri, compName);
- } else
- visitedUtilUri.add(uri);
- } // if
- } // for
- } // validateModuleMapsDuplicateUtil
-
- /**
- * Creates an error for duplicate util jars.
- *
- * @param String
- * earProjectName - The ears project name.
- * @param String
- * moduleUri - The modules uri.
- * @param String
- * projectName - The project name.
- */
- protected void duplicateUtilError(String earProjectName, String moduleUri, String projectName) {
- String[] params = new String[3];
- params[0] = projectName;
- params[1] = earProjectName;
- params[2] = moduleUri;
- String tmp = NLS.bind(EARValidationMessageResourceHandler.DUPLICATE_UTILJAR_FOR_PROJECT_NAME_ERROR_, params);
-
- addLocalizedError(tmp, null);
- }// duplicateUtilError
-
- public void validateModuleMaps(IVirtualComponent component) {
- IVirtualFile ddFile = component.getRootFolder().getFile(J2EEConstants.APPLICATION_DD_URI);
- if( ddFile.exists()){
- EList modules = appDD.getModules();
- if (!modules.isEmpty()) {
- EARArtifactEdit edit = null;
- try{
- edit = EARArtifactEdit.getEARArtifactEditForRead( component.getProject() );
-
- for (int i = 0; i < modules.size(); i++) {
- Module module = (Module) modules.get(i);
- String uri = module.getUri();
- IVirtualComponent referencedComp = edit.getModuleByManifestURI( uri );
- if( referencedComp == null ){
- String[] params = new String[]{uri, component.getProject().getName()};
- String tmp = NLS.bind(EARValidationMessageResourceHandler.MISSING_PROJECT_FORMODULE_WARN_, params);
-
- addLocalizedWarning(tmp, null);
- }
- validateModuleURIExtension(module);
- }
- }finally{
- if( edit != null )
- edit.dispose();
- }
- }
- }
- }
-
-
- protected void validateModuleURIExtension(Module module) {
- String newUri = module.getUri();
- if (newUri != null && newUri.length() > 0) {
- if (module instanceof EjbModule && !newUri.endsWith(".jar")) { //$NON-NLS-1$
- String[] params = new String[1];
- params[0] = module.getUri();
- IResource target = earHelper.getProject().getFile(ArchiveConstants.APPLICATION_DD_URI);
- String tmp = NLS.bind(EARValidationMessageResourceHandler.INVALID_URI_FOR_MODULE_ERROR_, params);
- addLocalizedWarning(tmp, target);
- } else if (module instanceof WebModule && !newUri.endsWith(".war")) { //$NON-NLS-1$
- String[] params = new String[1];
- params[0] = module.getUri();
- IResource target = earHelper.getProject().getFile(ArchiveConstants.APPLICATION_DD_URI);
- String tmp = NLS.bind(EARValidationMessageResourceHandler.INVALID_URI_FOR_MODULE_ERROR_, params);
- addLocalizedWarning(tmp, target);
- }
- }
- }
-
-
- public void cleanup(IReporter reporter) {
- if (earHelper != null)
- earHelper.closeEARFile();
- super.cleanup(reporter);
- }
-
- public void cleanup() {
-
- }
-
- protected IFile getManifestFile(Archive anArchive) {
- URIConverter conv = anArchive.getResourceSet().getURIConverter();
- if (conv instanceof WorkbenchURIConverter) {
- WorkbenchURIConverter wbConv = (WorkbenchURIConverter) conv;
- IContainer input = wbConv.getInputContainer();
- if (input == null)
- return null;
- IProject p = input.getProject();
- if (p == null || JemProjectUtilities.isBinaryProject(p))
- return null;
- IFile result = J2EEProjectUtilities.getManifestFile(p, false);
- if (result != null && result.exists())
- return result;
- }
- return null;
- }
-
- /**
- * Checks if the nature is consistent with doc type.
- */
- protected void validateDocType(EnterpriseArtifactEdit edit,IVirtualComponent module) {
- if (edit == null)
- return;
- if (edit.getJ2EEVersion() >= J2EEVersionConstants.J2EE_1_3_ID && appDD.getVersionID() < J2EEVersionConstants.J2EE_1_3_ID) {
- String[] params = new String[3];
- params[0] = DOCTYPE_1_2;
- params[1] = getResourceName();
- params[2] = DOCTYPE_1_3;
- String tmp = NLS.bind(EARValidationMessageResourceHandler.EAR_INVALID_DOC_TYPE_ERROR_, params);
- addLocalizedError(tmp, appDD);
- } else if (edit.getJ2EEVersion() < J2EEVersionConstants.J2EE_1_3_ID && appDD.getVersionID() >= J2EEVersionConstants.J2EE_1_3_ID) {
- String[] params = new String[3];
- params[0] = DOCTYPE_1_3;
- params[1] = getResourceName();
- params[2] = DOCTYPE_1_2;
- String tmp = NLS.bind(EARValidationMessageResourceHandler.EAR_INVALID_DOC_TYPE_ERROR_, params);
- addLocalizedError(tmp, appDD);
- }
- }
-
- /**
- * Validates that conflicting jar does not exist in the ear project.
- */
- public void validateUriAlreadyExistsInEar(EARArtifactEdit edit,IVirtualComponent component) {
- IVirtualReference[] modules = edit.getJ2EEModuleReferences();
- if (modules == null)
- return;
- for (int i = 0; i < modules.length; i++) {
- IVirtualReference reference = modules[i];
- IVirtualComponent module = reference.getReferencedComponent();
- if (module != null && module.getRootFolder().getRuntimePath() != null) {
- IProject currentEARProject = earHelper.getProject();
- try {
- IFile exFile = currentEARProject.getFile(module.getRootFolder().getRuntimePath());
- if (exFile != null && exFile.exists()) {
- String[] params = new String[2];
- params[0] = module.getRootFolder().getRuntimePath().toString();
- params[1] = currentEARProject.getName();
- String tmp = NLS.bind(EARValidationMessageResourceHandler.URI_ALREADY_EXISTS_IN_EAR_WARN_, params);
- addLocalizedWarning(tmp, appDD);
- }
- } catch (IllegalArgumentException iae) {
- Logger.getLogger().logError(iae);
- }
- }
- }
- }
-
- protected void removeAllMessages(EObject eObject, String groupName) {
- Resource res = eObject.eResource();
- if(res != null) {
- IFile file = WorkbenchResourceHelper.getFile(res);
- if(file != null)
- _reporter.removeMessageSubset(this,file,groupName);
- }
- }
-
-}// UIEarValidator

Back to the top