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/earproject/org')
-rw-r--r--plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/application/internal/operations/AddComponentToEnterpriseApplicationDataModelProvider.java60
-rw-r--r--plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/application/internal/operations/AddComponentToEnterpriseApplicationOp.java328
-rw-r--r--plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/application/internal/operations/AddWebComponentToEARDataModelProvider.java103
-rw-r--r--plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/application/internal/operations/AppClientComponentExportDataModelProvider.java71
-rw-r--r--plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/application/internal/operations/BinaryProjectHelper.java135
-rw-r--r--plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/application/internal/operations/ClassPathSelection.java1257
-rw-r--r--plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/application/internal/operations/ClasspathElement.java574
-rw-r--r--plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/application/internal/operations/ComputeEARsForContextRootUpdateDataModelProvider.java28
-rw-r--r--plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/application/internal/operations/ComputeEARsForContextRootUpdateOp.java131
-rw-r--r--plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/application/internal/operations/CopyArchiveIntoProjectOperation.java129
-rw-r--r--plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/application/internal/operations/CreateProjectWithExtractedJarOperation.java114
-rw-r--r--plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/application/internal/operations/CreateProjectWithLinkedJarOperation.java104
-rw-r--r--plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/application/internal/operations/DefaultJ2EEComponentCreationOperation.java134
-rw-r--r--plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/application/internal/operations/EARComponentExportDataModelProvider.java71
-rw-r--r--plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/application/internal/operations/EARComponentImportDataModelProvider.java726
-rw-r--r--plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/application/internal/operations/IAddComponentToEnterpriseApplicationDataModelProperties.java19
-rw-r--r--plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/application/internal/operations/IAnnotationsDataModel.java35
-rw-r--r--plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/application/internal/operations/IModuleExtensions.java21
-rw-r--r--plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/application/internal/operations/IUpdateModuleContextRootProperties.java28
-rw-r--r--plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/application/internal/operations/J2EEArtifactExportDataModelProvider.java444
-rw-r--r--plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/application/internal/operations/J2EEArtifactImportDataModelProvider.java364
-rw-r--r--plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/application/internal/operations/J2EEComponentExportDataModelProvider.java18
-rw-r--r--plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/application/internal/operations/J2EEComponentImportDataModelProvider.java82
-rw-r--r--plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/application/internal/operations/J2EEUtilityJarImportAssistantOperation.java197
-rw-r--r--plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/application/internal/operations/J2EEUtilityJarImportDataModelProvider.java59
-rw-r--r--plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/application/internal/operations/J2EEUtilityJarImportOperationNew.java42
-rw-r--r--plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/application/internal/operations/J2EEUtilityJarListImportDataModelProvider.java348
-rw-r--r--plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/application/internal/operations/J2EEUtilityJarListImportOperation.java147
-rw-r--r--plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/application/internal/operations/LinkArchiveIntoProjectOperation.java80
-rw-r--r--plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/application/internal/operations/RemoveComponentFromEnterpriseApplicationDataModelProvider.java25
-rw-r--r--plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/application/internal/operations/RemoveComponentFromEnterpriseApplicationOperation.java96
-rw-r--r--plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/application/internal/operations/UpdateManifestDataModelProperties.java46
-rw-r--r--plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/application/internal/operations/UpdateManifestDataModelProvider.java96
-rw-r--r--plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/application/internal/operations/UpdateManifestOperation.java79
-rw-r--r--plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/application/internal/operations/UpdateModuleContextRootInEAROp.java116
-rw-r--r--plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/componentcore/util/EARArtifactEdit.java683
-rw-r--r--plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/componentcore/util/EARVirtualComponent.java210
-rw-r--r--plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/componentcore/util/EARVirtualRootFolder.java74
-rw-r--r--plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/componentcore/util/package.xml19
-rw-r--r--plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/earcreation/IEarFacetInstallDataModelProperties.java28
-rw-r--r--plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/internal/earcreation/DefaultJ2EEComponentCreationDataModelProvider.java457
-rw-r--r--plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/internal/earcreation/EARCreationResourceHandler.java121
-rw-r--r--plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/internal/earcreation/EarFacetInstallDataModelProvider.java83
-rw-r--r--plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/internal/earcreation/IDefaultJ2EEComponentCreationDataModelProperties.java75
-rw-r--r--plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/internal/earcreation/IEarFacetInstallDataModelProperties.java21
-rw-r--r--plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/internal/earcreation/ILooseConfigConstants.java29
-rw-r--r--plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/internal/earcreation/modulemap/EARProjectMap.java40
-rw-r--r--plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/internal/earcreation/modulemap/EARProjectMapImpl.java171
-rw-r--r--plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/internal/earcreation/modulemap/ModuleMapping.java55
-rw-r--r--plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/internal/earcreation/modulemap/ModuleMappingImpl.java194
-rw-r--r--plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/internal/earcreation/modulemap/ModulemapAdapterFactory.java130
-rw-r--r--plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/internal/earcreation/modulemap/ModulemapFactory.java56
-rw-r--r--plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/internal/earcreation/modulemap/ModulemapFactoryImpl.java92
-rw-r--r--plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/internal/earcreation/modulemap/ModulemapInit.java57
-rw-r--r--plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/internal/earcreation/modulemap/ModulemapPackage.java181
-rw-r--r--plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/internal/earcreation/modulemap/ModulemapPackageImpl.java238
-rw-r--r--plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/internal/earcreation/modulemap/ModulemapSwitch.java107
-rw-r--r--plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/internal/earcreation/modulemap/UtilityJARMapping.java53
-rw-r--r--plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/internal/earcreation/modulemap/UtilityJARMappingImpl.java183
-rw-r--r--plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/internal/modulecore/util/EarEditAdapterFactory.java54
-rw-r--r--plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/internal/moduleextension/EarModuleExtension.java45
-rw-r--r--plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/internal/moduleextension/EarModuleExtensionImpl.java48
-rw-r--r--plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/internal/moduleextension/EarModuleExtensionRegistry.java72
-rw-r--r--plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/internal/moduleextension/EarModuleManager.java94
-rw-r--r--plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/internal/moduleextension/EjbModuleExtension.java52
-rw-r--r--plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/internal/moduleextension/JcaModuleExtension.java36
-rw-r--r--plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/internal/moduleextension/WebModuleExtension.java58
-rw-r--r--plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/internal/project/facet/EARFacetProjectCreationDataModelProvider.java34
-rw-r--r--plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/internal/project/facet/UtilityFacetInstallDataModelProvider.java72
-rw-r--r--plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/project/facet/EARFacetProjectCreationDataModelProvider.java24
-rw-r--r--plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/project/facet/EARFacetUtils.java26
-rw-r--r--plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/project/facet/EarFacetInstallDelegate.java77
-rw-r--r--plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/project/facet/EarFacetPostInstallDelegate.java90
-rw-r--r--plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/project/facet/EarFacetRuntimeHandler.java214
-rw-r--r--plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/project/facet/EarFacetValidator.java138
-rw-r--r--plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/project/facet/EarFacetValidator.properties11
-rw-r--r--plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/project/facet/EarFacetVersionChangeDelegate.java92
-rw-r--r--plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/project/facet/IJavaProjectMigrationDataModelProperties.java26
-rw-r--r--plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/project/facet/IJavaUtilityProjectCreationDataModelProperties.java30
-rw-r--r--plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/project/facet/IUtilityFacetInstallDataModelProperties.java19
-rw-r--r--plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/project/facet/JavaProjectMigrationDataModelProvider.java64
-rw-r--r--plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/project/facet/JavaProjectMigrationOperation.java99
-rw-r--r--plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/project/facet/JavaUtilityProjectCreationDataModelProvider.java43
-rw-r--r--plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/project/facet/JavaUtilityProjectCreationOperation.java83
-rw-r--r--plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/project/facet/UtilityFacetInstallDataModelProvider.java25
-rw-r--r--plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/project/facet/UtilityFacetInstallDelegate.java128
-rw-r--r--plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/project/facet/UtilityFacetPostInstallDelegate.java57
-rw-r--r--plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/project/facet/UtilityFacetUnInstallDelegate.java72
-rw-r--r--plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/project/facet/UtilityProjectCreationDataModelProvider.java68
89 files changed, 0 insertions, 11615 deletions
diff --git a/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/application/internal/operations/AddComponentToEnterpriseApplicationDataModelProvider.java b/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/application/internal/operations/AddComponentToEnterpriseApplicationDataModelProvider.java
deleted file mode 100644
index 48817a53d..000000000
--- a/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/application/internal/operations/AddComponentToEnterpriseApplicationDataModelProvider.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2005, 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.application.internal.operations;
-
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import org.eclipse.core.resources.IProject;
-import org.eclipse.jst.j2ee.internal.project.J2EEProjectUtilities;
-import org.eclipse.wst.common.componentcore.internal.operation.CreateReferenceComponentsDataModelProvider;
-import org.eclipse.wst.common.componentcore.resources.IVirtualComponent;
-import org.eclipse.wst.common.frameworks.datamodel.IDataModelOperation;
-
-public class AddComponentToEnterpriseApplicationDataModelProvider extends CreateReferenceComponentsDataModelProvider implements IAddComponentToEnterpriseApplicationDataModelProperties {
-
- public AddComponentToEnterpriseApplicationDataModelProvider() {
- super();
- }
-
- public Object getDefaultProperty(String propertyName) {
- if (TARGET_COMPONENTS_TO_URI_MAP.equals(propertyName)) {
- Map map = new HashMap();
- List components = (List) getProperty(TARGET_COMPONENT_LIST);
- for (int i = 0; i < components.size(); i++) {
- IVirtualComponent component = (IVirtualComponent) components.get(i);
- IProject project = component.getProject();
- String name = component.getName();
- if(name != null)
- name = name.replace(' ','_');
-
- if (J2EEProjectUtilities.isDynamicWebProject(project)) {
- name += IModuleExtensions.DOT_WAR;
- } else if (J2EEProjectUtilities.isJCAProject(project)) {
- name += IModuleExtensions.DOT_RAR;
- } else {
- name += IModuleExtensions.DOT_JAR;
- }
- map.put(component, name);
- }
- setProperty(propertyName, map);
- return map;
- }
- return super.getDefaultProperty(propertyName);
- }
-
-
- public IDataModelOperation getDefaultOperation() {
- return new AddComponentToEnterpriseApplicationOp(model);
- }
-
-}
diff --git a/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/application/internal/operations/AddComponentToEnterpriseApplicationOp.java b/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/application/internal/operations/AddComponentToEnterpriseApplicationOp.java
deleted file mode 100644
index 96eb8d6cf..000000000
--- a/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/application/internal/operations/AddComponentToEnterpriseApplicationOp.java
+++ /dev/null
@@ -1,328 +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.application.internal.operations;
-
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-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.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.core.runtime.SubProgressMonitor;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.jem.util.logger.proxy.Logger;
-import org.eclipse.jst.j2ee.application.WebModule;
-import org.eclipse.jst.j2ee.componentcore.J2EEModuleVirtualArchiveComponent;
-import org.eclipse.jst.j2ee.internal.J2EEVersionConstants;
-import org.eclipse.jst.j2ee.internal.common.classpath.J2EEComponentClasspathUpdater;
-import org.eclipse.jst.j2ee.model.IEARModelProvider;
-import org.eclipse.jst.j2ee.model.IModelProvider;
-import org.eclipse.jst.j2ee.model.ModelProviderManager;
-import org.eclipse.jst.j2ee.project.JavaEEProjectUtilities;
-import org.eclipse.jst.j2ee.project.facet.EarFacetRuntimeHandler;
-import org.eclipse.jst.javaee.application.ApplicationFactory;
-import org.eclipse.jst.javaee.application.Module;
-import org.eclipse.jst.javaee.application.Web;
-import org.eclipse.jst.jee.application.ICommonApplication;
-import org.eclipse.jst.jee.application.ICommonModule;
-import org.eclipse.wst.common.componentcore.datamodel.properties.ICreateReferenceComponentsDataModelProperties;
-import org.eclipse.wst.common.componentcore.internal.ReferencedComponent;
-import org.eclipse.wst.common.componentcore.internal.StructureEdit;
-import org.eclipse.wst.common.componentcore.internal.WorkbenchComponent;
-import org.eclipse.wst.common.componentcore.internal.operation.CreateReferenceComponentsOp;
-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.frameworks.datamodel.IDataModel;
-import org.eclipse.wst.common.project.facet.core.IFacetedProject;
-import org.eclipse.wst.common.project.facet.core.IProjectFacet;
-import org.eclipse.wst.common.project.facet.core.ProjectFacetsManager;
-
-public class AddComponentToEnterpriseApplicationOp extends CreateReferenceComponentsOp {
- public static final String metaInfFolderDeployPath = "/"; //$NON-NLS-1$
-
- public AddComponentToEnterpriseApplicationOp(IDataModel model) {
- super(model);
- }
-
- public IStatus execute(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
- if (monitor != null) {
- monitor.beginTask("", 3);
- }
- try {
- J2EEComponentClasspathUpdater.getInstance().pauseUpdates();
- IStatus status = validateEditEAR();
- if( status.isOK() ){
- status = super.execute(submon(monitor, 1), info);
- if (!status.isOK())
- return Status.CANCEL_STATUS;
- updateEARDD(submon(monitor, 1));
- updateModuleRuntimes(submon(monitor, 1));
- }
- return status;
- } finally {
- if (monitor != null) {
- monitor.done();
- }
- J2EEComponentClasspathUpdater.getInstance().resumeUpdates();
- }
- }
-
- protected String getArchiveName(IVirtualComponent comp) {
- boolean useArchiveURI = true;
- IFacetedProject facetedProject = null;
- try {
- facetedProject = ProjectFacetsManager.create(comp.getProject());
- } catch (CoreException e) {
- useArchiveURI = false;
- }
-
- if (useArchiveURI && facetedProject != null && ProjectFacetsManager.isProjectFacetDefined(IModuleConstants.JST_UTILITY_MODULE)) {
- IProjectFacet projectFacet = ProjectFacetsManager.getProjectFacet(IModuleConstants.JST_UTILITY_MODULE);
- useArchiveURI = projectFacet != null && facetedProject.hasProjectFacet(projectFacet);
- }
- if (useArchiveURI) {
- return super.getArchiveName(comp);
- }
- return ""; //$NON-NLS-1$
- }
-
- protected void updateEARDD(IProgressMonitor monitor) {
-
- StructureEdit se = null;
- try {
- IVirtualComponent sourceComp = (IVirtualComponent) model.getProperty(ICreateReferenceComponentsDataModelProperties.SOURCE_COMPONENT);
- final IEARModelProvider earModel = (IEARModelProvider)ModelProviderManager.getModelProvider(sourceComp.getProject());
- final IVirtualComponent ear = (IVirtualComponent) this.model.getProperty(ICreateReferenceComponentsDataModelProperties.SOURCE_COMPONENT);
- final IProject earpj = ear.getProject();
-
- se = StructureEdit.getStructureEditForWrite(sourceComp.getProject());
- if (earModel != null) {
- List list = (List) model.getProperty(ICreateReferenceComponentsDataModelProperties.TARGET_COMPONENT_LIST);
- final Map map = (Map) model.getProperty(IAddComponentToEnterpriseApplicationDataModelProperties.TARGET_COMPONENTS_TO_URI_MAP);
- if (list != null && list.size() > 0) {
- for (int i = 0; i < list.size(); i++) {
- StructureEdit compse = null;
- final IVirtualComponent wc = (IVirtualComponent) list.get(i);
- boolean linkedToEAR = true;
- try{
- if(wc.isBinary()){
- linkedToEAR = ((J2EEModuleVirtualArchiveComponent)wc).isLinkedToEAR();
- ((J2EEModuleVirtualArchiveComponent)wc).setLinkedToEAR(false);
- }
- WorkbenchComponent earwc = se.getComponent();
- try {
- compse = StructureEdit.getStructureEditForWrite(wc.getProject());
- WorkbenchComponent refwc = compse.getComponent();
- final ReferencedComponent ref = se.findReferencedComponent(earwc, refwc);
- earModel.modify(new Runnable() {
- public void run() {
- final ICommonApplication application = (ICommonApplication)earModel.getModelObject();
- if(application != null) {
- ICommonModule mod = addModule(application, wc, (String) map.get(wc));
- if (ref!=null)
- ref.setDependentObject((EObject)mod);
- if (JavaEEProjectUtilities.isStaticWebProject(wc.getProject())
- || JavaEEProjectUtilities.isDynamicWebComponent(wc)) {
- updateContextRoot(earpj, wc, mod);
- }
- }
- }
- }, null);
- } finally {
- if (compse != null) {
- compse.saveIfNecessary(monitor);
- compse.dispose();
- }
- }
- } finally {
- if(wc.isBinary()){
- ((J2EEModuleVirtualArchiveComponent)wc).setLinkedToEAR(linkedToEAR);
- }
- }
- }
- }
- }
- se.saveIfNecessary(monitor);
- } catch (Exception e) {
- Logger.getLogger().logError(e);
- } finally {
- if (se != null)
- se.dispose();
- }
- }
-
- private void updateContextRoot(final IProject earpj, final IVirtualComponent wc,
- ICommonModule mod) {
- boolean useNewModel = JavaEEProjectUtilities.getJ2EEDDProjectVersion(earpj).equals(
- J2EEVersionConstants.VERSION_5_0_TEXT);
- String contextroot = ComponentUtilities.getServerContextRoot(wc.getProject());
- if (contextroot == null) {
- contextroot = wc.getProject().getName();
- }
- if (useNewModel) {
- if (mod instanceof Module) {
- // safety check
- Module module = (Module) mod;
- Web web = ((Module) mod).getWeb();
- web.setContextRoot(contextroot);
- }
- }
- else {
- if (JavaEEProjectUtilities.isStaticWebProject(wc.getProject())
- || JavaEEProjectUtilities.isDynamicWebComponent(wc)) {
- if (mod instanceof WebModule) {
- ((WebModule) mod).setContextRoot(contextroot);
- }
- }
- }
- }
-
- protected ICommonModule createNewModule(IVirtualComponent wc, String name) {
- ICommonModule newModule = null;
- final IVirtualComponent ear = (IVirtualComponent) this.model.getProperty(ICreateReferenceComponentsDataModelProperties.SOURCE_COMPONENT);
- final IProject earpj = ear.getProject();
- boolean useNewModel = JavaEEProjectUtilities.getJ2EEDDProjectVersion(earpj).equals(J2EEVersionConstants.VERSION_5_0_TEXT);
- //[Bug 238264] need to use component to determine type of project in-case component is binary
- if (JavaEEProjectUtilities.isDynamicWebComponent(wc)) {
- if (useNewModel) {
- Web web = ApplicationFactory.eINSTANCE.createWeb();
- web.setWebUri(name);
- Module webModule = ApplicationFactory.eINSTANCE.createModule();
- webModule.setWeb(web);
- newModule = (ICommonModule)webModule;
- }
- else {
- org.eclipse.jst.j2ee.application.WebModule webModule = org.eclipse.jst.j2ee.application.ApplicationFactory.eINSTANCE.createWebModule();
- webModule.setUri(name);
- newModule = (ICommonModule)webModule;
- }
- updateContextRoot(earpj, wc, newModule);
- return newModule;
- } else if (JavaEEProjectUtilities.isEJBComponent(wc)) {
- if (useNewModel) {
- Module ejbModule = ApplicationFactory.eINSTANCE.createModule();
- ejbModule.setEjb(name);
- newModule = (ICommonModule)ejbModule;
- }
- else {
- org.eclipse.jst.j2ee.application.EjbModule ejbModule = org.eclipse.jst.j2ee.application.ApplicationFactory.eINSTANCE.createEjbModule();
- ejbModule.setUri(name);
- newModule = (ICommonModule)ejbModule;
- }
- return newModule;
- } else if (JavaEEProjectUtilities.isApplicationClientComponent(wc)) {
- if (useNewModel) {
- Module appClientModule = ApplicationFactory.eINSTANCE.createModule();
- appClientModule.setJava(name);
- newModule = (ICommonModule)appClientModule;
- }
- else {
- org.eclipse.jst.j2ee.application.JavaClientModule appClientModule = org.eclipse.jst.j2ee.application.ApplicationFactory.eINSTANCE.createJavaClientModule();
- appClientModule.setUri(name);
- newModule = (ICommonModule)appClientModule;
- }
- return newModule;
- } else if (JavaEEProjectUtilities.isJCAComponent(wc)) {
- if (useNewModel) {
- Module j2cModule = ApplicationFactory.eINSTANCE.createModule();
- j2cModule.setConnector(name);
- newModule = (ICommonModule)j2cModule;
- }
- else {
- org.eclipse.jst.j2ee.application.ConnectorModule j2cModule = org.eclipse.jst.j2ee.application.ApplicationFactory.eINSTANCE.createConnectorModule();
- j2cModule.setUri(name);
- newModule = (ICommonModule)j2cModule;
- }
- return newModule;
- }
- return null;
- }
-
- protected ICommonModule addModule(ICommonApplication application, IVirtualComponent wc, String name) {
- ICommonApplication dd = application;
- ICommonModule existingModule = dd.getFirstEARModule(name);
- if (existingModule == null) {
- existingModule = createNewModule(wc, name);
- if (existingModule != null) {
- existingModule.setUri(name);
- dd.getEARModules().add(existingModule);
- }
- }
- return existingModule;
- }
-
- private void updateModuleRuntimes(final IProgressMonitor monitor) {
- if (monitor != null) {
- monitor.beginTask("", 10);
- }
-
- try {
- final IVirtualComponent ear = (IVirtualComponent) this.model.getProperty(ICreateReferenceComponentsDataModelProperties.SOURCE_COMPONENT);
-
- final IProject earpj = ear.getProject();
-
- final List moduleComponents = (List) this.model.getProperty(ICreateReferenceComponentsDataModelProperties.TARGET_COMPONENT_LIST);
-
- final Set moduleProjects = new HashSet();
-
- for (Iterator itr = moduleComponents.iterator(); itr.hasNext();) {
- moduleProjects.add(((IVirtualComponent) itr.next()).getProject());
- }
-
- if (monitor != null) {
- monitor.worked(1);
- }
-
- EarFacetRuntimeHandler.updateModuleProjectRuntime(earpj, moduleProjects, submon(monitor, 9));
- } catch (Exception e) {
- Logger.getLogger().logError(e);
- } finally {
- if (monitor != null) {
- monitor.done();
- }
- }
- }
-
- private static IProgressMonitor submon(final IProgressMonitor parent, final int ticks) {
- return (parent == null ? null : new SubProgressMonitor(parent, ticks));
- }
-
- 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;
- }
-
- protected IStatus validateEditEAR() {
- IStatus status = OK_STATUS;
- IVirtualComponent sourceComp = (IVirtualComponent) model.getProperty(ICreateReferenceComponentsDataModelProperties.SOURCE_COMPONENT);
- IProject project = sourceComp.getProject();
- IModelProvider provider = ModelProviderManager.getModelProvider( project );
- status = provider.validateEdit(null, null);
- return status;
- }
-
- protected IStatus validateEdit() {
- return validateEditEAR();
- }
-}
diff --git a/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/application/internal/operations/AddWebComponentToEARDataModelProvider.java b/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/application/internal/operations/AddWebComponentToEARDataModelProvider.java
deleted file mode 100644
index 53dec7223..000000000
--- a/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/application/internal/operations/AddWebComponentToEARDataModelProvider.java
+++ /dev/null
@@ -1,103 +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.application.internal.operations;
-
-import java.util.Set;
-import com.ibm.icu.util.StringTokenizer;
-
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.jst.j2ee.datamodel.properties.IAddWebComponentToEnterpriseApplicationDataModelProperties;
-import org.eclipse.jst.j2ee.internal.plugin.J2EEPlugin;
-import org.eclipse.jst.j2ee.internal.project.ProjectSupportResourceHandler;
-import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
-
-
-/**
- *
- */
-public class AddWebComponentToEARDataModelProvider extends AddComponentToEnterpriseApplicationDataModelProvider implements IAddWebComponentToEnterpriseApplicationDataModelProperties {
-
- public Set getPropertyNames() {
- Set propertyNames = super.getPropertyNames();
- propertyNames.add(CONTEXT_ROOT);
- return propertyNames;
- }
-
- /**
- *
- */
- protected String getDefaultURIExtension() {
- return "war"; //$NON-NLS-1$
- }
-
- /**
- *
- */
- public boolean isWebModuleArchive() {
- return true;
- }
-
- /**
- *
- */
- public boolean propertySet(String propertyName, Object propertyValue) {
- boolean notify = super.propertySet(propertyName, propertyValue);
- if (notify && propertyName.equals(CONTEXT_ROOT))
- model.notifyPropertyChange(CONTEXT_ROOT, IDataModel.DEFAULT_CHG);
- return notify;
- }
-
- /**
- *
- */
- public Object getDefaultProperty(String propertyName) {
- // if (propertyName.equals(CONTEXT_ROOT))
- // return getDefaultContextRoot();
- return super.getDefaultProperty(propertyName);
- }
-
-
- /**
- *
- */
- public IStatus validate(String propertyName) {
- if (CONTEXT_ROOT.equals(propertyName)) {
- return validateContextRoot(getStringProperty(CONTEXT_ROOT));
- }
- return super.validate(propertyName);
- }
-
- /**
- *
- * @param contextRoot
- * @return
- */
- public IStatus validateContextRoot(String contextRoot) {
- if (contextRoot.equals("") || contextRoot == null) { //$NON-NLS-1$
- return J2EEPlugin.newErrorStatus(ProjectSupportResourceHandler.getString(ProjectSupportResourceHandler.Context_Root_cannot_be_empty_2, new Object[]{contextRoot}), null);
- } else if (contextRoot.trim().equals(contextRoot)) {
- StringTokenizer stok = new StringTokenizer(contextRoot, "."); //$NON-NLS-1$
- while (stok.hasMoreTokens()) {
- String token = stok.nextToken();
- for (int i = 0; i < token.length(); i++) {
- if (!(token.charAt(i) == '_') && !(token.charAt(i) == '-') && !(token.charAt(i) == '/') && Character.isLetterOrDigit(token.charAt(i)) == false) {
- Object[] invalidChar = new Object[]{(new Character(token.charAt(i))).toString()};
- String errorStatus = ProjectSupportResourceHandler.getString(ProjectSupportResourceHandler.The_character_is_invalid_in_a_context_root, invalidChar);
- return J2EEPlugin.newErrorStatus(errorStatus, null);
- }
- }
- }
- } else
- return J2EEPlugin.newErrorStatus(ProjectSupportResourceHandler.getString(ProjectSupportResourceHandler.Names_cannot_begin_or_end_with_whitespace_5, new Object[]{contextRoot}), null);
- return OK_STATUS;
- }
-}
diff --git a/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/application/internal/operations/AppClientComponentExportDataModelProvider.java b/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/application/internal/operations/AppClientComponentExportDataModelProvider.java
deleted file mode 100644
index 8b23858d4..000000000
--- a/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/application/internal/operations/AppClientComponentExportDataModelProvider.java
+++ /dev/null
@@ -1,71 +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.application.internal.operations;
-
-import org.eclipse.jst.j2ee.internal.archive.operations.AppClientComponentExportOperation;
-import org.eclipse.jst.j2ee.internal.earcreation.EARCreationResourceHandler;
-import org.eclipse.jst.j2ee.internal.project.J2EEProjectUtilities;
-import org.eclipse.wst.common.frameworks.datamodel.IDataModelOperation;
-
-
-public class AppClientComponentExportDataModelProvider extends J2EEComponentExportDataModelProvider {
-
- public AppClientComponentExportDataModelProvider() {
- super();
- }
-
- public IDataModelOperation getDefaultOperation() {
- return new AppClientComponentExportOperation(model);
- }
-
- protected String getModuleExtension() {
- return ".jar"; //$NON-NLS-1$
- }
-
- protected String getWrongComponentTypeString(String projectName) {
- return EARCreationResourceHandler.getString(EARCreationResourceHandler.NOT_AN_APP_CLIENT, new Object[]{projectName});
- }
-
- protected String getProjectType() {
- return J2EEProjectUtilities.APPLICATION_CLIENT;
- }
- /**
- * Exports the specified Application Client Module project to the specified Application Client
- * Jar file.
- *
- * @param appClientProjectName
- * The name of the Application Client Module project to export.
- * @param appClientJarFileName
- * The fully qualified Application Client Jar file location to export the specified
- * Application Client Module project.
- * @param overwriteExisting
- * If this is <code>true</code> then an existing file at the location specified by
- * <code>earFileName</code> will be overwritten.
- * @param exportSource
- * If this is <code>true</code> then all source files in the specified Application
- * Client Module will be included in the resulting Application Client Jar file.
- * @plannedfor WTP 1.0
- */
-// public static void exportProject(String appClientProjectName, String appClientJarFileName, boolean overwriteExisting, boolean exportSource) {
-// AppClientModuleExportDataModel dataModel = new AppClientModuleExportDataModel();
-// dataModel.setProperty(PROJECT_NAME, appClientProjectName);
-// dataModel.setBooleanProperty(OVERWRITE_EXISTING, overwriteExisting);
-// dataModel.setProperty(ARCHIVE_DESTINATION, appClientJarFileName);
-// dataModel.setBooleanProperty(EXPORT_SOURCE_FILES, exportSource);
-// try {
-// dataModel.getDefaultOperation().run(null);
-// } catch (InvocationTargetException e) {
-// Logger.getLogger().logError(e);
-// } catch (InterruptedException e) {
-// Logger.getLogger().logError(e);
-// }
-// }
-}
diff --git a/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/application/internal/operations/BinaryProjectHelper.java b/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/application/internal/operations/BinaryProjectHelper.java
deleted file mode 100644
index f49390988..000000000
--- a/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/application/internal/operations/BinaryProjectHelper.java
+++ /dev/null
@@ -1,135 +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.application.internal.operations;
-
-import java.io.FileNotFoundException;
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.jdt.core.IClasspathEntry;
-import org.eclipse.jdt.core.IJavaProject;
-import org.eclipse.jdt.core.JavaCore;
-import org.eclipse.jdt.core.JavaModelException;
-import org.eclipse.jem.util.emf.workbench.ProjectUtilities;
-import org.eclipse.jem.util.emf.workbench.WorkbenchByteArrayOutputStream;
-import org.eclipse.jem.util.logger.proxy.Logger;
-import org.eclipse.jst.j2ee.commonarchivecore.internal.Archive;
-import org.eclipse.jst.j2ee.commonarchivecore.internal.File;
-import org.eclipse.jst.j2ee.commonarchivecore.internal.util.ArchiveUtil;
-
-public class BinaryProjectHelper {
-
- public void importArchiveAsBinary(Archive archive, IProject project, IProgressMonitor monitor) {
- try {
-
- IJavaProject javaProject = JavaCore.create(project);
-
- IFile savedModuleFile = saveFile(archive, project);
- saveEnclosedFile(archive, project, ProjectUtilities.DOT_CLASSPATH);
- saveEnclosedFile(archive, project, ProjectUtilities.DOT_PROJECT);
- removeImportedClassesFromClasspathIfNecessary(project);
-
- ensureBinary(javaProject, monitor);
- IPath path = savedModuleFile.getFullPath();
-
- IClasspathEntry newEntry = JavaCore.newLibraryEntry(path, path, null, true);
-
- IClasspathEntry[] entries = javaProject.getRawClasspath();
- IClasspathEntry[] newEntries = new IClasspathEntry[entries.length + 1];
- System.arraycopy(entries, 0, newEntries, 1, entries.length);
- newEntries[0] = newEntry;
- javaProject.setRawClasspath(newEntries, monitor);
-
- } catch (FileNotFoundException e) {
- Logger.getLogger().log(e);
- } catch (IOException e) {
- Logger.getLogger().log(e);
- } catch (JavaModelException e) {
- Logger.getLogger().log(e);
- }
- }
-
- /**
- *
- */
- public static void removeImportedClassesFromClasspathIfNecessary(IProject project) {
- IJavaProject javaProj = JavaCore.create(project);
- if (javaProj != null) {
- IClasspathEntry[] entries = javaProj.readRawClasspath();
- if (entries != null) {
- IClasspathEntry entryToRemove = null;
- for (int i = 0; i < entries.length; i++) {
- if (entries[i].getEntryKind() == IClasspathEntry.CPE_LIBRARY && entries[i].getPath().toString().endsWith("imported_classes") && !project.getFolder("imported_classes").exists()) {
- entryToRemove = entries[i];
- break;
- }
- }
- if (null != entryToRemove) {
- IClasspathEntry[] newEntries = new IClasspathEntry[entries.length - 1];
- for (int i = 0, j = 0; i < newEntries.length && j < entries.length; j++) {
- if (entryToRemove != entries[j]) {
- newEntries[i] = entries[j];
- i++;
- }
- }
- entries = newEntries;
- IPath output = javaProj.readOutputLocation();
- if (output != null)
- try {
- javaProj.setRawClasspath(entries, output, null);
- } catch (JavaModelException e) {
- }
- }
-
- }
- }
- }
-
- protected IFile saveFile(File aFile, IProject p) throws IOException {
- IFile iFile = p.getFile(aFile.getURI());
- WorkbenchByteArrayOutputStream out = new WorkbenchByteArrayOutputStream(iFile);
- ArchiveUtil.copy(aFile.getInputStream(), out);
- return iFile;
- }
-
- protected void saveEnclosedFile(Archive anArchive, IProject p, String uri) throws IOException {
- try {
- File aFile = anArchive.getFile(uri);
- saveFile(aFile, p);
- } catch (FileNotFoundException ignore) {
- }
- }
-
- protected void ensureBinary(IJavaProject javaProject, IProgressMonitor monitor) {
-
- if (javaProject == null)
- return;
- List newCp = new ArrayList();
- try {
- IClasspathEntry[] entries = javaProject.getRawClasspath();
- for (int i = 0; i < entries.length; i++) {
- if (entries[i].getEntryKind() != IClasspathEntry.CPE_SOURCE)
- newCp.add(entries[i]);
- }
- entries = (IClasspathEntry[]) newCp.toArray(new IClasspathEntry[newCp.size()]);
- javaProject.setRawClasspath(entries, monitor);
- } catch (JavaModelException ex) {
- Logger.getLogger().log(ex);
- }
- }
-
-}
-
diff --git a/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/application/internal/operations/ClassPathSelection.java b/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/application/internal/operations/ClassPathSelection.java
deleted file mode 100644
index 01b86044a..000000000
--- a/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/application/internal/operations/ClassPathSelection.java
+++ /dev/null
@@ -1,1257 +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.application.internal.operations;
-
-
-
-import java.io.File;
-import java.io.FileNotFoundException;
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.Comparator;
-import java.util.HashMap;
-import java.util.Iterator;
-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.IProject;
-import org.eclipse.core.resources.IResource;
-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.emf.common.util.URI;
-import org.eclipse.jdt.core.IClasspathAttribute;
-import org.eclipse.jdt.core.IClasspathContainer;
-import org.eclipse.jdt.core.IClasspathEntry;
-import org.eclipse.jdt.core.IJavaProject;
-import org.eclipse.jdt.core.JavaCore;
-import org.eclipse.jem.util.emf.workbench.ProjectUtilities;
-import org.eclipse.jem.util.logger.proxy.Logger;
-import org.eclipse.jst.j2ee.classpathdep.ClasspathDependencyUtil;
-import org.eclipse.jst.j2ee.classpathdep.IClasspathDependencyConstants;
-import org.eclipse.jst.j2ee.commonarchivecore.internal.Archive;
-import org.eclipse.jst.j2ee.commonarchivecore.internal.CommonArchiveResourceHandler;
-import org.eclipse.jst.j2ee.commonarchivecore.internal.Container;
-import org.eclipse.jst.j2ee.commonarchivecore.internal.EARFile;
-import org.eclipse.jst.j2ee.commonarchivecore.internal.exception.ManifestException;
-import org.eclipse.jst.j2ee.commonarchivecore.internal.exception.OpenFailureException;
-import org.eclipse.jst.j2ee.commonarchivecore.internal.helpers.ArchiveManifest;
-import org.eclipse.jst.j2ee.commonarchivecore.internal.impl.CommonarchiveFactoryImpl;
-import org.eclipse.jst.j2ee.commonarchivecore.internal.strategy.LoadStrategy;
-import org.eclipse.jst.j2ee.commonarchivecore.internal.strategy.ZipFileLoadStrategyImpl;
-import org.eclipse.jst.j2ee.commonarchivecore.internal.util.ArchiveUtil;
-import org.eclipse.jst.j2ee.componentcore.J2EEModuleVirtualComponent;
-import org.eclipse.jst.j2ee.internal.archive.operations.ComponentLoadStrategyImpl;
-import org.eclipse.jst.j2ee.internal.archive.operations.EARComponentLoadStrategyImpl;
-import org.eclipse.jst.j2ee.internal.plugin.J2EEPlugin;
-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.jst.javaee.ejb.EJBJar;
-import org.eclipse.wst.common.componentcore.ComponentCore;
-import org.eclipse.wst.common.componentcore.UnresolveableURIException;
-import org.eclipse.wst.common.componentcore.internal.impl.ModuleURIUtil;
-import org.eclipse.wst.common.componentcore.internal.resources.VirtualArchiveComponent;
-import org.eclipse.wst.common.componentcore.internal.util.ComponentUtilities;
-import org.eclipse.wst.common.componentcore.resources.IVirtualComponent;
-import org.eclipse.wst.common.componentcore.resources.IVirtualReference;
-
-
-
-public class ClassPathSelection {
- protected Archive archive;
- protected org.eclipse.jst.j2ee.commonarchivecore.internal.helpers.ArchiveManifest manifest;
- protected IVirtualComponent component;
- protected IProject earProject;
- protected IVirtualComponent earComponent;
- protected List classpathElements;
- protected Map urisToElements;
- protected boolean modified;
- private String targetProjectName;
- protected Map ejbToClientJARs = null;
- protected Map clientToEJBJARs = null;
- public static final int FILTER_EJB_SERVER_JARS = 0;
- public static final int FILTER_EJB_CLIENT_JARS = 1;
- public static final int FILTER_NONE = 2;
-
- protected int filterLevel = 2;
-
- protected static Comparator comparator = new Comparator() {
- /**
- * @see Comparator#compare(Object, Object)
- */
- public int compare(Object o1, Object o2) {
- int retVal = 0;
- if (o1 instanceof Archive)
- {
- Archive a1 = (Archive) o1;
- Archive a2 = (Archive) o2;
- retVal = a1.getURI().compareTo(a2.getURI());
- }
- else if (o1 instanceof IVirtualReference)
- {
- IVirtualReference ref1 = (IVirtualReference) o1;
- IVirtualReference ref2 = (IVirtualReference) o2;
- retVal = ref1.getArchiveName().compareTo(ref2.getArchiveName());
- }
- else
- {
- retVal = o1.toString().compareTo(o2.toString());
- }
- return retVal;
- }
- };
-
- public ClassPathSelection(Archive anArchive, String targetProjectName, EARFile earFile) {
- super();
- archive = anArchive;
- this.targetProjectName = targetProjectName;
- initializeEARProject(earFile);
- initializeElements();
- }
-
- /**
- * ClassPathSelection constructor comment.
- */
- public ClassPathSelection(Archive anArchive, EARFile earFile) {
- super();
- archive = anArchive;
- initializeEARProject(earFile);
- initializeElements();
- }
-
- /**
- * Creates without an EAR component.
- */
- public ClassPathSelection(IVirtualComponent aComponent) {
- super();
- component = aComponent;
- targetProjectName = aComponent.getProject().getName();
- initializeElements();
- }
-
- /**
- * ClassPathSelection constructor comment.
- */
- public ClassPathSelection(IVirtualComponent aComponent, IVirtualComponent anEarComponent) {
- this(aComponent);
- earComponent = anEarComponent;
- earProject = earComponent.getProject();
- initializeElements();
- }
-
- /**
- * ClassPathSelection constructor comment.
- */
- public ClassPathSelection() {
- super();
- }
-
- protected ClasspathElement createElement(Archive referencingArchive, Archive referencedArchive, String cpEntry) {
- ClasspathElement element = new ClasspathElement(referencingArchive);
- element.setValid(true);
-
- String uriString = referencedArchive.getURI();
- URI uri = URI.createURI(uriString);
-
- boolean hasAbsolutePath = uri.hasAbsolutePath();
- if( hasAbsolutePath ){
- uriString = uri.lastSegment();
- }
-
- //element.setText(referencedArchive.getURI());
- element.setText(uriString);
- element.setTargetArchive(referencedArchive);
- element.setEarProject(earProject);
- if( earComponent != null ){
- IContainer earConentFolder = earComponent.getRootFolder().getUnderlyingFolder();
- if( earConentFolder.getType() == IResource.FOLDER ){
- element.setEarContentFolder( earConentFolder.getName());
- }else {
- element.setEarContentFolder( "" );
- }
- }
-
- setProjectValues(element, referencedArchive);
- if (cpEntry != null)
- element.setValuesSelected(cpEntry);
- setType(element, referencedArchive);
- return element;
- }
-
- protected ClasspathElement createElement(IVirtualComponent referencingArchive, IVirtualReference referencedArchive, String cpEntry) {
- ClasspathElement element = new ClasspathElement(referencingArchive);
- element.setValid(true);
-
- String uriString = referencedArchive.getArchiveName();
-
- element.setText(uriString);
- element.setTargetComponent(referencedArchive.getReferencedComponent());
- element.setEarProject(earProject);
- if( earComponent != null ){
- IContainer earConentFolder = earComponent.getRootFolder().getUnderlyingFolder();
- if( earConentFolder.getType() == IResource.FOLDER ){
- element.setEarContentFolder( earConentFolder.getName());
- }else {
- element.setEarContentFolder( "" );
- }
- }
-
- setProjectValues(element, referencedArchive);
- if (cpEntry != null)
- element.setValuesSelected(cpEntry);
- setType(element, referencedArchive);
- return element;
- }
-
- protected ClasspathElement createInvalidElement(String cpEntry) {
- ClasspathElement element = new ClasspathElement(archive);
- element.setValid(false);
- element.setSelected(true);
- element.setRelativeText(cpEntry);
- element.setText(cpEntry);
- element.setEarProject(earProject);
- setInvalidProject(element);
- return element;
- }
-
- public ClasspathElement createProjectElement(IProject project) {
- ClasspathElement element = new ClasspathElement(project);
- element.setValid(true);
- element.setSelected(true);
- element.setText(project.getName());
- element.setProject(project);
- addClasspathElement(element,element.getProjectName());
- return element;
- }
-
- public ClasspathElement createProjectElement(IProject project, boolean existingEntry ) {
- ClasspathElement element = new ClasspathElement(project);
- element.setValid(true);
- element.setSelected(existingEntry);
- element.setText(project.getName());
- element.setProject(project);
- addClasspathElement(element,element.getProjectName());
- return element;
- }
-
-
- public ClasspathElement createArchiveElement(URI uri, String name, String cpEntry) {
- ClasspathElement element = new ClasspathElement(uri);
- element.setValid(false);
- element.setRelativeText(name);
- if (cpEntry != null)
- element.setValuesSelected(cpEntry);
- element.setText(name);
- element.setEarProject(earProject);
- return element;
- }
-
- public void buildClasspathComponentDependencyMap(final IVirtualComponent comp, final Map pathToComp) {
- if (comp != null && comp instanceof J2EEModuleVirtualComponent) {
- J2EEModuleVirtualComponent j2eeComp = (J2EEModuleVirtualComponent) comp;
- IVirtualReference[] cpRefs = j2eeComp.getJavaClasspathReferences();
-
- for (int i = 0; i < cpRefs.length; i++) {
- // only ../ mappings supported at this level
- if (!cpRefs[i].getRuntimePath().equals(IClasspathDependencyConstants.RUNTIME_MAPPING_INTO_CONTAINER_PATH)) {
- continue;
- }
-
- final IVirtualComponent referencedComponent = cpRefs[i].getReferencedComponent();
- final IPath path = ClasspathDependencyUtil.getClasspathVirtualReferenceLocation(cpRefs[i]);
- final IVirtualComponent existingComp = (IVirtualComponent) pathToComp.get(path);
- if (existingComp != null) {
- // replace with a temp VirtualArchiveComponent whose IProject is set to a new pseudo name that is
- // the concatenation of all project contributions for that archive
- if (existingComp instanceof VirtualArchiveComponent) {
- final VirtualArchiveComponent oldComp = (VirtualArchiveComponent) existingComp;
- final IVirtualComponent newComp = updateDisplayVirtualArchiveComponent(oldComp, cpRefs[i]);
- pathToComp.put(path, newComp);
- }
- } else {
- pathToComp.put(path, referencedComponent);
- }
- }
- }
- }
-
- /**
- * Create a new VirtualArchiveComponent (used only for display purposes) whose IProject is set to a dummy value whose
- * name is a concatentation of the existing name and the name of the project associated with the new ref.
- * This is used to represent the case where a single unique archive is referenced/contributed by multiple dependent projects.
- */
- public static VirtualArchiveComponent updateDisplayVirtualArchiveComponent(final VirtualArchiveComponent oldComp, final IVirtualReference newRef) {
- final String newProjName = oldComp.getProject().getName() + " " + newRef.getReferencedComponent().getProject().getName();
- final IProject newProj = ResourcesPlugin.getWorkspace().getRoot().getProject(newProjName);
- final VirtualArchiveComponent newComponent = (VirtualArchiveComponent) ComponentCore.createArchiveComponent(newProj, oldComp.getName());
- return newComponent;
- }
-
- public ClasspathElement[] createClasspathEntryElements(final IVirtualComponent comp, final IPath archiveRuntimePath, final IPath classFolderRuntimePath) throws CoreException {
- final List elements = new ArrayList();
- if (comp != null && comp.getProject().isAccessible()) {
- final IProject project = comp.getProject();
- if (project.hasNature(JavaCore.NATURE_ID)) {
- final IJavaProject javaProject = JavaCore.create(project);
- final boolean isWebApp = J2EEProjectUtilities.isDynamicWebProject(project);
- final Map taggedEntries = ClasspathDependencyUtil.getRawComponentClasspathDependencies(javaProject);
-
- Iterator i = taggedEntries.keySet().iterator();
- while (i.hasNext()) {
- final IClasspathEntry entry = (IClasspathEntry) i.next();
- final IClasspathAttribute attrib = (IClasspathAttribute) taggedEntries.get(entry);
- final boolean isClassFolder = ClasspathDependencyUtil.isClassFolderEntry(entry);
- final IPath runtimePath = ClasspathDependencyUtil.getRuntimePath(attrib, isWebApp, isClassFolder);
- if (runtimePath != null && ((isClassFolder && !runtimePath.equals(classFolderRuntimePath)) || (!isClassFolder && !runtimePath.equals(archiveRuntimePath)))) {
- // if runtime path does not match target runtime path, skip
- continue;
- }
- final ClasspathElement element = createClasspathElementForEntry(project, entry);
- element.setSelected(true);
- addClasspathElement(element, element.getArchiveURI().toString());
- }
-
- final List potentialEntries = ClasspathDependencyUtil.getPotentialComponentClasspathDependencies(javaProject);
- i = potentialEntries.iterator();
- while (i.hasNext()) {
- final IClasspathEntry entry = (IClasspathEntry) i.next();
- if (isWebApp && classFolderRuntimePath.equals(IClasspathDependencyConstants.RUNTIME_MAPPING_INTO_COMPONENT_PATH) && ClasspathDependencyUtil.isClassFolderEntry(entry)) {
- // don't display class folder dependencies for dynamic web projects on the non-web lib dependency page
- continue;
- }
- final ClasspathElement element = createClasspathElementForEntry(project, entry);
- element.setSelected(false);
- addClasspathElement(element, element.getArchiveURI().toString());
- }
- }
- }
- return (ClasspathElement[]) elements.toArray(new ClasspathElement[elements.size()]);
- }
-
- private ClasspathElement createClasspathElementForEntry(final IProject project, final IClasspathEntry entry) {
- final IPath entryPath = entry.getPath();
- final URI archiveURI = URI.createURI(entryPath.toString());
- final int kind = entry.getEntryKind();
- String elementName = entryPath.toString();
- if (kind == IClasspathEntry.CPE_CONTAINER) {
- try {
- final IClasspathContainer container = JavaCore.getClasspathContainer(entryPath, JavaCore.create(project));
- if (container != null) {
- elementName = container.getDescription();
- }
- } catch (CoreException ce) {
- }
- }
-
- ClasspathElement element = createClasspathEntryElement(project, archiveURI, elementName, entry);
- return element;
- }
-
- /**
- * @param element
- */
- private void setInvalidProject(ClasspathElement element) {
- IProject earProj = element.getEarProject();
- //IVirtualComponent[] component = ComponentUtilities.getComponent(earProj.getName());
- IVirtualComponent refEarComponent = ComponentUtilities.getComponent(earProj.getName());
-
- IVirtualReference[] references = J2EEProjectUtilities.getComponentReferences(refEarComponent);
- String moduleName = element.getRelativeText();
- if(moduleName != null) {
- IVirtualComponent modComponent = null;
- for (int cnt=0; cnt < references.length; cnt++)
- {
- if (moduleName.equals(references[cnt].getArchiveName()))
- {
- modComponent = references[cnt].getReferencedComponent();
- }
- }
- if(modComponent != null) {
- IProject mappedProject = modComponent.getProject();
- element.setProject(mappedProject);
- }
- }
- }
-
- /**
- * Insert the method's description here. Creation date: (8/22/2001 1:17:21 PM)
- *
- * @return java.util.List
- */
- public java.util.List getClasspathElements() {
- if(classpathElements == null)
- classpathElements = new ArrayList();
- return classpathElements;
- }
-
- public java.util.List getSelectedClasspathElements() {
- ArrayList list = new ArrayList();
- Iterator it = getClasspathElements().iterator();
- while(it.hasNext()) {
- ClasspathElement element = (ClasspathElement)it.next();
- if( element.isSelected() ){
- list.add(element);
- }
- }
- return list;
- }
-
- /**
- * Adapter method to convert the manifest class path entries which map to a project to a list of
- * classpath entries for a java build path
- */
- protected IClasspathEntry[] getClasspathEntries(boolean filterSelected) {
- List result = new ArrayList();
- IClasspathEntry[] array = null;
- ClasspathElement element = null;
- if(classpathElements != null) {
- for (int i = 0; i < classpathElements.size(); i++) {
- element = (ClasspathElement) classpathElements.get(i);
- if (filterSelected && !element.isSelected())
- continue;
- array = ((ClasspathElement) classpathElements.get(i)).newClasspathEntries();
- if (array == null)
- continue;
- for (int j = 0; j < array.length; j++) {
- if (!result.contains(array[j]))
- result.add(array[j]);
- }
- }
- return (IClasspathEntry[]) result.toArray(new IClasspathEntry[result.size()]);
- }
- return null;
- }
-
- /**
- * Adapter method to convert the manifest class path entries which map to a project to a list of
- * classpath entries for a java build path
- */
- public IClasspathEntry[] getClasspathEntriesForAll() {
- return getClasspathEntries(false);
- }
-
- /**
- * Adapter method to convert the manifest class path entries which map to a project to a list of
- * classpath entries for a java build path
- */
- public IClasspathEntry[] getClasspathEntriesForSelected() {
- return getClasspathEntries(true);
- }
-
- protected EARFile getEARFile() {
- if (archive == null)
- return null;
-
- Container parent = archive.getContainer();
- if (parent != null && parent.isEARFile())
- return (EARFile) parent;
- return null;
- }
-
- protected static IProject getEARProject(Archive anArchive) {
- Container c = anArchive.getContainer();
- if (!c.isEARFile())
- return null;
- EARFile ear = (EARFile) c;
- LoadStrategy loader = ear.getLoadStrategy();
- if (!(loader instanceof EARComponentLoadStrategyImpl))
- return null;
-
- return ((EARComponentLoadStrategyImpl) loader).getComponent().getProject();
- }
-
- public Archive getArchive() {
- return archive;
- }
-
- protected IProject getProject(Archive anArchive) {
- IVirtualComponent comp = getComponent(anArchive);
- if (comp != null) {
- return comp.getProject();
- }
- return null;
- }
-
- protected IVirtualComponent getComponent(Archive anArchive) {
- LoadStrategy loader = anArchive.getLoadStrategy();
- if (loader instanceof ComponentLoadStrategyImpl)
- return ((ComponentLoadStrategyImpl) loader).getComponent();
- return null;
- }
-
- public String getText() {
- return archive.getURI();
- }
-
- protected Archive getArchive(String uri, List archives) {
- for (int i = 0; i < archives.size(); i++) {
- Archive anArchive = (Archive) archives.get(i);
-
- String archiveURIString = anArchive.getURI();
- URI archiveURI = URI.createURI(archiveURIString);
- boolean hasAbsolutePath = archiveURI.hasAbsolutePath();
- if( hasAbsolutePath ){
- archiveURIString = archiveURI.lastSegment();
- }
- if (archiveURIString.equals(uri))
- return anArchive;
- }
- return null;
- }
-
- protected IVirtualReference getVirtualReference(String uri, List archives) {
- for (int i = 0; i < archives.size(); i++) {
- IVirtualReference anArchive = (IVirtualReference) archives.get(i);
-
- String archiveURIString = anArchive.getArchiveName();
- if (archiveURIString.equals(uri))
- return anArchive;
- }
- return null;
- }
-
- public static boolean isValidDependency(IVirtualComponent referencedJAR, IVirtualComponent referencingJAR) {
- //No other modules should reference wars
- if (J2EEProjectUtilities.isDynamicWebComponent(referencedJAR))
- return false;
-
- if ( referencedJAR.getName().equals( referencingJAR.getName() ) )
- return false;
-
- //Clients can reference all but the WARs, which we've already covered
- // above; WARs and EJB JARs
- //can reference all but WARs, above, or ApplicationClients
- return J2EEProjectUtilities.isApplicationClientComponent(referencingJAR) || !J2EEProjectUtilities.isApplicationClientComponent(referencedJAR);
- }
-
- protected void initializeElements() {
-// ejbToClientJARs = J2EEProjectUtilities.collectEJBClientJARs(getEARFile());
- ejbToClientJARs = new HashMap();
- IVirtualComponent currentComponent = null;
- IVirtualComponent clientComponent = null;
- Object rootModelObject = null;
- IModelProvider modelProvider = null;
- String ejbClientJarName = null;
- List archives = null;
- IVirtualReference other = null;
- ClasspathElement element = null;
- String[] cp = new String[0];
-
- if (earComponent != null) {
- IVirtualReference[] references = earComponent.getReferences();
- for (int cnt=0; cnt<references.length; cnt++)
- {
- clientComponent = null;
- modelProvider = null;
- rootModelObject = null;
- ejbClientJarName = null;
- currentComponent = references[cnt].getReferencedComponent();
- if (J2EEProjectUtilities.isEJBComponent(currentComponent))
- {
- if(currentComponent.isBinary()){
- //TODO add binary support
- continue;
- } else {
- modelProvider = ModelProviderManager.getModelProvider(currentComponent);
- if(modelProvider==null) {
- continue;
- }
- rootModelObject = modelProvider.getModelObject();
- }
- if (rootModelObject instanceof EJBJar)
- {
- ejbClientJarName = ((EJBJar)rootModelObject).getEjbClientJar();
- }
- else if (rootModelObject instanceof org.eclipse.jst.j2ee.ejb.EJBJar)
- {
- ejbClientJarName = ((org.eclipse.jst.j2ee.ejb.EJBJar)rootModelObject).getEjbClientJar();
- }
- if (ejbClientJarName != null)
- {
- clientComponent = J2EEProjectUtilities.getModule(earComponent, ejbClientJarName);
- }
- if (clientComponent != null)
- {
- ejbToClientJARs.put(currentComponent, clientComponent);
- }
- }
- }
- clientToEJBJARs = reverse(ejbToClientJARs);
- classpathElements = new ArrayList();
- urisToElements = new HashMap();
-
-
- try {
- // cp = archive.getManifest().getClassPathTokenized();
- manifest = J2EEProjectUtilities.readManifest(component.getProject());
- cp = manifest.getClassPathTokenized();
- } catch (ManifestException ex) {
- Logger.getLogger().logError(ex);
- }
- String projectUri = earComponent.getReference(component.getName()).getArchiveName();
- archives = new ArrayList(Arrays.asList(earComponent.getReferences()));
-
- for (int i = 0; i < cp.length; i++) {
- String cpEntry = cp[i];
- String uri = ArchiveUtil.deriveEARRelativeURI(cpEntry, projectUri);
-
- other = getVirtualReference(uri, archives);
- if (other != null && isValidDependency(other.getReferencedComponent(), component)) {
- element = createElement(component, other, cpEntry);
- archives.remove(other);
- } else {
- element = createInvalidElement(cpEntry);
- if (element.representsImportedJar()) {
- element.setValid(true);
- element.setProject(getProject(archive));
- }
- if (other != null)
- element.setProject(other.getReferencedComponent().getProject());
-
- if( other == null ){
- //making a best guess for the project name
- if( element.getProject() == null ){
- int index = cpEntry.indexOf(".jar"); //$NON-NLS-1$
- // if jar is nested in a folder you must not look for
- // project (segments in project name cause assertion
- // error)
- boolean isMultiSegment = cpEntry
- .indexOf(File.pathSeparator) == -1;
- if (!isMultiSegment && index > 0) {
- String projectName = cpEntry.substring(0, index);
- IPath projectPath = new Path(projectName);
- //if there are multiple segments and no reference archive is found
- //then either this is pointing to a jar in the EAR that doesn't exist
- //or the DependecyGraphManager is stale
- if(projectPath.segmentCount() > 1){
- if(earComponent != null && earComponent.getProject() != null){
- element.setProject(earComponent.getProject());
- }
- } else {
- IProject project = ProjectUtilities.getProject( projectName );
- if( project != null && project.exists() )
- element.setProject( project );
- }
- }
- }
- }
- }
- addClasspathElement(element, uri);
- }
- }
-
- // Add resolved contributions from tagged classpath entries
- // XXX Don't show resolved contributions from tagged classpath entries on this project's classpath; we should elements corresponding to the raw entries instead
- //createClasspathComponentDependencyElements(comp);
-
- // Add elements for raw classpath entries (either already tagged or potentially taggable)
- try {
- createClasspathEntryElements(component, IClasspathDependencyConstants.RUNTIME_MAPPING_INTO_CONTAINER_PATH, IClasspathDependencyConstants.RUNTIME_MAPPING_INTO_COMPONENT_PATH);
- } catch (CoreException ce) {
- Logger.getLogger(J2EEPlugin.PLUGIN_ID).logError(ce);
- }
-
- if (earComponent != null) {
- Collections.sort(archives, comparator);
- //Anything that remains in the list of available archives that is valid should be
- //available for selection
- for (int i = 0; i < archives.size(); i++) {
- other = (IVirtualReference) archives.get(i);
-
- if (other != archive && isValidDependency(other.getReferencedComponent(), component)) {
- IProject project = other.getReferencedComponent().getProject();
- if (null == targetProjectName || null == project || !project.getName().equals(targetProjectName)) {
- element = createElement(component, other, null);
- element.setProject(other.getReferencedComponent().getProject());
- addClasspathElement(element, other.getArchiveName());
- }
- }
- }
- IVirtualReference[] newrefs = earComponent.getReferences();
- for( int i=0; i < newrefs.length; i++){
- IVirtualReference ref = newrefs[i];
- IVirtualComponent referencedComponent = ref.getReferencedComponent();
- boolean isBinary = referencedComponent.isBinary();
- if( isBinary ){
-
- /**
- * Warning clean-up 12/05/2005
- */
- //String uri = J2EEProjectUtilities.getResolvedPathForArchiveComponent(referencedComponent.getName()).toString();
- String unresolvedURI = ref.getArchiveName();
- if(unresolvedURI == null){
- try {
- unresolvedURI = ModuleURIUtil.getArchiveName(URI.createURI(ModuleURIUtil.getHandleString(referencedComponent)));
- } catch (UnresolveableURIException e) {
- e.printStackTrace();
- }
- }
-
- if(unresolvedURI != null){
- URI archiveURI = URI.createURI(unresolvedURI);
-
- boolean alreadyInList = false;
- Iterator iter = getClasspathElements().iterator();
- while(iter.hasNext()){
- ClasspathElement tmpelement = (ClasspathElement)iter.next();
- if(unresolvedURI.endsWith(tmpelement.getText())){
- alreadyInList = true;
- break;
- }
- }
-
- if( !alreadyInList ){
- if( inManifest(cp, archiveURI.lastSegment())){
- element = createArchiveElement(URI.createURI(ModuleURIUtil.getHandleString(referencedComponent)), archiveURI.lastSegment(), archiveURI.lastSegment());
- addClasspathElement(element, unresolvedURI);
- }else{
- element = createArchiveElement(URI.createURI(ModuleURIUtil.getHandleString(referencedComponent)), archiveURI.lastSegment(), null);
- addClasspathElement(element, unresolvedURI);
- }
- }
- }
- }
- }
- }
- }
-
- public ClasspathElement createClasspathArchiveElement(final IProject project, URI archiveURI, String unresolvedURI) {
- final ClasspathElement element = createArchiveElement(archiveURI, archiveURI.lastSegment(), archiveURI.lastSegment());
- element.setProject(project);
- element.setClasspathDependency(true);
- return element;
- }
-
- public ClasspathElement createClasspathEntryElement(final IProject project, URI archiveURI, String elementName, IClasspathEntry entry) {
- final ClasspathElement element = createArchiveElement(archiveURI, elementName, elementName);
- element.setProject(project);
- element.setClasspathEntry(true, entry);
- element.setValid(true);
- return element;
- }
-
- boolean inManifest(String[] cp, String archiveName ){
- boolean result = false;
- String cpEntry = "";
- for (int i = 0; i < cp.length; i++) {
- cpEntry = cp[i];
- if( archiveName.equals(cpEntry)){
- result = true;
- }
- }
- return result;
- }
-
- protected List loadClassPathArchives(){
- /**
- * Warning clean-up 12/05/2005
- */
- //LoadStrategy loadStrat = archive.getLoadStrategy();
-
- List archives = new ArrayList();
-
- if( earComponent!= null){
- IVirtualReference[] newrefs = earComponent.getReferences();
- for( int i=0; i < newrefs.length; i++){
- IVirtualReference ref = newrefs[i];
- IVirtualComponent referencedComponent = ref.getReferencedComponent();
- boolean isBinary = referencedComponent.isBinary();
-
- if( isBinary ){
- String uri = J2EEProjectUtilities.getResolvedPathForArchiveComponent(referencedComponent.getName()).toString();
-
- try {
- ZipFileLoadStrategyImpl strat = createLoadStrategy(uri);
- Archive archive = null;
- try {
- archive = CommonarchiveFactoryImpl.getActiveFactory().primOpenArchive(strat, uri);
- } catch (OpenFailureException e) {
- // TODO Auto-generated catch block
- Logger.getLogger().logError(e);
- }
-
- archives.add(archive);
-
- } catch (FileNotFoundException e) {
- Logger.getLogger().logError(e);
- } catch (IOException e) {
- Logger.getLogger().logError(e);
- }
- }
-
- }
- }
- return archives;
- }
-
- Archive getClassPathArchive(String uri, List archives){
- for (int i = 0; i < archives.size(); i++) {
- Archive anArchive = (Archive) archives.get(i);
-
- String archiveURIString = anArchive.getURI();
- URI archiveURI = URI.createURI(archiveURIString);
- boolean hasAbsolutePath = archiveURI.hasAbsolutePath();
- if( hasAbsolutePath ){
- archiveURIString = archiveURI.lastSegment();
- }
- if (archiveURIString.equals(uri))
- return anArchive;
- }
- return null;
- }
-
- boolean isClassPathArchive(String uri, List archives){
- for (int i = 0; i < archives.size(); i++) {
- Archive anArchive = (Archive) archives.get(i);
-
- String archiveURIString = anArchive.getURI();
- URI archiveURI = URI.createURI(archiveURIString);
- /**
- * Warning clean-up 12/05/2005
- */
- //boolean hasAbsolutePath = archiveURI.hasAbsolutePath();
- if( archiveURI.lastSegment().equals(uri) ){
- return true;
- }
- }
- return false;
- }
-
- public ZipFileLoadStrategyImpl createLoadStrategy(String uri) throws FileNotFoundException, IOException {
- String filename = uri.replace('/', java.io.File.separatorChar);
- java.io.File file = new java.io.File(filename);
- if (!file.exists()) {
- throw new FileNotFoundException(CommonArchiveResourceHandler.getString(CommonArchiveResourceHandler.file_not_found_EXC_, (new Object[]{uri, file.getAbsolutePath()}))); // = "URI Name: {0}; File name: {1}"
- }
- if (file.isDirectory()) {
- throw new FileNotFoundException(CommonArchiveResourceHandler.getString(CommonArchiveResourceHandler.file_not_found_EXC_, (new Object[]{uri, file.getAbsolutePath()}))); // = "URI Name: {0}; File name: {1}"
- }
- return new org.eclipse.jst.j2ee.commonarchivecore.internal.strategy.ZipFileLoadStrategyImpl(file);
- }
-
-
- private void initializeEARProject(EARFile earFile) {
- LoadStrategy loadStrat = earFile.getLoadStrategy();
- if (loadStrat instanceof EARComponentLoadStrategyImpl){
- earComponent = ((EARComponentLoadStrategyImpl) loadStrat).getComponent();
- earProject = ((EARComponentLoadStrategyImpl) loadStrat).getComponent().getProject();
- }
- }
-
- private void setType(ClasspathElement element, Archive other) {
- if (other == null)
- return;
- else if (clientToEJBJARs.containsKey(other))
- element.setJarType(ClasspathElement.EJB_CLIENT_JAR);
- else if (other.isEJBJarFile())
- element.setJarType(ClasspathElement.EJB_JAR);
- }
-
- private void setType(ClasspathElement element, IVirtualReference other) {
- if (other == null)
- return;
- else if (clientToEJBJARs.containsKey(other.getReferencedComponent()))
- element.setJarType(ClasspathElement.EJB_CLIENT_JAR);
- else if (J2EEProjectUtilities.isEJBComponent(other.getReferencedComponent()))
- element.setJarType(ClasspathElement.EJB_JAR);
- }
-
- /**
- * @param localejbToClientJARs
- * @return
- */
- private Map reverse(Map localejbToClientJARs) {
- if (localejbToClientJARs == null || localejbToClientJARs.isEmpty())
- return Collections.EMPTY_MAP;
- Map result = new HashMap();
- Iterator iter = localejbToClientJARs.entrySet().iterator();
- while (iter.hasNext()) {
- Map.Entry entry = (Map.Entry) iter.next();
- result.put(entry.getValue(), entry.getKey());
- }
- return result;
- }
-
- public void addClasspathElement(ClasspathElement element, String uri) {
- getClasspathElements().add(element);
- getUrisToElements().put(uri, element);
- element.setParentSelection(this);
- }
-
- /**
- * Insert the method's description here. Creation date: (8/22/2001 6:05:11 PM)
- *
- * @return boolean
- */
- public boolean isModified() {
- return modified;
- }
-
- /**
- * Insert the method's description here. Creation date: (8/22/2001 6:05:11 PM)
- *
- * @param newModified
- * boolean
- */
- public void setModified(boolean newModified) {
- modified = newModified;
- }
-
- protected void setProjectValues(ClasspathElement element, Archive referencedArchive) {
- IProject p = getProject(referencedArchive);
- if (p == null)
- return;
-
- element.setProject(p);
- //Handle the imported jars in the project
- String[] cp = null;
- try {
- cp = referencedArchive.getManifest().getClassPathTokenized();
- } catch (ManifestException mfEx) {
- Logger.getLogger().logError(mfEx);
- cp = new String[]{};
- }
- List paths = new ArrayList(cp.length);
- for (int i = 0; i < cp.length; i++) {
-
- IFile file = null;
- try {
- file = p.getFile(cp[i]);
- } catch (IllegalArgumentException invalidPath) {
- continue;
- }
- if (file.exists())
- paths.add(file.getFullPath());
- }
- if (!paths.isEmpty())
- element.setImportedJarPaths(paths);
- }
-
- protected void setProjectValues(ClasspathElement element, IVirtualReference referencedArchive) {
- IProject p = referencedArchive.getReferencedComponent().getProject();
- if (p == null)
- return;
-
- element.setProject(p);
-
- IVirtualComponent comp = ComponentCore.createComponent(p);
- if( comp == null )
- return;
-
- //Handle the imported jars in the project
- String[] cp = null;
- try {
-// cp = referencedArchive.getManifest().getClassPathTokenized();
- ArchiveManifest referencedManifest = null;
-
- if( comp.isBinary() ){
- referencedManifest = J2EEProjectUtilities.readManifest(comp);
- }else{
- referencedManifest = J2EEProjectUtilities.readManifest(p);
- }
- if( referencedManifest != null )
- cp = referencedManifest.getClassPathTokenized();
- } catch (ManifestException mfEx) {
- Logger.getLogger().logError(mfEx);
- cp = new String[]{};
- }
- if( cp != null ){
- List paths = new ArrayList(cp.length);
- for (int i = 0; i < cp.length; i++) {
-
- IFile file = null;
- try {
- file = p.getFile(cp[i]);
- } catch (IllegalArgumentException invalidPath) {
- continue;
- }
- if (file.exists())
- paths.add(file.getFullPath());
- }
- if (!paths.isEmpty())
- element.setImportedJarPaths(paths);
- }
- }
-
- public String toString() {
- StringBuffer sb = new StringBuffer();
- for (int i = 0; i < classpathElements.size(); i++) {
- ClasspathElement element = (ClasspathElement) classpathElements.get(i);
- if (element.isSelected() && !element.isClasspathDependency() && !element.isClasspathEntry()) {
- sb.append(element.getRelativeText());
- sb.append(" "); //$NON-NLS-1$
- }
- }
- //Remove the trailing space
- if (sb.length() > 0)
- sb.deleteCharAt(sb.length() - 1);
- return sb.toString();
- }
-
- public void setAllSelected(boolean selected) {
- setAllSelected(classpathElements, selected);
- }
-
- public void setAllSelected(List elements, boolean selected) {
- for (int i = 0; i < elements.size(); i++) {
- ClasspathElement elmt = (ClasspathElement) elements.get(i);
- elmt.setSelected(selected);
- }
- }
-
- /* borrowed code from jdt */
- protected List moveUp(List elements, List move) {
- int nElements = elements.size();
- List res = new ArrayList(nElements);
- Object floating = null;
- for (int i = 0; i < nElements; i++) {
- Object curr = elements.get(i);
- if (move.contains(curr)) {
- res.add(curr);
- } else {
- if (floating != null) {
- res.add(floating);
- }
- floating = curr;
- }
- }
- if (floating != null) {
- res.add(floating);
- }
- return res;
- }
-
- /* borrowed code from jdt */
- public void moveUp(List toMoveUp) {
- setModifiedIfAnySelected(toMoveUp);
- if (toMoveUp.size() > 0)
- classpathElements = moveUp(classpathElements, toMoveUp);
- }
-
- /* borrowed code from jdt */
- public void moveDown(List toMoveDown) {
- setModifiedIfAnySelected(toMoveDown);
- if (toMoveDown.size() > 0)
- classpathElements = reverse(moveUp(reverse(classpathElements), toMoveDown));
-
- }
-
- /* borrowed code from jdt */
- protected List reverse(List p) {
- List reverse = new ArrayList(p.size());
- for (int i = p.size() - 1; i >= 0; i--) {
- reverse.add(p.get(i));
- }
- return reverse;
- }
-
- public ClasspathElement getClasspathElement(String uri) {
- if (urisToElements == null)
- return null;
- return (ClasspathElement) urisToElements.get(uri);
- }
-
- public ClasspathElement getClasspathElement(IVirtualComponent archiveComponent) {
- if (archiveComponent != null) {
- for (int i = 0; i < classpathElements.size(); i++) {
- ClasspathElement elmnt = (ClasspathElement) classpathElements.get(i);
- if (archiveComponent.equals(elmnt.getComponent()))
- return elmnt;
- }
- }
- return null;
- }
-
- public ClasspathElement getClasspathElement(IProject archiveProject) {
- if (archiveProject != null) {
- for (int i = 0; i < classpathElements.size(); i++) {
- ClasspathElement elmnt = (ClasspathElement) classpathElements.get(i);
- if (archiveProject.equals(elmnt.getProject()))
- return elmnt;
- }
- }
- return null;
- }
-
- public boolean hasDirectOrIndirectDependencyTo(IProject archiveProject) {
- ClasspathElement element = getClasspathElement(archiveProject);
- if (element == null)
- return false;
- Archive anArchive = null;
- if (element.isValid()) {
- try {
- anArchive = (Archive) getEARFile().getFile(element.getText());
- } catch (FileNotFoundException e) {
- }
- }
- return anArchive != null && archive.hasClasspathVisibilityTo(anArchive);
- }
-
- public boolean hasDirectOrIndirectDependencyTo(String jarName) {
- ClasspathElement element = getClasspathElement(jarName);
- if (element == null)
- return false;
- Archive anArchive = null;
- if (element.isValid()) {
- try {
- anArchive = (Archive) getEARFile().getFile(element.getText());
- } catch (FileNotFoundException e) {
- }
- }
- return anArchive != null && archive.hasClasspathVisibilityTo(anArchive);
- }
-
-
- public boolean isAnyJarSelected(int type) {
- if (classpathElements != null) {
- for (int i = 0; i < classpathElements.size(); i++) {
- ClasspathElement element = (ClasspathElement) classpathElements.get(i);
- if (element.getJarType() == type && element.isSelected())
- return true;
- }
- }
- return false;
- }
-
-
- public boolean isAnyEJBJarSelected() {
- return isAnyJarSelected(ClasspathElement.EJB_JAR);
- }
-
-
-
- public boolean isAnyEJBClientJARSelected() {
- return isAnyJarSelected(ClasspathElement.EJB_CLIENT_JAR);
-
- }
-
- /**
- * @return
- */
- public int getFilterLevel() {
- return filterLevel;
- }
-
- /**
- * @param i
- */
- public void setFilterLevel(int i) {
- filterLevel = i;
- }
-
- /**
- * This method selects or deselects indivual elements based on the filter level, and
- * additionally sets the filter level.
- *
- * @param i
- */
- public void selectFilterLevel(int level) {
- setFilterLevel(level);
- switch (level) {
- case FILTER_EJB_CLIENT_JARS :
- invertClientJARSelections(ClasspathElement.EJB_CLIENT_JAR);
- break;
- case FILTER_EJB_SERVER_JARS :
- invertClientJARSelections(ClasspathElement.EJB_JAR);
- break;
- default :
- break;
- }
- }
-
- public void invertClientJARSelection(IProject aProject, IProject opposite) {
- ClasspathElement element = getClasspathElement(aProject);
- ClasspathElement oppositeElement = (opposite == null ? null : getClasspathElement(opposite));
- if (element.isSelected())
- invertSelectionIfPossible(element, oppositeElement);
- }
-
- private void invertClientJARSelections(int elementType) {
- if (classpathElements == null)
- return;
-
- for (int i = 0; i < classpathElements.size(); i++) {
- ClasspathElement element = (ClasspathElement) classpathElements.get(i);
- if (element.getJarType() == elementType && element.isSelected()) {
- invertSelectionIfPossible(element, null);
- }
- }
- }
-
- /**
- * @param element
- * @param elementType
- */
- private void invertSelectionIfPossible(ClasspathElement element, ClasspathElement opposite) {
- if (element == null)
- return;
- if (opposite == null)
- opposite = getOppositeElement(element);
- if (opposite != null) {
- opposite.setSelected(true);
- element.setSelected(false);
- }
- }
-
- /**
- * If the element represents an EJB client JAR, returns the corresponding server JAR. If the
- * element represents an EJB server JAR, returns the corresponding client JAR.
- */
- public ClasspathElement getOppositeElement(ClasspathElement element) {
- String uri = element.getText();
- IVirtualComponent target = element.getTargetComponent();
- if (uri == null || target == null)
- return null;
- IVirtualComponent oppositeJAR = null;
- switch (element.getJarType()) {
- case (ClasspathElement.EJB_CLIENT_JAR) :
- oppositeJAR = (IVirtualComponent) clientToEJBJARs.get(target);
- break;
- case (ClasspathElement.EJB_JAR) :
- oppositeJAR = (IVirtualComponent) ejbToClientJARs.get(target);
- break;
- default :
- break;
- }
- if (oppositeJAR != null)
- return getClasspathElement(oppositeJAR);
-
- return null;
- }
-
- private void setModifiedIfAnySelected(List elements) {
- for (int i = 0; i < elements.size(); i++) {
- ClasspathElement element = (ClasspathElement) elements.get(i);
- if (element.isSelected())
- setModified(true);
- }
- }
-
- public boolean isMyClientJAR(ClasspathElement element) {
- if (element == null || ejbToClientJARs == null)
- return false;
- IVirtualComponent myClientJar = (IVirtualComponent) ejbToClientJARs.get(component);
- return myClientJar != null && myClientJar == element.getTargetComponent();
- }
-
- public Map getUrisToElements() {
- if(urisToElements == null)
- urisToElements = new HashMap();
- return urisToElements;
- }
-
-}
diff --git a/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/application/internal/operations/ClasspathElement.java b/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/application/internal/operations/ClasspathElement.java
deleted file mode 100644
index 86ef605f4..000000000
--- a/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/application/internal/operations/ClasspathElement.java
+++ /dev/null
@@ -1,574 +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.application.internal.operations;
-
-
-
-import java.io.FileNotFoundException;
-import java.util.ArrayList;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-
-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.Path;
-import org.eclipse.emf.common.util.URI;
-import org.eclipse.jdt.core.IClasspathEntry;
-import org.eclipse.jdt.core.JavaCore;
-import org.eclipse.jem.util.logger.proxy.Logger;
-import org.eclipse.jst.j2ee.commonarchivecore.internal.Archive;
-import org.eclipse.jst.j2ee.commonarchivecore.internal.EARFile;
-import org.eclipse.jst.j2ee.commonarchivecore.internal.File;
-import org.eclipse.jst.j2ee.commonarchivecore.internal.util.ArchiveUtil;
-import org.eclipse.jst.j2ee.internal.archive.operations.J2EEImportConstants;
-import org.eclipse.jst.j2ee.internal.plugin.J2EEPlugin;
-import org.eclipse.jst.j2ee.internal.project.J2EEProjectUtilities;
-import org.eclipse.wst.common.componentcore.ComponentCore;
-import org.eclipse.wst.common.componentcore.UnresolveableURIException;
-import org.eclipse.wst.common.componentcore.internal.impl.ModuleURIUtil;
-import org.eclipse.wst.common.componentcore.resources.IVirtualComponent;
-import org.eclipse.wst.common.componentcore.resources.IVirtualReference;
-
-
-public class ClasspathElement {
- public final static int UTIL_JAR = 0;
- public final static int EJB_JAR = 1;
- public final static int EJB_CLIENT_JAR = 2;
- protected int jarType = UTIL_JAR;
- /** The owner archive of this entry */
- protected Archive archive;
-
- /** The archive this entry references, if it exists */
- protected Archive targetArchive;
-
- /** The display text for this item */
- protected String text;
- /** Indicates if this is selected in the view */
- protected boolean selected;
- protected boolean valid;
- /** Indicates if this element represents a component dependency associated with a resolved Java classpath entry that is mapped to the virtual component api */
- protected boolean isClasspathDependency = false;
- /** Indicates if this element represents a Java classpath entry */
- protected boolean isClasspathEntry= false;
- /** For elments that represent a Java classpath entry, holds the entry */
- protected IClasspathEntry classpathEntry = null;
-
- /**
- * The text that is an actual Class-Path entry in the Manifest; in the case of multi-segment
- * uris, might look like ../xxx
- */
- protected String relativeText;
- /** The project that corresponds to the dependent module, when it exists */
- protected IProject project;
- /**
- * If the project is not null, there may be imported jars in the project List of IPath
- */
- protected List importedJarPaths;
- protected IProject earProject;
- protected ClassPathSelection parentSelection;
- protected URI archiveURI;
- protected String earContentFolder;
- protected IVirtualComponent component;
- protected IVirtualComponent targetComponent;
-
- public ClasspathElement(Archive anArchive) {
- super();
- archive = anArchive;
- }
-
- public ClasspathElement(IProject project) {
- super();
- this.project = project;
- }
-
- public ClasspathElement(URI aArchiveURI) {
- super();
- archiveURI = aArchiveURI;
- }
-
- public ClasspathElement(IVirtualComponent aComponent) {
- super();
- this.component = aComponent;
- this.project = aComponent.getProject();
- }
-
- protected void computeRelativeText() {
- if (archive != null) {
- relativeText = J2EEProjectUtilities.computeRelativeText(archive.getURI(), getText());
- if (relativeText == null)
- relativeText = getText();
- }
- if (component != null)
- {
- IVirtualComponent earComponent = ComponentCore.createComponent(earProject);
- IVirtualReference[] refs = earComponent.getReferences();
- IVirtualReference reference = null;
- String archiveURI = null;
- for (int i = 0; i < refs.length; i++) {
- reference = refs[i];
- if( component.equals(reference.getReferencedComponent())){
- archiveURI = reference.getArchiveName();
- }
- }
- if (archiveURI != null)
- {
- relativeText = J2EEProjectUtilities.computeRelativeText(archiveURI, getText());
- }
- if (relativeText == null)
- relativeText = getText();
- }
- }
-
- /**
- * Insert the method's description here. Creation date: (8/28/2001 5:07:26 PM)
- *
- * @return org.eclipse.core.resources.IProject
- */
- public org.eclipse.core.resources.IProject getEarProject() {
- return earProject;
- }
-
- protected IFile getImportedJarAsIFile() {
- if (getProject() != null) {
- if (getText() != null && getText().endsWith(J2EEImportConstants.IMPORTED_JAR_SUFFIX)) {
- IFile file = getProject().getFile(getText());
- if (file != null && file.exists())
- return file;
- }
- }
- return null;
- }
-
- /**
- * Insert the method's description here. Creation date: (8/28/2001 4:33:35 PM)
- *
- * @return java.util.List
- */
- public java.util.List getImportedJarPaths() {
- return importedJarPaths;
- }
-
- /**
- * Insert the method's description here. Creation date: (8/27/2001 1:14:04 PM)
- *
- * @return int
- */
- public int getJarType() {
- return jarType;
- }
-
- /**
- * Insert the method's description here. Creation date: (8/25/2001 6:21:01 PM)
- *
- * @return org.eclipse.core.resources.IProject
- */
- public org.eclipse.core.resources.IProject getProject() {
- return project;
- }
-
- public IVirtualComponent getComponent() {
- if(project != null){
- return ComponentCore.createComponent(project);
- } else if(relativeText != null){
- IVirtualComponent earComponent = ComponentCore.createComponent(earProject);
- if(earComponent != null) {
- IVirtualReference[] refs = earComponent.getReferences();
- for (int i = 0; i < refs.length; i++) {
- IVirtualReference reference = refs[i];
- if( reference.getReferencedComponent() != null ){
- String name = reference.getReferencedComponent().getName();
- if(name.lastIndexOf('/') != -1){
- name = name.substring(name.lastIndexOf('/')+1);
- }
- if (name.equals(relativeText)){
- return reference.getReferencedComponent();
- }
- }
- }
- }
- }
- return null;
- }
-
-
- public String getProjectName() {
- return project == null ? null : project.getName();
- }
-
- public java.lang.String getRelativeText() {
- if (relativeText == null)
- computeRelativeText();
- return relativeText;
- }
-
- /**
- * Insert the method's description here. Creation date: (8/22/2001 11:00:36 AM)
- *
- * @return java.lang.String
- */
- public java.lang.String getText() {
- return text;
- }
-
- /**
- * Insert the method's description here. Creation date: (8/22/2001 11:01:46 AM)
- *
- * @return boolean
- */
- public boolean isSelected() {
- return selected;
- }
-
- /**
- * Determines if this ClasspathElement is associated with a resolved Java classpath entry
- * that is tagged as a component dependency.
- * @return True if a classpath component dependency.
- */
- public boolean isClasspathDependency() {
- return isClasspathDependency;
- }
-
- /**
- * Sets whether this ClasspathElement is associated with a resolved Java classpath entry
- * that is tagged as a component dependency.
- * @param classpathDependency True if a classpath component dependency.
- */
- public void setClasspathDependency(final boolean classpathDependency) {
- this.isClasspathDependency = classpathDependency;
- }
-
- /**
- * Determines if this ClasspathElement is associated with a Java classpath entry
- * that is either currently tagged or can be tagged as a component dependency.
- * @return True if a classpath component dependency.
- */
- public boolean isClasspathEntry() {
- return isClasspathEntry;
- }
-
- /**
- * Sets whether this ClasspathElement is associated with a Java classpath entry
- * that is either currently tagged or can be tagged as a component dependency.
- * @param isClasspathEntry True if a classpath entry.
- * @param entry The associated classpath entry.
- */
- public void setClasspathEntry(final boolean isClasspathEntry, final IClasspathEntry entry) {
- this.isClasspathEntry= isClasspathEntry;
- this.classpathEntry = entry;
- }
-
- /**
- * Retrieves any associated classpath entry.
- * @return Associated classpath entry, if there is one.
- */
- public IClasspathEntry getClasspathEntry() {
- return classpathEntry;
- }
-
- /**
- * Insert the method's description here. Creation date: (8/27/2001 1:04:35 PM)
- *
- * @return boolean
- */
- public boolean isValid() {
- return valid;
- }
-
- public IResource getResource() {
- if (project != null)
- return project;
- return earProject.getFile(getText());
- }
-
- public IClasspathEntry[] newClasspathEntriesForArchive() {
- if( !archiveURI.equals("")){
- String resourcePath = "";
- try {
- resourcePath = ModuleURIUtil.getArchiveName(archiveURI);
- } catch (UnresolveableURIException e) {
- Logger.getLogger().logError(e);
- }
- IPath resPath = new Path(resourcePath);
- if (!resPath.isAbsolute())
- resPath = resPath.makeAbsolute();
- java.io.File file = new java.io.File(resourcePath);
- if( file.exists() || J2EEPlugin.getWorkspace().getRoot().exists(new Path(resourcePath))){
- return new IClasspathEntry[]{JavaCore.newLibraryEntry( resPath, null, null, true)};
- }else{
- return new IClasspathEntry[]{JavaCore.newVariableEntry( resPath, null, null)};
- }
- }
- return new IClasspathEntry[0];
- }
-
-
- /**
- * Adapter method to convert this manifest class path element to zero or more classpath entries
- * for a java build path
- */
- public IClasspathEntry[] newClasspathEntries(Set visited) {
- if (visited.contains(this))
- return new IClasspathEntry[0];
- visited.add(this);
- if (representsImportedJar())
- return new IClasspathEntry[]{JavaCore.newLibraryEntry(getImportedJarAsIFile().getFullPath(), null, null)};
-
- if( archiveURI != null && !archiveURI.equals("") ){
- return newClasspathEntriesForArchive();
- }
- if (!valid && isSelected())
- return new IClasspathEntry[0];
-
- if (project == null)
- return newClasspathEntriesFromEARProject(visited);
-
- IClasspathEntry projectEntry = JavaCore.newProjectEntry(getProject().getFullPath(), true);
- if (importedJarPaths == null || importedJarPaths.isEmpty())
- return new IClasspathEntry[]{projectEntry};
-
- List result = new ArrayList(2);
- result.add(projectEntry);
- for (int i = 0; i < importedJarPaths.size(); i++) {
- IPath path = (IPath) importedJarPaths.get(i);
- result.add(JavaCore.newLibraryEntry(path, null, null));
- }
- return (IClasspathEntry[]) result.toArray(new IClasspathEntry[result.size()]);
- }
-
- public IClasspathEntry[] newClasspathEntries() {
- return newClasspathEntries(new HashSet());
- }
-
- protected IClasspathEntry newClasspathEntryFromEARProj() {
- IPath path = earProject.getFullPath().append( getEarContentFolder() + IPath.SEPARATOR + earProject.getFile(getText()).getProjectRelativePath());
- return JavaCore.newLibraryEntry(path, path, null, true);
- }
-
- /**
- * The archive is in the EAR and not in a project.
- */
- protected IClasspathEntry[] newClasspathEntriesFromEARProject(Set visited) {
- List cpEntries = new ArrayList();
- cpEntries.add(newClasspathEntryFromEARProj());
- traverseClasspaths(cpEntries, visited);
- return (IClasspathEntry[]) cpEntries.toArray(new IClasspathEntry[cpEntries.size()]);
- }
-
- /*
- * If you have a dependency to a JAR in the EAR project, and the JAR depends on another JAR in
- * the EAR; you want to compile cleanly after import, so you need both those JARs on your build
- * path
- */
- protected void traverseClasspaths(List projectCpEntries, Set visited) {
-
- File aFile = null;
- try {
- aFile = getEARFile().getFile(getText());
- } catch (FileNotFoundException notThere) {
- }
- if (aFile == null || !aFile.isArchive())
- return;
-
- Archive depArchive = (Archive) aFile;
- String[] manifestCpEntries = depArchive.getManifest().getClassPathTokenized();
- for (int i = 0; i < manifestCpEntries.length; i++) {
- String uri = ArchiveUtil.deriveEARRelativeURI(manifestCpEntries[i], depArchive);
- if (uri == null)
- continue;
- ClasspathElement other = parentSelection.getClasspathElement(uri);
- //If the other element is already selected, then
- // we don't need to add it again
- if (other == null || other.isSelected())
- continue;
- IClasspathEntry[] cpEntries = other.newClasspathEntries(visited);
- for (int j = 0; j < cpEntries.length; j++) {
- if (!projectCpEntries.contains(cpEntries[j]))
- projectCpEntries.add(cpEntries[j]);
- }
- }
- }
-
-
- public boolean representsImportedJar() {
- return getImportedJarAsIFile() != null;
- }
-
- /**
- * Insert the method's description here. Creation date: (8/28/2001 5:07:26 PM)
- *
- * @param newEarProject
- * org.eclipse.core.resources.IProject
- */
- public void setEarProject(org.eclipse.core.resources.IProject newEarProject) {
- earProject = newEarProject;
- }
-
- /**
- * Insert the method's description here. Creation date: (8/28/2001 4:33:35 PM)
- *
- * @param newImportedJarPaths
- * java.util.List
- */
- public void setImportedJarPaths(java.util.List newImportedJarPaths) {
- importedJarPaths = newImportedJarPaths;
- }
-
- /**
- * Insert the method's description here. Creation date: (8/27/2001 1:14:04 PM)
- *
- * @param newJarType
- * int
- */
- public void setJarType(int newJarType) {
- jarType = newJarType;
- }
-
- /**
- * Insert the method's description here. Creation date: (8/25/2001 6:21:01 PM)
- *
- * @param newProject
- * org.eclipse.core.resources.IProject
- */
- public void setProject(org.eclipse.core.resources.IProject newProject) {
- project = newProject;
- }
-
- /**
- * Insert the method's description here. Creation date: (8/22/2001 4:20:55 PM)
- *
- * @param newRelativeText
- * java.lang.String
- */
- public void setRelativeText(java.lang.String newRelativeText) {
- relativeText = newRelativeText;
- }
-
- public void setSelected(Archive referencingJar, Archive referencedJar, List classPath) {
- for (int i = 0; i < classPath.size(); i++) {
- String cpEntry = (String) classPath.get(i);
- String uri = ArchiveUtil.deriveEARRelativeURI(cpEntry, referencingJar);
- if (uri != null && uri.equals(referencedJar.getURI())) {
- setSelected(true);
- return;
- }
- }
- setSelected(false);
- }
-
- /**
- * Insert the method's description here. Creation date: (8/22/2001 11:01:46 AM)
- *
- * @param newSelected
- * boolean
- */
- public void setSelected(boolean newSelected) {
- boolean oldSelected = selected;
- selected = newSelected;
- if (oldSelected != newSelected && parentSelection != null)
- parentSelection.setModified(true);
- }
-
- /**
- * Insert the method's description here. Creation date: (8/22/2001 11:00:36 AM)
- *
- * @param newText
- * java.lang.String
- */
- public void setText(java.lang.String newText) {
- text = newText;
- }
-
- /**
- * Insert the method's description here. Creation date: (8/27/2001 1:04:35 PM)
- *
- * @param newValid
- * boolean
- */
- public void setValid(boolean newValid) {
- valid = newValid;
- }
-
- public void setValuesSelected(String cpEntry) {
- setSelected(true);
- setRelativeText(cpEntry);
- }
-
- public String toString() {
- return "ClasspatheElement(" + getText() + ")"; //$NON-NLS-1$ //$NON-NLS-2$
- }
-
- protected EARFile getEARFile() {
- return (EARFile) archive.getContainer();
- }
-
- void setParentSelection(ClassPathSelection selection) {
- parentSelection = selection;
- }
-
- /**
- * Returns the archive.
- *
- * @return Archive
- */
- public Archive getArchive() {
- return archive;
- }
-
- public boolean isEJBJar() {
- return jarType == EJB_JAR;
- }
-
- public boolean isEJBClientJar() {
- return jarType == EJB_CLIENT_JAR;
- }
-
- /**
- * @return
- */
- public Archive getTargetArchive() {
- return targetArchive;
- }
-
- /**
- * @return
- */
- public IVirtualComponent getTargetComponent() {
- return targetComponent;
- }
-
- /**
- * @param archive
- */
- public void setTargetArchive(Archive archive) {
- targetArchive = archive;
- }
-
- public void setTargetComponent(IVirtualComponent aTargetComponent) {
- targetComponent = aTargetComponent;
- }
-
- public URI getArchiveURI() {
- return archiveURI;
- }
-
- public String getEarContentFolder() {
- return earContentFolder;
- }
-
- public void setEarContentFolder(String earContentFolder) {
- this.earContentFolder = earContentFolder;
- }
-
-}
diff --git a/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/application/internal/operations/ComputeEARsForContextRootUpdateDataModelProvider.java b/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/application/internal/operations/ComputeEARsForContextRootUpdateDataModelProvider.java
deleted file mode 100644
index f3313f82c..000000000
--- a/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/application/internal/operations/ComputeEARsForContextRootUpdateDataModelProvider.java
+++ /dev/null
@@ -1,28 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006 BEA Systems, Inc
- * 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:
- * rfrost@bea.com - initial API and impl
- *******************************************************************************/
-
-package org.eclipse.jst.j2ee.application.internal.operations;
-
-import java.util.Set;
-
-import org.eclipse.wst.common.frameworks.datamodel.AbstractDataModelProvider;
-
-/**
- * <code>AbstractDataModelProvider</code> subclass that supports the <code>ComputeEARsForContextRootUpdateOp</code>.
- */
-public class ComputeEARsForContextRootUpdateDataModelProvider extends AbstractDataModelProvider implements IUpdateModuleContextRootProperties {
-
- public Set getPropertyNames() {
- final Set propertyNames = super.getPropertyNames();
- propertyNames.add(EARS_TO_UPDATE);
- return propertyNames;
- }
-}
diff --git a/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/application/internal/operations/ComputeEARsForContextRootUpdateOp.java b/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/application/internal/operations/ComputeEARsForContextRootUpdateOp.java
deleted file mode 100644
index 57baa525d..000000000
--- a/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/application/internal/operations/ComputeEARsForContextRootUpdateOp.java
+++ /dev/null
@@ -1,131 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006 BEA Systems, Inc
- * 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:
- * rfrost@bea.com - initial API and impl
- *******************************************************************************/
-package org.eclipse.jst.j2ee.application.internal.operations;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Properties;
-
-import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-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.application.WebModule;
-import org.eclipse.jst.j2ee.componentcore.util.EARArtifactEdit;
-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.frameworks.datamodel.AbstractDataModelOperation;
-import org.eclipse.wst.common.frameworks.datamodel.DataModelFactory;
-import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
-
-/**
- * <code>AbstractDataModelOperation</code> subclass that computes the set of referencing EARs
- * in which the context-root for a given module will be updated in the application.xml file.
- */
-public class ComputeEARsForContextRootUpdateOp extends AbstractDataModelOperation implements IUpdateModuleContextRootProperties {
-
- public ComputeEARsForContextRootUpdateOp() {
- super();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.core.commands.operations.IUndoableOperation#execute(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable)
- */
- public IStatus execute(final IProgressMonitor monitor, final IAdaptable info) throws ExecutionException {
- if (monitor != null) {
- monitor.beginTask("", 1);
- }
-
- final IProject project = (IProject)model.getProperty(PROJECT);
- final List earsToUpdate = new ArrayList();
- try {
- // get the set of all referencing EARs
- final IProject[] ears = J2EEProjectUtilities.getReferencingEARProjects(project);
-
- // for each EAR, check if the current context-root value is equal to the old context-root setting
- // if it is, update it to reflect the new value
- for (int i = 0; i < ears.length; i++) {
- // check if the current value of the context-root for the module
- // is equal to the value stored in the associated EAR's
- // application.xml
- if (currentRootEqualsEARRoot(ears[i], project)) {
- earsToUpdate.add(ears[i]);
- }
- }
- // Save the list of EARs to update in a nested IDataModel
- IDataModel nestedModel = DataModelFactory.createDataModel(new ComputeEARsForContextRootUpdateDataModelProvider());
- nestedModel.setProperty(EARS_TO_UPDATE, earsToUpdate);
- model.addNestedModel(NESTED_MODEL_ID, nestedModel);
-
- } catch (Exception e) {
- Logger.getLogger().logError(e);
- } finally {
- if (monitor != null) {
- monitor.done();
- }
- }
- return OK_STATUS;
- }
-
- /*
- * Determines if the current module context-root is equal to the value in the application.xml.
- */
- private boolean currentRootEqualsEARRoot(final IProject earProject, final IProject moduleProject) {
- EARArtifactEdit earEdit = null;
- try {
- earEdit = EARArtifactEdit.getEARArtifactEditForRead(earProject);
- if (earEdit == null) {
- return false;
- }
- final Application app = earEdit.getApplication();
- final IVirtualComponent comp = ComponentCore.createComponent(moduleProject);
- if (app == null || comp == null) {
- return false;
- }
- final String moduleURI = earEdit.getModuleURI(comp);
- final Module module = app.getFirstModule(moduleURI);
- if (module != null && module instanceof WebModule) {
- final Properties props = comp.getMetaProperties();
- if ((props != null) && (props.containsKey(J2EEConstants.CONTEXTROOT))) {
- return ((WebModule) module).getContextRoot().equals(props.getProperty(J2EEConstants.CONTEXTROOT));
- }
- }
- } finally {
- if (earEdit != null) {
- earEdit.dispose();
- }
- }
- return false;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.core.commands.operations.IUndoableOperation#redo(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable)
- */
- public IStatus redo(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
- // no-op
- return null;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.core.commands.operations.IUndoableOperation#undo(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable)
- */
- public IStatus undo(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
- // no-op
- return null;
- }
-
-}
diff --git a/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/application/internal/operations/CopyArchiveIntoProjectOperation.java b/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/application/internal/operations/CopyArchiveIntoProjectOperation.java
deleted file mode 100644
index 246aa579c..000000000
--- a/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/application/internal/operations/CopyArchiveIntoProjectOperation.java
+++ /dev/null
@@ -1,129 +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.application.internal.operations;
-
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileNotFoundException;
-import java.io.IOException;
-import java.lang.reflect.InvocationTargetException;
-
-import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.core.resources.IContainer;
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.MultiStatus;
-import org.eclipse.core.runtime.Path;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.core.runtime.SubProgressMonitor;
-import org.eclipse.jst.j2ee.internal.earcreation.EARCreationResourceHandler;
-import org.eclipse.jst.j2ee.internal.plugin.J2EEPlugin;
-import org.eclipse.osgi.util.NLS;
-import org.eclipse.wst.common.componentcore.ComponentCore;
-import org.eclipse.wst.common.componentcore.resources.IVirtualComponent;
-
-public class CopyArchiveIntoProjectOperation extends J2EEUtilityJarImportAssistantOperation {
-
- public CopyArchiveIntoProjectOperation(File utilityJar) {
- super(NLS.bind(EARCreationResourceHandler.CopyArchiveIntoProjectOperation_Copying_archive_into_selected_proje_, utilityJar.getName()), utilityJar);
- }
-
- public IStatus execute(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
- MultiStatus status = new MultiStatus(J2EEPlugin.PLUGIN_ID, 0, NLS.bind(EARCreationResourceHandler.CopyArchiveIntoProjectOperation_Copying_archive_into_selected_proje_, getUtilityJar().getName()), null);
-
- try {
-
- IFile copiedJarFile = null;
-
- IProject associatedEARProject = getWorkspaceRoot().getProject(getAssociatedEARProjectName());
- IVirtualComponent earComponent = ComponentCore.createComponent(associatedEARProject);
-
- IContainer underlyingFolder = earComponent.getRootFolder().getUnderlyingFolder();
- if(underlyingFolder.isAccessible()) {
- copiedJarFile = underlyingFolder.getFile(new Path(getUtilityJar().getName()));
- } else {
- copiedJarFile = associatedEARProject.getFile(getUtilityJar().getName());
- }
- if (copiedJarFile.exists()) {
- if (isOverwriteIfNecessary())
- copiedJarFile.delete(true, true, new SubProgressMonitor(monitor, 1));
- else {
- status.add(J2EEPlugin.createErrorStatus(0, NLS.bind(EARCreationResourceHandler.CopyArchiveIntoProjectOperation_Found_existing_file_0_, copiedJarFile), null));
- return status;
- }
- }
-
- FileInputStream fileInputStream = null;
- ByteArrayOutputStream bos = null;
- ByteArrayInputStream jarFileInputStream = null;
- try {
- fileInputStream = new FileInputStream(getUtilityJar());
- bos = new ByteArrayOutputStream();
- byte[] data = new byte[4096];
- try {
- int bytesRead = 0;
- while ((bytesRead = fileInputStream.read(data)) > 0)
- bos.write(data, 0, bytesRead);
- // clear space for GC
- data = null;
- } finally {
- if(fileInputStream != null)
- fileInputStream.close();
- }
-
- jarFileInputStream = new ByteArrayInputStream(bos.toByteArray());
- copiedJarFile.create(jarFileInputStream, 0, new SubProgressMonitor(monitor, 1));
-
- addLibraryToClasspath(associatedEARProject, copiedJarFile, monitor);
-
- createVirtualArchiveComponent(associatedEARProject, getUtilityJar().getName(), copiedJarFile, monitor);
-
-
- } catch (FileNotFoundException e) {
- status.add(J2EEPlugin.createErrorStatus(0, e.getMessage(), e));
- J2EEPlugin.logError(0, e.getMessage(), e);
- } catch (InvocationTargetException e) {
- status.add(J2EEPlugin.createErrorStatus(0, e.getMessage(), e));
- J2EEPlugin.logError(0, e.getMessage(), e);
- } catch (InterruptedException e) {
- status.add(J2EEPlugin.createErrorStatus(0, e.getMessage(), e));
- J2EEPlugin.logError(0, e.getMessage(), e);
- } finally {
- if (bos != null)
- bos.close();
- if (jarFileInputStream != null)
- jarFileInputStream.close();
- }
- } catch (IOException e) {
- status.add(J2EEPlugin.createErrorStatus(0, e.getMessage(), e));
- J2EEPlugin.logError(0, e.getMessage(), e);
- } catch (CoreException e) {
- status.add(J2EEPlugin.createErrorStatus(0, e.getMessage(), e));
- J2EEPlugin.logError(0, e.getMessage(), e);
- }
- return status;
- }
-
- public IStatus redo(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
- return Status.CANCEL_STATUS;
- }
-
- public IStatus undo(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
- return Status.CANCEL_STATUS;
- }
-
-}
diff --git a/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/application/internal/operations/CreateProjectWithExtractedJarOperation.java b/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/application/internal/operations/CreateProjectWithExtractedJarOperation.java
deleted file mode 100644
index 8ae372a96..000000000
--- a/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/application/internal/operations/CreateProjectWithExtractedJarOperation.java
+++ /dev/null
@@ -1,114 +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.application.internal.operations;
-
-import java.io.File;
-import java.lang.reflect.InvocationTargetException;
-
-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.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.MultiStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.core.runtime.SubProgressMonitor;
-import org.eclipse.jst.j2ee.commonarchivecore.internal.Archive;
-import org.eclipse.jst.j2ee.commonarchivecore.internal.CommonarchiveFactory;
-import org.eclipse.jst.j2ee.commonarchivecore.internal.exception.OpenFailureException;
-import org.eclipse.jst.j2ee.datamodel.properties.IJavaUtilityJarImportDataModelProperties;
-import org.eclipse.jst.j2ee.internal.earcreation.EARCreationResourceHandler;
-import org.eclipse.jst.j2ee.internal.plugin.J2EEPlugin;
-import org.eclipse.osgi.util.NLS;
-import org.eclipse.wst.common.frameworks.datamodel.DataModelFactory;
-import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
-import org.eclipse.wst.common.frameworks.internal.operations.IProjectCreationPropertiesNew;
-
-
-public class CreateProjectWithExtractedJarOperation extends J2EEUtilityJarImportAssistantOperation {
-// private boolean createBinaryProject = false;
- private String newProjectName;
- private String projectRoot;
-// private boolean createAsBinary;
-
- public CreateProjectWithExtractedJarOperation(File utilityJar, String overridingProjectRoot) {
- super(NLS.bind(EARCreationResourceHandler.CreateProjectWithExtractedJarOperation_Create_project_with_extracted_conte_, utilityJar.getName()), utilityJar);
- newProjectName = getUtilityJarProjectName(utilityJar);
- projectRoot = findUniqueLocation(overridingProjectRoot, newProjectName);
- }
-
- public IStatus execute(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
- MultiStatus status = new MultiStatus(J2EEPlugin.PLUGIN_ID, 0, NLS.bind(EARCreationResourceHandler.CreateProjectWithExtractedJarOperation_Create_project_with_extracted_conte_, getUtilityJar().getName()), null);
- Archive archive = null;
- try {
- archive = CommonarchiveFactory.eINSTANCE.primOpenArchive(getUtilityJar().getAbsolutePath());
-
- IDataModel importModel = DataModelFactory.createDataModel(new J2EEUtilityJarImportDataModelProvider());
-
- importModel.setProperty(IJavaUtilityJarImportDataModelProperties.FILE, archive);
-// importModel.setProperty(IJavaUtilityJarImportDataModelProperties.FILE_NAME, getUtilityJar().getAbsolutePath());
-
- if (projectRoot != null && projectRoot.length() > 0) {
- importModel.setBooleanProperty(IProjectCreationPropertiesNew.USE_DEFAULT_LOCATION, false);
- importModel.setProperty(IProjectCreationPropertiesNew.USER_DEFINED_LOCATION, projectRoot);
- }
-
- // importModel.getJ2eeProjectCreationDataModel().setBooleanProperty(J2EEProjectCreationDataModel.ADD_SERVER_TARGET, true);
- if (isOverwriteIfNecessary()) {
- // importModel.setBooleanProperty(IJavaUtilityJarImportDataModelProperties.OVERWRITE_HANDLER);
- IProject existingProject = getWorkspaceRoot().getProject(newProjectName);
- if (existingProject.exists()) {
- existingProject.delete(true, true, monitor);
- }
- }
-
- importModel.setProperty(IJavaUtilityJarImportDataModelProperties.PROJECT_NAME, newProjectName);
- importModel.setProperty(IJavaUtilityJarImportDataModelProperties.EAR_PROJECT_NAME, getAssociatedEARProjectName());
-
- status.add(importModel.getDefaultOperation().execute(new SubProgressMonitor(monitor, 1), info));
-
- IProject associatedEARProject = getWorkspaceRoot().getProject(getAssociatedEARProjectName());
- IProject utilityJarProject = getWorkspaceRoot().getProject(newProjectName);
- linkArchiveToEAR(associatedEARProject, getUtilityJar().getName(), utilityJarProject, new SubProgressMonitor(monitor, 1));
-
- } catch (OpenFailureException e) {
- status.add(J2EEPlugin.createErrorStatus(0, e.getMessage(), e));
- J2EEPlugin.logError(0, e.getMessage(), e);
- } catch (InvocationTargetException e) {
- status.add(J2EEPlugin.createErrorStatus(0, e.getMessage(), e));
- J2EEPlugin.logError(0, e.getMessage(), e);
- } catch (InterruptedException e) {
- status.add(J2EEPlugin.createErrorStatus(0, e.getMessage(), e));
- J2EEPlugin.logError(0, e.getMessage(), e);
- } catch (CoreException e) {
- status.add(J2EEPlugin.createErrorStatus(0, e.getMessage(), e));
- J2EEPlugin.logError(0, e.getMessage(), e);
- } finally {
- if(archive != null)
- archive.close();
- }
- return status;
- }
-
- public IStatus redo(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
- return Status.CANCEL_STATUS;
- }
-
- public IStatus undo(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
- return Status.CANCEL_STATUS;
- }
-
- public void setNewProjectName(String newProjectName) {
- this.newProjectName = newProjectName;
- }
-
-}
diff --git a/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/application/internal/operations/CreateProjectWithLinkedJarOperation.java b/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/application/internal/operations/CreateProjectWithLinkedJarOperation.java
deleted file mode 100644
index 8b4ab941f..000000000
--- a/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/application/internal/operations/CreateProjectWithLinkedJarOperation.java
+++ /dev/null
@@ -1,104 +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.application.internal.operations;
-
-import java.io.File;
-
-import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.IAdaptable;
-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.core.runtime.SubProgressMonitor;
-import org.eclipse.jdt.core.IJavaProject;
-import org.eclipse.jdt.core.IPackageFragmentRoot;
-import org.eclipse.jdt.core.JavaCore;
-import org.eclipse.jst.j2ee.internal.earcreation.EARCreationResourceHandler;
-import org.eclipse.jst.j2ee.internal.plugin.J2EEPlugin;
-import org.eclipse.jst.j2ee.project.facet.IJ2EEFacetProjectCreationDataModelProperties;
-import org.eclipse.jst.j2ee.project.facet.UtilityProjectCreationDataModelProvider;
-import org.eclipse.osgi.util.NLS;
-import org.eclipse.wst.common.componentcore.ComponentCore;
-import org.eclipse.wst.common.componentcore.datamodel.properties.IFacetProjectCreationDataModelProperties;
-import org.eclipse.wst.common.componentcore.resources.IVirtualComponent;
-import org.eclipse.wst.common.frameworks.datamodel.DataModelFactory;
-import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
-import org.eclipse.wst.common.frameworks.internal.operations.IProjectCreationPropertiesNew;
-
-public class CreateProjectWithLinkedJarOperation extends J2EEUtilityJarImportAssistantOperation {
-
- private String linkedPathVariable;
- private String projectRoot;
-// private boolean createAsBinary;
-
- public CreateProjectWithLinkedJarOperation(File utilityJar, String overridingProjectRoot, String linkedPathVariable) {
- super(NLS.bind(EARCreationResourceHandler.CreateProjectWithLinkedJarOperation_Creating_project_with_linked_archiv_, utilityJar.getName()), utilityJar);
- this.linkedPathVariable= linkedPathVariable;
- projectRoot = findUniqueLocation(overridingProjectRoot, getUtilityJarProjectName(utilityJar));
- }
-
- public IStatus execute(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
- MultiStatus status = new MultiStatus(J2EEPlugin.PLUGIN_ID, 0, NLS.bind(EARCreationResourceHandler.CreateProjectWithLinkedJarOperation_Creating_project_with_linked_archiv_, getUtilityJar().getName()), null);
-
- try {
- IProject project = getWorkspaceRoot().getProject(getUtilityJarProjectName(getUtilityJar()));
-
- IDataModel createUtilityProject = DataModelFactory.createDataModel(new UtilityProjectCreationDataModelProvider());
- createUtilityProject.setProperty(IFacetProjectCreationDataModelProperties.FACET_PROJECT_NAME, getUtilityJarProjectName(getUtilityJar()));
-
- if (projectRoot != null && projectRoot.length() > 0) {
- createUtilityProject.setBooleanProperty(IProjectCreationPropertiesNew.USE_DEFAULT_LOCATION, false);
- createUtilityProject.setProperty(IProjectCreationPropertiesNew.USER_DEFINED_LOCATION, projectRoot);
- }
-
- createUtilityProject.setProperty(IJ2EEFacetProjectCreationDataModelProperties.EAR_PROJECT_NAME, getAssociatedEARProjectName());
-
- status.add(createUtilityProject.getDefaultOperation().execute(monitor, info));
-
- IProject utilityJarProject = getWorkspaceRoot().getProject(getUtilityJarProjectName(getUtilityJar()));
-
- /* Remove the default src folder */
- IJavaProject utilityJarJavaProject = JavaCore.create(utilityJarProject);
- IPackageFragmentRoot srcFolder = utilityJarJavaProject.getPackageFragmentRoot(utilityJarProject.getFolder("src"));
- if(srcFolder.exists()) {
- srcFolder.delete(IResource.FORCE, IPackageFragmentRoot.ORIGINATING_PROJECT_CLASSPATH, monitor);
- }
- status.add(createLinkedArchive(project, getUtilityJar().getName(), getUtilityJar(), linkedPathVariable, monitor));
-
- /* Remove the /src mapping */
- IVirtualComponent utilComponent = ComponentCore.createComponent(project);
- status.add(removeRootMapping(utilComponent, "/src", monitor));
-
- /* Create the /<archive> mapping */
- status.add(createVirtualArchiveComponent(project, getUtilityJar().getName(), project.getFile(getUtilityJar().getName()), monitor));
-
- /* Make this project a utility jar project for the EAR */
- IProject associatedEARProject = getWorkspaceRoot().getProject(getAssociatedEARProjectName());
- status.add(linkArchiveToEAR(associatedEARProject, getUtilityJar().getName(), utilityJarProject, new SubProgressMonitor(monitor, 1)));
-
- } catch (Exception e) {
- status.add(J2EEPlugin.createErrorStatus(0, EARCreationResourceHandler.J2EEUtilityJarListImportOperation_UI_2, e));
- }
- return status;
- }
-
- public IStatus redo(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
- return Status.CANCEL_STATUS;
- }
-
- public IStatus undo(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
- return Status.CANCEL_STATUS;
- }
-
-}
diff --git a/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/application/internal/operations/DefaultJ2EEComponentCreationOperation.java b/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/application/internal/operations/DefaultJ2EEComponentCreationOperation.java
deleted file mode 100644
index b0de18a88..000000000
--- a/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/application/internal/operations/DefaultJ2EEComponentCreationOperation.java
+++ /dev/null
@@ -1,134 +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.application.internal.operations;
-
-import java.lang.reflect.InvocationTargetException;
-
-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.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.jem.util.emf.workbench.ProjectUtilities;
-import org.eclipse.jem.util.logger.proxy.Logger;
-import org.eclipse.jst.j2ee.internal.earcreation.IDefaultJ2EEComponentCreationDataModelProperties;
-import org.eclipse.wst.common.componentcore.datamodel.FacetProjectCreationDataModelProvider;
-import org.eclipse.wst.common.componentcore.internal.operation.FacetProjectCreationOperation;
-import org.eclipse.wst.common.frameworks.datamodel.AbstractDataModelOperation;
-import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
-import org.eclipse.wst.common.frameworks.internal.activities.WTPActivityBridge;
-import org.eclipse.wst.common.project.facet.core.IFacetedProject;
-import org.eclipse.wst.common.project.facet.core.ProjectFacetsManager;
-import org.eclipse.wst.common.project.facet.core.runtime.IRuntime;
-
-public class DefaultJ2EEComponentCreationOperation extends AbstractDataModelOperation implements IDefaultJ2EEComponentCreationDataModelProperties {
-
- public static final String JCA_DEV_ACTIVITY_ID = "com.ibm.wtp.jca.development"; //$NON-NLS-1$
-
- public static final String WEB_DEV_ACTIVITY_ID = "com.ibm.wtp.web.development"; //$NON-NLS-1$
-
- public static final String ENTERPRISE_JAVA = "com.ibm.wtp.ejb.development"; //$NON-NLS-1$
-
- public DefaultJ2EEComponentCreationOperation(IDataModel model) {
- super(model);
- }
-
- public IStatus execute(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
- try {
- if (model.getBooleanProperty(CREATE_EJB)) {
- IDataModel projectModel = model.getNestedModel(NESTED_MODEL_EJB);
- createEJBComponent(projectModel, monitor);
- }
- if (model.getBooleanProperty(CREATE_WEB)) {
- IDataModel projectModel = model.getNestedModel(NESTED_MODEL_WEB);
- createWebJ2EEComponent(projectModel, monitor);
- }
- if (model.getBooleanProperty(CREATE_CONNECTOR)) {
- IDataModel projectModel = model.getNestedModel(NESTED_MODEL_JCA);
- createRarJ2EEComponent(projectModel, monitor);
- }
- if (model.getBooleanProperty(CREATE_APPCLIENT)) {
- IDataModel projectModel = model.getNestedModel(NESTED_MODEL_CLIENT);
- createAppClientComponent(projectModel, monitor);
- }
- } catch (Exception e) {
- Logger.getLogger().log(e.getMessage());
- }
- return OK_STATUS;
- }
-
- /**
- * @param model
- */
- private void createEJBComponent(IDataModel model, IProgressMonitor monitor) throws CoreException, InvocationTargetException, InterruptedException, ExecutionException {
- model.getDefaultOperation().execute(monitor, null);
- addDefaultFacets(model);
- WTPActivityBridge.getInstance().enableActivity(ENTERPRISE_JAVA, true);
- }
-
- /**
- * @param model
- */
- private void createWebJ2EEComponent(IDataModel model, IProgressMonitor monitor) throws CoreException, InvocationTargetException, InterruptedException, ExecutionException {
- model.getDefaultOperation().execute(monitor, null);
- addDefaultFacets(model);
- WTPActivityBridge.getInstance().enableActivity(WEB_DEV_ACTIVITY_ID, true);
- }
-
- /**
- * @param model
- */
- private void createRarJ2EEComponent(IDataModel model, IProgressMonitor monitor) throws CoreException, InvocationTargetException, InterruptedException, ExecutionException {
- model.getDefaultOperation().execute(monitor, null);
- addDefaultFacets(model);
- WTPActivityBridge.getInstance().enableActivity(ENTERPRISE_JAVA, true);
- }
-
- /**
- * @param model
- */
- private void createAppClientComponent(IDataModel model, IProgressMonitor monitor) throws CoreException, InvocationTargetException, InterruptedException, ExecutionException {
- model.getDefaultOperation().execute(monitor, null);
- addDefaultFacets(model);
- WTPActivityBridge.getInstance().enableActivity(ENTERPRISE_JAVA, true);
-
- }
-
- private void addDefaultFacets(IDataModel model) throws CoreException{
- IRuntime runtime = (IRuntime) model.getProperty(FacetProjectCreationDataModelProvider.FACET_RUNTIME);
- String projectName = model.getStringProperty(FacetProjectCreationDataModelProvider.FACET_PROJECT_NAME);
- IProject project = ProjectUtilities.getProject( projectName );
- IFacetedProject facetedProject = null;
- try {
- facetedProject = ProjectFacetsManager.create(project);
- } catch (CoreException e) {
-
- }
-
- if( facetedProject != null && runtime != null ){
- try {
- FacetProjectCreationOperation.addDefaultFactets( facetedProject, runtime );
- } catch (ExecutionException e) {
- Logger.getLogger().logError(e);
- }
- }
- }
-
- public IStatus redo(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
- return null;
- }
-
- public IStatus undo(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
- return null;
- }
-
-}
diff --git a/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/application/internal/operations/EARComponentExportDataModelProvider.java b/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/application/internal/operations/EARComponentExportDataModelProvider.java
deleted file mode 100644
index 52037bf23..000000000
--- a/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/application/internal/operations/EARComponentExportDataModelProvider.java
+++ /dev/null
@@ -1,71 +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.application.internal.operations;
-
-import org.eclipse.jst.j2ee.internal.archive.operations.EARComponentExportOperation;
-import org.eclipse.jst.j2ee.internal.earcreation.EARCreationResourceHandler;
-import org.eclipse.jst.j2ee.internal.project.J2EEProjectUtilities;
-import org.eclipse.wst.common.frameworks.datamodel.IDataModelOperation;
-
-public class EARComponentExportDataModelProvider extends J2EEArtifactExportDataModelProvider {
-
- public EARComponentExportDataModelProvider() {
- super();
- }
-
- public IDataModelOperation getDefaultOperation() {
- return new EARComponentExportOperation(model);
- }
-
- protected String getModuleExtension() {
- return ".ear"; //$NON-NLS-1$
- }
-
- protected String getWrongComponentTypeString(String projectName) {
- return EARCreationResourceHandler.getString(EARCreationResourceHandler.NOT_AN_EAR, new Object[]{projectName});
- }
-
- protected String getProjectType() {
- return J2EEProjectUtilities.ENTERPRISE_APPLICATION;
- }
- /**
- * Exports the specified Enterprise Appliction project to the specified EAR file.
- *
- * @param earProjectName
- * The name of the Enterprise Application project to export.
- * @param earFileName
- * The fully qualified EAR file location to export the specified Enterprise
- * Application project.
- * @param overwriteExisting
- * If this is <code>true</code> then an existing file at the location specified by
- * <code>earFileName</code> will be overwritten.
- * @param exportSource
- * If this is <code>true</code> then all source files in the specified Enterprise
- * Application Project and all its modules will be included in the resulting EAR
- * file.
- * @plannedfor WTP 1.0
- */
-//TODO: can this be done in the new datamodel framework?
-// public static void exportProject(String earProjectName, String earFileName, boolean overwriteExisting, boolean exportSource) {
-// EnterpriseApplicationExportDataModel dataModel = new EnterpriseApplicationExportDataModel();
-// dataModel.setProperty(PROJECT_NAME, earProjectName);
-// dataModel.setBooleanProperty(OVERWRITE_EXISTING, overwriteExisting);
-// dataModel.setProperty(ARCHIVE_DESTINATION, earFileName);
-// dataModel.setBooleanProperty(EXPORT_SOURCE_FILES, exportSource);
-// try {
-// dataModel.getDefaultOperation().run(null);
-// } catch (InvocationTargetException e) {
-// Logger.getLogger().logError(e);
-// } catch (InterruptedException e) {
-// Logger.getLogger().logError(e);
-// }
-// }
-}
diff --git a/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/application/internal/operations/EARComponentImportDataModelProvider.java b/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/application/internal/operations/EARComponentImportDataModelProvider.java
deleted file mode 100644
index 68f0ba1c0..000000000
--- a/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/application/internal/operations/EARComponentImportDataModelProvider.java
+++ /dev/null
@@ -1,726 +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.application.internal.operations;
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.Enumeration;
-import java.util.Hashtable;
-import java.util.List;
-import java.util.Set;
-
-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.IStatus;
-import org.eclipse.core.runtime.Path;
-import org.eclipse.jem.util.emf.workbench.ProjectUtilities;
-import org.eclipse.jem.util.logger.proxy.Logger;
-import org.eclipse.jst.j2ee.applicationclient.internal.creation.AppClientComponentImportDataModelProvider;
-import org.eclipse.jst.j2ee.commonarchivecore.internal.Archive;
-import org.eclipse.jst.j2ee.commonarchivecore.internal.CommonarchiveFactory;
-import org.eclipse.jst.j2ee.commonarchivecore.internal.exception.OpenFailureException;
-import org.eclipse.jst.j2ee.datamodel.properties.IAddWebComponentToEnterpriseApplicationDataModelProperties;
-import org.eclipse.jst.j2ee.datamodel.properties.IEARComponentImportDataModelProperties;
-import org.eclipse.jst.j2ee.datamodel.properties.IJ2EEComponentImportDataModelProperties;
-import org.eclipse.jst.j2ee.datamodel.properties.IJ2EEModuleImportDataModelProperties;
-import org.eclipse.jst.j2ee.datamodel.properties.IJavaUtilityJarImportDataModelProperties;
-import org.eclipse.jst.j2ee.internal.J2EEVersionConstants;
-import org.eclipse.jst.j2ee.internal.archive.ArchiveWrapper;
-import org.eclipse.jst.j2ee.internal.archive.operations.EARComponentImportOperation;
-import org.eclipse.jst.j2ee.internal.common.J2EEVersionUtil;
-import org.eclipse.jst.j2ee.internal.common.XMLResource;
-import org.eclipse.jst.j2ee.internal.earcreation.EARCreationResourceHandler;
-import org.eclipse.jst.j2ee.internal.moduleextension.EarModuleManager;
-import org.eclipse.jst.j2ee.internal.moduleextension.EjbModuleExtension;
-import org.eclipse.jst.j2ee.internal.moduleextension.JcaModuleExtension;
-import org.eclipse.jst.j2ee.internal.moduleextension.WebModuleExtension;
-import org.eclipse.jst.j2ee.internal.project.J2EEProjectUtilities;
-import org.eclipse.jst.j2ee.project.facet.EARFacetProjectCreationDataModelProvider;
-import org.eclipse.jst.j2ee.project.facet.IJ2EEFacetConstants;
-import org.eclipse.jst.j2ee.project.facet.IJ2EEFacetInstallDataModelProperties;
-import org.eclipse.jst.j2ee.project.facet.IJ2EEFacetProjectCreationDataModelProperties;
-import org.eclipse.jst.jee.util.internal.JavaEEQuickPeek;
-import org.eclipse.wst.common.componentcore.datamodel.properties.IFacetDataModelProperties;
-import org.eclipse.wst.common.componentcore.datamodel.properties.IFacetProjectCreationDataModelProperties;
-import org.eclipse.wst.common.componentcore.datamodel.properties.IFacetProjectCreationDataModelProperties.FacetDataModelMap;
-import org.eclipse.wst.common.frameworks.datamodel.DataModelEvent;
-import org.eclipse.wst.common.frameworks.datamodel.DataModelFactory;
-import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
-import org.eclipse.wst.common.frameworks.datamodel.IDataModelListener;
-import org.eclipse.wst.common.frameworks.datamodel.IDataModelOperation;
-import org.eclipse.wst.common.frameworks.internal.WTPPlugin;
-import org.eclipse.wst.common.frameworks.internal.operations.IProjectCreationPropertiesNew;
-import org.eclipse.wst.common.frameworks.internal.operations.ProjectCreationDataModelProviderNew;
-import org.eclipse.wst.common.frameworks.internal.plugin.WTPCommonPlugin;
-import org.eclipse.wst.common.project.facet.core.IFacetedProject;
-import org.eclipse.wst.common.project.facet.core.ProjectFacetsManager;
-import org.eclipse.wst.common.project.facet.core.runtime.IRuntime;
-
-/**
- * This dataModel is used for to import Enterprise Applications(from EAR files) into the workspace.
- *
- * This class (and all its fields and methods) is likely to change during the WTP 1.0 milestones as the new project
- * structures are adopted. Use at your own risk.
- *
- * @plannedfor WTP 1.0
- */
-public final class EARComponentImportDataModelProvider extends J2EEArtifactImportDataModelProvider implements IAnnotationsDataModel, IEARComponentImportDataModelProperties {
-
- /**
- * This is only to force validation for the nested projects; do not set.
- */
- public static final String NESTED_PROJECTS_VALIDATION = "EARImportDataModel.NESTED_PROJECTS_VALIDATION"; //$NON-NLS-1$
-
- /**
- * This is only to force validation for the EAR name against the nested projects; do not set.
- */
- public static final String EAR_NAME_VALIDATION = "EARImportDataModel.EAR_NAME_VALIDATION";//$NON-NLS-1$
-
- private IDataModelListener nestedListener = new IDataModelListener() {
- public void propertyChanged(DataModelEvent event) {
- if (event.getPropertyName().equals(PROJECT_NAME)) {
- model.notifyPropertyChange(NESTED_PROJECTS_VALIDATION, IDataModel.DEFAULT_CHG);
- }
- }
- };
-
- private Hashtable<IDataModel, IDataModel> ejbJarModelsToClientJarModels = new Hashtable<IDataModel, IDataModel>();
-
- private Hashtable<IDataModel, IDataModel> clientJarModelsToEjbJarModels = new Hashtable<IDataModel, IDataModel>();
-
- private ArchiveWrapper cachedLoadError = null;
-
- public Set getPropertyNames() {
- Set propertyNames = super.getPropertyNames();
- propertyNames.add(NESTED_MODULE_ROOT);
- propertyNames.add(UTILITY_LIST);
- propertyNames.add(MODULE_MODELS_LIST);
- propertyNames.add(EJB_CLIENT_LIST);
- propertyNames.add(UTILITY_MODELS_LIST);
- propertyNames.add(NESTED_PROJECTS_VALIDATION);
- propertyNames.add(EAR_NAME_VALIDATION);
- propertyNames.add(SELECTED_MODELS_LIST);
- propertyNames.add(USE_ANNOTATIONS);
- propertyNames.add(ALL_PROJECT_MODELS_LIST);
- propertyNames.add(UNHANDLED_PROJECT_MODELS_LIST);
- propertyNames.add(HANDLED_PROJECT_MODELS_LIST);
- return propertyNames;
- }
-
- public Object getDefaultProperty(String propertyName) {
- if (NESTED_MODULE_ROOT.equals(propertyName)) {
- return getLocation().toOSString();
- } else if (MODULE_MODELS_LIST.equals(propertyName) || UTILITY_LIST.equals(propertyName) || UTILITY_MODELS_LIST.equals(propertyName) || SELECTED_MODELS_LIST.equals(propertyName) || EJB_CLIENT_LIST.equals(propertyName)) {
- return Collections.EMPTY_LIST;
- } else if (USE_ANNOTATIONS.equals(propertyName)) {
- return Boolean.FALSE;
- } else if (ALL_PROJECT_MODELS_LIST.equals(propertyName)) {
- return getProjectModels();
- } else if (UNHANDLED_PROJECT_MODELS_LIST.equals(propertyName)) {
- return getUnhandledProjectModels();
- } else if (HANDLED_PROJECT_MODELS_LIST.equals(propertyName)) {
- return getHandledSelectedModels();
- }
- return super.getDefaultProperty(propertyName);
- }
-
- public void propertyChanged(DataModelEvent event) {
- super.propertyChanged(event);
- if (event.getPropertyName().equals(PROJECT_NAME)) {
- changeModuleCreationLocationForNameChange(getProjectModels());
- } else if (event.getPropertyName().equals(IFacetProjectCreationDataModelProperties.FACET_RUNTIME) && event.getDataModel() == model.getNestedModel(NESTED_MODEL_J2EE_COMPONENT_CREATION)) {
- Object propertyValue = event.getProperty();
- IDataModel nestedModel = null;
- List projectModels = (List) getProperty(ALL_PROJECT_MODELS_LIST);
- for (int i = 0; i < projectModels.size(); i++) {
- nestedModel = (IDataModel) projectModels.get(i);
- nestedModel.setProperty(IFacetProjectCreationDataModelProperties.FACET_RUNTIME, propertyValue);
- }
- fixupJavaFacets();
- }
- }
-
- public boolean propertySet(String propertyName, Object propertyValue) {
- if (ALL_PROJECT_MODELS_LIST.equals(propertyName) || UNHANDLED_PROJECT_MODELS_LIST.equals(propertyName) || HANDLED_PROJECT_MODELS_LIST.equals(propertyName) || EAR_NAME_VALIDATION.equals(propertyName)) {
- throw new RuntimeException(propertyName + " is an unsettable property"); //$NON-NLS-1$
- }
- boolean doSet = super.propertySet(propertyName, propertyValue);
- if (NESTED_MODULE_ROOT.equals(propertyName)) {
- updateModuleRoot();
- } else if (FILE_NAME.equals(propertyName)) {
- List nestedModels = getModuleModels();
- setProperty(MODULE_MODELS_LIST, nestedModels);
- updateModuleRoot();
- setProperty(UTILITY_LIST, null);
-
- IDataModel earProjectModel = model.getNestedModel(NESTED_MODEL_J2EE_COMPONENT_CREATION);
- if (getArchiveWrapper() != null) {
- FacetDataModelMap map = (FacetDataModelMap) earProjectModel.getProperty(IFacetProjectCreationDataModelProperties.FACET_DM_MAP);
- IDataModel earFacetDataModel = map.getFacetDataModel(J2EEProjectUtilities.ENTERPRISE_APPLICATION);
-
- JavaEEQuickPeek quickPeek = getArchiveWrapper().getJavaEEQuickPeek();
- int minimumVersion = quickPeek.getVersion();
- if(nestedModels != null){
- //increase the JavaEE facet version to accommodate the highest module version
- for(int i=0;i<nestedModels.size(); i++){
- IDataModel nestedModel = (IDataModel)nestedModels.get(i);
- ArchiveWrapper nestedWrapper = (ArchiveWrapper)nestedModel.getProperty(ARCHIVE_WRAPPER);
- int nestedEEVersion = nestedWrapper.getJavaEEQuickPeek().getJavaEEVersion();
- if(nestedEEVersion > minimumVersion){
- minimumVersion = nestedEEVersion;
- }
- }
- }
-
- String versionText = J2EEVersionUtil.getJ2EETextVersion(minimumVersion);
- earFacetDataModel.setStringProperty(IFacetDataModelProperties.FACET_VERSION_STR, versionText);
- }
-
- model.notifyPropertyChange(PROJECT_NAME, IDataModel.VALID_VALUES_CHG);
- if (getJ2EEVersion() < J2EEVersionConstants.VERSION_1_3)
- setBooleanProperty(USE_ANNOTATIONS, false);
- model.notifyPropertyChange(USE_ANNOTATIONS, IDataModel.ENABLE_CHG);
- fixupJavaFacets();
- } else if (UTILITY_LIST.equals(propertyName)) {
- updateUtilityModels((List) propertyValue);
- } else if (USE_ANNOTATIONS.equals(propertyName)) {
- List projectModels = (List) getProperty(MODULE_MODELS_LIST);
- IDataModel nestedModel = null;
- for (int i = 0; i < projectModels.size(); i++) {
- nestedModel = (IDataModel) projectModels.get(i);
- if (nestedModel.isProperty(USE_ANNOTATIONS)) {
- nestedModel.setProperty(USE_ANNOTATIONS, propertyValue);
- }
- }
- } else if (MODULE_MODELS_LIST.equals(propertyName)) {
- List newList = new ArrayList();
- newList.addAll(getProjectModels());
- setProperty(SELECTED_MODELS_LIST, newList);
- } else if (PROJECT_NAME.equals(propertyName)) {
- List nestedModels = (List) getProperty(MODULE_MODELS_LIST);
- IDataModel nestedModel = null;
- for (int i = 0; i < nestedModels.size(); i++) {
- nestedModel = (IDataModel) nestedModels.get(i);
- nestedModel.setProperty(IJ2EEFacetProjectCreationDataModelProperties.EAR_PROJECT_NAME, propertyValue);
- }
- nestedModels = (List) getProperty(UTILITY_MODELS_LIST);
- for (int i = 0; i < nestedModels.size(); i++) {
- nestedModel = (IDataModel) nestedModels.get(i);
- nestedModel.setProperty(IJavaUtilityJarImportDataModelProperties.EAR_PROJECT_NAME, propertyValue);
- }
-
- if (ProjectCreationDataModelProviderNew.validateProjectName(getStringProperty(PROJECT_NAME)).isOK()) {
- IProject project = ProjectUtilities.getProject(getStringProperty(PROJECT_NAME));
- if (null != project && project.exists()) {
-
- IFacetedProject facetedProject = null;
- boolean canContinue = true;
- try {
- facetedProject = ProjectFacetsManager.create(project);
- } catch (CoreException e) {
- Logger.getLogger().logError(e);
- canContinue = false;
- }
-
- if (canContinue) {
- IRuntime runtime = facetedProject.getRuntime();
- if (null != runtime) {
- setProperty(IFacetProjectCreationDataModelProperties.FACET_RUNTIME, runtime);
- }
- }
- }
- }
- }
- return doSet;
- }
-
- protected boolean forceResetOnPreserveMetaData() {
- return false;
- }
-
- protected void fixupJavaFacets() {
- List subProjects = getSelectedModels();
- IDataModel subDataModel = null;
- for (int i = 0; i < subProjects.size(); i++) {
- subDataModel = (IDataModel) subProjects.get(i);
- subDataModel.validateProperty(FACET_RUNTIME);
- }
- }
-
- public IStatus validate(String propertyName) {
- if (propertyName.equals(NESTED_PROJECTS_VALIDATION) || propertyName.equals(EAR_NAME_VALIDATION)) {
- boolean checkAgainstEARNameOnly = propertyName.equals(EAR_NAME_VALIDATION);
-
- String earProjectName = getStringProperty(IFacetProjectCreationDataModelProperties.FACET_PROJECT_NAME);
- List subProjects = getSelectedModels();
- IDataModel subDataModel = null;
- String tempProjectName = null;
- ArchiveWrapper tempArchive = null;
- IStatus tempStatus = null;
- Hashtable<String, ArchiveWrapper> projects = new Hashtable<String, ArchiveWrapper>(4);
- for (int i = 0; i < subProjects.size(); i++) {
- subDataModel = (IDataModel) subProjects.get(i);
- tempProjectName = subDataModel.getStringProperty(IFacetProjectCreationDataModelProperties.FACET_PROJECT_NAME);
- // TODO: add manual validation
- // IStatus status =
- // ProjectCreationDataModel.validateProjectName(tempProjectName);
- // if (!status.isOK()) {
- // return status;
- // }
- tempArchive = (ArchiveWrapper) subDataModel.getProperty(ARCHIVE_WRAPPER);
-
- if (checkAgainstEARNameOnly) {
- if (tempProjectName.equals(earProjectName)) {
- return WTPCommonPlugin.createWarningStatus(EARCreationResourceHandler.bind(EARCreationResourceHandler.EARImportDataModel_UI_1, new Object[] { tempProjectName,
- tempArchive.getPath() }));
- } else if (!WTPPlugin.isPlatformCaseSensitive()) {
- if (tempProjectName.toLowerCase().equals(earProjectName.toLowerCase())) {
- return WTPCommonPlugin.createWarningStatus(EARCreationResourceHandler.bind(EARCreationResourceHandler.EARImportDataModel_UI_1a, new Object[] { earProjectName,
- tempProjectName, tempArchive.getPath() }));
- }
- }
- } else {
- // if (!overwrite && subDataModel.getProject().exists()) {
- // return
- // WTPCommonPlugin.createErrorStatus(EARCreationResourceHandler.getString("EARImportDataModel_UI_0",
- // new Object[]{tempProjectName, tempArchive.getURI()})); //$NON-NLS-1$
- // }
- tempStatus = subDataModel.validateProperty(IFacetDataModelProperties.FACET_PROJECT_NAME);
- if (!tempStatus.isOK()) {
- return WTPCommonPlugin.createErrorStatus(EARCreationResourceHandler.bind(EARCreationResourceHandler.EARImportDataModel_UI_0, new Object[] { tempProjectName,
- tempArchive.getPath() }));
- }
- tempStatus = subDataModel.validate();
- if (!tempStatus.isOK()) {
- return tempStatus;
- }
- if (tempProjectName.equals(earProjectName)) {
- return WTPCommonPlugin.createErrorStatus(EARCreationResourceHandler.bind(EARCreationResourceHandler.EARImportDataModel_UI_1, new Object[] { tempProjectName,
- tempArchive.getPath() }));
- } else if (!WTPPlugin.isPlatformCaseSensitive()) {
- if (tempProjectName.toLowerCase().equals(earProjectName.toLowerCase())) {
- return WTPCommonPlugin.createErrorStatus(EARCreationResourceHandler.bind(EARCreationResourceHandler.EARImportDataModel_UI_1a, new Object[] { earProjectName,
- tempProjectName, tempArchive.getPath() }));
- }
- }
- if (projects.containsKey(tempProjectName)) {
- return WTPCommonPlugin.createErrorStatus(EARCreationResourceHandler.bind(EARCreationResourceHandler.EARImportDataModel_UI_2, new Object[] { tempProjectName,
- tempArchive.getPath(), ((ArchiveWrapper) projects.get(tempProjectName)).getPath() }));
- } else if (!WTPPlugin.isPlatformCaseSensitive()) {
- String lowerCaseProjectName = tempProjectName.toLowerCase();
- String currentKey = null;
- Enumeration keys = projects.keys();
- while (keys.hasMoreElements()) {
- currentKey = (String) keys.nextElement();
- if (currentKey.toLowerCase().equals(lowerCaseProjectName)) {
- return WTPCommonPlugin.createErrorStatus(EARCreationResourceHandler.bind(EARCreationResourceHandler.EARImportDataModel_UI_2a, new Object[] { tempProjectName,
- currentKey, tempArchive.getPath(), projects.get(currentKey).getPath() }));
- }
- }
- }
- projects.put(tempProjectName, tempArchive);
- }
- }
- } else if (propertyName.equals(FILE_NAME)) {
- IStatus status = super.validate(propertyName);
- if (!status.isOK()) {
- return status;
- } else if (cachedLoadError != null) {
- return WTPCommonPlugin
- .createWarningStatus(EARCreationResourceHandler.bind(EARCreationResourceHandler.EARImportDataModel_UI_4, new Object[] { cachedLoadError.getPath().toOSString() }));
- }
- return status;
- }
- // TODO: check context root is not inside current working
- // directory...this is invalid
- return super.validate(propertyName);
- }
-
- private void updateModuleRoot() {
- List projects = getProjectModels();
- String basePath = isPropertySet(NESTED_MODULE_ROOT) ? getStringProperty(NESTED_MODULE_ROOT) : null;
- boolean useDefault = basePath == null;
- IDataModel localModel = null;
- for (int i = 0; null != projects && i < projects.size(); i++) {
- localModel = (IDataModel) projects.get(i);
- localModel.setProperty(IProjectCreationPropertiesNew.USER_DEFINED_BASE_LOCATION, basePath);
- localModel.setBooleanProperty(IProjectCreationPropertiesNew.USE_DEFAULT_LOCATION, useDefault);
- }
- }
-
- private void changeModuleCreationLocationForNameChange(List projects) {
- IDataModel localModel = null;
- for (int i = 0; null != projects && i < projects.size(); i++) {
- localModel = (IDataModel) projects.get(i);
- if (isPropertySet(NESTED_MODULE_ROOT)) {
- IPath newPath = new Path((String) getProperty(NESTED_MODULE_ROOT));
- newPath = newPath.append((String) localModel.getProperty(IJ2EEComponentImportDataModelProperties.PROJECT_NAME));
- // model.setProperty(J2EEComponentCreationDataModel.PROJECT_LOCATION,
- // newPath.toOSString());
- } else {
- // model.setProperty(J2EEComponentCreationDataModel.PROJECT_LOCATION, null);
- }
- }
- }
-
- private IPath getLocation() {
- return ResourcesPlugin.getWorkspace().getRoot().getLocation();
- }
-
- private void trimSelection() {
- boolean modified = false;
- List selectedList = getSelectedModels();
- List allList = getProjectModels();
- for (int i = selectedList.size() - 1; i > -1; i--) {
- if (!allList.contains(selectedList.get(i))) {
- modified = true;
- selectedList.remove(i);
- }
- }
- if (modified) {
- List newList = new ArrayList();
- newList.addAll(selectedList);
- setProperty(SELECTED_MODELS_LIST, newList);
- }
- }
-
- private void updateUtilityModels(List<ArchiveWrapper> utilityJars) {
- updateUtilityModels(utilityJars, SELECTED_MODELS_LIST, UTILITY_MODELS_LIST);
- }
-
- private void updateUtilityModels(List<ArchiveWrapper> utilityJars, String selectedProperty, String listTypeProperty) {
- boolean allSelected = true;
- List<IDataModel> selectedList = (List<IDataModel>) getProperty(selectedProperty);
- List<IDataModel> allList = getProjectModels();
- if (selectedList.size() == allList.size()) {
- for (int i = 0; i < selectedList.size() && allSelected; i++) {
- if (!selectedList.contains(allList.get(i)) || !allList.contains(selectedList.get(i))) {
- allSelected = false;
- }
- }
- } else {
- allSelected = false;
- }
- List<IDataModel> utilityModels = (List<IDataModel>) getProperty(listTypeProperty);
- ArchiveWrapper currentArchive = null;
- IDataModel currentUtilityModel = null;
- boolean utilityJarsModified = false;
- // Add missing
- for (int i = 0; null != utilityJars && i < utilityJars.size(); i++) {
- currentArchive = utilityJars.get(i);
- boolean added = false;
- for (int j = 0; utilityModels != null && j < utilityModels.size() && !added; j++) {
- currentUtilityModel = (IDataModel) utilityModels.get(j);
- if (currentUtilityModel.getProperty(IJavaUtilityJarImportDataModelProperties.ARCHIVE_WRAPPER) == currentArchive) {
- added = true;
- }
- }
- if (!added) {
- if (!isPropertySet(listTypeProperty)) {
- utilityModels = new ArrayList<IDataModel>();
- setProperty(listTypeProperty, utilityModels);
- }
- IDataModel localModel = DataModelFactory.createDataModel(new J2EEUtilityJarImportDataModelProvider());
- localModel.setProperty(IJavaUtilityJarImportDataModelProperties.ARCHIVE_WRAPPER, currentArchive);
- localModel.setProperty(IJavaUtilityJarImportDataModelProperties.EAR_PROJECT_NAME, getStringProperty(PROJECT_NAME));
- localModel.setProperty(IFacetProjectCreationDataModelProperties.FACET_RUNTIME, getProperty(IFacetProjectCreationDataModelProperties.FACET_RUNTIME));
- utilityModels.add(localModel);
- localModel.addListener(nestedListener);
- utilityJarsModified = true;
- }
- } // Remove extras
- for (int i = utilityModels.size() - 1; i >= 0; i--) {
- currentUtilityModel = (IDataModel) utilityModels.get(i);
- currentArchive = (ArchiveWrapper) currentUtilityModel.getProperty(IJavaUtilityJarImportDataModelProperties.ARCHIVE_WRAPPER);
- if (null == utilityJars || !utilityJars.contains(currentArchive)) {
- currentUtilityModel.removeListener(nestedListener);
- currentUtilityModel.dispose();
- utilityModels.remove(currentUtilityModel);
- utilityJarsModified = true;
- }
- }
- allList = getProjectModels();
- if (allSelected) {
- List<IDataModel> newList = new ArrayList<IDataModel>();
- newList.addAll(allList);
- setProperty(SELECTED_MODELS_LIST, newList);
- } else {
- trimSelection();
- }
- if (utilityJarsModified) {
- model.notifyPropertyChange(NESTED_PROJECTS_VALIDATION, IDataModel.VALUE_CHG);
- }
- }
-
- private List getModuleModels() {
- ArchiveWrapper earWrapper = getArchiveWrapper();
- if (earWrapper == null)
- return Collections.EMPTY_LIST;
- cachedLoadError = null;
- List<ArchiveWrapper> modules = earWrapper.getEarModules();
- List moduleModels = new ArrayList();
- List<ArchiveWrapper> clientJarArchives = new ArrayList();
- IDataModel localModel;
- String earProjectName = getStringProperty(IFacetProjectCreationDataModelProperties.FACET_PROJECT_NAME);
-
- List defaultModuleNames = new ArrayList();
- defaultModuleNames.add(earProjectName);
- List collidingModuleNames = null;
- Hashtable<IDataModel, ArchiveWrapper> ejbJarsWithClients = new Hashtable();
- for (int i = 0; i < modules.size(); i++) {
- localModel = null;
- ArchiveWrapper temp = modules.get(i);
- try {
- if (temp.isApplicationClientFile()) {
- localModel = DataModelFactory.createDataModel(new AppClientComponentImportDataModelProvider());
- } else if (temp.isWARFile()) {
- WebModuleExtension webExt = EarModuleManager.getWebModuleExtension();
- if (webExt != null) {
- localModel = webExt.createImportDataModel();
- String ctxRt = temp.getWebContextRoot();
- if (null != ctxRt) {
- localModel.setProperty(IAddWebComponentToEnterpriseApplicationDataModelProperties.CONTEXT_ROOT, ctxRt);
- }
- }
- } else if (temp.isEJBJarFile()) {
- EjbModuleExtension ejbExt = EarModuleManager.getEJBModuleExtension();
- if (ejbExt != null) {
- localModel = ejbExt.createImportDataModel();
- }
- try {
- ArchiveWrapper clientArch = earWrapper.getEJBClientArchiveWrapper(temp);
- if (null != clientArch) {
- clientJarArchives.add(clientArch);
- ejbJarsWithClients.put(localModel, clientArch);
- }
- } catch (Exception e) {
- Logger.getLogger().logError(e);
- }
-
- } else if (temp.isRARFile()) {
- JcaModuleExtension rarExt = EarModuleManager.getJCAModuleExtension();
- if (rarExt != null) {
- localModel = rarExt.createImportDataModel();
- }
- }
- if (localModel != null) {
- localModel.setProperty(ARCHIVE_WRAPPER, temp);
- localModel.setProperty(IJ2EEFacetProjectCreationDataModelProperties.EAR_PROJECT_NAME, earProjectName);
- localModel.setProperty(IFacetProjectCreationDataModelProperties.FACET_RUNTIME, getProperty(IFacetProjectCreationDataModelProperties.FACET_RUNTIME));
- localModel.addListener(this);
- localModel.addListener(nestedListener);
- moduleModels.add(localModel);
- String moduleName = localModel.getStringProperty(IJ2EEFacetProjectCreationDataModelProperties.FACET_PROJECT_NAME);
- if (defaultModuleNames.contains(moduleName)) {
- if (collidingModuleNames == null) {
- collidingModuleNames = new ArrayList();
- }
- collidingModuleNames.add(moduleName);
- } else {
- defaultModuleNames.add(moduleName);
- }
- }
- } catch (Exception e) {
- Logger.getLogger().logError("Error loading nested archive: " + temp.getPath().toOSString()); //$NON-NLS-1$
- Logger.getLogger().logError(e);
- cachedLoadError = temp;
- }
- }
- updateUtilityModels(clientJarArchives, EJB_CLIENT_LIST, EJB_CLIENT_LIST);
- List<IDataModel> clientModelList = (List<IDataModel>) getProperty(EJB_CLIENT_LIST);
- Enumeration<IDataModel> ejbModels = ejbJarsWithClients.keys();
- ejbJarModelsToClientJarModels.clear();
- clientJarModelsToEjbJarModels.clear();
- while (ejbModels.hasMoreElements()) {
- IDataModel ejbModel = ejbModels.nextElement();
- ArchiveWrapper ejbClientArchiveWrapper = ejbJarsWithClients.get(ejbModel);
- IDataModel clientModel = null;
- for (int i = 0; clientModel == null && i < clientModelList.size(); i++) {
- if (((ArchiveWrapper) clientModelList.get(i).getProperty(ARCHIVE_WRAPPER)).getUnderLyingArchive() == ejbClientArchiveWrapper.getUnderLyingArchive()) {
- clientModel = clientModelList.get(i);
- }
- }
- ejbJarModelsToClientJarModels.put(ejbModel, clientModel);
- clientJarModelsToEjbJarModels.put(clientModel, ejbModel);
- }
-
- for (int i = 0; collidingModuleNames != null && i < moduleModels.size(); i++) {
- localModel = (IDataModel) moduleModels.get(i);
- String moduleName = localModel.getStringProperty(IJ2EEModuleImportDataModelProperties.PROJECT_NAME);
- if (collidingModuleNames.contains(moduleName)) {
- ArchiveWrapper module = (ArchiveWrapper) localModel.getProperty(IJ2EEModuleImportDataModelProperties.ARCHIVE_WRAPPER);
- String suffix = null;
- if (module.isApplicationClientFile()) {
- suffix = "_AppClient"; //$NON-NLS-1$
- } else if (module.isWARFile()) {
- suffix = "_WEB"; //$NON-NLS-1$
- } else if (module.isEJBJarFile()) {
- suffix = "_EJB"; //$NON-NLS-1$
- } else if (module.isRARFile()) {
- suffix = "_JCA"; //$NON-NLS-1$
- }
- if (defaultModuleNames.contains(moduleName + suffix)) {
- int count = 1;
- for (; defaultModuleNames.contains(moduleName + suffix + count) && count < 10; count++)
- ;
- suffix += count;
- }
- localModel.setProperty(IJ2EEModuleImportDataModelProperties.PROJECT_NAME, moduleName + suffix);
- }
- }
- return moduleModels;
- }
-
- protected int getType() {
- return XMLResource.APPLICATION_TYPE;
- }
-
- protected Archive openArchive(String uri) throws OpenFailureException {
- return CommonarchiveFactory.eINSTANCE.openEARFile(getArchiveOptions(), uri);
- }
-
- /*
- * private EARFile getEARFile() { return (EARFile) getArchiveFile(); }
- */
- /*
- * public boolean handlesArchive(Archive anArchive) { List temp = new ArrayList(); List tempList = (List)
- * getProperty(MODULE_MODELS_LIST); if (null != tempList) { temp.addAll(tempList); } tempList = (List)
- * getProperty(EJB_CLIENT_LIST); if (null != tempList) { temp.addAll(tempList); } tempList = getSelectedModels();
- * for (int i = 0; i < tempList.size(); i++) { if (!temp.contains(tempList.get(i))) { temp.add(tempList.get(i)); } }
- * IDataModel importDM = null; for (int i = 0; i < temp.size(); i++) { importDM = (IDataModel) temp.get(i); if
- * (importDM.getProperty(ARCHIVE_WRAPPER) == anArchive) { return true; } } return false; }
- */
- private List<IDataModel> getProjectModels() {
- List<IDataModel> temp = new ArrayList<IDataModel>();
- List tempList = (List) getProperty(MODULE_MODELS_LIST);
- if (null != tempList) {
- temp.addAll(tempList);
- }
- tempList = (List) getProperty(UTILITY_MODELS_LIST);
- if (null != tempList) {
- temp.addAll(tempList);
- }
- tempList = (List) getProperty(EJB_CLIENT_LIST);
- if (null != tempList) {
- temp.addAll(tempList);
- }
- return temp;
- }
-
- private List getUnhandledProjectModels() {
- List handled = removeHandledModels(getProjectModels(), getProjectModels(), false);
- List all = getProjectModels();
- all.removeAll(handled);
- return all;
- }
-
- public List getSelectedModels() {
- return (List) getProperty(SELECTED_MODELS_LIST);
- }
-
- private List removeHandledModels(List listToPrune, List modelsToCheck, boolean addModels) {
- List newList = new ArrayList();
- newList.addAll(listToPrune);
- // IDataModel localModel = null;
- // for (int i = 0; i < modelsToCheck.size(); i++) {
- // localModel = (IDataModel) modelsToCheck.get(i);
- // model.extractHandled(newList, addModels);
- // }
- return newList;
- }
-
- private List getHandledSelectedModels() {
- List selectedModels = getSelectedModels();
- return removeHandledModels(selectedModels, selectedModels, true);
- }
-
- /*
- * public int getJ2EEVersion() { EARFile ef = getEARFile(); return null == ef ? J2EEVersionConstants.J2EE_1_2_ID :
- * ArchiveUtil.getFastSpecVersion(ef); }
- */
-
- public boolean isPropertyEnabled(String propertyName) {
- if (!super.isPropertyEnabled(propertyName)) {
- return false;
- }
- if (propertyName.equals(USE_ANNOTATIONS)) {
- if (getJ2EEVersion() < J2EEVersionConstants.VERSION_1_3)
- return false;
- return true;
- }
- return true;
- }
-
- public void dispose() {
- super.dispose();
- List list = getProjectModels();
- for (int i = 0; i < list.size(); i++) {
- ((IDataModel) list.get(i)).dispose();
- }
- }
-
- /**
- * Do not use this it will be deleted post 2.0. This method will be moved to a utility class.
- * @deprecated
- * @param earFile
- * @return
- */
- public static List getAllUtilities(org.eclipse.jst.j2ee.commonarchivecore.internal.EARFile earFile) {
- List files = earFile.getFiles();
- List utilJars = new ArrayList();
- for (int i = 0; i < files.size(); i++) {
- org.eclipse.jst.j2ee.commonarchivecore.internal.impl.FileImpl file = (org.eclipse.jst.j2ee.commonarchivecore.internal.impl.FileImpl) files.get(i);
- if (file.isArchive() && !file.isModuleFile() && file.getURI().endsWith(".jar")) { //$NON-NLS-1$
- utilJars.add(file);
- }
- if (file.isWARFile()) {
- utilJars.addAll(getWebLibs((org.eclipse.jst.j2ee.commonarchivecore.internal.WARFile) file));
- }
- }
- return utilJars;
- }
-
- /**
- * Do not use this it will be deleted post 2.0 This method will be moved to a utility class.
- * @deprecated
- * @param warFile
- * @return
- */
- public static List getWebLibs(org.eclipse.jst.j2ee.commonarchivecore.internal.WARFile warFile) {
- return ((org.eclipse.jst.j2ee.commonarchivecore.internal.impl.WARFileImpl) warFile).getLibArchives();
- }
-
- // TODO: Implement with J2EEArtifactImportDataModelProvider
- /*
- * public J2EEArtifactImportDataModel getMatchingEJBJarOrClient(J2EEArtifactImportDataModel model) { if
- * (clientJarToEjbJarModels.containsKey(model)) { return (J2EEArtifactImportDataModel)
- * clientJarToEjbJarModels.get(model); } else if (ejbJarToClientJarModels.containsKey(model)) { return
- * (J2EEArtifactImportDataModel) ejbJarToClientJarModels.get(model); } else { return null; } }
- */
-
- protected IDataModel createJ2EEComponentCreationDataModel() {
- return DataModelFactory.createDataModel(new EARFacetProjectCreationDataModelProvider());
- }
-
- public IDataModelOperation getDefaultOperation() {
- return new EARComponentImportOperation(model);
- }
-
- public void init() {
- super.init();
- IDataModel componentCreationDM = model.getNestedModel(NESTED_MODEL_J2EE_COMPONENT_CREATION);
- FacetDataModelMap map = (FacetDataModelMap) componentCreationDM.getProperty(IFacetProjectCreationDataModelProperties.FACET_DM_MAP);
- IDataModel earFacet = map.getFacetDataModel( IJ2EEFacetConstants.ENTERPRISE_APPLICATION );
- earFacet.setBooleanProperty(IJ2EEFacetInstallDataModelProperties.GENERATE_DD, false);
- }
-}
diff --git a/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/application/internal/operations/IAddComponentToEnterpriseApplicationDataModelProperties.java b/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/application/internal/operations/IAddComponentToEnterpriseApplicationDataModelProperties.java
deleted file mode 100644
index 9b519183d..000000000
--- a/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/application/internal/operations/IAddComponentToEnterpriseApplicationDataModelProperties.java
+++ /dev/null
@@ -1,19 +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.application.internal.operations;
-
-import org.eclipse.wst.common.componentcore.datamodel.properties.ICreateReferenceComponentsDataModelProperties;
-
-public interface IAddComponentToEnterpriseApplicationDataModelProperties extends ICreateReferenceComponentsDataModelProperties {
-
-
-
-}
diff --git a/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/application/internal/operations/IAnnotationsDataModel.java b/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/application/internal/operations/IAnnotationsDataModel.java
deleted file mode 100644
index 8b8a47720..000000000
--- a/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/application/internal/operations/IAnnotationsDataModel.java
+++ /dev/null
@@ -1,35 +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.application.internal.operations;
-
-/**
- * The IAnnotationsDataModel is data model interface used by other data models in
- * the WTP wizard and operation framework.
- * @see org.eclipse.wst.common.frameworks.internal.operations.WTPOperationDataModel
- * @see org.eclipse.wst.common.frameworks.internal.operations.WTPOperation
- *
- * This provides the USE_ANNOTATIONS property which is used to determine whether or
- * not artifacts should be created using annotations or not.
- *
- * Subclasses may extend this interface to add their own properties.
- *
- * The use of this interface is EXPERIMENTAL and subject to substantial changes.
- *
- */
-public interface IAnnotationsDataModel {
-
- /**
- * Optional, type Boolean to determine whether an artifact should be created with annotated tags.
- * The default is set on the particular data model who implements this interface.
- */
- public static final String USE_ANNOTATIONS = "IAnnotationsDataModel.useAnnotations"; //$NON-NLS-1$
-
-}
diff --git a/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/application/internal/operations/IModuleExtensions.java b/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/application/internal/operations/IModuleExtensions.java
deleted file mode 100644
index 19136e28a..000000000
--- a/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/application/internal/operations/IModuleExtensions.java
+++ /dev/null
@@ -1,21 +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.application.internal.operations;
-
-public interface IModuleExtensions {
-
- public String DOT_WAR = ".war"; //$NON-NLS-1$
- public String DOT_JAR = ".jar"; //$NON-NLS-1$
- public String DOT_RAR = ".rar"; //$NON-NLS-1$
- public String DOT_EAR = ".ear"; //$NON-NLS-1$
-
-
-}
diff --git a/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/application/internal/operations/IUpdateModuleContextRootProperties.java b/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/application/internal/operations/IUpdateModuleContextRootProperties.java
deleted file mode 100644
index fed7be589..000000000
--- a/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/application/internal/operations/IUpdateModuleContextRootProperties.java
+++ /dev/null
@@ -1,28 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006 BEA Systems, Inc
- * 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:
- * rfrost@bea.com - initial API and impl
- *******************************************************************************/
-package org.eclipse.jst.j2ee.application.internal.operations;
-
-import org.eclipse.wst.common.componentcore.datamodel.properties.IServerContextRootDataModelProperties;
-
-/**
- * Holds DataModelOperation properties for updating the context-root of modules in associated EAR application.xml files.
- */
-public interface IUpdateModuleContextRootProperties extends IServerContextRootDataModelProperties {
- /**
- * ID for nexted IDataModel
- */
- public static final String NESTED_MODEL_ID = "UpdateModuleContextRootModel"; //$NON-NLS-1$
- /**
- * Name of property (in nested model) that holds a List of EAR IProjects.
- */
- public static final String EARS_TO_UPDATE = "IUpdateModuleContextRootProperties.EARS_TO_UPDATE"; //$NON-NLS-1$
-
-}
diff --git a/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/application/internal/operations/J2EEArtifactExportDataModelProvider.java b/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/application/internal/operations/J2EEArtifactExportDataModelProvider.java
deleted file mode 100644
index 7cb134768..000000000
--- a/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/application/internal/operations/J2EEArtifactExportDataModelProvider.java
+++ /dev/null
@@ -1,444 +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.application.internal.operations;
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.Comparator;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Set;
-
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.resources.IWorkspace;
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Path;
-import org.eclipse.jst.j2ee.archive.IArchiveExportParticipant;
-import org.eclipse.jst.j2ee.datamodel.properties.IJ2EEComponentExportDataModelProperties;
-import org.eclipse.jst.j2ee.internal.archive.ArchiveExportParticipantsExtensionPoint;
-import org.eclipse.jst.j2ee.internal.plugin.J2EEPlugin;
-import org.eclipse.jst.j2ee.internal.project.J2EEProjectUtilities;
-import org.eclipse.wst.common.componentcore.internal.util.ComponentUtilities;
-import org.eclipse.wst.common.componentcore.resources.IVirtualComponent;
-import org.eclipse.wst.common.frameworks.datamodel.AbstractDataModelProvider;
-import org.eclipse.wst.common.frameworks.datamodel.DataModelPropertyDescriptor;
-import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
-import org.eclipse.wst.common.frameworks.internal.plugin.WTPCommonMessages;
-import org.eclipse.wst.common.frameworks.internal.plugin.WTPCommonPlugin;
-import org.eclipse.wst.common.project.facet.core.IFacetedProject;
-import org.eclipse.wst.common.project.facet.core.ProjectFacetsManager;
-import org.eclipse.wst.common.project.facet.core.runtime.IRuntime;
-import org.eclipse.wst.common.project.facet.core.runtime.RuntimeManager;
-
-public abstract class J2EEArtifactExportDataModelProvider extends AbstractDataModelProvider implements IJ2EEComponentExportDataModelProperties {
-
- private static final class ArchiveExportParticipantData implements IArchiveExportParticipantData
- {
- private String id = null;
- private IArchiveExportParticipant extension = null;
- private IDataModel datamodel = null;
-
- public String getId()
- {
- return this.id;
- }
-
- public IArchiveExportParticipant getParticipant()
- {
- return this.extension;
- }
-
- public IDataModel getDataModel()
- {
- return this.datamodel;
- }
- }
-
- public HashMap componentMap;
-
- public J2EEArtifactExportDataModelProvider() {
- super();
- }
-
- public Set getPropertyNames() {
- Set propertyNames = super.getPropertyNames();
- propertyNames.add(PROJECT_NAME);
- propertyNames.add(ARCHIVE_DESTINATION);
- propertyNames.add(EXPORT_SOURCE_FILES);
- propertyNames.add(OVERWRITE_EXISTING);
- propertyNames.add(RUN_BUILD);
- propertyNames.add(COMPONENT);
- propertyNames.add(OPTIMIZE_FOR_SPECIFIC_RUNTIME);
- propertyNames.add(RUNTIME);
- propertyNames.add(RUNTIME_SPECIFIC_PARTICIPANTS);
- return propertyNames;
- }
-
- protected abstract String getProjectType();
-
- protected abstract String getWrongComponentTypeString(String projectName);
-
- protected abstract String getModuleExtension();
-
- public Object getDefaultProperty(String propertyName) {
- if (propertyName.equals(ARCHIVE_DESTINATION)) {
- return ""; //$NON-NLS-1$
- } else if (propertyName.equals(EXPORT_SOURCE_FILES)) {
- return Boolean.FALSE;
- } else if (propertyName.equals(OVERWRITE_EXISTING)) {
- return Boolean.FALSE;
- } else if (propertyName.equals(RUN_BUILD)) {
- return Boolean.TRUE;
- } else if (propertyName.equals(RUNTIME_SPECIFIC_PARTICIPANTS)) {
- return new ArrayList<IArchiveExportParticipantData>();
- } else if(propertyName.equals(OPTIMIZE_FOR_SPECIFIC_RUNTIME)){
- return Boolean.FALSE;
- }
- return super.getDefaultProperty(propertyName);
- }
-
- public boolean isPropertyEnabled( final String propertyName )
- {
- if( propertyName.equals( OPTIMIZE_FOR_SPECIFIC_RUNTIME ) )
- {
- return getDataModel().getValidPropertyDescriptors( RUNTIME ).length > 0;
- }
- else if( propertyName.equals( RUNTIME ) )
- {
- return getBooleanProperty(OPTIMIZE_FOR_SPECIFIC_RUNTIME);
- }
-
- return true;
- }
-
- public boolean propertySet(String propertyName, Object propertyValue)
- {
- boolean set = super.propertySet(propertyName, propertyValue);
- final IDataModel dm = getDataModel();
-
- if (propertyName.equals(PROJECT_NAME)) {
- if (getComponentMap().isEmpty())
- intializeComponentMap();
- IVirtualComponent component = (IVirtualComponent) getComponentMap().get(propertyValue);
- if (null != component && component.getName().equals(propertyValue)) {
- setProperty(COMPONENT, component);
- } else {
- setProperty(COMPONENT, null);
- }
-
- dm.notifyPropertyChange( RUNTIME, IDataModel.VALID_VALUES_CHG );
-
- IFacetedProject fproj = null;
-
- if( component != null )
- {
- try
- {
- fproj = ProjectFacetsManager.create( component.getProject() );
- }
- catch( CoreException e )
- {
- J2EEPlugin.logError( -1, e.getMessage(), e );
- }
- }
-
- boolean optimize = false;
- IRuntime runtime = null;
-
- if( fproj != null )
- {
- runtime = fproj.getPrimaryRuntime();
-
- if( runtime != null )
- {
- optimize = true;
- }
- else
- {
- final DataModelPropertyDescriptor[] validValues
- = dm.getValidPropertyDescriptors( RUNTIME );
-
- if( validValues.length > 0 )
- {
- runtime = (IRuntime) validValues[ 0 ].getPropertyValue();
- }
- }
- }
-
- setProperty( OPTIMIZE_FOR_SPECIFIC_RUNTIME, optimize);
- setProperty( RUNTIME, runtime );
- }
- else if( propertyName.equals( OPTIMIZE_FOR_SPECIFIC_RUNTIME ) )
- {
- dm.notifyPropertyChange( RUNTIME, IDataModel.ENABLE_CHG );
- }
- else if( propertyName.equals( RUNTIME ) )
- {
- final List<IArchiveExportParticipantData> currentExtDataList
- = (List<IArchiveExportParticipantData>) getProperty( RUNTIME_SPECIFIC_PARTICIPANTS );
-
- if( currentExtDataList != null )
- {
- for( IArchiveExportParticipantData extData : currentExtDataList )
- {
- dm.removeNestedModel( extData.getId() );
- }
- }
-
- final List<IArchiveExportParticipantData> extensions = new ArrayList<IArchiveExportParticipantData>();
-
- if( propertyValue != null )
- {
- final IProject project = getProject();
-
- if( project != null && propertyValue != null )
- {
- final IRuntime runtime = (IRuntime) propertyValue;
-
- for( ArchiveExportParticipantsExtensionPoint.ParticipantInfo partInfo
- : ArchiveExportParticipantsExtensionPoint.getExtensions( project, runtime ) )
- {
- ArchiveExportParticipantData partData = new ArchiveExportParticipantData();
- partData.id = partInfo.getId();
- partData.extension = partInfo.loadParticipant();
-
- if( partData.extension != null )
- {
- try
- {
- partData.datamodel = partData.extension.createDataModel( dm );
- dm.addNestedModel( partData.id, partData.datamodel );
- }
- catch( Exception e )
- {
- J2EEPlugin.logError( -1, e.getMessage(), e );
- partData = null;
- }
- }
- else
- {
- partData = null;
- }
-
- if( partData != null )
- {
- extensions.add( partData );
- }
- }
- }
- }
-
- setProperty( RUNTIME_SPECIFIC_PARTICIPANTS, Collections.unmodifiableList( extensions ) );
- }
-
- return set;
- }
-
- public HashMap getComponentMap() {
- if (componentMap == null)
- componentMap = new HashMap();
- return componentMap;
- }
-
- public void intializeComponentMap() {
- IVirtualComponent[] comps = ComponentUtilities.getAllWorkbenchComponents();
- for (int i = 0; i < comps.length; i++) {
- getComponentMap().put(comps[i].getName(), comps[i]);
- }
- }
-
- /**
- * Populate the resource name combo with projects that are not encrypted.
- */
- public DataModelPropertyDescriptor[] getValidPropertyDescriptors(String propertyName) {
- // TODO: populate valid components
- if (propertyName.equals(PROJECT_NAME)) {
- List componentNames = new ArrayList();
- IVirtualComponent[] wbComps = ComponentUtilities.getAllWorkbenchComponents();
-
- List relevantComponents = new ArrayList();
- for (int i = 0; i < wbComps.length; i++) {
- if (J2EEProjectUtilities.getJ2EEProjectType(wbComps[i].getProject()).equals(getProjectType())) {
- relevantComponents.add(wbComps[i]);
- getComponentMap().put(wbComps[i].getName(), wbComps[i]);
- }
- }
-
- if (relevantComponents == null || relevantComponents.size() == 0)
- return null;
-
- for (int j = 0; j < relevantComponents.size(); j++) {
- componentNames.add(((IVirtualComponent) relevantComponents.get(j)).getName());
- }
- String[] names = (String[]) componentNames.toArray(new String[componentNames.size()]);
-
- return DataModelPropertyDescriptor.createDescriptors(names);
- }
- else if( propertyName.equals( RUNTIME ) )
- {
- final List<IRuntime> runtimes = new ArrayList<IRuntime>();
- final IVirtualComponent component = (IVirtualComponent) getProperty( COMPONENT );
-
- if( component != null )
- {
- if( component != null )
- {
- try
- {
- final IFacetedProject fproj = ProjectFacetsManager.create( component.getProject() );
-
- for( IRuntime runtime : RuntimeManager.getRuntimes() )
- {
- if( fproj.isTargetable( runtime ) )
- {
- runtimes.add( runtime );
- }
- }
-
- final Comparator<IRuntime> comparator = new Comparator<IRuntime>()
- {
- public int compare( final IRuntime r1,
- final IRuntime r2 )
- {
- return r1.getName().compareTo( r2.getName() );
- }
- };
-
- Collections.sort( runtimes, comparator );
- }
- catch( CoreException e )
- {
- J2EEPlugin.logError( -1, e.getMessage(), e );
- }
- }
- }
-
- return DataModelPropertyDescriptor.createDescriptors( runtimes.toArray() );
- }
-
- return super.getValidPropertyDescriptors(propertyName);
- // (ProjectUtilities.getProjectNamesWithoutForwardSlash((String[])
- // projectsWithNature.toArray(new String[projectsWithNature.size()])));
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.wst.common.frameworks.internal.operation.WTPOperationDataModel#doValidateProperty(java.lang.String)
- */
- public IStatus validate(String propertyName) {
- if (PROJECT_NAME.equals(propertyName)) {
- String projectName = (String) model.getProperty(PROJECT_NAME);
- if (projectName == null || projectName.equals("")) //$NON-NLS-1$
- return WTPCommonPlugin.createErrorStatus(WTPCommonPlugin.getResourceString(WTPCommonMessages.MODULE_EXISTS_ERROR));
- IVirtualComponent component = (IVirtualComponent) componentMap.get(projectName);
- if (component == null) {
- return WTPCommonPlugin.createErrorStatus(WTPCommonPlugin.getResourceString(WTPCommonMessages.MODULE_EXISTS_ERROR));
- }
- if (!J2EEProjectUtilities.getJ2EEProjectType(component.getProject()).equals(getProjectType())) {
- return WTPCommonPlugin.createErrorStatus(getWrongComponentTypeString(projectName));
- }
- }
- if (ARCHIVE_DESTINATION.equals(propertyName)) {
- String archiveLocation = (String) model.getProperty(ARCHIVE_DESTINATION);
- if (!model.isPropertySet(ARCHIVE_DESTINATION) || archiveLocation.equals("")) { //$NON-NLS-1$
- return WTPCommonPlugin.createErrorStatus(WTPCommonPlugin.getResourceString(WTPCommonMessages.DESTINATION_INVALID)); //);
- } else if (model.isPropertySet(ARCHIVE_DESTINATION) && !validateModuleType(archiveLocation)) {
- return WTPCommonPlugin.createErrorStatus(WTPCommonPlugin.getResourceString(WTPCommonMessages.DESTINATION_ARCHIVE_SHOULD_END_WITH, new Object[]{getModuleExtension()})); //);
- } else if (model.isPropertySet(ARCHIVE_DESTINATION)) {
- IStatus tempStatus = validateLocation(archiveLocation);
- if (tempStatus != OK_STATUS)
- return tempStatus;
- }
- }
- if (ARCHIVE_DESTINATION.equals(propertyName) || OVERWRITE_EXISTING.equals(propertyName)) {
- String location = (String) getProperty(ARCHIVE_DESTINATION);
- if (checkForExistingFileResource(location)) {
- return WTPCommonPlugin.createErrorStatus(WTPCommonPlugin.getResourceString(WTPCommonMessages.RESOURCE_EXISTS_ERROR, new Object[]{location}));
- }
- }
- return OK_STATUS;
- }
-
- private IStatus validateLocation(String archiveLocation) {
- IPath path = null;
- try {
- path = new Path(archiveLocation);
- } catch (IllegalArgumentException ex) {
- return WTPCommonPlugin.createErrorStatus(WTPCommonPlugin.getResourceString(WTPCommonMessages.DESTINATION_INVALID));
- }
- IWorkspace workspace = ResourcesPlugin.getWorkspace();
- IStatus status = workspace.validateName(path.lastSegment(), IResource.FILE);
- if (!status.isOK()) {
- return status;
- }
- String device = path.getDevice();
- if (device == null)
- return OK_STATUS;
- if (path == null || device.length() == 1 && device.charAt(0) == IPath.DEVICE_SEPARATOR)
- return WTPCommonPlugin.createErrorStatus(WTPCommonPlugin.getResourceString(WTPCommonMessages.DESTINATION_INVALID));
-
- if (!path.toFile().canWrite()) {
- if (path.toFile().exists()) {
- return WTPCommonPlugin.createErrorStatus(WTPCommonPlugin.getResourceString(WTPCommonMessages.IS_READ_ONLY));
- }
- boolean OK = false;
- path = path.removeLastSegments(1);
- for (int i = 1; !OK && i < 20 && path.segmentCount() > 0; i++) {
- if (path.toFile().exists()) {
- OK = true;
- }
- status = workspace.validateName(path.lastSegment(), IResource.FOLDER);
- if (!status.isOK()) {
- return WTPCommonPlugin.createErrorStatus(WTPCommonPlugin.getResourceString(WTPCommonMessages.DESTINATION_INVALID));
- }
- path = path.removeLastSegments(1);
- }
- }
-
- return OK_STATUS;
- }
-
- private boolean checkForExistingFileResource(String fileName) {
- if (!model.getBooleanProperty(OVERWRITE_EXISTING)) {
- java.io.File externalFile = new java.io.File(fileName);
- if (externalFile != null && externalFile.exists())
- return true;
- }
- return false;
- }
-
- private boolean validateModuleType(String archive) {
- if ((archive.length() < 4) || (!(archive.substring(archive.length() - 4, archive.length()).equalsIgnoreCase(getModuleExtension())))) {
- return false;
- }
- return true;
- }
-
- private IProject getProject()
- {
- final IVirtualComponent component = (IVirtualComponent) getProperty( COMPONENT );
-
- if( component != null )
- {
- return component.getProject();
- }
- else
- {
- return null;
- }
- }
-
-}
diff --git a/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/application/internal/operations/J2EEArtifactImportDataModelProvider.java b/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/application/internal/operations/J2EEArtifactImportDataModelProvider.java
deleted file mode 100644
index 80e4a9327..000000000
--- a/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/application/internal/operations/J2EEArtifactImportDataModelProvider.java
+++ /dev/null
@@ -1,364 +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.application.internal.operations;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Set;
-
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Path;
-import org.eclipse.jem.util.emf.workbench.ProjectUtilities;
-import org.eclipse.jem.util.logger.proxy.Logger;
-import org.eclipse.jst.j2ee.commonarchivecore.internal.Archive;
-import org.eclipse.jst.j2ee.commonarchivecore.internal.exception.OpenFailureException;
-import org.eclipse.jst.j2ee.commonarchivecore.internal.helpers.ArchiveOptions;
-import org.eclipse.jst.j2ee.commonarchivecore.internal.helpers.SaveFilter;
-import org.eclipse.jst.j2ee.commonarchivecore.internal.util.ArchiveUtil;
-import org.eclipse.jst.j2ee.datamodel.properties.IJ2EEComponentImportDataModelProperties;
-import org.eclipse.jst.j2ee.internal.J2EEConstants;
-import org.eclipse.jst.j2ee.internal.archive.ArchiveWrapper;
-import org.eclipse.jst.j2ee.internal.archive.JavaEEArchiveUtilities;
-import org.eclipse.jst.j2ee.internal.project.J2EECreationResourceHandler;
-import org.eclipse.jst.jee.archive.ArchiveOpenFailureException;
-import org.eclipse.jst.jee.archive.IArchive;
-import org.eclipse.jst.jee.util.internal.JavaEEQuickPeek;
-import org.eclipse.wst.common.componentcore.ComponentCore;
-import org.eclipse.wst.common.componentcore.datamodel.FacetProjectCreationDataModelProvider;
-import org.eclipse.wst.common.componentcore.datamodel.properties.IFacetDataModelProperties;
-import org.eclipse.wst.common.componentcore.datamodel.properties.IFacetProjectCreationDataModelProperties;
-import org.eclipse.wst.common.componentcore.datamodel.properties.IFacetProjectCreationDataModelProperties.FacetDataModelMap;
-import org.eclipse.wst.common.componentcore.internal.util.IModuleConstants;
-import org.eclipse.wst.common.frameworks.datamodel.AbstractDataModelProvider;
-import org.eclipse.wst.common.frameworks.datamodel.DataModelEvent;
-import org.eclipse.wst.common.frameworks.datamodel.DataModelPropertyDescriptor;
-import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
-import org.eclipse.wst.common.frameworks.datamodel.IDataModelListener;
-import org.eclipse.wst.common.frameworks.internal.plugin.WTPCommonMessages;
-import org.eclipse.wst.common.frameworks.internal.plugin.WTPCommonPlugin;
-import org.eclipse.wst.common.project.facet.core.IProjectFacet;
-import org.eclipse.wst.common.project.facet.core.IProjectFacetVersion;
-import org.eclipse.wst.common.project.facet.core.runtime.IRuntime;
-
-public abstract class J2EEArtifactImportDataModelProvider extends AbstractDataModelProvider implements IJ2EEComponentImportDataModelProperties, IDataModelListener {
-
- private static final String USE_DEFAULT_PROJECT_NAME = "J2EEArtifactImportDataModelProvider.USE_DEFAULT_PROJECT_NAME"; //$NON-NLS-1$
-
- public static final String FACET_RUNTIME = "IJ2EEArtifactImportDataModelProperties.FACET_RUNTIME"; //$NON-NLS-1$
-
- private IDataModel componentCreationDM;
- private Throwable archiveOpenFailure = null;
-
- public Set getPropertyNames() {
- Set propertyNames = super.getPropertyNames();
- propertyNames.add(FILE_NAME);
- propertyNames.add(FILE);
- propertyNames.add(SAVE_FILTER);
- propertyNames.add(OVERWRITE_HANDLER);
- propertyNames.add(CLOSE_ARCHIVE_ON_DISPOSE);
- propertyNames.add(USE_DEFAULT_PROJECT_NAME);
- propertyNames.add(PROJECT_NAME);
- propertyNames.add(COMPONENT);
- propertyNames.add( FACET_RUNTIME );
- propertyNames.add(ARCHIVE_WRAPPER);
- return propertyNames;
- }
-
- public void init() {
- super.init();
- componentCreationDM = createJ2EEComponentCreationDataModel();
- componentCreationDM.setBooleanProperty(FacetProjectCreationDataModelProvider.FORCE_VERSION_COMPLIANCE, false);
- componentCreationDM.addListener(this);
- model.addNestedModel(NESTED_MODEL_J2EE_COMPONENT_CREATION, componentCreationDM);
- }
-
- public Object getDefaultProperty(String propertyName) {
- if (propertyName.equals(CLOSE_ARCHIVE_ON_DISPOSE)) {
- return Boolean.TRUE;
- } else if (propertyName.equals(USE_DEFAULT_PROJECT_NAME)) {
- return Boolean.TRUE;
- }else if( propertyName.equals(COMPONENT)){
- String projectName = getStringProperty(PROJECT_NAME);
- IProject project = ProjectUtilities.getProject(projectName);
- return ComponentCore.createComponent(project);
- }
- return super.getDefaultProperty(propertyName);
- }
-
- private boolean settingFileName = false;
-
- public boolean propertySet(String propertyName, Object propertyValue) {
- if (propertyName.equals(ARCHIVE_WRAPPER)) {
- if(propertyValue != null){
- if (!settingFileName) {
- setProperty(FILE_NAME, null);
- }
- updateDefaultComponentName();
- }
- return true;
- } else if(propertyName.equals(FILE)){
- if(propertyValue != null){
- if(!settingFileName) {
- ArchiveWrapper archiveWrapper = getArchiveWrapper();
- if(null == archiveWrapper || archiveWrapper.getCommonArchive() != propertyValue){
- archiveWrapper = new ArchiveWrapper((Archive)propertyValue);
- setProperty(ARCHIVE_WRAPPER, archiveWrapper);
- }
- }
- }
- } else if (propertyName.equals(SAVE_FILTER) && getArchiveWrapper() != null && getArchiveWrapper().getCommonArchive() != null) {
- getArchiveWrapper().getCommonArchive().setSaveFilter(getSaveFilter());
- } else if (FILE_NAME.equals(propertyName)) {
- try {
- archiveOpenFailure = null;
- handleArchiveSetup((String) propertyValue);
- } catch (OpenFailureException oe) {
- archiveOpenFailure = oe;
- } catch (ArchiveOpenFailureException e) {
- archiveOpenFailure = e;
- }
- } else if( COMPONENT.equals(propertyName)){
- throw new RuntimeException(propertyName + " should not be set."); //$NON-NLS-1$
- }else if (PROJECT_NAME.equals(propertyName)) {
- List nestedModels = new ArrayList(model.getNestedModels());
- IDataModel nestedModel = null;
- for (int i = 0; i < nestedModels.size(); i++) {
- nestedModel = (IDataModel) nestedModels.get(i);
- try {
- nestedModel.setProperty(IFacetProjectCreationDataModelProperties.FACET_PROJECT_NAME, propertyValue);
- } catch (Exception e) {
- Logger.getLogger().logError(e);
- }
- }
- } else if( FACET_RUNTIME.equals( propertyName )){
- throw new RuntimeException(propertyName + " should not be set."); //$NON-NLS-1$
- }
- return true;
- }
-
- private boolean doingComponentUpdate;
-
- private void updateDefaultComponentName() {
- ArchiveWrapper wrapper = getArchiveWrapper();
- if (null != wrapper && getBooleanProperty(USE_DEFAULT_PROJECT_NAME)) {
- try {
- doingComponentUpdate = true;
- IPath path = wrapper.getPath();
- String defaultProjectName = path.segment(path.segmentCount() - 1);
- if (defaultProjectName.indexOf('.') > 0) {
- defaultProjectName = defaultProjectName.substring(0, defaultProjectName.lastIndexOf('.'));
- }
- setProperty(PROJECT_NAME, defaultProjectName);
- } finally {
- doingComponentUpdate = false;
- }
-
- }
- }
-
- private boolean handleArchiveSetup(String fileName) throws OpenFailureException, ArchiveOpenFailureException {
- try {
- settingFileName = true;
- ArchiveWrapper wrapper = getArchiveWrapper();
- if (wrapper!= null) {
- wrapper.close();
- setProperty(FILE, null);
- setProperty(ARCHIVE_WRAPPER, null);
- }
- String uri = getStringProperty(FILE_NAME);
- if (!archiveExistsOnFile())
- return false;
- wrapper = openArchiveWrapper(uri);
- if(wrapper != null){
- setProperty(ARCHIVE_WRAPPER, wrapper);
- if(wrapper.getCommonArchive() != null){
- setProperty(FILE, wrapper.getCommonArchive());
- }
- }
- return wrapper!= null;
- } finally {
- settingFileName = false;
- }
-
- }
-
- protected ArchiveWrapper openArchiveWrapper(String uri) throws OpenFailureException, ArchiveOpenFailureException{
- IArchive archive = null;
- IPath path = new Path(uri);
- archive = JavaEEArchiveUtilities.INSTANCE.openArchive(path);
- archive.getArchiveOptions().setOption(JavaEEArchiveUtilities.DISCRIMINATE_EJB_ANNOTATIONS, Boolean.TRUE);
- archive.setPath(path);
- JavaEEQuickPeek jqp = JavaEEArchiveUtilities.INSTANCE.getJavaEEQuickPeek(archive);
-
- if(jqp.getJavaEEVersion() == J2EEConstants.UNKNOWN && jqp.getType() == J2EEConstants.UNKNOWN){
- handleUnknownType(jqp);
- }
-
- return new ArchiveWrapper(archive);
- }
- /**
- * This method allows subclasses to handle an unknown archive type.
- * @param jqp
- */
- protected void handleUnknownType(JavaEEQuickPeek jqp) {
- }
-
- protected abstract Archive openArchive(String uri) throws OpenFailureException;
-
- private boolean closeArchive() {
- if (null != getArchiveWrapper()) {
- getArchiveWrapper().close();
- }
- return true;
- }
-
- public IStatus validate(String propertyName) {
- if (FILE_NAME.equals(propertyName) && !isPropertySet(ARCHIVE_WRAPPER)) {
- String fileName = getStringProperty(propertyName);
- if (fileName == null || fileName.length() == 0) {
- return WTPCommonPlugin.createErrorStatus(WTPCommonPlugin.getResourceString(WTPCommonMessages.ARCHIVE_FILE_NAME_EMPTY_ERROR, new Object[]{ArchiveUtil.getModuleFileTypeName(getType())}));
- } else if (archiveOpenFailure != null) {
- return WTPCommonPlugin.createErrorStatus(WTPCommonPlugin.getResourceString(archiveOpenFailure.getMessage()));
- } else if (fileName != null && !archiveExistsOnFile()) {
- return WTPCommonPlugin.createErrorStatus(WTPCommonPlugin.getResourceString(WTPCommonMessages.FILE_DOES_NOT_EXIST_ERROR, new Object[]{ArchiveUtil.getModuleFileTypeName(getType())}));
- }
- } else if (NESTED_MODEL_J2EE_COMPONENT_CREATION.equals(propertyName) ) {
- return getDataModel().getNestedModel(NESTED_MODEL_J2EE_COMPONENT_CREATION).validate(true);
- } else if(FACET_RUNTIME.equals(propertyName)){
- return validateVersionSupportedByServer();
- }
- return OK_STATUS;
- }
-
- protected int getJ2EEVersion() {
- return 0;
- }
-
- protected abstract IDataModel createJ2EEComponentCreationDataModel();
-
- /*
- * @see XMLResource#APP_CLIENT_TYPE
- * @see XMLResource#APPLICATION_TYPE
- * @see XMLResource#EJB_TYPE
- * @see XMLResource#WEB_APP_TYPE
- * @see XMLResource#RAR_TYPE
- */
- protected abstract int getType();
-
- private boolean archiveExistsOnFile() {
- String jarName = (String) getProperty(FILE_NAME);
- if (jarName != null && jarName.length() > 0) {
- java.io.File file = new java.io.File(jarName);
- return file.exists() && !file.isDirectory();
- }
- return false;
- }
-
- public void dispose() {
- if (getBooleanProperty(CLOSE_ARCHIVE_ON_DISPOSE))
- closeArchive();
- super.dispose();
- }
-
- protected final void setArchiveFile(Archive archiveFile) {
- setProperty(FILE, archiveFile);
- }
-
- protected final ArchiveWrapper getArchiveWrapper(){
- return (ArchiveWrapper)getProperty(ARCHIVE_WRAPPER);
- }
-
- /**
- * @deprecated
- * @return use ARCHIVE_WRAPPER
- */
- protected final Archive getArchiveFile() {
- return (Archive) getProperty(FILE);
- }
-
- protected final ArchiveOptions getArchiveOptions() {
- ArchiveOptions opts = new ArchiveOptions();
- opts.setIsReadOnly(true);
- return opts;
- }
-
- private SaveFilter getSaveFilter() {
- return (SaveFilter) getProperty(SAVE_FILTER);
- }
-
- public DataModelPropertyDescriptor[] getValidPropertyDescriptors(String propertyName) {
- return super.getValidPropertyDescriptors(propertyName);
- }
-
- public void propertyChanged(DataModelEvent event) {
- if (!doingComponentUpdate && event.getDataModel() == componentCreationDM && event.getPropertyName().equals(PROJECT_NAME) && getBooleanProperty(USE_DEFAULT_PROJECT_NAME)) {
- setBooleanProperty(USE_DEFAULT_PROJECT_NAME, false);
- }
- if( event.getDataModel() == componentCreationDM && event.getPropertyName().equals(IFacetProjectCreationDataModelProperties.FACET_RUNTIME)){
- model.notifyPropertyChange(FACET_RUNTIME, IDataModel.DEFAULT_CHG);
- }
- }
-
- /**
- * Calling this method will fixup the JST facet version if it is incompatible with the selected runtime
- * It should be called when the Server Runtime or the Archive properties are set.
- * @return
- */
- protected IStatus validateVersionSupportedByServer(){
- if( model.isPropertySet(ARCHIVE_WRAPPER) && model.isPropertySet(IFacetProjectCreationDataModelProperties.FACET_RUNTIME)){
- IDataModel projectModel = model.getNestedModel(NESTED_MODEL_J2EE_COMPONENT_CREATION);
- FacetDataModelMap map = (FacetDataModelMap) projectModel.getProperty(IFacetProjectCreationDataModelProperties.FACET_DM_MAP);
- Collection projectFacets = (Collection)getProperty(FacetProjectCreationDataModelProvider.REQUIRED_FACETS_COLLECTION);
-
- IRuntime runtime = (IRuntime) getProperty(IFacetProjectCreationDataModelProperties.FACET_RUNTIME);
- if(runtime != null){
- for(Iterator iterator = projectFacets.iterator(); iterator.hasNext();){
- IDataModel facetDataModel = map.getFacetDataModel(((IProjectFacet)iterator.next()).getId());
- IProjectFacetVersion facetVersion = (IProjectFacetVersion)facetDataModel.getProperty(IFacetDataModelProperties.FACET_VERSION);
- if(facetVersion.getProjectFacet().getId().equals(IModuleConstants.JST_JAVA)){
- Set set = Collections.singleton(facetVersion.getProjectFacet());
- try {
- Set correctSet = runtime.getDefaultFacets(set);
- IProjectFacetVersion correctVersion = null;
- Iterator correctVersions = correctSet.iterator();
- while(correctVersions.hasNext() && correctVersion == null){
- IProjectFacetVersion version = (IProjectFacetVersion)correctVersions.next();
- if(version.getProjectFacet().getId().equals(IModuleConstants.JST_JAVA)){
- correctVersion = version;
- }
- }
-
- if(correctVersion != null){
- if(!facetVersion.equals(correctVersion)){
- facetDataModel.setProperty(IFacetDataModelProperties.FACET_VERSION, correctVersion);
- facetVersion = correctVersion;
- }
- }
- } catch (CoreException e) {
- Logger.getLogger().logError(e);
- }
- }
-
- if(!runtime.supports(facetVersion)){
- return WTPCommonPlugin.createErrorStatus( J2EECreationResourceHandler.VERSION_NOT_SUPPORTED ); //$NON-NLS-1$
- }
- }
- }
- }
- return OK_STATUS;
- }
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/application/internal/operations/J2EEComponentExportDataModelProvider.java b/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/application/internal/operations/J2EEComponentExportDataModelProvider.java
deleted file mode 100644
index b302081cc..000000000
--- a/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/application/internal/operations/J2EEComponentExportDataModelProvider.java
+++ /dev/null
@@ -1,18 +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.application.internal.operations;
-
-public abstract class J2EEComponentExportDataModelProvider extends J2EEArtifactExportDataModelProvider {
-
- public J2EEComponentExportDataModelProvider() {
- super();
- }
-}
diff --git a/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/application/internal/operations/J2EEComponentImportDataModelProvider.java b/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/application/internal/operations/J2EEComponentImportDataModelProvider.java
deleted file mode 100644
index dc57589ab..000000000
--- a/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/application/internal/operations/J2EEComponentImportDataModelProvider.java
+++ /dev/null
@@ -1,82 +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.application.internal.operations;
-
-import java.util.Set;
-
-import org.eclipse.jst.common.project.facet.JavaFacetUtils;
-import org.eclipse.jst.j2ee.commonarchivecore.internal.ModuleFile;
-import org.eclipse.jst.j2ee.datamodel.properties.IJ2EEModuleImportDataModelProperties;
-import org.eclipse.jst.j2ee.internal.J2EEVersionConstants;
-import org.eclipse.jst.j2ee.internal.archive.ArchiveWrapper;
-import org.eclipse.jst.j2ee.internal.project.J2EEProjectUtilities;
-import org.eclipse.wst.common.componentcore.datamodel.properties.IFacetDataModelProperties;
-import org.eclipse.wst.common.componentcore.datamodel.properties.IFacetProjectCreationDataModelProperties;
-import org.eclipse.wst.common.componentcore.datamodel.properties.IFacetProjectCreationDataModelProperties.FacetDataModelMap;
-import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
-import org.eclipse.wst.common.project.facet.core.IProjectFacetVersion;
-
-/**
- * This dataModel is a common super class used to import J2EE Modules.
- *
- * This class (and all its fields and methods) is likely to change during the WTP 1.0 milestones as
- * the new project structures are adopted. Use at your own risk.
- *
- * @plannedfor WTP 1.0
- */
-public abstract class J2EEComponentImportDataModelProvider extends J2EEArtifactImportDataModelProvider implements IJ2EEModuleImportDataModelProperties {
-
-
- public Set getPropertyNames() {
- Set propertyNames = super.getPropertyNames();
- propertyNames.add(EXTENDED_IMPORT_FACTORY);
- return propertyNames;
- }
-
- protected int getModuleSpecVersion() {
- ArchiveWrapper wrapper = getArchiveWrapper();
- return wrapper.getJavaEEQuickPeek().getVersion();
- }
-
- /**
- * @deprecated use #IARCHIVE_WRAPPER
- */
- protected ModuleFile getModuleFile() {
- return (ModuleFile) getArchiveFile();
- }
-
- /**
- * Updates the Java Facet Version so it is compliant with the Java EE Module version
- */
- protected void updateJavaFacetVersion() {
- ArchiveWrapper wrapper = getArchiveWrapper();
- int javaEEVersion = wrapper.getJavaEEQuickPeek().getJavaEEVersion();
- IProjectFacetVersion javaFacetVersion = null;
- switch (javaEEVersion){
- case J2EEVersionConstants.J2EE_1_2_ID:
- case J2EEVersionConstants.J2EE_1_3_ID:
- javaFacetVersion = JavaFacetUtils.JAVA_13;
- break;
- case J2EEVersionConstants.J2EE_1_4_ID:
- javaFacetVersion = JavaFacetUtils.JAVA_14;
- break;
- case J2EEVersionConstants.JEE_5_0_ID:
- javaFacetVersion = JavaFacetUtils.JAVA_50;
- break;
- }
- if(javaFacetVersion != null){
- IDataModel moduleDM = model.getNestedModel(NESTED_MODEL_J2EE_COMPONENT_CREATION);
- FacetDataModelMap map = (FacetDataModelMap) moduleDM.getProperty(IFacetProjectCreationDataModelProperties.FACET_DM_MAP);
- IDataModel javaFacetDataModel = map.getFacetDataModel( J2EEProjectUtilities.JAVA );
- javaFacetDataModel.setProperty(IFacetDataModelProperties.FACET_VERSION, javaFacetVersion);
- }
- }
-}
diff --git a/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/application/internal/operations/J2EEUtilityJarImportAssistantOperation.java b/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/application/internal/operations/J2EEUtilityJarImportAssistantOperation.java
deleted file mode 100644
index 641eb6a5a..000000000
--- a/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/application/internal/operations/J2EEUtilityJarImportAssistantOperation.java
+++ /dev/null
@@ -1,197 +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.application.internal.operations;
-
-import java.io.File;
-import java.lang.reflect.InvocationTargetException;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.Map;
-
-import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.core.commands.operations.AbstractOperation;
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IPathVariableManager;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.resources.IWorkspaceRoot;
-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.core.runtime.IStatus;
-import org.eclipse.core.runtime.Path;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.core.runtime.SubProgressMonitor;
-import org.eclipse.jdt.core.IAccessRule;
-import org.eclipse.jdt.core.IClasspathAttribute;
-import org.eclipse.jdt.core.IClasspathEntry;
-import org.eclipse.jdt.core.IJavaProject;
-import org.eclipse.jdt.core.JavaCore;
-import org.eclipse.jdt.core.JavaModelException;
-import org.eclipse.jst.j2ee.internal.earcreation.EARCreationResourceHandler;
-import org.eclipse.jst.j2ee.internal.plugin.J2EEPlugin;
-import org.eclipse.osgi.util.NLS;
-import org.eclipse.wst.common.componentcore.ComponentCore;
-import org.eclipse.wst.common.componentcore.datamodel.properties.ICreateReferenceComponentsDataModelProperties;
-import org.eclipse.wst.common.componentcore.internal.operation.CreateReferenceComponentsDataModelProvider;
-import org.eclipse.wst.common.componentcore.internal.resources.VirtualArchiveComponent;
-import org.eclipse.wst.common.componentcore.resources.IVirtualComponent;
-import org.eclipse.wst.common.frameworks.datamodel.DataModelFactory;
-import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
-
-public abstract class J2EEUtilityJarImportAssistantOperation extends AbstractOperation {
-
- private File utilityJar;
-
- private boolean overwriteIfNecessary = false;
- private String associatedEARProjectName;
-
- public J2EEUtilityJarImportAssistantOperation(String label, File utilityJar) {
- super(label);
- this.utilityJar = utilityJar;
- }
-
- public void setAssociatedEARProjectName(String associatedEARProjectName) {
- this.associatedEARProjectName = associatedEARProjectName;
- }
-
-
- public void setOverwriteIfNecessary(boolean overwriteProject) {
- this.overwriteIfNecessary = overwriteProject;
- }
-
- protected final void createLinkedPathVariable(String linkedPathVariable, File archiveFile) throws CoreException {
- IPathVariableManager manager = ResourcesPlugin.getWorkspace().getPathVariableManager();
- IPath linkedPath = new Path(archiveFile.getAbsolutePath());
- manager.setValue(linkedPathVariable, linkedPath);
-
- }
-
- protected final String getUtilityJarProjectName(File utilityJar) {
- String name = null;
- if (utilityJar != null) {
- int len = utilityJar.getName().lastIndexOf('.');
- name = utilityJar.getName().substring(0, len);
- }
- return name;
- }
-
- protected final IStatus linkArchiveToEAR(IProject earProject, String uriMapping, IProject utilityProject, IProgressMonitor monitor) throws InvocationTargetException, InterruptedException, ExecutionException {
- IDataModel addArchiveProjectToEARDataModel = DataModelFactory.createDataModel(new CreateReferenceComponentsDataModelProvider());
-
- IVirtualComponent earcomponent = ComponentCore.createComponent(earProject);
- IVirtualComponent utilcomponent = ComponentCore.createComponent(utilityProject);
-
- addArchiveProjectToEARDataModel.setProperty(ICreateReferenceComponentsDataModelProperties.SOURCE_COMPONENT, earcomponent);
- addArchiveProjectToEARDataModel.setProperty(ICreateReferenceComponentsDataModelProperties.TARGET_COMPONENT_LIST, Collections.singletonList(utilcomponent));
- Map uriMap = new HashMap();
- uriMap.put(utilcomponent, uriMapping);
- addArchiveProjectToEARDataModel.setProperty(ICreateReferenceComponentsDataModelProperties.TARGET_COMPONENTS_TO_URI_MAP, uriMap);
- return addArchiveProjectToEARDataModel.getDefaultOperation().execute(monitor, null);
- }
-
- protected final IStatus createVirtualArchiveComponent(IProject targetProject, String uriMapping, IFile utilityJarIFile, IProgressMonitor monitor) throws InvocationTargetException, InterruptedException, ExecutionException {
- IDataModel addArchiveProjectToEARDataModel = DataModelFactory.createDataModel(new CreateReferenceComponentsDataModelProvider());
-
- IVirtualComponent earcomponent = ComponentCore.createComponent(targetProject);
-
- IVirtualComponent utilcomponent = ComponentCore.createArchiveComponent(targetProject, VirtualArchiveComponent.LIBARCHIVETYPE + IPath.SEPARATOR + utilityJarIFile.getProjectRelativePath().toString());
-
- addArchiveProjectToEARDataModel.setProperty(ICreateReferenceComponentsDataModelProperties.SOURCE_COMPONENT, earcomponent);
- addArchiveProjectToEARDataModel.setProperty(ICreateReferenceComponentsDataModelProperties.TARGET_COMPONENT_LIST, Collections.singletonList(utilcomponent));
- Map uriMap = new HashMap();
- uriMap.put(utilcomponent, uriMapping);
- addArchiveProjectToEARDataModel.setProperty(ICreateReferenceComponentsDataModelProperties.TARGET_COMPONENTS_TO_URI_MAP, uriMap);
- return addArchiveProjectToEARDataModel.getDefaultOperation().execute(monitor, null);
- }
-
-
- protected final IStatus removeRootMapping(IVirtualComponent sourceComponent, String uriMapping, IProgressMonitor monitor) throws InvocationTargetException, InterruptedException, ExecutionException {
-
- try {
- sourceComponent.getRootFolder().removeLink(new Path(uriMapping), 0, monitor);
- } catch (CoreException e) {
- return J2EEPlugin.createErrorStatus(0, e.getMessage(), e);
- }
- return Status.OK_STATUS;
- }
-
- protected File getUtilityJar() {
- return utilityJar;
- }
-
- protected final IWorkspaceRoot getWorkspaceRoot() {
- return ResourcesPlugin.getWorkspace().getRoot();
- }
-
-
- protected final String getAssociatedEARProjectName() {
- return associatedEARProjectName;
- }
-
- protected final boolean isOverwriteIfNecessary() {
- return overwriteIfNecessary;
- }
-
- protected final void addLibraryToClasspath(IProject associatedEARProject, IFile copiedJarFile, IProgressMonitor monitor) throws CoreException, JavaModelException {
- if (associatedEARProject.hasNature(JavaCore.NATURE_ID)) {
-
- IClasspathEntry entry = JavaCore.newLibraryEntry(copiedJarFile.getFullPath().makeAbsolute(), null, // source
- // attachment
- null, // source attachment root
- new IAccessRule[0], // accessRules
- new IClasspathAttribute[0], // extraAttributes
- false); // isExported
-
- IJavaProject earJavaProject = JavaCore.create(associatedEARProject);
- IClasspathEntry[] rawClasspath = earJavaProject.getRawClasspath();
- IClasspathEntry[] newClasspath = new IClasspathEntry[rawClasspath.length + 1];
- System.arraycopy(rawClasspath, 0, newClasspath, 0, rawClasspath.length);
- newClasspath[rawClasspath.length] = entry;
- earJavaProject.setRawClasspath(newClasspath, monitor);
-
- }
- }
-
- protected final IStatus createLinkedArchive(IProject project, String linkedFileName, File archiveFile, String linkedPathVariable, IProgressMonitor monitor) throws CoreException {
- IFile linkedJarFile = null;
- IPath pathToArchive = getLinkedPath(archiveFile, linkedPathVariable);
-
- linkedJarFile = project.getFile(linkedFileName);
- if (linkedJarFile.exists()) {
- if (isOverwriteIfNecessary())
- linkedJarFile.delete(true, true, new SubProgressMonitor(monitor, 1));
- else
- return J2EEPlugin.createErrorStatus(0, NLS.bind(EARCreationResourceHandler.CreateProjectWithLinkedJarOperation_File_already_exists_0_, linkedJarFile.getFullPath()), null);
- }
- linkedJarFile.createLink(pathToArchive, IResource.ALLOW_MISSING_LOCAL, new SubProgressMonitor(monitor, 1));
-
- addLibraryToClasspath(project, linkedJarFile, monitor);
- return Status.OK_STATUS;
- }
-
- protected final IPath getLinkedPath(File archiveFile, String linkedPathVariable) throws CoreException {
-
- if (linkedPathVariable == null || linkedPathVariable.length() == 0)
- return new Path(archiveFile.getAbsolutePath());
- else {
- createLinkedPathVariable(linkedPathVariable, archiveFile.getParentFile());
- return new Path(linkedPathVariable).append(archiveFile.getName());
- }
- }
-
- protected final String findUniqueLocation(String baseLocation, String proposedProjectName) {
-
- return baseLocation != null ? (baseLocation + File.separator + proposedProjectName) : null;
- }
-
-}
diff --git a/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/application/internal/operations/J2EEUtilityJarImportDataModelProvider.java b/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/application/internal/operations/J2EEUtilityJarImportDataModelProvider.java
deleted file mode 100644
index 37ee68a78..000000000
--- a/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/application/internal/operations/J2EEUtilityJarImportDataModelProvider.java
+++ /dev/null
@@ -1,59 +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 Dec 15, 2003
- *
- * To change the template for this generated file go to Window - Preferences -
- * Java - Code Generation - Code and Comments
- */
-package org.eclipse.jst.j2ee.application.internal.operations;
-
-import java.util.Set;
-
-import org.eclipse.jst.j2ee.commonarchivecore.internal.Archive;
-import org.eclipse.jst.j2ee.commonarchivecore.internal.exception.OpenFailureException;
-import org.eclipse.jst.j2ee.datamodel.properties.IJavaUtilityJarImportDataModelProperties;
-import org.eclipse.jst.j2ee.project.facet.UtilityProjectCreationDataModelProvider;
-import org.eclipse.wst.common.frameworks.datamodel.DataModelFactory;
-import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
-import org.eclipse.wst.common.frameworks.datamodel.IDataModelOperation;
-
-public final class J2EEUtilityJarImportDataModelProvider extends J2EEArtifactImportDataModelProvider implements IJavaUtilityJarImportDataModelProperties {
-
- public static String J2EE_UTILITY_JAR_IMPORT_DMP_ID = "j2eeUtilityJarImportDataModelProvider";
-
- public Set getPropertyNames() {
- Set propertyNames = super.getPropertyNames();
- propertyNames.add(EAR_PROJECT_NAME);
- return propertyNames;
- }
-
- protected Archive openArchive(String uri) throws OpenFailureException {
- return null;
- }
-
- protected int getType() {
- return 0;
- }
-
- public IDataModelOperation getDefaultOperation() {
- return new J2EEUtilityJarImportOperationNew(model);
- }
-
- protected IDataModel createJ2EEComponentCreationDataModel() {
- return DataModelFactory.createDataModel(new UtilityProjectCreationDataModelProvider());
- }
-
- public String getID() {
-
- return J2EE_UTILITY_JAR_IMPORT_DMP_ID;
- }
-}
diff --git a/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/application/internal/operations/J2EEUtilityJarImportOperationNew.java b/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/application/internal/operations/J2EEUtilityJarImportOperationNew.java
deleted file mode 100644
index d19a082be..000000000
--- a/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/application/internal/operations/J2EEUtilityJarImportOperationNew.java
+++ /dev/null
@@ -1,42 +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.application.internal.operations;
-
-import org.eclipse.jst.j2ee.commonarchivecore.internal.strategy.SaveStrategy;
-import org.eclipse.jst.j2ee.internal.archive.ComponentArchiveSaveAdapter;
-import org.eclipse.jst.j2ee.internal.archive.J2EEJavaComponentArchiveSaveAdapter;
-import org.eclipse.jst.j2ee.internal.archive.operations.J2EEArtifactImportOperation;
-import org.eclipse.jst.j2ee.internal.archive.operations.J2EEJavaComponentSaveStrategyImpl;
-import org.eclipse.wst.common.componentcore.resources.IVirtualComponent;
-import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
-
-/**
- * @author jsholl
- *
- * To change the template for this generated type comment go to Window - Preferences - Java - Code
- * Generation - Code and Comments
- */
-public class J2EEUtilityJarImportOperationNew extends J2EEArtifactImportOperation {
-
- public J2EEUtilityJarImportOperationNew(IDataModel dataModel) {
- super(dataModel);
- }
-
- protected ComponentArchiveSaveAdapter getArchiveSaveAdapter(IVirtualComponent virtualComponent){
- return new J2EEJavaComponentArchiveSaveAdapter(virtualComponent);
- }
-
- protected SaveStrategy createSaveStrategy(IVirtualComponent virtualComponent) {
- J2EEJavaComponentSaveStrategyImpl saveStrat = new J2EEJavaComponentSaveStrategyImpl(virtualComponent);
- return saveStrat;
- }
-
-}
diff --git a/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/application/internal/operations/J2EEUtilityJarListImportDataModelProvider.java b/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/application/internal/operations/J2EEUtilityJarListImportDataModelProvider.java
deleted file mode 100644
index 8f42d3014..000000000
--- a/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/application/internal/operations/J2EEUtilityJarListImportDataModelProvider.java
+++ /dev/null
@@ -1,348 +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.application.internal.operations;
-
-import java.io.File;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Set;
-
-import org.eclipse.core.resources.IPathVariableManager;
-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.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.jem.util.emf.workbench.ProjectUtilities;
-import org.eclipse.jst.j2ee.datamodel.properties.IJ2EEUtilityJarListImportDataModelProperties;
-import org.eclipse.jst.j2ee.internal.earcreation.EARCreationResourceHandler;
-import org.eclipse.jst.j2ee.internal.plugin.J2EEPlugin;
-import org.eclipse.jst.j2ee.project.facet.EARFacetUtils;
-import org.eclipse.wst.common.frameworks.datamodel.AbstractDataModelProvider;
-import org.eclipse.wst.common.frameworks.datamodel.DataModelPropertyDescriptor;
-import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
-import org.eclipse.wst.common.frameworks.datamodel.IDataModelOperation;
-import org.eclipse.wst.common.project.facet.core.IFacetedProject;
-import org.eclipse.wst.common.project.facet.core.ProjectFacetsManager;
-
-/**
- * @author mdelder
- *
- */
-public class J2EEUtilityJarListImportDataModelProvider extends AbstractDataModelProvider implements IJ2EEUtilityJarListImportDataModelProperties {
-
-
-
- private static final Object[] EMPTY_ARRAY = new Object[0];
-
- public J2EEUtilityJarListImportDataModelProvider() {
- super();
- }
-
- public Set getPropertyNames(){
- Set propertyNames = super.getPropertyNames();
- propertyNames.add(EAR_PROJECT_NAME);
- propertyNames.add(CREATE_PROJECT);
- propertyNames.add(LINK_IMPORT);
- propertyNames.add(CREATE_LINKED_PROJECT);
- propertyNames.add(COPY);
- propertyNames.add(BINARY_IMPORT);
- propertyNames.add(UTILITY_JAR_LIST);
- propertyNames.add(AVAILABLE_JARS_DIRECTORY);
- propertyNames.add(PROJECT_ROOT);
- propertyNames.add(OVERRIDE_PROJECT_ROOT);
- propertyNames.add(OVERWRITE_IF_NECESSARY);
- propertyNames.add(CREATE_LINKED_PATH_VARIABLE);
- propertyNames.add(LINKED_PATH_VARIABLE);
- return propertyNames;
- }
-
- public boolean propertySet(String propertyName, Object propertyValue) {
-
- boolean notify = super.propertySet(propertyName, propertyValue);
-
- if (AVAILABLE_JARS_DIRECTORY.equals(propertyName)) {
- setProperty(UTILITY_JAR_LIST, EMPTY_ARRAY);
- } else if (UTILITY_JAR_LIST.equals(propertyName)) {
- if (propertyValue == null)
- setProperty(UTILITY_JAR_LIST, EMPTY_ARRAY);
- else
- model.setProperty(UTILITY_JAR_LIST, propertyValue);
-
- } else if (PROJECT_ROOT.equals(propertyName)) {
- if (propertyValue == null || ((String) propertyValue).length() == 0)
- setBooleanProperty(OVERRIDE_PROJECT_ROOT, false);
- else
- setBooleanProperty(OVERRIDE_PROJECT_ROOT, true);
-
- } else if (J2EEUtilityJarListImportDataModelProvider.CREATE_PROJECT.equals(propertyName) && getBooleanProperty(J2EEUtilityJarListImportDataModelProvider.CREATE_PROJECT)) {
-
- setBooleanProperty(LINK_IMPORT, false);
- setBooleanProperty(CREATE_LINKED_PROJECT, false);
- setBooleanProperty(COPY, false);
-
- model.notifyPropertyChange(BINARY_IMPORT, IDataModel.ENABLE_CHG);
- model.notifyPropertyChange(OVERRIDE_PROJECT_ROOT, IDataModel.ENABLE_CHG);
- model.notifyPropertyChange(PROJECT_ROOT, IDataModel.ENABLE_CHG);
- model.notifyPropertyChange(CREATE_LINKED_PATH_VARIABLE, IDataModel.ENABLE_CHG);
- model.notifyPropertyChange(LINKED_PATH_VARIABLE, IDataModel.ENABLE_CHG);
-
- } else if (J2EEUtilityJarListImportDataModelProvider.LINK_IMPORT.equals(propertyName) && getBooleanProperty(J2EEUtilityJarListImportDataModelProvider.LINK_IMPORT)) {
-
- setBooleanProperty(CREATE_PROJECT, false);
- setBooleanProperty(CREATE_LINKED_PROJECT, false);
- setBooleanProperty(COPY, false);
-
- model.notifyPropertyChange(BINARY_IMPORT, IDataModel.ENABLE_CHG);
- model.notifyPropertyChange(OVERRIDE_PROJECT_ROOT, IDataModel.ENABLE_CHG);
- model.notifyPropertyChange(PROJECT_ROOT, IDataModel.ENABLE_CHG);
- model.notifyPropertyChange(CREATE_LINKED_PATH_VARIABLE, IDataModel.ENABLE_CHG);
- model.notifyPropertyChange(LINKED_PATH_VARIABLE, IDataModel.ENABLE_CHG);
-
- } else if (J2EEUtilityJarListImportDataModelProvider.CREATE_LINKED_PROJECT.equals(propertyName) && getBooleanProperty(J2EEUtilityJarListImportDataModelProvider.CREATE_LINKED_PROJECT)) {
-
- setBooleanProperty(LINK_IMPORT, false);
- setBooleanProperty(CREATE_PROJECT, false);
- setBooleanProperty(COPY, false);
-
- model.notifyPropertyChange(BINARY_IMPORT, IDataModel.ENABLE_CHG);
- model.notifyPropertyChange(OVERRIDE_PROJECT_ROOT, IDataModel.ENABLE_CHG);
- model.notifyPropertyChange(PROJECT_ROOT, IDataModel.ENABLE_CHG);
- model.notifyPropertyChange(CREATE_LINKED_PATH_VARIABLE, IDataModel.ENABLE_CHG);
- model.notifyPropertyChange(LINKED_PATH_VARIABLE, IDataModel.ENABLE_CHG);
-
- } else if (J2EEUtilityJarListImportDataModelProvider.COPY.equals(propertyName) && getBooleanProperty(J2EEUtilityJarListImportDataModelProvider.COPY)) {
-
- setBooleanProperty(CREATE_PROJECT, false);
- setBooleanProperty(LINK_IMPORT, false);
- setBooleanProperty(CREATE_LINKED_PROJECT, false);
-
- model.notifyPropertyChange(BINARY_IMPORT, IDataModel.ENABLE_CHG);
- model.notifyPropertyChange(OVERRIDE_PROJECT_ROOT, IDataModel.ENABLE_CHG);
- model.notifyPropertyChange(PROJECT_ROOT, IDataModel.ENABLE_CHG);
- model.notifyPropertyChange(CREATE_LINKED_PATH_VARIABLE, IDataModel.ENABLE_CHG);
- model.notifyPropertyChange(LINKED_PATH_VARIABLE, IDataModel.ENABLE_CHG);
-
-
- } else if (J2EEUtilityJarListImportDataModelProvider.OVERRIDE_PROJECT_ROOT.equals(propertyName)) {
- model.notifyPropertyChange(PROJECT_ROOT, IDataModel.ENABLE_CHG);
- } else if (J2EEUtilityJarListImportDataModelProvider.CREATE_LINKED_PATH_VARIABLE.equals(propertyName)) {
-
- if (isLinkedPathVariableInvalid())
- setProperty(J2EEUtilityJarListImportDataModelProvider.LINKED_PATH_VARIABLE, "TEAM_SHARED_DIRECTORY"); //$NON-NLS-1$
-
- model.notifyPropertyChange(J2EEUtilityJarListImportDataModelProvider.LINKED_PATH_VARIABLE, IDataModel.ENABLE_CHG);
- model.notifyPropertyChange(AVAILABLE_JARS_DIRECTORY, IDataModel.ENABLE_CHG);
-
- } else if (J2EEUtilityJarListImportDataModelProvider.LINKED_PATH_VARIABLE.equals(propertyName)) {
- // will only set if necessary
- setProperty(J2EEUtilityJarListImportDataModelProvider.CREATE_LINKED_PATH_VARIABLE, Boolean.TRUE);
-
- if (linkedPathExists()) {
- String linkedPathVariable = getStringProperty(J2EEUtilityJarListImportDataModelProvider.LINKED_PATH_VARIABLE);
- IPathVariableManager manager = ResourcesPlugin.getWorkspace().getPathVariableManager();
- IPath availableJarsPath = manager.getValue(linkedPathVariable);
- setProperty(J2EEUtilityJarListImportDataModelProvider.CREATE_LINKED_PATH_VARIABLE, Boolean.valueOf(availableJarsPath != null));
-
- String availableJarsPathString = availableJarsPath.toOSString();
- if (availableJarsPathString != null && availableJarsPathString.length() > 0)
- setProperty(J2EEUtilityJarListImportDataModelProvider.AVAILABLE_JARS_DIRECTORY, availableJarsPathString);
- }
-
- model.notifyPropertyChange(AVAILABLE_JARS_DIRECTORY, IDataModel.ENABLE_CHG);
- }
- return notify;
- }
-
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.wst.common.frameworks.internal.operation.WTPOperationDataModel#basicIsEnabled(java.lang.String)
- */
- public boolean isPropertyEnabled(String propertyName) {
- if (J2EEUtilityJarListImportDataModelProvider.BINARY_IMPORT.equals(propertyName)) {
- return getBooleanProperty(J2EEUtilityJarListImportDataModelProvider.CREATE_PROJECT) || getBooleanProperty(J2EEUtilityJarListImportDataModelProvider.CREATE_LINKED_PROJECT);
- } else if (J2EEUtilityJarListImportDataModelProvider.OVERRIDE_PROJECT_ROOT.equals(propertyName)) {
- return getBooleanProperty(J2EEUtilityJarListImportDataModelProvider.CREATE_PROJECT) || getBooleanProperty(J2EEUtilityJarListImportDataModelProvider.CREATE_LINKED_PROJECT);
- } else if (J2EEUtilityJarListImportDataModelProvider.PROJECT_ROOT.equals(propertyName)) {
- return (getBooleanProperty(J2EEUtilityJarListImportDataModelProvider.CREATE_PROJECT) || getBooleanProperty(J2EEUtilityJarListImportDataModelProvider.CREATE_LINKED_PROJECT)) && getBooleanProperty(J2EEUtilityJarListImportDataModelProvider.OVERRIDE_PROJECT_ROOT);
- } else if (J2EEUtilityJarListImportDataModelProvider.CREATE_LINKED_PATH_VARIABLE.equals(propertyName)) {
- return (getBooleanProperty(J2EEUtilityJarListImportDataModelProvider.LINK_IMPORT) || getBooleanProperty(J2EEUtilityJarListImportDataModelProvider.CREATE_LINKED_PROJECT));
- } else if (J2EEUtilityJarListImportDataModelProvider.LINKED_PATH_VARIABLE.equals(propertyName)) {
- return getBooleanProperty(J2EEUtilityJarListImportDataModelProvider.CREATE_LINKED_PATH_VARIABLE);
- } else if (J2EEUtilityJarListImportDataModelProvider.AVAILABLE_JARS_DIRECTORY.equals(propertyName)) {
- boolean createPath = getBooleanProperty(J2EEUtilityJarListImportDataModelProvider.CREATE_LINKED_PATH_VARIABLE);
- return !createPath || !linkedPathExists();
- }
- return super.isPropertyEnabled(propertyName);
- }
-
- private boolean linkedPathExists() {
- String linkedPathVariable = getStringProperty(J2EEUtilityJarListImportDataModelProvider.LINKED_PATH_VARIABLE);
- if (linkedPathVariable == null || linkedPathVariable.trim().length() == 0)
- return false;
-
- IPathVariableManager manager = ResourcesPlugin.getWorkspace().getPathVariableManager();
- IPath availableJarsPath = manager.getValue(linkedPathVariable);
- return availableJarsPath != null;
- }
-
- private boolean isLinkedPathVariableInvalid() {
- boolean createPath = getBooleanProperty(J2EEUtilityJarListImportDataModelProvider.CREATE_LINKED_PATH_VARIABLE);
- String linkedPathVariable = getStringProperty(J2EEUtilityJarListImportDataModelProvider.LINKED_PATH_VARIABLE);
- return (createPath && (linkedPathVariable == null || linkedPathVariable.trim().length() == 0));
- }
-
- public IDataModelOperation getDefaultOperation() {
- return new J2EEUtilityJarListImportOperation(model);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.jst.j2ee.internal.internal.application.operations.J2EEImportDataModel#getDefaultProperty(java.lang.String)
- */
- public Object getDefaultProperty(String propertyName) {
- if (CREATE_PROJECT.equals(propertyName))
- return Boolean.TRUE;
- else if (LINK_IMPORT.equals(propertyName))
- return Boolean.FALSE;
- else if (COPY.equals(propertyName))
- return Boolean.FALSE;
- else if (CREATE_LINKED_PROJECT.equals(propertyName))
- return Boolean.FALSE;
- else if (CREATE_LINKED_PATH_VARIABLE.equals(propertyName))
- return Boolean.FALSE;
- else if (OVERRIDE_PROJECT_ROOT.equals(propertyName))
- return Boolean.FALSE;
- else if (BINARY_IMPORT.equals(propertyName))
- return Boolean.FALSE;
- else if (PROJECT_ROOT.equals(propertyName))
- return ResourcesPlugin.getWorkspace().getRoot().getRawLocation().toOSString();
- else if (EAR_PROJECT_NAME.equals(propertyName))
- return ""; //$NON-NLS-1$
- else if (AVAILABLE_JARS_DIRECTORY.equals(propertyName))
- return ""; //$NON-NLS-1$
- else if (LINKED_PATH_VARIABLE.equals(propertyName))
- return ""; //$NON-NLS-1$
- else if (UTILITY_JAR_LIST.equals(propertyName))
- return EMPTY_ARRAY;
- else
- return super.getDefaultProperty(propertyName);
- }
-
- public DataModelPropertyDescriptor[] getValidPropertyDescriptors(String propertyName) {
- if (EAR_PROJECT_NAME.equals(propertyName)) {
- return DataModelPropertyDescriptor.createDescriptors(getValidProjectNames());
- } else if (LINKED_PATH_VARIABLE.equals(propertyName)) {
- IPathVariableManager manager = ResourcesPlugin.getWorkspace().getPathVariableManager();
- return DataModelPropertyDescriptor.createDescriptors(manager.getPathVariableNames());
- } else
- return super.getValidPropertyDescriptors(propertyName);
- }
-
- /**
- * Populate the resource name combo with connector projects that are not encrypted.
- */
- protected Object[] getValidProjectNames() {
- IProject[] projects = ResourcesPlugin.getWorkspace().getRoot().getProjects();
- List projectsWithNature = new ArrayList();
-
- IFacetedProject facetedProject = null;
- for (int i = 0; i < projects.length; i++) {
- if(projects[i].isAccessible()) {
- try {
- facetedProject = ProjectFacetsManager.create(projects[i]);
- if (facetedProject!=null && facetedProject.hasProjectFacet(EARFacetUtils.EAR_FACET)) {
- projectsWithNature.add(projects[i].getFullPath().toString());
- }
- } catch (CoreException e) {
- J2EEPlugin.logError(0, e.getMessage(), e);
- }
- }
- }
-
- return ProjectUtilities.getProjectNamesWithoutForwardSlash((String[]) projectsWithNature.toArray(new String[projectsWithNature.size()]));
- }
-
- public IStatus validate(String propertyName) {
- if (EAR_PROJECT_NAME.equals(propertyName) /* && isSet(EAR_PROJECT_NAME) */) {
- String earProjectName = getStringProperty(EAR_PROJECT_NAME);
- if (earProjectName != null && earProjectName.length() > 0) {
- IProject earProject = ResourcesPlugin.getWorkspace().getRoot().getProject(earProjectName);
- try {
- if (!earProject.isAccessible())
- return new Status(IStatus.ERROR, J2EEPlugin.PLUGIN_ID, 0, EARCreationResourceHandler.J2EEUtilityJarListImportDataModel_Specify_Valid_Project, null);
- return Status.OK_STATUS;
- } catch (Exception e) {
- return new Status(IStatus.ERROR, J2EEPlugin.PLUGIN_ID, 0, EARCreationResourceHandler.J2EEUtilityJarListImportDataModel_Specify_Valid_Project, e);
- }
- }
- return new Status(IStatus.ERROR, J2EEPlugin.PLUGIN_ID, 0, EARCreationResourceHandler.J2EEUtilityJarListImportDataModel_Specify_Valid_Project, null);
-
- } else if (UTILITY_JAR_LIST.equals(propertyName) || J2EEUtilityJarListImportDataModelProvider.OVERWRITE_IF_NECESSARY.equals(propertyName)) {
-
- Object[] list = (Object[]) getProperty(UTILITY_JAR_LIST);
- if (list == null || list.length == 0)
- return new Status(IStatus.ERROR, J2EEPlugin.PLUGIN_ID, 0, EARCreationResourceHandler.J2EEUtilityJarListImportDataModel_Select_Jar, null);
-
- /* return validateExistingProjects(); */
-
- return Status.OK_STATUS;
- } else if (LINKED_PATH_VARIABLE.equals(propertyName)) {
- if (isLinkedPathVariableInvalid())
- return new Status(IStatus.ERROR, J2EEPlugin.PLUGIN_ID, 0, EARCreationResourceHandler.J2EEUtilityJarListImportDataModel_Specify_Linked_Path, null);
- else if (linkedPathExists())
- return new Status(IStatus.INFO, J2EEPlugin.PLUGIN_ID, 0, EARCreationResourceHandler.J2EEUtilityJarListImportDataModel_Linked_Path_Exists, null);
- } else if (PROJECT_ROOT.equals(propertyName)) {
- return validateProjectRoot();
- }
- return super.validate(propertyName);
- }
-
- private IStatus validateProjectRoot() {
- if (isPropertySet(PROJECT_ROOT) && getBooleanProperty(OVERRIDE_PROJECT_ROOT)) {
- String loc = (String) getProperty(PROJECT_ROOT);
- File file = new File(loc);
- if (!file.canWrite() || !file.isDirectory())
- return new Status(IStatus.ERROR, J2EEPlugin.PLUGIN_ID, 0, EARCreationResourceHandler.J2EEUtilityJarListImportDataModel_0, null);
- }
- return OK_STATUS;
- }
-
- // private IStatus validateExistingProjects() {
- // boolean createProject = (getBooleanProperty(J2EEUtilityJarListImportDataModel.CREATE_PROJECT)
- // || getBooleanProperty(J2EEUtilityJarListImportDataModel.CREATE_LINKED_PROJECT));
- // boolean overwrite =
- // getBooleanProperty(J2EEUtilityJarListImportDataModel.OVERWRITE_IF_NECESSARY);
- // if (createProject && !overwrite) {
- // File jarFile = null;
- // String nameWithoutJar = null;
- // Object[] selectedJars = (Object[]) getProperty(UTILITY_JAR_LIST);
- // for (int i = 0; i < selectedJars.length; i++) {
- // jarFile = (File) selectedJars[i];
- // int start = jarFile.getName().indexOf(".jar");
- // nameWithoutJar = jarFile.getName().substring(0, start);
- // if (ProjectUtilities.getProject(nameWithoutJar).exists())
- // return new Status(IStatus.ERROR, J2EEPlugin.PLUGIN_ID, 0, "Existing projects with the derived
- // names already exist (\"{0}\").", null); // {0}
- // // nameWithoutJar
- //
- // }
- // }
- // return Status.OK_STATUS;
- // }
-
-
-
-}
diff --git a/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/application/internal/operations/J2EEUtilityJarListImportOperation.java b/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/application/internal/operations/J2EEUtilityJarListImportOperation.java
deleted file mode 100644
index bf7021fdb..000000000
--- a/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/application/internal/operations/J2EEUtilityJarListImportOperation.java
+++ /dev/null
@@ -1,147 +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.application.internal.operations;
-
-import java.io.File;
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-
-import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.core.commands.operations.IUndoableOperation;
-import org.eclipse.core.runtime.IAdaptable;
-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.core.runtime.SubProgressMonitor;
-import org.eclipse.jst.j2ee.datamodel.properties.IJ2EEUtilityJarListImportDataModelProperties;
-import org.eclipse.jst.j2ee.internal.earcreation.EARCreationResourceHandler;
-import org.eclipse.jst.j2ee.internal.plugin.J2EEPlugin;
-import org.eclipse.wst.common.frameworks.datamodel.AbstractDataModelOperation;
-import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
-
-public class J2EEUtilityJarListImportOperation extends AbstractDataModelOperation implements IUndoableOperation {
-
- private static final int ASSISTANT_TICKS = 5;
-
- public J2EEUtilityJarListImportOperation(IDataModel model) {
- super(model);
- }
-
- public IStatus execute(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
-
- MultiStatus status = new MultiStatus(J2EEPlugin.PLUGIN_ID, 0, EARCreationResourceHandler.J2EEUtilityJarListImportOperation_UI_Import_Utility_Jars, null);
-
- Object[] utilityJars = (Object[]) model.getProperty(IJ2EEUtilityJarListImportDataModelProperties.UTILITY_JAR_LIST);
- if (utilityJars == null || utilityJars.length == 0)
- return J2EEPlugin.createErrorStatus(0, EARCreationResourceHandler.J2EEUtilityJarListImportOperation_There_were_no_utility_jars_selected, null);
-
- monitor.beginTask(EARCreationResourceHandler.J2EEUtilityJarListImportOperation_UI_Import_Utility_Jars, utilityJars.length * (1 + ASSISTANT_TICKS)); //$NON-NLS-1$
-
-// String earProjectName = model.getStringProperty(IJ2EEUtilityJarListImportDataModelProperties.EAR_PROJECT_NAME);
-// boolean isBinary = model.getBooleanProperty(IJ2EEUtilityJarListImportDataModelProperties.BINARY_IMPORT);
-
- // if model.getBooleanProperty(IJ2EEUtilityJarListImportDataModelProperties.COPY) then
- // isLinked = createProject = false;
- boolean toLinkImportedJars = shouldLinkImportedJars();
- boolean toCreateProject = shouldCreateProject();
- boolean toOverrideProjectRoot = shouldOverrideProjectRoot();
- boolean toOverwriteIfNecessary = shouldOverwriteIfNecessary();
-
-
- String projectRoot = null;
- if(toOverrideProjectRoot)
- projectRoot = model.getStringProperty(IJ2EEUtilityJarListImportDataModelProperties.PROJECT_ROOT);
-
- monitor.subTask(EARCreationResourceHandler.J2EEUtilityJarListImportOperation_UI_Preparing_to_import); //$NON-NLS-1$
-
- String associatedEARProjectName = model.getStringProperty(IJ2EEUtilityJarListImportDataModelProperties.EAR_PROJECT_NAME);
-
- J2EEUtilityJarImportAssistantOperation assistantOperation = null;
- List utilityJarOperations = new ArrayList();
- File utilityJar = null;
- String linkedPathVariable = null;
- if(model.isPropertySet(IJ2EEUtilityJarListImportDataModelProperties.LINKED_PATH_VARIABLE))
- linkedPathVariable = model.getStringProperty(IJ2EEUtilityJarListImportDataModelProperties.LINKED_PATH_VARIABLE);
- for (int i = 0; i < utilityJars.length && !monitor.isCanceled(); i++) {
- utilityJar = (File) utilityJars[i];
- if (toCreateProject) {
- if (!toLinkImportedJars) {
- assistantOperation = new CreateProjectWithExtractedJarOperation(utilityJar, projectRoot);
-
- } else {
- assistantOperation = new CreateProjectWithLinkedJarOperation(utilityJar, projectRoot, linkedPathVariable);
-
- }
- } else {
- if (!toLinkImportedJars) {
- assistantOperation = new CopyArchiveIntoProjectOperation(utilityJar);
- } else
- assistantOperation = new LinkArchiveIntoProjectOperation(utilityJar, linkedPathVariable);
- }
- assistantOperation.setAssociatedEARProjectName(associatedEARProjectName);
- assistantOperation.setOverwriteIfNecessary(toOverwriteIfNecessary);
- utilityJarOperations.add(assistantOperation);
-
- monitor.worked(1);
- }
-
- for (Iterator iter = utilityJarOperations.iterator(); iter.hasNext() && !monitor.isCanceled();) {
- try {
- assistantOperation = (J2EEUtilityJarImportAssistantOperation) iter.next();
- IProgressMonitor submonitor = new SubProgressMonitor(monitor, ASSISTANT_TICKS);
- assistantOperation.execute(submonitor, null);
- submonitor.done();
- } catch (Exception e) {
- status.add(J2EEPlugin.createErrorStatus(0, e.getMessage(), e));
- J2EEPlugin.logError(0, e.getMessage(), e);
- }
- }
-
- monitor.done();
-
- return status;
- }
-
- private boolean shouldOverwriteIfNecessary() {
- return model.getBooleanProperty(IJ2EEUtilityJarListImportDataModelProperties.OVERWRITE_IF_NECESSARY);
- }
-
- protected final boolean shouldImportAsBinary() {
- return model.getBooleanProperty(IJ2EEUtilityJarListImportDataModelProperties.BINARY_IMPORT);
- }
-
- protected final boolean shouldOverrideProjectRoot() {
- return model.getBooleanProperty(IJ2EEUtilityJarListImportDataModelProperties.OVERRIDE_PROJECT_ROOT);
- }
-
- protected final boolean shouldCreateProject() {
- return (model.getBooleanProperty(IJ2EEUtilityJarListImportDataModelProperties.CREATE_PROJECT) || model.getBooleanProperty(IJ2EEUtilityJarListImportDataModelProperties.CREATE_LINKED_PROJECT));
- }
-
- protected final boolean shouldLinkImportedJars() {
- return (model.getBooleanProperty(IJ2EEUtilityJarListImportDataModelProperties.LINK_IMPORT) || model.getBooleanProperty(IJ2EEUtilityJarListImportDataModelProperties.CREATE_LINKED_PROJECT));
- }
-
- public IStatus redo(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
- return Status.CANCEL_STATUS;
- }
-
- public IStatus undo(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
- return Status.CANCEL_STATUS;
- }
-
-
-
-
-
-}
diff --git a/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/application/internal/operations/LinkArchiveIntoProjectOperation.java b/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/application/internal/operations/LinkArchiveIntoProjectOperation.java
deleted file mode 100644
index 8f7ba933b..000000000
--- a/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/application/internal/operations/LinkArchiveIntoProjectOperation.java
+++ /dev/null
@@ -1,80 +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.application.internal.operations;
-
-import java.io.File;
-import java.lang.reflect.InvocationTargetException;
-
-import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IAdaptable;
-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.core.runtime.SubProgressMonitor;
-import org.eclipse.jst.j2ee.internal.earcreation.EARCreationResourceHandler;
-import org.eclipse.jst.j2ee.internal.plugin.J2EEPlugin;
-import org.eclipse.osgi.util.NLS;
-
-public class LinkArchiveIntoProjectOperation extends J2EEUtilityJarImportAssistantOperation {
-
-
- private String linkedPathVariable;
-
- public LinkArchiveIntoProjectOperation(File utilityJar, String linkedPathVariable) {
- super(NLS.bind(EARCreationResourceHandler.LinkArchiveIntoProjectOperation_Linking_archive_into_selected_proje_, utilityJar.getName()), utilityJar);
- this.linkedPathVariable = linkedPathVariable;
-
- }
-
- public IStatus execute(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
- MultiStatus status = new MultiStatus(J2EEPlugin.PLUGIN_ID, 0, NLS.bind(EARCreationResourceHandler.LinkArchiveIntoProjectOperation_Linking_archive_into_selected_proje_, getUtilityJar().getName()), null);
-
- IProject project = getWorkspaceRoot().getProject(getAssociatedEARProjectName());
-
- try {
- IFile linkedJarFile = project.getFile(getUtilityJar().getName());
- if (linkedJarFile.exists()) {
- if (isOverwriteIfNecessary())
- linkedJarFile.delete(true, true, new SubProgressMonitor(monitor, 1));
- else {
- status.add(J2EEPlugin.createErrorStatus(0, NLS.bind(EARCreationResourceHandler.CreateProjectWithLinkedJarOperation_File_already_exists_0_, linkedJarFile.getFullPath()), null));
- return status;
- }
- }
- status.add(createLinkedArchive(project, getUtilityJar().getName(), getUtilityJar(), linkedPathVariable, monitor));
-
- addLibraryToClasspath(project, linkedJarFile, monitor);
-
- createVirtualArchiveComponent(project, getUtilityJar().getName(), linkedJarFile, monitor);
-
- } catch (CoreException e) {
- status.add(J2EEPlugin.createErrorStatus(0, e.getMessage(), e));
- } catch (InvocationTargetException e) {
- status.add(J2EEPlugin.createErrorStatus(0, e.getMessage(), e));
- } catch (InterruptedException e) {
- status.add(J2EEPlugin.createErrorStatus(0, e.getMessage(), e));
- }
- return status;
- }
-
- public IStatus redo(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
- return Status.CANCEL_STATUS;
- }
-
- public IStatus undo(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
- return Status.CANCEL_STATUS;
- }
-
-}
diff --git a/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/application/internal/operations/RemoveComponentFromEnterpriseApplicationDataModelProvider.java b/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/application/internal/operations/RemoveComponentFromEnterpriseApplicationDataModelProvider.java
deleted file mode 100644
index 806c123bf..000000000
--- a/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/application/internal/operations/RemoveComponentFromEnterpriseApplicationDataModelProvider.java
+++ /dev/null
@@ -1,25 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2005, 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.application.internal.operations;
-
-import org.eclipse.wst.common.componentcore.internal.operation.RemoveReferenceComponentsDataModelProvider;
-import org.eclipse.wst.common.frameworks.datamodel.IDataModelOperation;
-
-public class RemoveComponentFromEnterpriseApplicationDataModelProvider extends RemoveReferenceComponentsDataModelProvider implements IAddComponentToEnterpriseApplicationDataModelProperties {
-
- public RemoveComponentFromEnterpriseApplicationDataModelProvider() {
- super();
- }
-
- public IDataModelOperation getDefaultOperation() {
- return new RemoveComponentFromEnterpriseApplicationOperation(model);
- }
-}
diff --git a/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/application/internal/operations/RemoveComponentFromEnterpriseApplicationOperation.java b/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/application/internal/operations/RemoveComponentFromEnterpriseApplicationOperation.java
deleted file mode 100644
index d5bc93f8c..000000000
--- a/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/application/internal/operations/RemoveComponentFromEnterpriseApplicationOperation.java
+++ /dev/null
@@ -1,96 +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.application.internal.operations;
-
-import java.util.List;
-
-import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.jst.j2ee.internal.common.classpath.J2EEComponentClasspathUpdater;
-import org.eclipse.jst.j2ee.model.IEARModelProvider;
-import org.eclipse.jst.j2ee.model.ModelProviderManager;
-import org.eclipse.jst.jee.application.ICommonApplication;
-import org.eclipse.jst.jee.application.ICommonModule;
-import org.eclipse.wst.common.componentcore.datamodel.properties.ICreateReferenceComponentsDataModelProperties;
-import org.eclipse.wst.common.componentcore.internal.operation.RemoveReferenceComponentOperation;
-import org.eclipse.wst.common.componentcore.resources.IVirtualComponent;
-import org.eclipse.wst.common.componentcore.resources.IVirtualFile;
-import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
-
-public class RemoveComponentFromEnterpriseApplicationOperation extends RemoveReferenceComponentOperation {
-
-
- public RemoveComponentFromEnterpriseApplicationOperation(IDataModel model) {
- super(model);
- }
-
- public IStatus execute(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
- try {
- J2EEComponentClasspathUpdater.getInstance().pauseUpdates();
- updateEARDD(monitor);
- super.execute(monitor, info);
- return OK_STATUS;
- } finally {
- J2EEComponentClasspathUpdater.getInstance().resumeUpdates();
- }
- }
-
- protected void updateEARDD(final IProgressMonitor monitor) {
- final IVirtualComponent comp = (IVirtualComponent) model.getProperty(ICreateReferenceComponentsDataModelProperties.SOURCE_COMPONENT);
- if (!comp.getProject().isAccessible())
- return;
- J2EEComponentClasspathUpdater.getInstance().queueUpdateEAR(comp.getProject());
- final IEARModelProvider earModel = (IEARModelProvider)ModelProviderManager.getModelProvider(comp.getProject());
- earModel.modify(new Runnable() {
- public void run() {
- ICommonApplication application = (ICommonApplication)earModel.getModelObject();
- if (application == null)
- return;
- List list = (List) model.getProperty(ICreateReferenceComponentsDataModelProperties.TARGET_COMPONENT_LIST);
- if (list != null && list.size() > 0) {
- for (int i = 0; i < list.size(); i++) {
- IVirtualComponent wc = (IVirtualComponent) list.get(i);
- IVirtualComponent moduleComponent = wc.getComponent();
- if(!moduleComponent.isBinary()){
- J2EEComponentClasspathUpdater.getInstance().queueUpdateModule(moduleComponent.getProject());
- }
- String moduleURI = getModuleURI(earModel, wc);
- removeModule(application, moduleURI);
- IVirtualFile vFile = comp.getRootFolder().getFile(moduleURI);
- IFile iFile = vFile.getUnderlyingFile();
- if(iFile.exists()){
- try {
- iFile.delete(true, monitor);
- } catch (CoreException e) {
- e.printStackTrace();
- }
- }
- }
- }
-
- }
- }, null);
- }
-
- protected String getModuleURI(final IEARModelProvider earModule, final IVirtualComponent targetComponent) {
- return earModule.getModuleURI(targetComponent);
- }
-
- protected void removeModule(ICommonApplication application, String moduleURI) {
- ICommonModule module = application.getFirstEARModule(moduleURI);
- application.getEARModules().remove(module);
- }
-
-}
diff --git a/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/application/internal/operations/UpdateManifestDataModelProperties.java b/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/application/internal/operations/UpdateManifestDataModelProperties.java
deleted file mode 100644
index 36573c508..000000000
--- a/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/application/internal/operations/UpdateManifestDataModelProperties.java
+++ /dev/null
@@ -1,46 +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.application.internal.operations;
-
-public interface UpdateManifestDataModelProperties {
- /**
- * Project name with manifest to update, type String required.
- */
- public static final String PROJECT_NAME = "UpdateManifestDataModel.PROJECT_NAME"; //$NON-NLS-1$
-
- /**
- * java.util.List of Strings
- */
- public static final String JAR_LIST = "UpdateManifestDataModel.CLASSPATH_LIST"; //$NON-NLS-1$
-
- /**
- * String. This is build from the JAR_LIST property. Never set this property.
- */
- public static final String JAR_LIST_TEXT_UI = "UpdateManifestDataModel.CLASSPATH_LIST_TEXT_UI"; //$NON-NLS-1$
-
- /**
- * Boolean, true merges, false replaces, default is true
- */
- public static final String MERGE = "UpdateManifestDataModel.MERGE"; //$NON-NLS-1$
-
- /**
- * String, no default.
- */
- public static final String MAIN_CLASS = "UpdateManifestDataModel.MAIN_CLASS"; //$NON-NLS-1$
-
-
- /**
- * String, no default.
- */
- public static final String MANIFEST_FILE = "UpdateManifestDataModel.MANIFEST_FILE"; //$NON-NLS-1$
-
-
-}
diff --git a/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/application/internal/operations/UpdateManifestDataModelProvider.java b/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/application/internal/operations/UpdateManifestDataModelProvider.java
deleted file mode 100644
index a4d5e0e6b..000000000
--- a/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/application/internal/operations/UpdateManifestDataModelProvider.java
+++ /dev/null
@@ -1,96 +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 Nov 13, 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.application.internal.operations;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Set;
-import com.ibm.icu.util.StringTokenizer;
-
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.wst.common.frameworks.datamodel.AbstractDataModelProvider;
-import org.eclipse.wst.common.frameworks.datamodel.IDataModelOperation;
-
-/**
- * @author jsholl
- *
- * 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 UpdateManifestDataModelProvider extends AbstractDataModelProvider implements UpdateManifestDataModelProperties {
-
- public Set getPropertyNames() {
- Set propertyNames = super.getPropertyNames();
- propertyNames.add(PROJECT_NAME);
- propertyNames.add(JAR_LIST);
- propertyNames.add(JAR_LIST_TEXT_UI);
- propertyNames.add(MERGE);
- propertyNames.add(MAIN_CLASS);
- propertyNames.add(MANIFEST_FILE);
- return propertyNames;
- }
-
- public Object getDefaultProperty(String propertyName) {
- if (propertyName.equals(MERGE)) {
- return Boolean.TRUE;
- } else if (propertyName.equals(JAR_LIST)) {
- return new ArrayList();
- } else if (propertyName.equals(JAR_LIST_TEXT_UI)) {
- return getClasspathAsString();
- }
- return super.getDefaultProperty(propertyName);
- }
-
- public boolean propertySet(String propertyName, Object propertyValue) {
- boolean set = super.propertySet(propertyName, propertyValue);
- if (propertyName.equals(JAR_LIST) && isPropertySet(JAR_LIST_TEXT_UI))
- setProperty(JAR_LIST_TEXT_UI, getClasspathAsString());
- return set;
- }
-
- public IProject getProject() {
- String projectName = (String) getProperty(PROJECT_NAME);
- return ResourcesPlugin.getWorkspace().getRoot().getProject(projectName);
- }
-
- public String getClasspathAsString() {
- List classpathList = (List) getProperty(JAR_LIST);
- return convertClasspathListToString(classpathList);
- }
-
- public static String convertClasspathListToString(List list) {
- String classpathString = ""; //$NON-NLS-1$
- for (int i = 0; i < list.size(); i++) {
- classpathString += ((String) list.get(i)) + " "; //$NON-NLS-1$
- }
- return classpathString.trim();
- }
-
- public static List convertClasspathStringToList(String string) {
- List list = new ArrayList();
- StringTokenizer tokenizer = new StringTokenizer(string, " "); //$NON-NLS-1$
- while (tokenizer.hasMoreTokens()) {
- list.add(tokenizer.nextToken());
- }
- return list;
- }
-
- public IDataModelOperation getDefaultOperation() {
- return new UpdateManifestOperation(model);
- }
-}
diff --git a/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/application/internal/operations/UpdateManifestOperation.java b/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/application/internal/operations/UpdateManifestOperation.java
deleted file mode 100644
index 7c1ff049e..000000000
--- a/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/application/internal/operations/UpdateManifestOperation.java
+++ /dev/null
@@ -1,79 +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 Nov 13, 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.application.internal.operations;
-
-import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.jst.j2ee.commonarchivecore.internal.helpers.ArchiveManifest;
-import org.eclipse.jst.j2ee.commonarchivecore.internal.helpers.ArchiveManifestImpl;
-import org.eclipse.jst.j2ee.commonarchivecore.internal.util.ArchiveUtil;
-import org.eclipse.jst.j2ee.internal.project.J2EEProjectUtilities;
-import org.eclipse.wst.common.frameworks.datamodel.AbstractDataModelOperation;
-import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
-
-
-/**
- * @author jsholl
- *
- * 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 UpdateManifestOperation extends AbstractDataModelOperation {
-
- public UpdateManifestOperation(IDataModel dataModel) {
- super(dataModel);
- }
-
- public IStatus execute(IProgressMonitor monitor, IAdaptable adaptable) throws ExecutionException {
- IFile file = (IFile)model.getProperty(UpdateManifestDataModelProperties.MANIFEST_FILE);
-
- String classPathValue = model.getStringProperty(UpdateManifestDataModelProperties.JAR_LIST_TEXT_UI);
- try {
- ArchiveManifest mf = J2EEProjectUtilities.readManifest(file);
-
- if (mf == null)
- mf = new ArchiveManifestImpl();
- mf.addVersionIfNecessary();
- if (model.getBooleanProperty(UpdateManifestDataModelProperties.MERGE)) {
- mf.mergeClassPath(ArchiveUtil.getTokens(classPathValue));
- } else {
- mf.setClassPath(classPathValue);
- }
- if (model.isPropertySet(UpdateManifestDataModelProperties.MAIN_CLASS)) {
- mf.setMainClass(model.getStringProperty(UpdateManifestDataModelProperties.MAIN_CLASS));
- }
-
- J2EEProjectUtilities.writeManifest(file, mf);
- } catch (java.io.IOException ex) {
- throw new ExecutionException(ex.getMessage(),ex);
- }
- return OK_STATUS;
- }
-
- 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;
- }
-}
diff --git a/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/application/internal/operations/UpdateModuleContextRootInEAROp.java b/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/application/internal/operations/UpdateModuleContextRootInEAROp.java
deleted file mode 100644
index cf16b571d..000000000
--- a/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/application/internal/operations/UpdateModuleContextRootInEAROp.java
+++ /dev/null
@@ -1,116 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006 BEA Systems, Inc
- * 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:
- * rfrost@bea.com - initial API and impl
- *******************************************************************************/
-package org.eclipse.jst.j2ee.application.internal.operations;
-
-import java.util.List;
-
-import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-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.application.WebModule;
-import org.eclipse.jst.j2ee.componentcore.util.EARArtifactEdit;
-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.frameworks.datamodel.IDataModel;
-
-/**
- * <code>AbstractDataModelOperation</code> subclass that updates the context-root for a given
- * module within the application.xml files of all containing EARs.
- */
-public class UpdateModuleContextRootInEAROp extends AbstractDataModelOperation implements IUpdateModuleContextRootProperties {
-
- public UpdateModuleContextRootInEAROp() {
- super();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.core.commands.operations.IUndoableOperation#execute(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable)
- */
- public IStatus execute(final IProgressMonitor monitor, final IAdaptable info) throws ExecutionException {
- if(monitor != null) {
- monitor.beginTask("", 1);
- }
-
- try {
- final String newContextRoot = model.getStringProperty(CONTEXT_ROOT);
- final IProject project = (IProject) model.getProperty(PROJECT);
- final IDataModel nestedModel = model.getNestedModel(NESTED_MODEL_ID);
- if (nestedModel != null) {
- List earsToUpdate= (List) nestedModel.getProperty(EARS_TO_UPDATE);
- if (newContextRoot != null && earsToUpdate != null && project != null) {
- // update each specified EAR
- for (int i = 0; i < earsToUpdate.size(); i++) {
- updateEARContextRoot((IProject) earsToUpdate.get(i), project, newContextRoot, monitor);
- }
- }
- }
- } catch (Exception e) {
- Logger.getLogger().logError(e);
- } finally {
- if (monitor != null) {
- monitor.done();
- }
- }
- return OK_STATUS;
- }
-
- /*
- * Updates the context-root element int the application.xml of the specified EAR for the specified
- * module project to the new value.
- */
- private void updateEARContextRoot(final IProject ear, final IProject project, final String newContextRoot,
- final IProgressMonitor monitor) {
- EARArtifactEdit earEdit = null;
- try {
- earEdit = EARArtifactEdit.getEARArtifactEditForWrite(ear);
- if (earEdit != null) {
- final Application application = earEdit.getApplication();
- final IVirtualComponent comp = ComponentCore.createComponent(project);
- if (comp == null) {
- return;
- }
- final String moduleURI = earEdit.getModuleURI(comp);
- final Module module = application.getFirstModule(moduleURI);
- if (module != null && module instanceof WebModule) {
- ((WebModule) module).setContextRoot(newContextRoot);
- }
- earEdit.saveIfNecessary(monitor);
- }
- } finally {
- if (earEdit != null) {
- earEdit.dispose();
- }
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.core.commands.operations.IUndoableOperation#redo(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable)
- */
- public IStatus redo(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
- // no-op
- return null;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.core.commands.operations.IUndoableOperation#undo(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable)
- */
- public IStatus undo(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
- // no-op
- return null;
- }
-
-}
diff --git a/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/componentcore/util/EARArtifactEdit.java b/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/componentcore/util/EARArtifactEdit.java
deleted file mode 100644
index 30022028d..000000000
--- a/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/componentcore/util/EARArtifactEdit.java
+++ /dev/null
@@ -1,683 +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.componentcore.util;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.Iterator;
-import java.util.List;
-
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.NullProgressMonitor;
-import org.eclipse.emf.common.util.URI;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.ecore.resource.Resource;
-import org.eclipse.jem.util.emf.workbench.WorkbenchResourceHelperBase;
-import org.eclipse.jst.j2ee.application.Application;
-import org.eclipse.jst.j2ee.application.ApplicationFactory;
-import org.eclipse.jst.j2ee.application.ApplicationResource;
-import org.eclipse.jst.j2ee.application.Module;
-import org.eclipse.jst.j2ee.application.WebModule;
-import org.eclipse.jst.j2ee.commonarchivecore.internal.Archive;
-import org.eclipse.jst.j2ee.commonarchivecore.internal.CommonarchiveFactory;
-import org.eclipse.jst.j2ee.commonarchivecore.internal.exception.OpenFailureException;
-import org.eclipse.jst.j2ee.commonarchivecore.internal.helpers.ArchiveOptions;
-import org.eclipse.jst.j2ee.componentcore.EnterpriseArtifactEdit;
-import org.eclipse.jst.j2ee.internal.J2EEConstants;
-import org.eclipse.jst.j2ee.internal.archive.operations.EARComponentLoadStrategyImpl;
-import org.eclipse.jst.j2ee.internal.common.XMLResource;
-import org.eclipse.jst.j2ee.internal.plugin.IJ2EEModuleConstants;
-import org.eclipse.jst.j2ee.model.IEARModelProvider;
-import org.eclipse.jst.j2ee.model.IModelProvider;
-import org.eclipse.jst.j2ee.project.EarUtilities;
-import org.eclipse.jst.j2ee.project.JavaEEProjectUtilities;
-import org.eclipse.jst.j2ee.project.facet.IJ2EEFacetConstants;
-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.UnresolveableURIException;
-import org.eclipse.wst.common.componentcore.internal.ArtifactEditModel;
-import org.eclipse.wst.common.componentcore.internal.ReferencedComponent;
-import org.eclipse.wst.common.componentcore.internal.StructureEdit;
-import org.eclipse.wst.common.componentcore.internal.impl.ModuleURIUtil;
-import org.eclipse.wst.common.componentcore.internal.util.IArtifactEditFactory;
-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;
-
-/**
- * <p>
- * EARArtifactEdit obtains an {@see org.eclipse.jst.j2ee.application.Application}&nbsp;metamodel.
- * The {@see org.eclipse.jst.j2ee.application.ApplicationResource}&nbsp; which stores the metamodel
- * is retrieved from the {@see org.eclipse.wst.common.modulecore.ArtifactEditModel}&nbsp;using a
- * cached constant (@see
- * org.eclipse.jst.j2ee.commonarchivecore.internal.helpers.ArchiveConstants#APPLICATION_DD_URI). The
- * defined methods extract data or manipulate the contents of the underlying resource.
- * </p>
- */
-
-public class EARArtifactEdit extends EnterpriseArtifactEdit implements IArtifactEditFactory, IEARModelProvider {
-
- private static final String EAR_CONTENT_TYPE = "org.eclipse.jst.j2ee.earDD";
-
- public static final Class ADAPTER_TYPE = EARArtifactEdit.class;
-
- private static final IVirtualReference[] NO_REFERENCES = new IVirtualReference[0];
-
- /**
- *
- */
- public EARArtifactEdit() {
- super();
- }
-
- /**
- * @param aHandle
- * @param toAccessAsReadOnly
- * @throws IllegalArgumentException
- */
- public EARArtifactEdit(IProject aProject, boolean toAccessAsReadOnly) throws IllegalArgumentException {
- super(aProject, toAccessAsReadOnly);
- }
-
- // This should be reverted to protected when 115924 is fixed
- public EARArtifactEdit(IProject aProject, boolean toAccessAsReadOnly, boolean forCreate) throws IllegalArgumentException {
- super(aProject, toAccessAsReadOnly, forCreate, IJ2EEFacetConstants.ENTERPRISE_APPLICATION);
- }
-
- /**
- * <p>
- * Returns an instance facade to manage the underlying edit model for the given
- * {@see WorkbenchComponent}. Instances of ArtifactEdit that are returned through this method
- * must be {@see #dispose()}ed of when no longer in use.
- * </p>
- * <p>
- * Use to acquire an ArtifactEdit facade for a specific {@see WorkbenchComponent}&nbsp;that
- * will not be used for editing. Invocations of any save*() API on an instance returned from
- * this method will throw exceptions.
- * </p>
- * <p>
- * <b>The following method may return null. </b>
- * </p>
- *
- * @param aModule
- * A valid {@see WorkbenchComponent}&nbsp;with a handle that resolves to an
- * accessible project in the workspace
- * @return An instance of ArtifactEdit that may only be used to read the underlying content
- * model
- */
- public static EARArtifactEdit getEARArtifactEditForRead(IProject aProject) {
- EARArtifactEdit artifactEdit = null;
- try {
- if (isValidEARModule(ComponentCore.createComponent(aProject)))
- artifactEdit = new EARArtifactEdit(aProject, true, false);
- } catch (Exception iae) {
- artifactEdit = null;
- }
- return artifactEdit;
- }
-
- /**
- * <p>
- * Returns an instance facade to manage the underlying edit model for the given
- * {@see WorkbenchComponent}. Instances of ArtifactEdit that are returned through this method
- * must be {@see #dispose()}ed of when no longer in use.
- * </p>
- * <p>
- * Use to acquire an ArtifactEdit facade for a specific {@see WorkbenchComponent}&nbsp;that
- * will be used for editing.
- * </p>
- * <p>
- * <b>The following method may return null. </b>
- * </p>
- *
- * @param aModule
- * A valid {@see WorkbenchComponent}&nbsp;with a handle that resolves to an
- * accessible project in the workspace
- * @return An instance of ArtifactEdit that may be used to modify and persist changes to the
- * underlying content model
- */
- public static EARArtifactEdit getEARArtifactEditForWrite(IProject aProject) {
- EARArtifactEdit artifactEdit = null;
- try {
- if (isValidEARModule(ComponentCore.createComponent(aProject)))
- artifactEdit = new EARArtifactEdit(aProject, false, false);
- } catch (Exception iae) {
- artifactEdit = null;
- }
- return artifactEdit;
- }
-
- /**
- * <p>
- * Returns an instance facade to manage the underlying edit model for the given
- * {@see WorkbenchComponent}. Instances of EARArtifactEdit that are returned through this
- * method must be {@see #dispose()}ed of when no longer in use.
- * </p>
- * <p>
- * Use to acquire an EARArtifactEdit facade for a specific {@see WorkbenchComponent}&nbsp;that
- * will not be used for editing. Invocations of any save*() API on an instance returned from
- * this method will throw exceptions.
- * </p>
- * <p>
- * <b>This method may return null. </b>
- * </p>
- * <p>
- * Note: This method is for internal use only. Clients should not call this method.
- * </p>
- *
- * @param aModule
- * A valid {@see WorkbenchComponent}&nbsp;with a handle that resolves to an
- * accessible project in the workspace
- * @return An instance of EARArtifactEdit that may only be used to read the underlying content
- * model
- * @throws UnresolveableURIException
- * could not resolve uri.
- */
- public static EARArtifactEdit getEARArtifactEditForRead(IVirtualComponent aModule) {
- if (aModule == null)
- return null;
- return getEARArtifactEditForRead(aModule.getProject());
- }
-
-
- /**
- * <p>
- * Returns an instance facade to manage the underlying edit model for the given
- * {@see WorkbenchComponent}. Instances of WebArtifactEdit that are returned through this
- * method must be {@see #dispose()}ed of when no longer in use.
- * </p>
- * <p>
- * Use to acquire an EARArtifactEdit facade for a specific {@see WorkbenchComponent}&nbsp;that
- * will be used for editing.
- * </p>
- * <p>
- * <b>This method may return null. </b>
- * </p>
- * <p>
- * Note: This method is for internal use only. Clients should not call this method.
- * </p>
- *
- * @param aModule
- * A valid {@see WorkbenchComponent}&nbsp;with a handle that resolves to an
- * accessible project in the workspace
- * @return An instance of EARArtifactEdit that may be used to modify and persist changes to the
- * underlying content model
- */
- public static EARArtifactEdit getEARArtifactEditForWrite(IVirtualComponent aModule) {
- if (aModule == null)
- return null;
- return getEARArtifactEditForWrite(aModule.getProject());
- }
-
- /**
- * @param module
- * A {@see WorkbenchComponent}
- * @return True if the supplied module
- * {@see ArtifactEdit#isValidEditableModule(WorkbenchComponent)}and the moduleTypeId is
- * a JST module
- */
- public static boolean isValidEARModule(IVirtualComponent aModule) throws UnresolveableURIException {
- if (!isValidEditableModule(aModule))
- return false;
- return JavaEEProjectUtilities.isEARProject(aModule.getProject());
- }
-
- /**
- * <p>
- * Creates an instance facade for the given {@see ArtifactEditModel}.
- * </p>
- *
- * @param anArtifactEditModel
- */
- public EARArtifactEdit(ArtifactEditModel model) {
- super(model);
- }
-
- /**
- * <p>
- * Creates an instance facade for the given {@see ArtifactEditModel}
- * </p>
- * <p>
- * Note: This method is for internal use only. Clients should not call this method.
- * </p>
- *
- * @param aNature
- * A non-null {@see ModuleCoreNature}for an accessible project
- * @param aModule
- * A non-null {@see WorkbenchComponent}pointing to a module from the given
- * {@see ModuleCoreNature}
- */
-
-
- protected EARArtifactEdit(ModuleCoreNature aNature, IVirtualComponent aModule, boolean toAccessAsReadOnly) {
- super(aNature, aModule, toAccessAsReadOnly);
- }
-
- /**
- * <p>
- * Retrieves J2EE version information from ApplicationResource.
- * </p>
- *
- * @return an integer representation of a J2EE Spec version
- *
- */
- public int getJ2EEVersion() {
- verifyOperationSupported();
- return getApplicationXmiResource().getJ2EEVersionID();
- }
-
- /**
- *
- * @return ApplicationResource from (@link getDeploymentDescriptorResource())
- *
- */
-
- public ApplicationResource getApplicationXmiResource() {
- verifyOperationSupported();
- return (ApplicationResource) getDeploymentDescriptorResource();
- }
-
- /**
- * <p>
- * Obtains the Application {@see Application}root object from the {@see ApplicationResource},
- * the root object contains all other resource defined objects.
- * </p>
- *
- * @return Application
- *
- */
-
- public Application getApplication() {
- verifyOperationSupported();
- return (Application) getDeploymentDescriptorRoot();
- }
-
- /**
- * <p>
- * Retrieves the resource from the {@see ArtifactEditModel}
- * </p>
- *
- * @return Resource
- *
- */
-
- public Resource getDeploymentDescriptorResource() {
- verifyOperationSupported();
- return getArtifactEditModel().getResource(J2EEConstants.APPLICATION_DD_URI_OBJ);
- }
-
-
- /**
- * <p>
- * Creates a deployment descriptor root object (Application) and populates with data. Adds the
- * root object to the deployment descriptor resource.
- * </p>
- *
- * <p>
- *
- * @param aModule
- * A non-null pointing to a {@see XMLResource}
- * @param version
- * Version to be set on resource....if null default is taken
- *
- * Note: This method is typically used for JUNIT - move?
- * </p>
- */
- protected void addApplicationIfNecessary(XMLResource aResource) {
- verifyOperationSupported();
- if (aResource != null) {
- if (aResource.getContents() == null || aResource.getContents().isEmpty()) {
- Application newApp = ApplicationFactory.eINSTANCE.createApplication();
- aResource.getContents().add(newApp);
- }
- Application application = (Application) aResource.getContents().get(0);
- URI moduleURI = getArtifactEditModel().getModuleURI();
- try {
- application.setDisplayName(StructureEdit.getDeployedName(moduleURI));
- } catch (UnresolveableURIException e) {
- // Ignore
- }
- aResource.setID(application, J2EEConstants.APPL_ID);
- // TODO add more mandatory elements
- }
- }
-
- /**
- * Checks if the uri mapping already exists.
- *
- * @param String
- * currentURI - The current uri of the module.
- * @return boolean
- */
- public boolean uriExists(String currentURI) {
- StructureEdit edit = null;
- try {
- edit = StructureEdit.getStructureEditForRead(getProject());
- if (edit!=null && edit.getComponent()!=null) {
- List referencedComps = edit.getComponent().getReferencedComponents();
- for (int i=0; i<referencedComps.size(); i++) {
- ReferencedComponent ref = (ReferencedComponent) referencedComps.get(i);
- Object module = ref.getDependentObject();
- if (module!=null && module instanceof Module) {
- String existingURI = ((Module)module).getUri();
- if (existingURI!=null && existingURI.equals(currentURI))
- return true;
- }
- }
- }
- } finally {
- if (edit != null)
- edit.dispose();
- }
- return false;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.jst.j2ee.internal.modulecore.util.EnterpriseArtifactEdit#createModelRoot()
- */
- public EObject createModelRoot() {
- verifyOperationSupported();
- return createModelRoot(getJ2EEVersion());
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.jst.j2ee.internal.modulecore.util.EnterpriseArtifactEdit#createModelRoot(java.lang.Integer)
- */
- public EObject createModelRoot(int version) {
- verifyOperationSupported();
- ApplicationResource res = (ApplicationResource) getDeploymentDescriptorResource();
- res.setModuleVersionID(version);
- addApplicationIfNecessary(res);
- return ((ApplicationResource) getDeploymentDescriptorResource()).getRootObject();
- }
-
- /**
- * This method will return the list of IVirtualReferences for all of the utility modules
- * contained in the EAR application
- *
- * @return - an array of IVirtualReferences for utility modules in the EAR
- */
- public IVirtualReference[] getUtilityModuleReferences() {
- verifyOperationSupported();
- List explicitUtilityReferences =
- getComponentReferencesAsList(Collections.singletonList(IJ2EEFacetConstants.UTILITY));
-
- // fetch other Utility Jars attached to the EAR project
- List implicitUtilityReferenceTypes =
- Arrays.asList(new String[] { IModuleConstants.JST_APPCLIENT_MODULE,
- IModuleConstants.JST_WEB_MODULE,
- IModuleConstants.JST_EJB_MODULE });
-
- List implicitUtilityReferences =
- getComponentReferencesAsList(implicitUtilityReferenceTypes);
-
-
- Application application = getApplication();
- Module module = null;
- IVirtualReference reference = null;
- for (Iterator referenceItr = implicitUtilityReferences.iterator(); referenceItr.hasNext(); ) {
- reference = (IVirtualReference) referenceItr.next();
- module = application.getFirstModule(reference.getArchiveName());
- if(module != null)
- referenceItr.remove();
- }
-
- List allUtilityModuleReferences = new ArrayList();
- allUtilityModuleReferences.addAll(explicitUtilityReferences);
- allUtilityModuleReferences.addAll(implicitUtilityReferences);
-
- if(allUtilityModuleReferences.size() > 0)
- return (IVirtualReference[]) allUtilityModuleReferences.toArray(new IVirtualReference[allUtilityModuleReferences.size()]);
- return NO_REFERENCES;
-
- }
-
- public String getModuleURI(IVirtualComponent moduleComp) {
- IVirtualReference [] refs = getComponent().getReferences();
- for(int i=0; i<refs.length; i++){
- if(refs[i].getReferencedComponent().equals(moduleComp)){
- return refs[i].getArchiveName();
- }
- }
- return null;
- }
-
-// private String getJarURI(final ReferencedComponent ref, final IVirtualComponent moduleComp) {
-// String uri = ref.getArchiveName();
-// if( uri == null || uri.length() < 0 ){
-// uri = moduleComp.getName()+IJ2EEModuleConstants.JAR_EXT;
-// }else{
-// String prefix = ref.getRuntimePath().makeRelative().toString();
-// if(prefix.length() > 0){
-// uri = prefix + "/" + uri; //$NON-NLS-1$
-// }
-// }
-// return uri;
-// }
-
- public IVirtualComponent getModuleByManifestURI(final String uri) {
- IVirtualComponent earComponent = ComponentCore.createComponent(getProject());
- IVirtualReference [] refs = earComponent.getReferences();
-
- for(int i=0;i<refs.length; i++){
- if(refs[i].getArchiveName().equals(uri)){
- return refs[i].getReferencedComponent();
- }
- }
- return null;
- }
-
- /**
- * This method will return the an IVirtualComponent for the given module name. The method take
- * either moduleName or moduleName + ".module_extension" (module_extension = ".jar" || ".war" ||
- * ".rar") which allows users to get a IVirtualComponent for a given entry in an application.xml
- *
- * @return - a IVirtualComponent for module name
- * @deprecated - see {@link J2EEProjectUtilities.getModule(IVirtualComponent earComponent, String moduleName)}
- */
- public IVirtualComponent getModule(String moduleName) {
- if (moduleName == null)
- return null;
- if (moduleName.endsWith(IJ2EEModuleConstants.JAR_EXT) || moduleName.endsWith(IJ2EEModuleConstants.WAR_EXT) || moduleName.endsWith(IJ2EEModuleConstants.RAR_EXT))
- moduleName = moduleName.substring(0, (moduleName.length() - IJ2EEModuleConstants.JAR_EXT.length()));
- IVirtualReference[] references = getComponentReferences();
- for (int i = 0; i < references.length; i++) {
- IVirtualComponent component = references[i].getReferencedComponent();
- if (component.getName().equals(moduleName)) {
- return component;
- }
- }
- return null;
- }
-
- /**
- * This method will return the list of IVirtualReferences for the J2EE module components
- * contained in this EAR application.
- *
- * @return - an array of IVirtualReferences for J2EE modules in the EAR
- * @deprecated - see {@link EarUtilities.getJ2EEModuleReferences(IVirtualComponent earComponent)}
- */
- public IVirtualReference[] getJ2EEModuleReferences() {
- return EarUtilities.getJ2EEModuleReferences(getComponent());
- }
-
- /**
- * This method will return the list of IVirtualReferences for all of the components contained in
- * this EAR application.
- *
- * @return - an array of IVirtualReferences for components in the EAR
- * @deprecated - see {@link EarUtilities.getComponentReferences(IVirtualComponent earComponent)}
- */
- public IVirtualReference[] getComponentReferences() {
- return EarUtilities.getComponentReferences(getComponent());
- }
-
- /**
- * This method will return the IVirtualReference to the component of the given name
- *
- * @return - IVirtualReference or null if not found
- * @deprecated - see {@link EarUtilities.getComponentReference(IVirtualComponent earComponent, String componentName)}
- */
- public IVirtualReference getComponentReference(String componentName) {
- return EarUtilities.getComponentReference(getComponent(), componentName);
- }
-
- /**
- *
- * @param componentTypes
- * @return A List of {@link IVirtualReference}s.
- *
- * A copy of this method is now in J2EEProjectUtilities. Any bug fixes should occur in both locations.
- */
- private List getComponentReferencesAsList(List componentTypes) {
- List components = new ArrayList();
- IVirtualComponent earComponent = getComponent();
- if (earComponent != null && JavaEEProjectUtilities.isEARProject(earComponent.getProject())) {
- IVirtualReference[] refComponents = earComponent.getReferences();
- for (int i = 0; i < refComponents.length; i++) {
- IVirtualComponent module = refComponents[i].getReferencedComponent();
- if (module == null)
- continue;
- // if component types passed in is null then return all components
- if (componentTypes == null || componentTypes.size() == 0)
- components.add(refComponents[i]);
- else {
- if (componentTypes.contains(JavaEEProjectUtilities.getJ2EEComponentType(module))) {
- components.add(refComponents[i]);
- }
- }
- }
- }
- return components;
- }
-
- public ArtifactEdit createArtifactEditForRead(IVirtualComponent aComponent) {
-
- return getEARArtifactEditForRead(aComponent);
- }
-
- public ArtifactEdit createArtifactEditForWrite(IVirtualComponent aComponent) {
-
- return getEARArtifactEditForWrite(aComponent);
- }
-
- public Archive asArchive(boolean includeSource) throws OpenFailureException {
- return asArchive(includeSource, true);
- }
-
- public Archive asArchive(boolean includeSource, boolean includeClasspathComponents) throws OpenFailureException {
- return asArchive(includeSource, includeClasspathComponents, false);
- }
- public Archive asArchive(boolean includeSource, boolean includeClasspathComponents, boolean readOnly) throws OpenFailureException {
- verifyOperationSupported();
- EARComponentLoadStrategyImpl loader = new EARComponentLoadStrategyImpl(getComponent(), includeClasspathComponents);
- loader.setReadOnly(readOnly);
- loader.setExportSource(includeSource);
- String uri = ModuleURIUtil.getHandleString(getComponent());
- ArchiveOptions options = new ArchiveOptions();
- options.setLoadStrategy(loader);
- options.setIsReadOnly(readOnly);
- return CommonarchiveFactory.eINSTANCE.openEARFile(options, uri);
- }
-
- public static void createDeploymentDescriptor(IProject project, int version) {
- EnterpriseArtifactEdit earEdit = new EARArtifactEdit(project, false, true);
- try {
- earEdit.createModelRoot(version);
- earEdit.save(null);
- } finally { // Make sure new resource is removed - the uri used for creation shouldn't be cached
- Resource newRes = earEdit.getDeploymentDescriptorResource();
- WorkbenchResourceHelperBase.getResourceSet(project).getResources().remove(newRes);
- newRes.unload();
- earEdit.dispose();
- }
- }
-
- /**
- * This method will return the context root in this application for the passed in web project.
- *
- * @param webProject
- * @return contextRoot String
- */
- public String getWebContextRoot(IProject webProject) {
- verifyOperationSupported();
- if (webProject == null || !JavaEEProjectUtilities.isDynamicWebProject(webProject))
- return null;
- IVirtualComponent webComp = ComponentCore.createComponent(webProject);
- String webModuleURI = getModuleURI(webComp);
- if (webModuleURI != null) {
- WebModule webModule = (WebModule) getApplication().getModule(webModuleURI, null);
- if (webModule != null)
- return webModule.getContextRoot();
- }
- return null;
- }
-
- /**
- * This method will set the context root on the application for the passed in contextRoot. This
- * must be called in a write artifact edit and be saved for changes to be saved.
- *
- * @param webProject
- * @param aContextRoot
- */
- public void setWebContextRoot(IProject webProject, String aContextRoot) {
- verifyOperationSupported();
- if (webProject == null || !JavaEEProjectUtilities.isDynamicWebProject(webProject))
- return;
- IVirtualComponent webComp = ComponentCore.createComponent(webProject);
- String webModuleURI = getModuleURI(webComp);
- if (webModuleURI != null) {
- WebModule webModule = (WebModule) getApplication().getModule(webModuleURI, null);
- if (webModule != null)
- webModule.setContextRoot(aContextRoot);
- }
- }
- public IModelProvider create(IProject project) {
- return (IModelProvider)getEARArtifactEditForRead(project);
- }
-
- public IModelProvider create(IVirtualComponent component) {
- return (IModelProvider)getEARArtifactEditForRead(component);
- }
- /* (non-Javadoc)
- * @see org.eclipse.jst.j2ee.componentcore.EnterpriseArtifactEdit#modify(java.lang.Runnable, org.eclipse.core.runtime.IPath)
- */
- public void modify(Runnable runnable, IPath modelPath) {
- setWritableEdit(getEARArtifactEditForWrite(getProject()));
- try {
- runnable.run();
- if( getWritableEdit() != null ){
- // Always save regardless of resource path passed - Artifactedits save resources as a unit
- getWritableEdit().saveIfNecessary( new NullProgressMonitor() );
- }
-
- } finally {
- getWritableEdit().dispose();
- setWritableEdit(null);
- }
- }
-
-
- protected String getContentTypeDescriber() {
- return EAR_CONTENT_TYPE;
- }
- protected URI getRootURI() {
- return J2EEConstants.APPLICATION_DD_URI_OBJ;
- }
-}
diff --git a/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/componentcore/util/EARVirtualComponent.java b/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/componentcore/util/EARVirtualComponent.java
deleted file mode 100644
index ff56c4377..000000000
--- a/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/componentcore/util/EARVirtualComponent.java
+++ /dev/null
@@ -1,210 +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.componentcore.util;
-
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IResource;
-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.componentcore.J2EEModuleVirtualArchiveComponent;
-import org.eclipse.jst.j2ee.internal.plugin.IJ2EEModuleConstants;
-import org.eclipse.jst.j2ee.internal.project.J2EEProjectUtilities;
-import org.eclipse.jst.jee.application.ICommonModule;
-import org.eclipse.wst.common.componentcore.ComponentCore;
-import org.eclipse.wst.common.componentcore.internal.ReferencedComponent;
-import org.eclipse.wst.common.componentcore.internal.StructureEdit;
-import org.eclipse.wst.common.componentcore.internal.WorkbenchComponent;
-import org.eclipse.wst.common.componentcore.internal.builder.DependencyGraphManager;
-import org.eclipse.wst.common.componentcore.internal.resources.VirtualArchiveComponent;
-import org.eclipse.wst.common.componentcore.internal.resources.VirtualComponent;
-import org.eclipse.wst.common.componentcore.internal.util.IComponentImplFactory;
-import org.eclipse.wst.common.componentcore.resources.IVirtualComponent;
-import org.eclipse.wst.common.componentcore.resources.IVirtualFile;
-import org.eclipse.wst.common.componentcore.resources.IVirtualFolder;
-import org.eclipse.wst.common.componentcore.resources.IVirtualReference;
-import org.eclipse.wst.common.componentcore.resources.IVirtualResource;
-
-public class EARVirtualComponent extends VirtualComponent implements IComponentImplFactory {
-
- private IVirtualReference[] cachedReferences;
- private long depGraphModStamp;
- public EARVirtualComponent() {
- super();
- }
-
- public EARVirtualComponent(IProject aProject, IPath aRuntimePath) {
- super(aProject, aRuntimePath);
- }
-
- public IVirtualComponent createArchiveComponent(IProject aProject, String archiveLocation, IPath aRuntimePath) {
- return new J2EEModuleVirtualArchiveComponent(aProject, archiveLocation, aRuntimePath);
- }
-
- public IVirtualComponent createComponent(IProject aProject) {
- return new EARVirtualComponent(aProject, new Path("/")); //$NON-NLS-1$
- }
-
- public IVirtualFolder createFolder(IProject aProject, IPath aRuntimePath) {
- return new EARVirtualRootFolder(aProject, aRuntimePath);
- }
-
- private static String getJarURI(final ReferencedComponent ref, final IVirtualComponent moduleComp) {
- String uri = ref.getArchiveName();
- if (uri == null || uri.length() < 0) {
- if(moduleComp.isBinary()){
- uri = new Path(moduleComp.getName()).lastSegment();
- } else {
- uri = moduleComp.getName() + IJ2EEModuleConstants.JAR_EXT;
- }
- } else {
- String prefix = ref.getRuntimePath().makeRelative().toString();
- if (prefix.length() > 0) {
- uri = prefix + "/" + uri; //$NON-NLS-1$
- }
- }
- return uri;
- }
-
- private static List getHardReferences(IVirtualComponent earComponent) {
- StructureEdit core = null;
- List hardReferences = new ArrayList();
- try {
- core = StructureEdit.getStructureEditForRead(earComponent.getProject());
- if (core != null && core.getComponent() != null) {
- WorkbenchComponent component = core.getComponent();
- if (component != null) {
- List referencedComponents = component.getReferencedComponents();
- for (Iterator iter = referencedComponents.iterator(); iter.hasNext();) {
- ReferencedComponent referencedComponent = (ReferencedComponent) iter.next();
- if (referencedComponent == null)
- continue;
- IVirtualReference vReference = StructureEdit.createVirtualReference(earComponent, referencedComponent);
- if (vReference != null) {
- IVirtualComponent referencedIVirtualComponent = vReference.getReferencedComponent();
- if (referencedIVirtualComponent != null && referencedIVirtualComponent.exists()) {
- String archiveName = null;
- if (referencedComponent.getDependentObject() != null) {
- archiveName = ((ICommonModule) referencedComponent.getDependentObject()).getUri();
- } else {
- if (referencedIVirtualComponent.isBinary()) {
- archiveName = getJarURI(referencedComponent, referencedIVirtualComponent);
- } else if(referencedComponent.getArchiveName() != null){
- archiveName = referencedComponent.getArchiveName();
- } else {
- IProject referencedProject = referencedIVirtualComponent.getProject();
- // If dependent object is not set, assume
- // compname is module name + proper
- // extension
- if (J2EEProjectUtilities.isDynamicWebProject(referencedProject) || J2EEProjectUtilities.isStaticWebProject(referencedProject)) {
- archiveName = referencedIVirtualComponent.getName() + IJ2EEModuleConstants.WAR_EXT;
- } else if (J2EEProjectUtilities.isJCAProject(referencedProject)) {
- archiveName = referencedIVirtualComponent.getName() + IJ2EEModuleConstants.RAR_EXT;
- } else if (J2EEProjectUtilities.isUtilityProject(referencedProject)) {
- archiveName = getJarURI(referencedComponent, referencedIVirtualComponent);
- } else {
- archiveName = referencedIVirtualComponent.getName() + IJ2EEModuleConstants.JAR_EXT;
- }
- }
- }
- vReference.setArchiveName(archiveName);
- hardReferences.add(vReference);
- }
- }
- }
- }
- }
- } finally {
- if (core != null)
- core.dispose();
- }
- return hardReferences;
- }
-
- /**
- * Returns the resulting list of referenced components based off the hard references and archives mapping to the root folder.
- *
- * @param earComponent
- * @param hardReferences
- * @param membersToIgnore
- * @return
- */
- private static List getLooseArchiveReferences(EARVirtualComponent earComponent, List hardReferences) {
- return getLooseArchiveReferences(earComponent, hardReferences, null, (EARVirtualRootFolder)earComponent.getRootFolder());
- }
-
- private static List getLooseArchiveReferences(EARVirtualComponent earComponent, List hardReferences, List dynamicReferences, EARVirtualRootFolder folder) {
- try {
- IVirtualResource[] members = folder.superMembers();
- for (int i = 0; i < members.length; i++) {
- if (IVirtualResource.FILE == members[i].getType()) {
- if(folder.isDynamicComponent((IVirtualFile)members[i])){
- String archiveName = members[i].getRuntimePath().toString().substring(1);
- boolean shouldInclude = true;
- for (int j = 0; j < hardReferences.size() && shouldInclude; j++) {
- String tempArchiveName = ((IVirtualReference) hardReferences.get(j)).getArchiveName();
- if (null != tempArchiveName && tempArchiveName.equals(archiveName)) {
- shouldInclude = false;
- }
- }
- if (shouldInclude) {
- IResource iResource = members[i].getUnderlyingResource();
- IVirtualComponent dynamicComponent = ComponentCore.createArchiveComponent(earComponent.getProject(), VirtualArchiveComponent.LIBARCHIVETYPE + iResource.getFullPath().toString());
- IVirtualReference dynamicRef = ComponentCore.createReference(earComponent, dynamicComponent);
- dynamicRef.setArchiveName(archiveName);
- if (null == dynamicReferences) {
- dynamicReferences = new ArrayList();
- }
- dynamicReferences.add(dynamicRef);
- }
- }
- } else if(IVirtualResource.FOLDER == members[i].getType()){
- dynamicReferences = getLooseArchiveReferences(earComponent, hardReferences, dynamicReferences, (EARVirtualRootFolder)members[i]);
- }
- }
- } catch (CoreException e) {
- Logger.getLogger().logError(e);
- }
- return dynamicReferences;
- }
-
- public IVirtualReference[] getReferences() {
-
- IVirtualReference[] cached = getCachedReferences();
- if (cached != null)
- return cached;
- List hardReferences = getHardReferences(this);
- List dynamicReferences = getLooseArchiveReferences(this, hardReferences);
-
- if (dynamicReferences != null) {
- hardReferences.addAll(dynamicReferences);
- }
- cachedReferences = (IVirtualReference[]) hardReferences.toArray(new IVirtualReference[hardReferences.size()]);
- return cachedReferences;
- }
- // Returns cache if still valid or null
- public IVirtualReference[] getCachedReferences() {
- if (cachedReferences != null && checkIfStillValid())
- return cachedReferences;
- else
- depGraphModStamp = DependencyGraphManager.getInstance().getModStamp();
- return null;
- }
-
- private boolean checkIfStillValid() {
- return DependencyGraphManager.getInstance().checkIfStillValid(depGraphModStamp);
- }
-}
diff --git a/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/componentcore/util/EARVirtualRootFolder.java b/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/componentcore/util/EARVirtualRootFolder.java
deleted file mode 100644
index 83ef7cc9c..000000000
--- a/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/componentcore/util/EARVirtualRootFolder.java
+++ /dev/null
@@ -1,74 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2005, 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.componentcore.util;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.jst.j2ee.internal.common.classpath.J2EEComponentClasspathUpdater;
-import org.eclipse.wst.common.componentcore.internal.resources.VirtualFolder;
-import org.eclipse.wst.common.componentcore.resources.IVirtualFile;
-import org.eclipse.wst.common.componentcore.resources.IVirtualResource;
-
-//TODO this should be renamed to EARVirtualFolder because it is not used only for the root.
-public class EARVirtualRootFolder extends VirtualFolder {
-
- public EARVirtualRootFolder(IProject aComponentProject, IPath aRuntimePath) {
- super(aComponentProject, aRuntimePath);
- }
-
- public static String [] EXTENSIONS_TO_IGNORE = new String [] {".jar", ".zip", ".rar", ".war" };
-
- public IVirtualResource[] superMembers() throws CoreException {
- return superMembers(IResource.NONE);
- }
-
- public IVirtualResource[] superMembers(int memberFlags) throws CoreException {
- return super.members(memberFlags);
- }
-
- public boolean isDynamicComponent(IVirtualFile vFile){
- String archiveName = vFile.getName();
- for(int j = 0; j<EXTENSIONS_TO_IGNORE.length; j++){
- if(J2EEComponentClasspathUpdater.endsWithIgnoreCase(archiveName, EXTENSIONS_TO_IGNORE[j])){
- return true;
- }
- }
- return false;
- }
-
- /**
- * For now, just rip out files with .jar, .rar, or .war file extensions, because these are
- * the only files automatically added dyamically
- */
- public IVirtualResource[] members(int memberFlags) throws CoreException {
- IVirtualResource[] members = superMembers(memberFlags);
- List virtualResources = new ArrayList();
- boolean shouldAdd = true;
- for (int i = 0; i < members.length; i++) {
- shouldAdd = true;
- if (IVirtualResource.FILE == members[i].getType()) {
- if(isDynamicComponent((IVirtualFile)members[i])){
- shouldAdd = false;
- }
- }
- if (shouldAdd) {
- virtualResources.add(members[i]);
- }
- }
- return (IVirtualResource[]) virtualResources
- .toArray(new IVirtualResource[virtualResources.size()]);
- }
-}
diff --git a/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/componentcore/util/package.xml b/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/componentcore/util/package.xml
deleted file mode 100644
index aec496d4e..000000000
--- a/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/componentcore/util/package.xml
+++ /dev/null
@@ -1,19 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<html>
- <head>
- <meta
- name="root"
- content="../../../../../../../" />
- <title>EJBArtifactEdit api overview</title>
- </head>
-
- <body>
- <abstract>
- This package includes the EARArtifactEdit api. This api is used to work with the emf model
- of a flexible EAR module. It contains api to read and serialize out the emf model for enterprise applications.
- </abstract>
-
- <a href="#top">top</a>
- </body>
-</html>
- \ No newline at end of file
diff --git a/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/earcreation/IEarFacetInstallDataModelProperties.java b/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/earcreation/IEarFacetInstallDataModelProperties.java
deleted file mode 100644
index 720a41ed8..000000000
--- a/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/earcreation/IEarFacetInstallDataModelProperties.java
+++ /dev/null
@@ -1,28 +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.earcreation;
-
-import org.eclipse.jst.j2ee.internal.project.facet.EARFacetProjectCreationDataModelProvider;
-import org.eclipse.jst.j2ee.project.facet.IJ2EEFacetInstallDataModelProperties;
-
-public interface IEarFacetInstallDataModelProperties extends IJ2EEFacetInstallDataModelProperties {
-
- /**
- * This field should not be used. It is not part of the API and may be modified in the future.
- */
- public static Class _provider_class = EARFacetProjectCreationDataModelProvider.class;
-
- //TODO what is this???
- public static final String CONTENT_DIR = "IEarFacetInstallDataModelProperties.CONTENT_DIR";//$NON-NLS-1$
-
- public static final String J2EE_PROJECTS_LIST = "IEarFacetInstallDataModelProperties.J2EE_PROJECTS_LIST"; //$NON-NLS-1$
- public static final String JAVA_PROJECT_LIST = "IEarFacetInstallDataModelProperties.JAVA_PROJECT_LIST"; //$NON-NLS-1$
-}
diff --git a/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/internal/earcreation/DefaultJ2EEComponentCreationDataModelProvider.java b/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/internal/earcreation/DefaultJ2EEComponentCreationDataModelProvider.java
deleted file mode 100644
index 349c412c3..000000000
--- a/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/internal/earcreation/DefaultJ2EEComponentCreationDataModelProvider.java
+++ /dev/null
@@ -1,457 +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.earcreation;
-
-import java.util.ArrayList;
-import java.util.Set;
-
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IWorkspaceRoot;
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.jst.j2ee.application.internal.operations.DefaultJ2EEComponentCreationOperation;
-import org.eclipse.jst.j2ee.applicationclient.internal.creation.AppClientFacetProjectCreationDataModelProvider;
-import org.eclipse.jst.j2ee.internal.J2EEVersionConstants;
-import org.eclipse.jst.j2ee.internal.common.J2EEVersionUtil;
-import org.eclipse.jst.j2ee.internal.moduleextension.EarModuleManager;
-import org.eclipse.jst.j2ee.internal.moduleextension.EjbModuleExtension;
-import org.eclipse.jst.j2ee.internal.moduleextension.JcaModuleExtension;
-import org.eclipse.jst.j2ee.internal.moduleextension.WebModuleExtension;
-import org.eclipse.jst.j2ee.internal.plugin.J2EEPlugin;
-import org.eclipse.jst.j2ee.internal.project.J2EEProjectUtilities;
-import org.eclipse.jst.j2ee.project.facet.IJ2EEFacetProjectCreationDataModelProperties;
-import org.eclipse.jst.j2ee.project.facet.IJ2EEModuleFacetInstallDataModelProperties;
-import org.eclipse.jst.j2ee.project.facet.J2EEModuleFacetInstallDataModelProvider;
-import org.eclipse.wst.common.componentcore.datamodel.properties.IFacetDataModelProperties;
-import org.eclipse.wst.common.componentcore.datamodel.properties.IFacetProjectCreationDataModelProperties;
-import org.eclipse.wst.common.componentcore.datamodel.properties.IFacetProjectCreationDataModelProperties.FacetDataModelMap;
-import org.eclipse.wst.common.frameworks.datamodel.AbstractDataModelProvider;
-import org.eclipse.wst.common.frameworks.datamodel.DataModelFactory;
-import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
-import org.eclipse.wst.common.frameworks.datamodel.IDataModelOperation;
-import org.eclipse.wst.common.frameworks.internal.WTPPlugin;
-import org.eclipse.wst.common.project.facet.core.IFacetedProjectWorkingCopy;
-import org.eclipse.wst.common.project.facet.core.IProjectFacetVersion;
-import org.eclipse.wst.common.project.facet.core.ProjectFacetsManager;
-
-public class DefaultJ2EEComponentCreationDataModelProvider extends AbstractDataModelProvider implements IDefaultJ2EEComponentCreationDataModelProperties {
- private static String CREATE_BASE = "DefaultJ2EEComponentCreationDataModel.CREATE_"; //$NON-NLS-1$
-
- private static final int EJB = 0;
- private static final int WEB = 1;
- private static final int RAR = 2;
- private static final int CLIENT = 3;
-
- private static final String WEB_SUFFIX = "Web"; //$NON-NLS-1$
- private static final String EJB_SUFFIX = "EJB"; //$NON-NLS-1$
- private static final String CLIENT_SUFFIX = "Client"; //$NON-NLS-1$
- private static final String CONNECTOR_SUFFIX = "Connector"; //$NON-NLS-1$
-
- private IDataModel ejbModel;
- private IDataModel ejbFacetModel;
- private IDataModel webModel;
- private IDataModel webFacetModel;
- private IDataModel jcaModel;
- private IDataModel jcaFacetModel;
- private IDataModel clientModel;
- private IDataModel clientFacetModel;
-
- public DefaultJ2EEComponentCreationDataModelProvider() {
- super();
- }
-
- public Set getPropertyNames() {
- Set propertyNames = super.getPropertyNames();
- propertyNames.add(PROJECT_NAME);
- propertyNames.add(EAR_COMPONENT_NAME);
- propertyNames.add(APPCLIENT_COMPONENT_NAME);
- propertyNames.add(WEB_COMPONENT_NAME);
- propertyNames.add(EJB_COMPONENT_NAME);
- propertyNames.add(CONNECTOR_COMPONENT_NAME);
- propertyNames.add(J2EE_VERSION);
- propertyNames.add(CREATE_EJB);
- propertyNames.add(CREATE_WEB);
- propertyNames.add(CREATE_APPCLIENT);
- propertyNames.add(CREATE_CONNECTOR);
- propertyNames.add(MODULE_NAME_COLLISIONS_VALIDATION);
- propertyNames.add(ENABLED);
- propertyNames.add(NESTED_MODEL_CLIENT);
- propertyNames.add(NESTED_MODEL_EJB);
- propertyNames.add(NESTED_MODEL_JCA);
- propertyNames.add(NESTED_MODEL_WEB);
- propertyNames.add(FACET_RUNTIME);
- return propertyNames;
- }
-
-
- public IDataModelOperation getDefaultOperation() {
- return new DefaultJ2EEComponentCreationOperation(model);
- }
-
- public void init() {
- initNestedCreationModels();
- super.init();
- }
-
- protected void initNestedCreationModels() {
- clientModel = DataModelFactory.createDataModel(new AppClientFacetProjectCreationDataModelProvider());
- model.addNestedModel(NESTED_MODEL_CLIENT, clientModel);
- clientFacetModel = ((FacetDataModelMap)clientModel.getProperty(IFacetProjectCreationDataModelProperties.FACET_DM_MAP)).getFacetDataModel(J2EEProjectUtilities.APPLICATION_CLIENT);
- clientFacetModel.setBooleanProperty(IJ2EEModuleFacetInstallDataModelProperties.ADD_TO_EAR, false);
- clientFacetModel.setBooleanProperty(J2EEModuleFacetInstallDataModelProvider.PROHIBIT_ADD_TO_EAR, true);
-
- EjbModuleExtension ejbExt = EarModuleManager.getEJBModuleExtension();
- if (ejbExt != null) {
- ejbModel = ejbExt.createProjectDataModel();
- if (ejbModel != null){
- model.addNestedModel(NESTED_MODEL_EJB, ejbModel);
- ejbFacetModel = ((FacetDataModelMap)ejbModel.getProperty(IFacetProjectCreationDataModelProperties.FACET_DM_MAP)).getFacetDataModel(J2EEProjectUtilities.EJB);
- ejbFacetModel.setBooleanProperty(IJ2EEModuleFacetInstallDataModelProperties.ADD_TO_EAR, false);
- ejbFacetModel.setBooleanProperty(J2EEModuleFacetInstallDataModelProvider.PROHIBIT_ADD_TO_EAR, true);
- }
- }
- WebModuleExtension webExt = EarModuleManager.getWebModuleExtension();
- if (webExt != null) {
- webModel = webExt.createProjectDataModel();
- if (webModel != null){
- model.addNestedModel(NESTED_MODEL_WEB, webModel);
- webFacetModel = ((FacetDataModelMap)webModel.getProperty(IFacetProjectCreationDataModelProperties.FACET_DM_MAP)).getFacetDataModel(J2EEProjectUtilities.DYNAMIC_WEB);
- webFacetModel.setBooleanProperty(IJ2EEModuleFacetInstallDataModelProperties.ADD_TO_EAR, false);
- webFacetModel.setBooleanProperty(J2EEModuleFacetInstallDataModelProvider.PROHIBIT_ADD_TO_EAR, true);
- }
- }
- JcaModuleExtension rarExt = EarModuleManager.getJCAModuleExtension();
- if (rarExt != null) {
- jcaModel = rarExt.createProjectDataModel();
- if (jcaModel != null){
- model.addNestedModel(NESTED_MODEL_JCA, jcaModel);
- jcaFacetModel = ((FacetDataModelMap)jcaModel.getProperty(IFacetProjectCreationDataModelProperties.FACET_DM_MAP)).getFacetDataModel(J2EEProjectUtilities.JCA);
- jcaFacetModel.setBooleanProperty(IJ2EEModuleFacetInstallDataModelProperties.ADD_TO_EAR, false);
- jcaFacetModel.setBooleanProperty(J2EEModuleFacetInstallDataModelProvider.PROHIBIT_ADD_TO_EAR, true);
- }
- }
- }
-
- public Object getDefaultProperty(String propertyName) {
- if (propertyName.startsWith(CREATE_BASE))
- return getDefaultCreateValue(propertyName);
- if (propertyName.equals(ENABLED))
- return Boolean.TRUE;
- return super.getDefaultProperty(propertyName);
- }
-
-
- private Object getDefaultCreateValue(String propertyName) {
- if (propertyName.equals(CREATE_CONNECTOR)) {
- int version = getIntProperty(J2EE_VERSION);
- if (version < J2EEVersionConstants.J2EE_1_3_ID)
- return Boolean.FALSE;
- }
- return Boolean.TRUE;
- }
-
- private int convertPropertyNameToInt(String propertyName) {
- if (propertyName.equals(CREATE_WEB)) {
- return WEB;
- } else if (propertyName.equals(CREATE_EJB)) {
- return EJB;
- } else if (propertyName.equals(CREATE_CONNECTOR)) {
- return RAR;
- } else if (propertyName.equals(CREATE_APPCLIENT)) {
- return CLIENT;
- }
- return -1;
- }
-
- private String ensureUniqueProjectName(String projectName) {
- IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
- String newName = projectName;
- int index = 0;
- IProject proj = root.getProject(newName);
- while (proj.exists()) {
- index++;
- newName = projectName + index;
- proj = root.getProject(newName);
- }
- return newName;
- }
-
- public boolean propertySet(String propertyName, Object propertyValue) {
- boolean notify = super.propertySet(propertyName, propertyValue);
- if (propertyName.equals(J2EE_VERSION)) {
- updatedJ2EEVersion((Integer) propertyValue);
- return true;
- }else if (propertyName.startsWith(CREATE_BASE)){
- notifyEnablement(convertPropertyNameToInt(propertyName));
- }else if (propertyName.equals(EAR_COMPONENT_NAME)) {
- setDefaultComponentNames((String) propertyValue);
- }else if(webModel != null && propertyName.equals(WEB_COMPONENT_NAME)){
- webModel.setProperty(IFacetProjectCreationDataModelProperties.FACET_PROJECT_NAME, propertyValue);
- }else if(clientModel != null && propertyName.equals(APPCLIENT_COMPONENT_NAME)){
- clientModel.setProperty(IFacetProjectCreationDataModelProperties.FACET_PROJECT_NAME, propertyValue);
- }else if(ejbModel != null && propertyName.equals(EJB_COMPONENT_NAME)){
- ejbModel.setProperty(IFacetProjectCreationDataModelProperties.FACET_PROJECT_NAME, propertyValue);
- }else if(jcaModel != null && propertyName.equals(CONNECTOR_COMPONENT_NAME)){
- jcaModel.setProperty(IFacetProjectCreationDataModelProperties.FACET_PROJECT_NAME, propertyValue);
- }
- else if(FACET_RUNTIME.equals(propertyName)){
- if(webModel != null){
- webModel.setProperty(IFacetProjectCreationDataModelProperties.FACET_RUNTIME, propertyValue);
- }
- if(clientModel != null){
- clientModel.setProperty(IFacetProjectCreationDataModelProperties.FACET_RUNTIME, propertyValue);
- }
- if(ejbModel != null){
- ejbModel.setProperty(IFacetProjectCreationDataModelProperties.FACET_RUNTIME, propertyValue);
- }
- if(jcaModel != null){
- jcaModel.setProperty(IFacetProjectCreationDataModelProperties.FACET_RUNTIME, propertyValue);
- }
- }
- return notify;
- }
-
- private void notifyEnablement(int flag) {
- String propertyName = null;
- switch (flag) {
- case EJB :
- propertyName = EJB_COMPONENT_NAME;
- break;
- case WEB :
- propertyName = WEB_COMPONENT_NAME;
- break;
- case CLIENT :
- propertyName = APPCLIENT_COMPONENT_NAME;
- break;
- case RAR :
- propertyName = CONNECTOR_COMPONENT_NAME;
- }
- if (propertyName != null)
- model.notifyPropertyChange(propertyName, IDataModel.ENABLE_CHG);
- }
-
- private void updatedJ2EEVersion(Integer version) {
- setNestedJ2EEVersion(version);
- if (version.intValue() < J2EEVersionConstants.J2EE_1_3_ID && model.isPropertySet(CREATE_CONNECTOR)) {
- model.setProperty(CREATE_CONNECTOR, Boolean.FALSE);
- }
- }
-
- public IStatus validateModuleNameCollisions() {
- if (getBooleanProperty(ENABLED)) {
- ArrayList list = new ArrayList();
- String projectName = null;
- String actualProjectName = null;
- boolean errorCollision = false;
- boolean errorNoSelection = true;
- if (getBooleanProperty(CREATE_APPCLIENT)) {
- actualProjectName = clientModel.getStringProperty(IFacetProjectCreationDataModelProperties.FACET_PROJECT_NAME);
- projectName = WTPPlugin.isPlatformCaseSensitive() ? actualProjectName : actualProjectName.toLowerCase();
- list.add(projectName);
- errorNoSelection = false;
- }
- if (getBooleanProperty(CREATE_EJB)) {
- actualProjectName = ejbModel.getStringProperty(IFacetProjectCreationDataModelProperties.FACET_PROJECT_NAME);
- projectName = WTPPlugin.isPlatformCaseSensitive() ? actualProjectName : actualProjectName.toLowerCase();
- if (!list.contains(projectName)) {
- list.add(projectName);
- } else {
- errorCollision = true;
- }
- errorNoSelection = false;
- }
- if (!errorCollision && getBooleanProperty(CREATE_WEB)) {
- actualProjectName = webModel.getStringProperty(IFacetProjectCreationDataModelProperties.FACET_PROJECT_NAME);
- projectName = WTPPlugin.isPlatformCaseSensitive() ? actualProjectName : actualProjectName.toLowerCase();
- if (!list.contains(projectName)) {
- list.add(projectName);
- } else {
- errorCollision = true;
- }
- errorNoSelection = false;
- }
- if (!errorCollision && getBooleanProperty(CREATE_CONNECTOR)) {
- actualProjectName = jcaModel.getStringProperty(IFacetProjectCreationDataModelProperties.FACET_PROJECT_NAME);
- projectName = WTPPlugin.isPlatformCaseSensitive() ? actualProjectName : actualProjectName.toLowerCase();
- if (!list.contains(projectName)) {
- list.add(projectName);
- } else {
- errorCollision = true;
- }
- errorNoSelection = false;
- }
- if (errorCollision) {
- return J2EEPlugin.newErrorStatus(EARCreationResourceHandler.getString("DuplicateModuleNames", new Object[]{actualProjectName}), null); //$NON-NLS-1$
- } else if (errorNoSelection) {
- return J2EEPlugin.newErrorStatus(EARCreationResourceHandler.NoModulesSelected, null);
- }
- }
-
- return OK_STATUS;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.wst.common.frameworks.internal.operation.WTPOperationDataModel#doValidateProperty(java.lang.String)
- */
- public IStatus validate(String propertyName) {
-
- if (getBooleanProperty(CREATE_APPCLIENT) && propertyName.equals(APPCLIENT_COMPONENT_NAME)) {
- return clientModel.validateProperty(IFacetProjectCreationDataModelProperties.FACET_PROJECT_NAME);
- }
-
- if (getBooleanProperty(CREATE_WEB) && propertyName.equals(WEB_COMPONENT_NAME)) {
- return webModel.validateProperty(IFacetProjectCreationDataModelProperties.FACET_PROJECT_NAME);
- }
-
- if (getBooleanProperty(CREATE_EJB) && propertyName.equals(EJB_COMPONENT_NAME)) {
- return ejbModel.validateProperty(IFacetProjectCreationDataModelProperties.FACET_PROJECT_NAME);
- }
-
- if (getBooleanProperty(CREATE_CONNECTOR) && propertyName.equals(CONNECTOR_COMPONENT_NAME)) {
- return jcaModel.validateProperty(IFacetProjectCreationDataModelProperties.FACET_PROJECT_NAME);
- }
- return super.validate(propertyName);
- }
-
-// private IStatus validateComponentName(String componentName) {
-// IStatus status = OK_STATUS;
-// if (status.isOK()) {
-// if (componentName.indexOf("#") != -1) { //$NON-NLS-1$
-// String errorMessage = WTPCommonPlugin.getResourceString(WTPCommonMessages.ERR_INVALID_CHARS);
-// return WTPCommonPlugin.createErrorStatus(errorMessage);
-// } else if (componentName == null || componentName.equals("")) { //$NON-NLS-1$
-// String errorMessage = WTPCommonPlugin.getResourceString(WTPCommonMessages.ERR_EMPTY_MODULE_NAME);
-// return WTPCommonPlugin.createErrorStatus(errorMessage);
-// }
-// }
-// return status;
-// }
-
- private void setDefaultNestedComponentName(String name, int flag) {
- IDataModel modModule = getNestedModel(flag);
- if (modModule != null) {
- String compName = ensureUniqueProjectName(name);
- modModule.setProperty(IFacetProjectCreationDataModelProperties.FACET_PROJECT_NAME, compName);
- }
- }
-
- private void setDefaultComponentNames(String base) {
- String componentName;
- if (base.endsWith(EJB_SUFFIX))
- componentName = base;
- else
- componentName = base + EJB_SUFFIX;
- setDefaultNestedComponentName(componentName, EJB);
- setProperty(EJB_COMPONENT_NAME, componentName);
- if (base.endsWith(WEB_SUFFIX))
- componentName = base;
- else
- componentName = base + WEB_SUFFIX;
- setDefaultNestedComponentName(componentName, WEB);
- setProperty(WEB_COMPONENT_NAME, componentName);
- if (base.endsWith(CLIENT_SUFFIX))
- componentName = base;
- else
- componentName = base + CLIENT_SUFFIX;
- setDefaultNestedComponentName(componentName, CLIENT);
- setProperty(APPCLIENT_COMPONENT_NAME, componentName);
- if (base.endsWith(CONNECTOR_SUFFIX))
- componentName = base;
- else
- componentName = base + CONNECTOR_SUFFIX;
- setDefaultNestedComponentName(componentName, RAR);
- setProperty(CONNECTOR_COMPONENT_NAME, componentName);
-
-
- // update the EAR Project Name field as well
- if(webModel != null){
- webModel.setProperty(IJ2EEFacetProjectCreationDataModelProperties.EAR_PROJECT_NAME, base);
- }
- if(clientModel != null){
- clientModel.setProperty(IJ2EEFacetProjectCreationDataModelProperties.EAR_PROJECT_NAME, base);
- }
- if(ejbModel != null){
- ejbModel.setProperty(IJ2EEFacetProjectCreationDataModelProperties.EAR_PROJECT_NAME, base);
- }
- if(jcaModel != null){
- jcaModel.setProperty(IJ2EEFacetProjectCreationDataModelProperties.EAR_PROJECT_NAME, base);
- }
- }
-
- private void setNestedJ2EEVersion(Object j2eeVersion) {
- int j2eeVer = ((Integer) j2eeVersion).intValue();
- if (ejbModel != null && ejbFacetModel != null) {
- String facetVersionString = J2EEVersionUtil.convertVersionIntToString(J2EEVersionUtil.convertJ2EEVersionIDToEJBVersionID(j2eeVer));
- IProjectFacetVersion facetVersion = ProjectFacetsManager.getProjectFacet(ejbFacetModel.getStringProperty(IFacetDataModelProperties.FACET_ID)).getVersion(facetVersionString);
- ejbFacetModel.setProperty(IFacetDataModelProperties.FACET_VERSION, facetVersion);
- //[Bug 243226] IFacetedProjectWorkingCopy facet version is not automatically updated so it has to be done manually
- IFacetedProjectWorkingCopy fpwc = (IFacetedProjectWorkingCopy)ejbModel.getProperty(IFacetProjectCreationDataModelProperties.FACETED_PROJECT_WORKING_COPY);
- fpwc.changeProjectFacetVersion(facetVersion);
- }
- if (webModel != null &&webFacetModel != null) {
- String facetVersionString = J2EEVersionUtil.convertVersionIntToString(J2EEVersionUtil.convertJ2EEVersionIDToWebVersionID(j2eeVer));
- IProjectFacetVersion facetVersion = ProjectFacetsManager.getProjectFacet(webFacetModel.getStringProperty(IFacetDataModelProperties.FACET_ID)).getVersion(facetVersionString);
- webFacetModel.setProperty(IFacetDataModelProperties.FACET_VERSION, facetVersion);
- //[Bug 243226] IFacetedProjectWorkingCopy facet version is not automatically updated so it has to be done manually
- IFacetedProjectWorkingCopy fpwc = (IFacetedProjectWorkingCopy)webModel.getProperty(IFacetProjectCreationDataModelProperties.FACETED_PROJECT_WORKING_COPY);
- fpwc.changeProjectFacetVersion(facetVersion);
- }
- if (jcaModel != null && jcaFacetModel != null) {
- String facetVersionString = J2EEVersionUtil.convertVersionIntToString(J2EEVersionUtil.convertJ2EEVersionIDToConnectorVersionID(j2eeVer));
- IProjectFacetVersion facetVersion = ProjectFacetsManager.getProjectFacet(jcaFacetModel.getStringProperty(IFacetDataModelProperties.FACET_ID)).getVersion(facetVersionString);
- jcaFacetModel.setProperty(IFacetDataModelProperties.FACET_VERSION, facetVersion);
- //[Bug 243226] IFacetedProjectWorkingCopy facet version is not automatically updated so it has to be done manually
- IFacetedProjectWorkingCopy fpwc = (IFacetedProjectWorkingCopy)jcaModel.getProperty(IFacetProjectCreationDataModelProperties.FACETED_PROJECT_WORKING_COPY);
- fpwc.changeProjectFacetVersion(facetVersion);
- }
- if (clientModel != null && clientFacetModel != null){
- String facetVersionString = J2EEVersionUtil.convertVersionIntToString(j2eeVer);
- IProjectFacetVersion facetVersion = ProjectFacetsManager.getProjectFacet(clientFacetModel.getStringProperty(IFacetDataModelProperties.FACET_ID)).getVersion(facetVersionString);
- clientFacetModel.setProperty(IFacetDataModelProperties.FACET_VERSION, facetVersion);
- //[Bug 243226] IFacetedProjectWorkingCopy facet version is not automatically updated so it has to be done manually
- IFacetedProjectWorkingCopy fpwc = (IFacetedProjectWorkingCopy)clientModel.getProperty(IFacetProjectCreationDataModelProperties.FACETED_PROJECT_WORKING_COPY);
- fpwc.changeProjectFacetVersion(facetVersion);
- }
- }
-
- private IDataModel getNestedModel(int flag) {
- switch (flag) {
- case EJB :
- return ejbModel;
- case WEB :
- return webModel;
- case RAR :
- return jcaModel;
- case CLIENT :
- return clientModel;
- }
- return null;
- }
-
- public boolean isPropertyEnabled(String propertyName) {
- if (propertyName.equals(CREATE_CONNECTOR)) {
- int version = getIntProperty(J2EE_VERSION);
- return version > J2EEVersionConstants.J2EE_1_2_ID;
- }
- if( propertyName.equals(CONNECTOR_COMPONENT_NAME)){
- return getBooleanProperty(CREATE_CONNECTOR);
- }
- if (propertyName.equals(APPCLIENT_COMPONENT_NAME))
- return getBooleanProperty(CREATE_APPCLIENT);
- if (propertyName.equals(EJB_COMPONENT_NAME))
- return getBooleanProperty(CREATE_EJB);
- if (propertyName.equals(WEB_COMPONENT_NAME))
- return getBooleanProperty(CREATE_WEB);
- return super.isPropertyEnabled(propertyName);
- }
-}
diff --git a/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/internal/earcreation/EARCreationResourceHandler.java b/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/internal/earcreation/EARCreationResourceHandler.java
deleted file mode 100644
index 64e6e194e..000000000
--- a/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/internal/earcreation/EARCreationResourceHandler.java
+++ /dev/null
@@ -1,121 +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.earcreation;
-
-
-
-import org.eclipse.osgi.util.NLS;
-
-public class EARCreationResourceHandler extends NLS {
-
- private static final String BUNDLE_NAME = "earcreation";//$NON-NLS-1$
-
- private EARCreationResourceHandler() {
- // Do not instantiate
- }
-
- public static String Error_occured_getting_appl_ERROR_;
- public static String Error_occured_getting_appl1_ERROR_;
- public static String Creating__UI_;
- public static String Creating_EAR_Project_UI_;
- public static String The_project_already_exist_ERROR_;
- public static String EARProjectCreationOperatio_ERROR_;
- public static String ABS_PATH_CHANGED_UI_;
- public static String UNSAVED_CHANGES_WARN_;
- public static String PROJECT_MAP_PROBLEMS_ERROR_;
- public static String MODULE_PROJECTS_CLOSED_WARN_;
- public static String Add_Module_Command_Label_UI_;
- public static String Remove_Module_Command_Label_UI_;
-
- public static String Set_project_UI_;
- public static String Add_Utility_JAR_UI;
- public static String REM_UTIL_JAR_UI;
- public static String PROJ_DESC_UPDATE_ERROR_UI_;
- public static String Not_an_ear_project_UI_;
- public static String EAR_PROJECT_MUST_BE_OPEN_UI_;
- public static String Updating_absolute_paths_UI_;
- public static String DuplicateModuleNames;
- public static String NoModulesSelected;
-
- public static String KEY_1;
- public static String KEY_2;
- public static String KEY_3;
- public static String KEY_4;
- public static String KEY_5;
- public static String KEY_6;
- public static String KEY_7;
- public static String KEY_8;
- public static String KEY_9;
- public static String KEY_10;
- public static String KEY_11;
- public static String KEY_12;
- public static String KEY_13;
- public static String KEY_14;
- public static String KEY_15;
- public static String KEY_16;
-
- public static String J2EEUtilityJarListImportOperation_UI_Import_Utility_Jars;
- public static String J2EEUtilityJarListImportOperation_UI_Preparing_to_import;
- public static String J2EEUtilityJarListImportOperation_UI_2;
- public static String J2EEUtilityJarListImportDataModel_0;
- public static String J2EEUtilityJarListImportDataModel_Specify_Valid_Project;
- public static String J2EEUtilityJarListImportDataModel_Select_Jar;
- public static String J2EEUtilityJarListImportDataModel_Specify_Linked_Path;
- public static String J2EEUtilityJarListImportOperation_There_were_no_utility_jars_selected;
- public static String J2EEUtilityJarListImportDataModel_Linked_Path_Exists;
-
-
- public static String CreateProjectWithExtractedJarOperation_Create_project_with_extracted_conte_;
- public static String CopyArchiveIntoProjectOperation_Copying_archive_into_selected_proje_;
- public static String CopyArchiveIntoProjectOperation_Found_existing_file_0_;
- public static String CreateProjectWithLinkedJarOperation_Creating_project_with_linked_archiv_;
- public static String CreateProjectWithLinkedJarOperation_Cannot_link_utility_jar_into_a_clos_;
- public static String CreateProjectWithLinkedJarOperation_File_already_exists_0_;
- public static String LinkArchiveIntoProjectOperation_Linking_archive_into_selected_proje_;
-
- public static String EARImportDataModel_UI_0;
- public static String EARImportDataModel_UI_1;
- public static String EARImportDataModel_UI_1a;
- public static String EARImportDataModel_UI_2;
- public static String EARImportDataModel_UI_2a;
- public static String EARImportDataModel_UI_3;
- public static String EARImportDataModel_UI_4;
- public static String ModuleMappingImpl_UI_0;
- public static String UtilityJARMappingImpl_UI_0;
- public static String importWrongType;
- public static String importWrongVersion;
- public static String EAR_PROJECTNAME_SAMEAS_MODULE;
-
- static {
- NLS.initializeMessages(BUNDLE_NAME, EARCreationResourceHandler.class);
- }
-
- public static String getString(String key, Object[] args) {
- return NLS.bind(key, args);
- }
-
- public static final String ADD_MODULE_MODULE_TYPE = KEY_1;
- public static final String ADD_MODULE_MODULE_EXISTS = KEY_2;
- public static final String ADD_MODULE_MODULE_CLOSED = KEY_3;
- public static final String ADD_MODULE_MODULE_NULL = KEY_4;
- public static final String ADD_PROJECT_URI_EXISTS = KEY_5;
- public static final String ADD_PROJECT_NOT_JAVA = KEY_6;
- public static final String ADD_PROJECT_UTIL_URI = KEY_7;
- public static final String ADD_PROJECT_UTIL_MAPPED = KEY_8;
- public static final String ADD_PROJECT_NOT_EAR = KEY_9;
- public static final String ADD_PROJECT_URI_EMPTY = KEY_10;
- public static final String NOT_AN_APP_CLIENT = KEY_11;
- public static final String NOT_AN_EAR = KEY_12;
- public static final String NOT_AN_EJB = KEY_13;
- public static final String NOT_A_RAR = KEY_14;
- public static final String NOT_A_WAR = KEY_15;
- public static final String SERVER_TARGET_NOT_SUPPORT_EAR = KEY_16;
-}
diff --git a/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/internal/earcreation/EarFacetInstallDataModelProvider.java b/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/internal/earcreation/EarFacetInstallDataModelProvider.java
deleted file mode 100644
index a7a961fdf..000000000
--- a/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/internal/earcreation/EarFacetInstallDataModelProvider.java
+++ /dev/null
@@ -1,83 +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.earcreation;
-
-import java.util.Collections;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Set;
-
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.jst.j2ee.internal.common.J2EEVersionUtil;
-import org.eclipse.jst.j2ee.internal.plugin.J2EEPlugin;
-import org.eclipse.jst.j2ee.internal.plugin.J2EEPreferences;
-import org.eclipse.jst.j2ee.project.facet.IJ2EEFacetConstants;
-import org.eclipse.jst.j2ee.project.facet.J2EEFacetInstallDataModelProvider;
-import org.eclipse.wst.common.componentcore.ComponentCore;
-import org.eclipse.wst.common.componentcore.resources.IVirtualComponent;
-import org.eclipse.wst.common.project.facet.core.IProjectFacetVersion;
-
-public class EarFacetInstallDataModelProvider extends J2EEFacetInstallDataModelProvider implements IEarFacetInstallDataModelProperties {
-
- public Set getPropertyNames() {
- Set names = super.getPropertyNames();
- names.add(CONTENT_DIR);
- names.add(J2EE_PROJECTS_LIST);
- names.add(JAVA_PROJECT_LIST);
- return names;
- }
-
- public Object getDefaultProperty(String propertyName) {
- if (propertyName.equals(FACET_ID)) {
- return ENTERPRISE_APPLICATION;
- } else if (propertyName.equals(CONTENT_DIR)) {
- return J2EEPlugin.getDefault().getJ2EEPreferences().getString(J2EEPreferences.Keys.APPLICATION_CONTENT_FOLDER);
- } else if (propertyName.equals(J2EE_PROJECTS_LIST) || propertyName.equals(JAVA_PROJECT_LIST)) {
- return Collections.EMPTY_LIST;
- } else if(propertyName.equals(GENERATE_DD)){
- IProjectFacetVersion facetVersion = (IProjectFacetVersion)getProperty(FACET_VERSION);
- if(facetVersion == IJ2EEFacetConstants.ENTERPRISE_APPLICATION_50){
- return Boolean.valueOf(J2EEPlugin.getDefault().getJ2EEPreferences().getBoolean(J2EEPreferences.Keys.APPLICATION_GENERATE_DD));
- }
- return Boolean.TRUE;
- }
- return super.getDefaultProperty(propertyName);
- }
-
- public IStatus validate(String name) {
- if (name.equals(J2EE_PROJECTS_LIST)) {
- return validateTargetComponentVersion((List) model.getProperty(J2EE_PROJECTS_LIST));
- } else if (name.equals(CONTENT_DIR)) {
- return validateFolderName(getStringProperty(CONTENT_DIR));
- }
- return super.validate(name);
- }
-
- private IStatus validateTargetComponentVersion(List list) {
- int earVersion = getJ2EEVersion();
- for (Iterator iter = list.iterator(); iter.hasNext();) {
- IProject handle = (IProject) iter.next();
- IVirtualComponent comp = ComponentCore.createComponent(handle.getProject());
- if (comp == null) return OK_STATUS; //Not a faceted project, so version not relevant
- int compVersion = J2EEVersionUtil.convertVersionStringToInt(comp);
- if (earVersion < compVersion) {
- String errorStatus = "The Module specification level of " + handle.getName() + ", is incompatible with the containing EAR version"; //$NON-NLS-1$
- return J2EEPlugin.newErrorStatus(errorStatus, null);
- }
- }
- return OK_STATUS;
- }
-
- protected int convertFacetVersionToJ2EEVersion(IProjectFacetVersion version) {
- return J2EEVersionUtil.convertVersionStringToInt(version.getVersionString());
- }
-}
diff --git a/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/internal/earcreation/IDefaultJ2EEComponentCreationDataModelProperties.java b/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/internal/earcreation/IDefaultJ2EEComponentCreationDataModelProperties.java
deleted file mode 100644
index 5fc021a25..000000000
--- a/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/internal/earcreation/IDefaultJ2EEComponentCreationDataModelProperties.java
+++ /dev/null
@@ -1,75 +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.earcreation;
-
-public interface IDefaultJ2EEComponentCreationDataModelProperties {
- /**
- * Required - This is the name of the project. type String
- */
- public static final String PROJECT_NAME = "DefaultJ2EEComponentCreationDataModel.PROJECT_NAME"; //$NON-NLS-1$
- /**
- * Required - This is the name of the ear. type String
- */
- public static final String EAR_COMPONENT_NAME = "DefaultJ2EEComponentCreationDataModel.EAR_NAME"; //$NON-NLS-1$
- /**
- * Required - This is the name of the app client. type String
- */
- public static final String APPCLIENT_COMPONENT_NAME = "DefaultJ2EEComponentCreationDataModel.APPCLIENT_NAME"; //$NON-NLS-1$
- /**
- * Required - This is the name of the WEB. type String
- */
- public static final String WEB_COMPONENT_NAME = "DefaultJ2EEComponentCreationDataModel.WEB_COMPONENT_NAME"; //$NON-NLS-1$
- /**
- * Required - This is the name of the EJB. type String
- */
- public static final String EJB_COMPONENT_NAME = "DefaultJ2EEComponentCreationDataModel.EJB_COMPONENT_NAME"; //$NON-NLS-1$
- /**
- * Required - This is the name of the connector. type String
- */
- public static final String CONNECTOR_COMPONENT_NAME = "DefaultJ2EEComponentCreationDataModel.CONNECTOR_COMPONENT_NAME"; //$NON-NLS-1$
-
- public static final String J2EE_VERSION = "DefaultJ2EEComponentCreationDataModel.J2EE_VERSION"; //$NON-NLS-1$
- /**
- * Default is true. type Boolean
- */
- public static final String CREATE_EJB = "DefaultJ2EEComponentCreationDataModel.CREATE_EJB";
- /**
- * Default is true. type Boolean
- */
- public static final String CREATE_WEB = "DefaultJ2EEComponentCreationDataModel.CREATE_WEB";
- /**
- * Default is true. type Boolean
- */
- public static final String CREATE_APPCLIENT = "DefaultJ2EEComponentCreationDataModel.CREATE_CLIENT";
- /**
- * Default is true. type Boolean
- */
- public static final String CREATE_CONNECTOR = "DefaultJ2EEComponentCreationDataModel.CREATE_CONNECTOR";
-
- /**
- * Used for validation only; validates no collsions between various module names. Do not set
- * this value.
- */
- public static final String MODULE_NAME_COLLISIONS_VALIDATION = "DefaultJ2EEComponentCreationDataModel.MODULE_NAME_COLLISIONS_VALIDATION"; //$NON-NLS-1$
-
- /**
- * Default is true. type Boolean
- */
- public static final String ENABLED = "DefaultJ2EEComponentCreationDataModel.ENABLED"; //$NON-NLS-1$
-
- public static final String NESTED_MODEL_EJB = "DefaultJ2EEComponentCreationDataModel.NESTED_MODEL_EJB"; //$NON-NLS-1$
- public static final String NESTED_MODEL_WEB = "DefaultJ2EEComponentCreationDataModel.NESTED_MODEL_WEB"; //$NON-NLS-1$
- public static final String NESTED_MODEL_JCA = "DefaultJ2EEComponentCreationDataModel.NESTED_MODEL_JCA"; //$NON-NLS-1$
- public static final String NESTED_MODEL_CLIENT = "DefaultJ2EEComponentCreationDataModel.NESTED_MODEL_CLIENT"; //$NON-NLS-1$
-
- public static final String FACET_RUNTIME = "DefaultJ2EEComponentCreationDataModel.FACET_RUNTIME";//$NON-NLS-1$
-
-}
diff --git a/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/internal/earcreation/IEarFacetInstallDataModelProperties.java b/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/internal/earcreation/IEarFacetInstallDataModelProperties.java
deleted file mode 100644
index 53e754ed6..000000000
--- a/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/internal/earcreation/IEarFacetInstallDataModelProperties.java
+++ /dev/null
@@ -1,21 +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.earcreation;
-
-/**
- * This interface is being made public. Please use {@link org.eclipse.jst.j2ee.earcreation.IEarFacetInstallDataModelProperties}
- *
- * @deprecated
- * @see org.eclipse.jst.j2ee.earcreation.IEarFacetInstallDataModelProperties
- */
-public interface IEarFacetInstallDataModelProperties extends org.eclipse.jst.j2ee.earcreation.IEarFacetInstallDataModelProperties {
-
-}
diff --git a/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/internal/earcreation/ILooseConfigConstants.java b/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/internal/earcreation/ILooseConfigConstants.java
deleted file mode 100644
index fd059de77..000000000
--- a/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/internal/earcreation/ILooseConfigConstants.java
+++ /dev/null
@@ -1,29 +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.earcreation;
-
-
-import org.eclipse.jst.j2ee.commonarchivecore.looseconfig.internal.LooseConfigRegister;
-import org.eclipse.jst.j2ee.internal.plugin.J2EEPlugin;
-
-
-public interface ILooseConfigConstants {
- /**
- * The short name of the loose configuration file; will most often need to use
- * {@link #CONFIG_PATH}
- */
- String CONFIG_FILE_NAME = "looseconfig.xmi"; //$NON-NLS-1$
- /** The absolute path to the loose configuration file */
- String CONFIG_PATH = J2EEPlugin.getDefault().getStateLocation().append(CONFIG_FILE_NAME).toOSString();
- /** The property name used by WebSphere to lookup the loose configuration location to load */
- String WAS_PROPERTY = LooseConfigRegister.LOOSE_CONFIG_PROPERTY;
-
-}
diff --git a/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/internal/earcreation/modulemap/EARProjectMap.java b/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/internal/earcreation/modulemap/EARProjectMap.java
deleted file mode 100644
index 49d57deec..000000000
--- a/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/internal/earcreation/modulemap/EARProjectMap.java
+++ /dev/null
@@ -1,40 +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.earcreation.modulemap;
-
-
-import org.eclipse.emf.common.util.EList;
-import org.eclipse.emf.ecore.EObject;
-
-
-/**
- * @lastgen interface EARProjectMap extends EObject {}
- * @deprecated
- * Use
- * <p>
- * Need to use the ModuleCore and WorkbenchComponent Api to get to the referenced modules
- * as with the Flexible project changes a .modulemaps file will not exist in an EAR module and
- * all the info that was captured in .modulemaps file will is now captured in the .component file
- */
-public interface EARProjectMap extends EObject {
- /**
- * @generated This field/method will be replaced during code generation
- * @return The list of Mappings references
- */
- EList getMappings();
-
- /**
- * @generated This field/method will be replaced during code generation
- * @return The list of UtilityJARMappings references
- */
- EList getUtilityJARMappings();
-
-} //EARProjectMap
diff --git a/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/internal/earcreation/modulemap/EARProjectMapImpl.java b/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/internal/earcreation/modulemap/EARProjectMapImpl.java
deleted file mode 100644
index ed53a879c..000000000
--- a/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/internal/earcreation/modulemap/EARProjectMapImpl.java
+++ /dev/null
@@ -1,171 +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.earcreation.modulemap;
-
-import java.util.Collection;
-
-import org.eclipse.emf.common.notify.NotificationChain;
-import org.eclipse.emf.common.util.EList;
-import org.eclipse.emf.ecore.EClass;
-import org.eclipse.emf.ecore.EStructuralFeature;
-import org.eclipse.emf.ecore.InternalEObject;
-import org.eclipse.emf.ecore.impl.EObjectImpl;
-import org.eclipse.emf.ecore.util.EObjectContainmentEList;
-import org.eclipse.emf.ecore.util.InternalEList;
-
-
-
-/**
- * @lastgen class EARProjectMapImpl extends EObjectImpl implements EARProjectMap, EObject {}
- * @deprecated
- * Use
- * <p>
- * Need to use the ModuleCore and WorkbenchComponent Api to get to the referenced modules
- * as with the Flexible project changes a .modulemaps file will not exist in an EAR module and
- * all the info that was captured in .modulemaps file will is now captured in the .component file
- */
-public class EARProjectMapImpl extends EObjectImpl implements EARProjectMap {
- /**
- * @generated This field/method will be replaced during code generation.
- */
- /**
- * @generated This field/method will be replaced during code generation.
- */
- protected EList mappings = null;
- /**
- * @generated This field/method will be replaced during code generation.
- */
- protected EList utilityJARMappings = null;
-
-
-
- /**
- * @generated This field/method will be replaced during code generation.
- */
- protected EARProjectMapImpl() {
- super();
- }
-
- /**
- * <!-- begin-user-doc --> <!-- end-user-doc -->
- *
- * @generated
- */
- protected EClass eStaticClass() {
- return ModulemapPackage.eINSTANCE.getEARProjectMap();
- }
-
- /**
- * @generated This field/method will be replaced during code generation
- */
- public EList getMappings() {
- if (mappings == null) {
- mappings = new EObjectContainmentEList(ModuleMapping.class, this, ModulemapPackage.EAR_PROJECT_MAP__MAPPINGS);
- }
- return mappings;
- }
-
- /**
- * @generated This field/method will be replaced during code generation
- */
- public EList getUtilityJARMappings() {
- if (utilityJARMappings == null) {
- utilityJARMappings = new EObjectContainmentEList(UtilityJARMapping.class, this, ModulemapPackage.EAR_PROJECT_MAP__UTILITY_JAR_MAPPINGS);
- }
- return utilityJARMappings;
- }
-
- /**
- * <!-- begin-user-doc --> <!-- end-user-doc -->
- *
- * @generated
- */
- public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, Class baseClass, NotificationChain msgs) {
- if (featureID >= 0) {
- switch (baseClass == null ? featureID : eDerivedStructuralFeatureID(featureID, baseClass)) {
- case ModulemapPackage.EAR_PROJECT_MAP__MAPPINGS :
- return ((InternalEList) getMappings()).basicRemove(otherEnd, msgs);
- case ModulemapPackage.EAR_PROJECT_MAP__UTILITY_JAR_MAPPINGS :
- return ((InternalEList) getUtilityJARMappings()).basicRemove(otherEnd, msgs);
- default :
- return eDynamicInverseRemove(otherEnd, featureID, baseClass, msgs);
- }
- }
- return eBasicSetContainer(null, featureID, msgs);
- }
-
- /**
- * <!-- begin-user-doc --> <!-- end-user-doc -->
- *
- * @generated
- */
- public Object eGet(EStructuralFeature eFeature, boolean resolve) {
- switch (eDerivedStructuralFeatureID(eFeature.getFeatureID(), eFeature.getContainerClass())) {
- case ModulemapPackage.EAR_PROJECT_MAP__MAPPINGS :
- return getMappings();
- case ModulemapPackage.EAR_PROJECT_MAP__UTILITY_JAR_MAPPINGS :
- return getUtilityJARMappings();
- }
- return eDynamicGet(eFeature, resolve);
- }
-
- /**
- * <!-- begin-user-doc --> <!-- end-user-doc -->
- *
- * @generated
- */
- public void eSet(EStructuralFeature eFeature, Object newValue) {
- switch (eDerivedStructuralFeatureID(eFeature.getFeatureID(), eFeature.getContainerClass())) {
- case ModulemapPackage.EAR_PROJECT_MAP__MAPPINGS :
- getMappings().clear();
- getMappings().addAll((Collection) newValue);
- return;
- case ModulemapPackage.EAR_PROJECT_MAP__UTILITY_JAR_MAPPINGS :
- getUtilityJARMappings().clear();
- getUtilityJARMappings().addAll((Collection) newValue);
- return;
- }
- eDynamicSet(eFeature, newValue);
- }
-
- /**
- * <!-- begin-user-doc --> <!-- end-user-doc -->
- *
- * @generated
- */
- public void eUnset(EStructuralFeature eFeature) {
- switch (eDerivedStructuralFeatureID(eFeature.getFeatureID(), eFeature.getContainerClass())) {
- case ModulemapPackage.EAR_PROJECT_MAP__MAPPINGS :
- getMappings().clear();
- return;
- case ModulemapPackage.EAR_PROJECT_MAP__UTILITY_JAR_MAPPINGS :
- getUtilityJARMappings().clear();
- return;
- }
- eDynamicUnset(eFeature);
- }
-
- /**
- * <!-- begin-user-doc --> <!-- end-user-doc -->
- *
- * @generated
- */
- public boolean eIsSet(EStructuralFeature eFeature) {
- switch (eDerivedStructuralFeatureID(eFeature.getFeatureID(), eFeature.getContainerClass())) {
- case ModulemapPackage.EAR_PROJECT_MAP__MAPPINGS :
- return mappings != null && !mappings.isEmpty();
- case ModulemapPackage.EAR_PROJECT_MAP__UTILITY_JAR_MAPPINGS :
- return utilityJARMappings != null && !utilityJARMappings.isEmpty();
- }
- return eDynamicIsSet(eFeature);
- }
-
-} //EARProjectMapImpl
diff --git a/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/internal/earcreation/modulemap/ModuleMapping.java b/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/internal/earcreation/modulemap/ModuleMapping.java
deleted file mode 100644
index cee99ee07..000000000
--- a/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/internal/earcreation/modulemap/ModuleMapping.java
+++ /dev/null
@@ -1,55 +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.earcreation.modulemap;
-
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.jst.j2ee.application.Module;
-
-
-
-/**
- * @lastgen interface ModuleMapping extends EObject {}
- * @deprecated
- * Use
- * <p>
- * Need to use the ModuleCore and WorkbenchComponent Api to get to the referenced modules
- * as with the Flexible project changes a .modulemaps file will not exist in an EAR module and
- * all the info that was captured in .modulemaps file will is now captured in the .component file
- * </p>
- */
-public interface ModuleMapping extends EObject {
- /**
- * @generated This field/method will be replaced during code generation
- * @return The value of the ProjectName attribute
- */
- String getProjectName();
-
- /**
- * @generated This field/method will be replaced during code generation
- * @param value
- * The new value of the ProjectName attribute
- */
- void setProjectName(String value);
-
- /**
- * @generated This field/method will be replaced during code generation
- * @return The Module reference
- */
- Module getModule();
-
- /**
- * @generated This field/method will be replaced during code generation
- * @param l
- * The new value of the Module reference
- */
- void setModule(Module value);
-
-} //ModuleMapping
diff --git a/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/internal/earcreation/modulemap/ModuleMappingImpl.java b/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/internal/earcreation/modulemap/ModuleMappingImpl.java
deleted file mode 100644
index 333f8d9b7..000000000
--- a/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/internal/earcreation/modulemap/ModuleMappingImpl.java
+++ /dev/null
@@ -1,194 +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.earcreation.modulemap;
-
-import org.eclipse.emf.common.notify.Notification;
-import org.eclipse.emf.ecore.EClass;
-import org.eclipse.emf.ecore.EStructuralFeature;
-import org.eclipse.emf.ecore.impl.ENotificationImpl;
-import org.eclipse.emf.ecore.impl.EObjectImpl;
-import org.eclipse.emf.ecore.util.EcoreUtil;
-import org.eclipse.jst.j2ee.application.Module;
-import org.eclipse.jst.j2ee.internal.earcreation.EARCreationResourceHandler;
-
-
-/**
- * @lastgen class ModuleMappingImpl extends EObjectImpl implements ModuleMapping, EObject {}
- * * @deprecated
- * Use
- * <p>
- * Need to use the ModuleCore and WorkbenchComponent Api to get to the referenced modules
- * as with the Flexible project changes a .modulemaps file will not exist in an EAR module and
- * all the info that was captured in .modulemaps file will is now captured in the .component file
- */
-public class ModuleMappingImpl extends EObjectImpl implements ModuleMapping {
- /**
- * The default value of the '{@link #getProjectName() <em>Project Name</em>}' attribute. <!--
- * begin-user-doc --> <!-- end-user-doc -->
- *
- * @see #getProjectName()
- * @generated
- * @ordered
- */
- protected static final String PROJECT_NAME_EDEFAULT = null;
-
- /**
- * @generated This field/method will be replaced during code generation.
- */
- /**
- * @generated This field/method will be replaced during code generation.
- */
- protected String projectName = PROJECT_NAME_EDEFAULT;
- /**
- * @generated This field/method will be replaced during code generation.
- */
- protected Module module = null;
-
- /**
- * @generated This field/method will be replaced during code generation.
- */
- protected ModuleMappingImpl() {
- super();
- }
-
- /**
- * <!-- begin-user-doc --> <!-- end-user-doc -->
- *
- * @generated
- */
- protected EClass eStaticClass() {
- return ModulemapPackage.eINSTANCE.getModuleMapping();
- }
-
- /**
- * @generated This field/method will be replaced during code generation
- */
- public String getProjectName() {
- return projectName;
- }
-
- /**
- * @generated This field/method will be replaced during code generation.
- */
- public void setProjectName(String newProjectName) {
- String oldProjectName = projectName;
- projectName = newProjectName;
- if (eNotificationRequired())
- eNotify(new ENotificationImpl(this, Notification.SET, ModulemapPackage.MODULE_MAPPING__PROJECT_NAME, oldProjectName, projectName));
- }
-
- /**
- * @generated This field/method will be replaced during code generation
- */
- public Module getModule() {
- if (module != null && module.eIsProxy()) {
- Module oldModule = module;
- module = (Module) EcoreUtil.resolve(module, this);
- if (module != oldModule) {
- if (eNotificationRequired())
- eNotify(new ENotificationImpl(this, Notification.RESOLVE, ModulemapPackage.MODULE_MAPPING__MODULE, oldModule, module));
- }
- }
- return module;
- }
-
- /**
- * <!-- begin-user-doc --> <!-- end-user-doc -->
- *
- * @generated
- */
- public Module basicGetModule() {
- return module;
- }
-
- /**
- * @generated This field/method will be replaced during code generation.
- */
- public void setModule(Module newModule) {
- Module oldModule = module;
- module = newModule;
- if (eNotificationRequired())
- eNotify(new ENotificationImpl(this, Notification.SET, ModulemapPackage.MODULE_MAPPING__MODULE, oldModule, module));
- }
-
- /**
- * <!-- begin-user-doc --> <!-- end-user-doc -->
- *
- * @generated
- */
- public Object eGet(EStructuralFeature eFeature, boolean resolve) {
- switch (eDerivedStructuralFeatureID(eFeature.getFeatureID(), eFeature.getContainerClass())) {
- case ModulemapPackage.MODULE_MAPPING__PROJECT_NAME :
- return getProjectName();
- case ModulemapPackage.MODULE_MAPPING__MODULE :
- if (resolve)
- return getModule();
- return basicGetModule();
- }
- return eDynamicGet(eFeature, resolve);
- }
-
- /**
- * @generated This field/method will be replaced during code generation.
- */
- public boolean eIsSet(EStructuralFeature eFeature) {
- switch (eDerivedStructuralFeatureID(eFeature.getFeatureID(), eFeature.getContainerClass())) {
- case ModulemapPackage.MODULE_MAPPING__PROJECT_NAME :
- return PROJECT_NAME_EDEFAULT == null ? projectName != null : !PROJECT_NAME_EDEFAULT.equals(projectName);
- case ModulemapPackage.MODULE_MAPPING__MODULE :
- return module != null;
- }
- return eDynamicIsSet(eFeature);
- }
-
- /**
- * @generated This field/method will be replaced during code generation.
- */
- public void eSet(EStructuralFeature eFeature, Object newValue) {
- switch (eDerivedStructuralFeatureID(eFeature.getFeatureID(), eFeature.getContainerClass())) {
- case ModulemapPackage.MODULE_MAPPING__PROJECT_NAME :
- setProjectName((String) newValue);
- return;
- case ModulemapPackage.MODULE_MAPPING__MODULE :
- setModule((Module) newValue);
- return;
- }
- eDynamicSet(eFeature, newValue);
- }
-
- /**
- * @generated This field/method will be replaced during code generation.
- */
- public void eUnset(EStructuralFeature eFeature) {
- switch (eDerivedStructuralFeatureID(eFeature.getFeatureID(), eFeature.getContainerClass())) {
- case ModulemapPackage.MODULE_MAPPING__PROJECT_NAME :
- setProjectName(PROJECT_NAME_EDEFAULT);
- return;
- case ModulemapPackage.MODULE_MAPPING__MODULE :
- setModule((Module) null);
- return;
- }
- eDynamicUnset(eFeature);
- }
-
- /**
- * @generated This field/method will be replaced during code generation.
- */
- public String toString() {
- if (eIsProxy())
- return super.toString();
-
- StringBuffer result = new StringBuffer(super.toString());
- result.append(EARCreationResourceHandler.getString("ModuleMappingImpl_UI_0", new Object[]{projectName})); //$NON-NLS-1$
- return result.toString();
- }
-
-} //ModuleMappingImpl
diff --git a/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/internal/earcreation/modulemap/ModulemapAdapterFactory.java b/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/internal/earcreation/modulemap/ModulemapAdapterFactory.java
deleted file mode 100644
index ae34dbb68..000000000
--- a/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/internal/earcreation/modulemap/ModulemapAdapterFactory.java
+++ /dev/null
@@ -1,130 +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.earcreation.modulemap;
-
-import org.eclipse.emf.common.notify.Adapter;
-import org.eclipse.emf.common.notify.Notifier;
-import org.eclipse.emf.common.notify.impl.AdapterFactoryImpl;
-import org.eclipse.emf.ecore.EObject;
-
-
-
-/**
- * @lastgen class ModulemapAdapterFactory extends AdapterFactoryImpl {}
- * @deprecated
- * Use
- * <p>
- * Need to use the ModuleCore and WorkbenchComponent Api to get to the referenced modules
- * as with the Flexible project changes a .modulemaps file will not exist in an EAR module and
- * all the info that was captured in .modulemaps file will is now captured in the .component file
- */
-public class ModulemapAdapterFactory extends AdapterFactoryImpl {
- /**
- * @generated This field/method will be replaced during code generation.
- */
-
- /**
- * @generated This field/method will be replaced during code generation.
- */
- protected static ModulemapPackage modelPackage;
-
- /**
- * @generated This field/method will be replaced during code generation.
- */
- public ModulemapAdapterFactory() {
- if (modelPackage == null) {
- modelPackage = ModulemapPackage.eINSTANCE;
- }
- }
-
- /**
- * @generated This field/method will be replaced during code generation.
- */
- public boolean isFactoryForType(Object object) {
- if (object == modelPackage) {
- return true;
- }
- if (object instanceof EObject) {
- return ((EObject) object).eClass().getEPackage() == modelPackage;
- }
- return false;
- }
-
- /**
- * The switch the delegates to the <code>createXXX</code> methods. <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- *
- * @generated
- */
- protected ModulemapSwitch modelSwitch = new ModulemapSwitch() {
- public Object caseModuleMapping(ModuleMapping object) {
- return createModuleMappingAdapter();
- }
-
- public Object caseEARProjectMap(EARProjectMap object) {
- return createEARProjectMapAdapter();
- }
-
- public Object caseUtilityJARMapping(UtilityJARMapping object) {
- return createUtilityJARMappingAdapter();
- }
-
- public Object defaultCase(EObject object) {
- return createEObjectAdapter();
- }
- };
-
- /**
- * @generated This field/method will be replaced during code generation.
- */
- public Adapter createAdapter(Notifier target) {
- return (Adapter) modelSwitch.doSwitch((EObject) target);
- }
-
-
- /**
- * By default create methods return null so that we can easily ignore cases. It's useful to
- * ignore a case when inheritance will catch all the cases anyway.
- */
-
- /**
- * @generated This field/method will be replaced during code generation.
- */
- public Adapter createEARProjectMapAdapter() {
- return null;
- }
-
- /**
- * @generated This field/method will be replaced during code generation.
- */
- public Adapter createModuleMappingAdapter() {
- return null;
- }
-
- /**
- * @generated This field/method will be replaced during code generation.
- */
- public Adapter createUtilityJARMappingAdapter() {
- return null;
- }
-
- /**
- * Creates a new adapter for the default case. <!-- begin-user-doc --> This default
- * implementation returns null. <!-- end-user-doc -->
- *
- * @return the new adapter.
- * @generated
- */
- public Adapter createEObjectAdapter() {
- return null;
- }
-
-} //ModulemapAdapterFactory
diff --git a/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/internal/earcreation/modulemap/ModulemapFactory.java b/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/internal/earcreation/modulemap/ModulemapFactory.java
deleted file mode 100644
index 33a1f779e..000000000
--- a/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/internal/earcreation/modulemap/ModulemapFactory.java
+++ /dev/null
@@ -1,56 +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.earcreation.modulemap;
-
-import org.eclipse.emf.ecore.EFactory;
-
-
-/**
- * @lastgen interface ModulemapFactory extends EFactory {}
- * @deprecated
- * Use
- * <p>
- * Need to use the ModuleCore and WorkbenchComponent Api to get to the referenced modules
- * as with the Flexible project changes a .modulemaps file will not exist in an EAR module and
- * all the info that was captured in .modulemaps file will is now captured in the .component file
- */
-public interface ModulemapFactory extends EFactory {
- /**
- * The singleton instance of the factory. <!-- begin-user-doc --> <!-- end-user-doc -->
- *
- * @generated
- */
- ModulemapFactory eINSTANCE = new org.eclipse.jst.j2ee.internal.earcreation.modulemap.ModulemapFactoryImpl();
-
- /**
- * @generated This field/method will be replaced during code generation
- * @return EARProjectMap value
- */
- EARProjectMap createEARProjectMap();
-
- /**
- * @generated This field/method will be replaced during code generation
- * @return ModuleMapping value
- */
- ModuleMapping createModuleMapping();
-
- /**
- * @generated This field/method will be replaced during code generation
- * @return UtilityJARMapping value
- */
- UtilityJARMapping createUtilityJARMapping();
-
- /**
- * @generated This field/method will be replaced during code generation.
- */
- ModulemapPackage getModulemapPackage();
-
-} //ModulemapFactory
diff --git a/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/internal/earcreation/modulemap/ModulemapFactoryImpl.java b/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/internal/earcreation/modulemap/ModulemapFactoryImpl.java
deleted file mode 100644
index 1f132f364..000000000
--- a/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/internal/earcreation/modulemap/ModulemapFactoryImpl.java
+++ /dev/null
@@ -1,92 +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.earcreation.modulemap;
-
-import org.eclipse.emf.ecore.EClass;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.ecore.impl.EFactoryImpl;
-
-
-
-/**
- * @lastgen class ModulemapFactoryImpl extends EFactoryImpl implements ModulemapFactory, EFactory {}
- * @deprecated
- * Use
- * <p>
- * Need to use the ModuleCore and WorkbenchComponent Api to get to the referenced modules
- * as with the Flexible project changes a .modulemaps file will not exist in an EAR module and
- * all the info that was captured in .modulemaps file will is now captured in the .component file
- */
-public class ModulemapFactoryImpl extends EFactoryImpl implements ModulemapFactory {
-
- /**
- * @generated This field/method will be replaced during code generation.
- */
- public ModulemapFactoryImpl() {
- super();
- }
-
- /**
- * <!-- begin-user-doc --> <!-- end-user-doc -->
- *
- * @generated
- */
- public EObject create(EClass eClass) {
- switch (eClass.getClassifierID()) {
- case ModulemapPackage.MODULE_MAPPING :
- return createModuleMapping();
- case ModulemapPackage.EAR_PROJECT_MAP :
- return createEARProjectMap();
- case ModulemapPackage.UTILITY_JAR_MAPPING :
- return createUtilityJARMapping();
- }
- return null;
- }
-
- /**
- * @generated This field/method will be replaced during code generation.
- */
- public EARProjectMap createEARProjectMap() {
- EARProjectMapImpl earProjectMap = new EARProjectMapImpl();
- return earProjectMap;
- }
-
- /**
- * @generated This field/method will be replaced during code generation.
- */
- public ModuleMapping createModuleMapping() {
- ModuleMappingImpl moduleMapping = new ModuleMappingImpl();
- return moduleMapping;
- }
-
- /**
- * @generated This field/method will be replaced during code generation.
- */
- public UtilityJARMapping createUtilityJARMapping() {
- UtilityJARMappingImpl utilityJARMapping = new UtilityJARMappingImpl();
- return utilityJARMapping;
- }
-
- /**
- * @generated This field/method will be replaced during code generation.
- */
- public ModulemapPackage getModulemapPackage() {
- return (ModulemapPackage) getEPackage();
- }
-
- /**
- * @generated This field/method will be replaced during code generation.
- */
- public static ModulemapPackage getPackage() {
- return ModulemapPackage.eINSTANCE;
- }
-
-} //ModulemapFactoryImpl
diff --git a/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/internal/earcreation/modulemap/ModulemapInit.java b/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/internal/earcreation/modulemap/ModulemapInit.java
deleted file mode 100644
index 78a5aed32..000000000
--- a/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/internal/earcreation/modulemap/ModulemapInit.java
+++ /dev/null
@@ -1,57 +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.earcreation.modulemap;
-
-
-import org.eclipse.emf.ecore.EFactory;
-import org.eclipse.emf.ecore.EPackage;
-import org.eclipse.wst.common.internal.emf.utilities.ExtendedEcoreUtil;
-
-//import com.ibm.etools.j2ee.internal.project.EAREditModel;
-/**
-* @deprecated
-* Use
-* <p>
-* Need to use the ModuleCore and WorkbenchComponent Api to get to the referenced modules
-* as with the Flexible project changes a .modulemaps file will not exist in an EAR module and
-* all the info that was captured in .modulemaps file will is now captured in the .component file
-*/
-
-public class ModulemapInit {
- protected static boolean initialized = false;
-
- public static void init() {
- init(true);
- }
-
- public static void init(boolean shouldPreRegisterPackages) {
- if (!initialized) {
- initialized = true;
- invokePrereqInits(shouldPreRegisterPackages);
- if (shouldPreRegisterPackages) {
- ExtendedEcoreUtil.preRegisterPackage("modulemap.xmi", new EPackage.Descriptor() { //$NON-NLS-1$
- public EPackage getEPackage() {
- return ModulemapPackage.eINSTANCE;
- }
- public EFactory getEFactory() {
- return ModulemapFactory.eINSTANCE;
- }
- });
- }
- //ResourceDependencyRegister.registerDependency(J2EEConstants.APPLICATION_DD_URI_OBJ, EAREditModel.MODULE_MAP_URI_OBJ);
- }
- }
-
- public static void invokePrereqInits(boolean shouldPreRegisterPackages) {
- //TODO Should remove....
- //com.ibm.ejs.models.base.extensions.init.ExtensionsInit.init(shouldPreRegisterPackages);
- }
-}
diff --git a/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/internal/earcreation/modulemap/ModulemapPackage.java b/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/internal/earcreation/modulemap/ModulemapPackage.java
deleted file mode 100644
index 638f73a11..000000000
--- a/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/internal/earcreation/modulemap/ModulemapPackage.java
+++ /dev/null
@@ -1,181 +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.earcreation.modulemap;
-
-
-import org.eclipse.emf.ecore.EAttribute;
-import org.eclipse.emf.ecore.EClass;
-import org.eclipse.emf.ecore.EPackage;
-import org.eclipse.emf.ecore.EReference;
-
-
-/**
- * @lastgen interface ModulemapPackage extends EPackage {}
- * @deprecated
- * Use
- * <p>
- * Need to use the ModuleCore and WorkbenchComponent Api to get to the referenced modules
- * as with the Flexible project changes a .modulemaps file will not exist in an EAR module and
- * all the info that was captured in .modulemaps file will is now captured in the .component file
- */
-public interface ModulemapPackage extends EPackage {
- /**
- * The package name. <!-- begin-user-doc --> <!-- end-user-doc -->
- *
- * @generated
- */
- String eNAME = "modulemap"; //$NON-NLS-1$
-
- /**
- * @generated This field/method will be replaced during code generation.
- */
-
-
- /**
- * @generated This field/method will be replaced during code generation.
- */
- int EAR_PROJECT_MAP = 1;
- /**
- * @generated This field/method will be replaced during code generation.
- */
- int MODULE_MAPPING = 0;
- /**
- * @generated This field/method will be replaced during code generation.
- */
- int MODULE_MAPPING__PROJECT_NAME = 0;
- /**
- * @generated This field/method will be replaced during code generation.
- */
- int MODULE_MAPPING__MODULE = 1;
-
- /**
- * The number of structural features of the the '<em>Module Mapping</em>' class. <!--
- * begin-user-doc --> <!-- end-user-doc -->
- *
- * @generated
- * @ordered
- */
- int MODULE_MAPPING_FEATURE_COUNT = 2;
-
- /**
- * @generated This field/method will be replaced during code generation.
- */
- int EAR_PROJECT_MAP__MAPPINGS = 0;
- /**
- * @generated This field/method will be replaced during code generation.
- */
- int EAR_PROJECT_MAP__UTILITY_JAR_MAPPINGS = 1;
-
- /**
- * The number of structural features of the the '<em>EAR Project Map</em>' class. <!--
- * begin-user-doc --> <!-- end-user-doc -->
- *
- * @generated
- * @ordered
- */
- int EAR_PROJECT_MAP_FEATURE_COUNT = 2;
-
- /**
- * @generated This field/method will be replaced during code generation.
- */
- int UTILITY_JAR_MAPPING = 2;
- /**
- * @generated This field/method will be replaced during code generation.
- */
- int UTILITY_JAR_MAPPING__PROJECT_NAME = 0;
- /**
- * @generated This field/method will be replaced during code generation.
- */
- int UTILITY_JAR_MAPPING__URI = 1;
-
-
- /**
- * The number of structural features of the the '<em>Utility JAR Mapping</em>' class. <!--
- * begin-user-doc --> <!-- end-user-doc -->
- *
- * @generated
- * @ordered
- */
- int UTILITY_JAR_MAPPING_FEATURE_COUNT = 2;
-
-
- /**
- * @generated This field/method will be replaced during code generation.
- */
- String eNS_URI = "modulemap.xmi"; //$NON-NLS-1$
- /**
- * The package namespace name. <!-- begin-user-doc --> <!-- end-user-doc -->
- *
- * @generated
- */
- String eNS_PREFIX = "modulemap"; //$NON-NLS-1$
-
- /**
- * The singleton instance of the package. <!-- begin-user-doc --> <!-- end-user-doc -->
- *
- * @generated
- */
- ModulemapPackage eINSTANCE = org.eclipse.jst.j2ee.internal.earcreation.modulemap.ModulemapPackageImpl.init();
-
- /**
- * @generated This field/method will be replaced during code generation
- * @return EARProjectMap object
- */
- EClass getEARProjectMap();
-
- /**
- * @generated This field/method will be replaced during code generation.
- */
- EReference getEARProjectMap_Mappings();
-
- /**
- * @generated This field/method will be replaced during code generation.
- */
- EReference getEARProjectMap_UtilityJARMappings();
-
- /**
- * @generated This field/method will be replaced during code generation
- * @return ModuleMapping object
- */
- EClass getModuleMapping();
-
- /**
- * @generated This field/method will be replaced during code generation.
- */
- EAttribute getModuleMapping_ProjectName();
-
- /**
- * @generated This field/method will be replaced during code generation.
- */
- EReference getModuleMapping_Module();
-
- /**
- * @generated This field/method will be replaced during code generation
- * @return UtilityJARMapping object
- */
- EClass getUtilityJARMapping();
-
- /**
- * @generated This field/method will be replaced during code generation.
- */
- EAttribute getUtilityJARMapping_ProjectName();
-
- /**
- * @generated This field/method will be replaced during code generation.
- */
- EAttribute getUtilityJARMapping_Uri();
-
- /**
- * @generated This field/method will be replaced during code generation.
- */
- ModulemapFactory getModulemapFactory();
-
-} //ModulemapPackage
diff --git a/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/internal/earcreation/modulemap/ModulemapPackageImpl.java b/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/internal/earcreation/modulemap/ModulemapPackageImpl.java
deleted file mode 100644
index a4178da44..000000000
--- a/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/internal/earcreation/modulemap/ModulemapPackageImpl.java
+++ /dev/null
@@ -1,238 +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.earcreation.modulemap;
-
-import org.eclipse.emf.ecore.EAttribute;
-import org.eclipse.emf.ecore.EClass;
-import org.eclipse.emf.ecore.EPackage;
-import org.eclipse.emf.ecore.EReference;
-import org.eclipse.emf.ecore.impl.EPackageImpl;
-import org.eclipse.emf.ecore.impl.EcorePackageImpl;
-import org.eclipse.jem.java.internal.impl.JavaRefPackageImpl;
-import org.eclipse.jst.j2ee.application.ApplicationPackage;
-import org.eclipse.jst.j2ee.application.internal.impl.ApplicationPackageImpl;
-import org.eclipse.jst.j2ee.common.internal.impl.CommonPackageImpl;
-
-
-
-/**
- * @lastgen class ModulemapPackageImpl extends EPackageImpl implements ModulemapPackage, EPackage {}
- * @deprecated
- * Use
- * <p>
- * Need to use the ModuleCore and WorkbenchComponent Api to get to the referenced modules
- * as with the Flexible project changes a .modulemaps file will not exist in an EAR module and
- * all the info that was captured in .modulemaps file will is now captured in the .component file
- */
-public class ModulemapPackageImpl extends EPackageImpl implements ModulemapPackage {
- /**
- * <!-- begin-user-doc --> <!-- end-user-doc -->
- *
- * @generated
- */
- private EClass moduleMappingEClass = null;
-
- /**
- * <!-- begin-user-doc --> <!-- end-user-doc -->
- *
- * @generated
- */
- private EClass earProjectMapEClass = null;
-
- /**
- * <!-- begin-user-doc --> <!-- end-user-doc -->
- *
- * @generated
- */
- private EClass utilityJARMappingEClass = null;
-
- /**
- * @generated This field/method will be replaced during code generation.
- */
- private ModulemapPackageImpl() {
- super(eNS_URI, ModulemapFactory.eINSTANCE);
- }
-
- /**
- * @generated This field/method will be replaced during code generation.
- */
- public static ModulemapPackage init() {
- // Initialize simple dependencies
- CommonPackageImpl.init();
- JavaRefPackageImpl.init();
- ApplicationPackageImpl.init();
- EcorePackageImpl.init();
-
- // Obtain or create and register package and interdependencies
- ModulemapPackageImpl theModulemapPackage = (ModulemapPackageImpl) (EPackage.Registry.INSTANCE.getEPackage(eNS_URI) instanceof EPackage ? EPackage.Registry.INSTANCE.getEPackage(eNS_URI) : new ModulemapPackageImpl());
-
- // Step 1: create meta-model objects
- theModulemapPackage.createPackageContents();
-
- // Step 2: complete initialization
- theModulemapPackage.initializePackageContents();
-
- return theModulemapPackage;
- }
-
- /**
- * @generated This field/method will be replaced during code generation.
- */
- public EClass getEARProjectMap() {
- return earProjectMapEClass;
- }
-
- /**
- * @generated This field/method will be replaced during code generation.
- */
- public EReference getEARProjectMap_Mappings() {
- return (EReference) earProjectMapEClass.getEReferences().get(0);
- }
-
- /**
- * @generated This field/method will be replaced during code generation.
- */
- public EReference getEARProjectMap_UtilityJARMappings() {
- return (EReference) earProjectMapEClass.getEReferences().get(1);
- }
-
- /**
- * @generated This field/method will be replaced during code generation.
- */
- public EClass getModuleMapping() {
- return moduleMappingEClass;
- }
-
- /**
- * @generated This field/method will be replaced during code generation.
- */
- public EAttribute getModuleMapping_ProjectName() {
- return (EAttribute) moduleMappingEClass.getEAttributes().get(0);
- }
-
- /**
- * @generated This field/method will be replaced during code generation.
- */
- public EReference getModuleMapping_Module() {
- return (EReference) moduleMappingEClass.getEReferences().get(0);
- }
-
- /**
- * @generated This field/method will be replaced during code generation.
- */
- public EClass getUtilityJARMapping() {
- return utilityJARMappingEClass;
- }
-
- /**
- * @generated This field/method will be replaced during code generation.
- */
- public EAttribute getUtilityJARMapping_ProjectName() {
- return (EAttribute) utilityJARMappingEClass.getEAttributes().get(0);
- }
-
- /**
- * @generated This field/method will be replaced during code generation.
- */
- public EAttribute getUtilityJARMapping_Uri() {
- return (EAttribute) utilityJARMappingEClass.getEAttributes().get(1);
- }
-
- /**
- * @generated This field/method will be replaced during code generation.
- */
- public ModulemapFactory getModulemapFactory() {
- return (ModulemapFactory) getEFactoryInstance();
- }
-
- /**
- * <!-- begin-user-doc --> <!-- end-user-doc -->
- *
- * @generated
- */
- private boolean isCreated = false;
-
- /**
- * Creates the meta-model objects for the package. This method is guarded to have no affect on
- * any invocation but its first. <!-- begin-user-doc --> <!-- end-user-doc -->
- *
- * @generated
- */
- public void createPackageContents() {
- if (isCreated)
- return;
- isCreated = true;
-
- // Create classes and their features
- moduleMappingEClass = createEClass(MODULE_MAPPING);
- createEAttribute(moduleMappingEClass, MODULE_MAPPING__PROJECT_NAME);
- createEReference(moduleMappingEClass, MODULE_MAPPING__MODULE);
-
- earProjectMapEClass = createEClass(EAR_PROJECT_MAP);
- createEReference(earProjectMapEClass, EAR_PROJECT_MAP__MAPPINGS);
- createEReference(earProjectMapEClass, EAR_PROJECT_MAP__UTILITY_JAR_MAPPINGS);
-
- utilityJARMappingEClass = createEClass(UTILITY_JAR_MAPPING);
- createEAttribute(utilityJARMappingEClass, UTILITY_JAR_MAPPING__PROJECT_NAME);
- createEAttribute(utilityJARMappingEClass, UTILITY_JAR_MAPPING__URI);
- }
-
- /**
- * <!-- begin-user-doc --> <!-- end-user-doc -->
- *
- * @generated
- */
- private boolean isInitialized = false;
-
- /**
- * Complete the initialization of the package and its meta-model. This method is guarded to have
- * no affect on any invocation but its first. <!-- begin-user-doc --> <!-- end-user-doc -->
- *
- * @generated
- */
- public void initializePackageContents() {
- if (isInitialized)
- return;
- isInitialized = true;
-
- // Initialize package
- setName(eNAME);
- setNsPrefix(eNS_PREFIX);
- setNsURI(eNS_URI);
-
- // Obtain other dependent packages
- // CommonPackageImpl theCommonPackage =
- // (CommonPackageImpl)EPackage.Registry.INSTANCE.getEPackage(CommonPackage.eNS_URI);
- // JavaRefPackageImpl theJavaRefPackage =
- // (JavaRefPackageImpl)EPackage.Registry.INSTANCE.getEPackage(JavaRefPackage.eNS_URI);
- ApplicationPackageImpl theApplicationPackage = (ApplicationPackageImpl) EPackage.Registry.INSTANCE.getEPackage(ApplicationPackage.eNS_URI);
- // EcorePackageImpl theEcorePackage =
- // (EcorePackageImpl)EPackage.Registry.INSTANCE.getEPackage(EcorePackage.eNS_URI);
-
- // Add supertypes to classes
-
- // Initialize classes and features; add operations and parameters
- initEClass(moduleMappingEClass, ModuleMapping.class, "ModuleMapping", !IS_ABSTRACT, !IS_INTERFACE); //$NON-NLS-1$
- initEAttribute(getModuleMapping_ProjectName(), ecorePackage.getEString(), "projectName", null, 0, 1, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, true, false); //$NON-NLS-1$
- initEReference(getModuleMapping_Module(), theApplicationPackage.getModule(), null, "module", null, 1, 1, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, true, false); //$NON-NLS-1$
-
- initEClass(earProjectMapEClass, EARProjectMap.class, "EARProjectMap", !IS_ABSTRACT, !IS_INTERFACE); //$NON-NLS-1$
- initEReference(getEARProjectMap_Mappings(), this.getModuleMapping(), null, "mappings", null, 0, -1, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, true, false); //$NON-NLS-1$
- initEReference(getEARProjectMap_UtilityJARMappings(), this.getUtilityJARMapping(), null, "utilityJARMappings", null, 1, -1, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, true, false); //$NON-NLS-1$
-
- initEClass(utilityJARMappingEClass, UtilityJARMapping.class, "UtilityJARMapping", !IS_ABSTRACT, !IS_INTERFACE); //$NON-NLS-1$
- initEAttribute(getUtilityJARMapping_ProjectName(), ecorePackage.getEString(), "projectName", null, 0, 1, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, true, false); //$NON-NLS-1$
- initEAttribute(getUtilityJARMapping_Uri(), ecorePackage.getEString(), "uri", null, 0, 1, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, true, false); //$NON-NLS-1$
-
- // Create resource
- createResource(eNS_URI);
- }
-} //ModulemapPackageImpl
diff --git a/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/internal/earcreation/modulemap/ModulemapSwitch.java b/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/internal/earcreation/modulemap/ModulemapSwitch.java
deleted file mode 100644
index ff5df4d72..000000000
--- a/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/internal/earcreation/modulemap/ModulemapSwitch.java
+++ /dev/null
@@ -1,107 +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.earcreation.modulemap;
-
-import org.eclipse.emf.ecore.EClass;
-import org.eclipse.emf.ecore.EObject;
-
-
-
-/**
- * @lastgen class ModulemapSwitch {}
- * @deprecated
- * Use
- * <p>
- * Need to use the ModuleCore and WorkbenchComponent Api to get to the referenced modules
- * as with the Flexible project changes a .modulemaps file will not exist in an EAR module and
- * all the info that was captured in .modulemaps file will is now captured in the .component file
- */
-public class ModulemapSwitch {
- /**
- * The cached model package <!-- begin-user-doc --> <!-- end-user-doc -->
- *
- * @generated
- */
- protected static ModulemapPackage modelPackage;
-
- /**
- * @generated This field/method will be replaced during code generation.
- */
- public ModulemapSwitch() {
- if (modelPackage == null) {
- modelPackage = ModulemapPackage.eINSTANCE;
- }
- }
-
- /**
- * @generated This field/method will be replaced during code generation.
- */
- public Object doSwitch(EObject theEObject) {
- EClass theEClass = theEObject.eClass();
- if (theEClass.eContainer() == modelPackage) {
- switch (theEClass.getClassifierID()) {
- case ModulemapPackage.MODULE_MAPPING : {
- ModuleMapping moduleMapping = (ModuleMapping) theEObject;
- Object result = caseModuleMapping(moduleMapping);
- if (result == null)
- result = defaultCase(theEObject);
- return result;
- }
- case ModulemapPackage.EAR_PROJECT_MAP : {
- EARProjectMap earProjectMap = (EARProjectMap) theEObject;
- Object result = caseEARProjectMap(earProjectMap);
- if (result == null)
- result = defaultCase(theEObject);
- return result;
- }
- case ModulemapPackage.UTILITY_JAR_MAPPING : {
- UtilityJARMapping utilityJARMapping = (UtilityJARMapping) theEObject;
- Object result = caseUtilityJARMapping(utilityJARMapping);
- if (result == null)
- result = defaultCase(theEObject);
- return result;
- }
- default :
- return defaultCase(theEObject);
- }
- }
- return defaultCase(theEObject);
- }
-
- /**
- * @generated This field/method will be replaced during code generation.
- */
- public Object caseEARProjectMap(EARProjectMap object) {
- return null;
- }
-
- /**
- * @generated This field/method will be replaced during code generation.
- */
- public Object caseModuleMapping(ModuleMapping object) {
- return null;
- }
-
- /**
- * @generated This field/method will be replaced during code generation.
- */
- public Object caseUtilityJARMapping(UtilityJARMapping object) {
- return null;
- }
-
- /**
- * @generated This field/method will be replaced during code generation.
- */
- public Object defaultCase(EObject object) {
- return null;
- }
-
-} //ModulemapSwitch
diff --git a/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/internal/earcreation/modulemap/UtilityJARMapping.java b/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/internal/earcreation/modulemap/UtilityJARMapping.java
deleted file mode 100644
index e52356154..000000000
--- a/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/internal/earcreation/modulemap/UtilityJARMapping.java
+++ /dev/null
@@ -1,53 +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.earcreation.modulemap;
-
-
-import org.eclipse.emf.ecore.EObject;
-
-
-/**
- * @lastgen interface UtilityJARMapping extends EObject {}
- * @deprecated
- * Use
- * <p>
- * Need to use the ModuleCore and WorkbenchComponent Api to get to the referenced modules
- * as with the Flexible project changes a .modulemaps file will not exist in an EAR module and
- * all the info that was captured in .modulemaps file will is now captured in the .component file
- */
-public interface UtilityJARMapping extends EObject {
- /**
- * @generated This field/method will be replaced during code generation
- * @return The value of the ProjectName attribute
- */
- String getProjectName();
-
- /**
- * @generated This field/method will be replaced during code generation
- * @param value
- * The new value of the ProjectName attribute
- */
- void setProjectName(String value);
-
- /**
- * @generated This field/method will be replaced during code generation
- * @return The value of the Uri attribute
- */
- String getUri();
-
- /**
- * @generated This field/method will be replaced during code generation
- * @param value
- * The new value of the Uri attribute
- */
- void setUri(String value);
-
-} //UtilityJARMapping
diff --git a/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/internal/earcreation/modulemap/UtilityJARMappingImpl.java b/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/internal/earcreation/modulemap/UtilityJARMappingImpl.java
deleted file mode 100644
index d935451e0..000000000
--- a/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/internal/earcreation/modulemap/UtilityJARMappingImpl.java
+++ /dev/null
@@ -1,183 +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.earcreation.modulemap;
-
-import org.eclipse.emf.common.notify.Notification;
-import org.eclipse.emf.ecore.EClass;
-import org.eclipse.emf.ecore.EStructuralFeature;
-import org.eclipse.emf.ecore.impl.ENotificationImpl;
-import org.eclipse.emf.ecore.impl.EObjectImpl;
-import org.eclipse.jst.j2ee.internal.earcreation.EARCreationResourceHandler;
-
-
-/**
- * @lastgen class UtilityJARMappingImpl extends EObjectImpl implements UtilityJARMapping, EObject {}
- * @deprecated
- * Use
- * <p>
- * Need to use the ModuleCore and WorkbenchComponent Api to get to the referenced modules
- * as with the Flexible project changes a .modulemaps file will not exist in an EAR module and
- * all the info that was captured in .modulemaps file will is now captured in the .component file
- */
-public class UtilityJARMappingImpl extends EObjectImpl implements UtilityJARMapping {
- /**
- * The default value of the '{@link #getProjectName() <em>Project Name</em>}' attribute. <!--
- * begin-user-doc --> <!-- end-user-doc -->
- *
- * @see #getProjectName()
- * @generated
- * @ordered
- */
- protected static final String PROJECT_NAME_EDEFAULT = null;
-
- /**
- * @generated This field/method will be replaced during code generation.
- */
- /**
- * @generated This field/method will be replaced during code generation.
- */
- protected String projectName = PROJECT_NAME_EDEFAULT;
- /**
- * The default value of the '{@link #getUri() <em>Uri</em>}' attribute. <!-- begin-user-doc
- * --> <!-- end-user-doc -->
- *
- * @see #getUri()
- * @generated
- * @ordered
- */
- protected static final String URI_EDEFAULT = null;
-
- /**
- * @generated This field/method will be replaced during code generation.
- */
- protected String uri = URI_EDEFAULT;
-
- /**
- * @generated This field/method will be replaced during code generation.
- */
- protected UtilityJARMappingImpl() {
- super();
- }
-
- /**
- * <!-- begin-user-doc --> <!-- end-user-doc -->
- *
- * @generated
- */
- protected EClass eStaticClass() {
- return ModulemapPackage.eINSTANCE.getUtilityJARMapping();
- }
-
- /**
- * @generated This field/method will be replaced during code generation
- */
- public String getProjectName() {
- return projectName;
- }
-
- /**
- * @generated This field/method will be replaced during code generation.
- */
- public void setProjectName(String newProjectName) {
- String oldProjectName = projectName;
- projectName = newProjectName;
- if (eNotificationRequired())
- eNotify(new ENotificationImpl(this, Notification.SET, ModulemapPackage.UTILITY_JAR_MAPPING__PROJECT_NAME, oldProjectName, projectName));
- }
-
- /**
- * @generated This field/method will be replaced during code generation
- */
- public String getUri() {
- return uri;
- }
-
- /**
- * @generated This field/method will be replaced during code generation.
- */
- public void setUri(String newUri) {
- String oldUri = uri;
- uri = newUri;
- if (eNotificationRequired())
- eNotify(new ENotificationImpl(this, Notification.SET, ModulemapPackage.UTILITY_JAR_MAPPING__URI, oldUri, uri));
- }
-
- /**
- * <!-- begin-user-doc --> <!-- end-user-doc -->
- *
- * @generated
- */
- public Object eGet(EStructuralFeature eFeature, boolean resolve) {
- switch (eDerivedStructuralFeatureID(eFeature.getFeatureID(), eFeature.getContainerClass())) {
- case ModulemapPackage.UTILITY_JAR_MAPPING__PROJECT_NAME :
- return getProjectName();
- case ModulemapPackage.UTILITY_JAR_MAPPING__URI :
- return getUri();
- }
- return eDynamicGet(eFeature, resolve);
- }
-
- /**
- * @generated This field/method will be replaced during code generation.
- */
- public boolean eIsSet(EStructuralFeature eFeature) {
- switch (eDerivedStructuralFeatureID(eFeature.getFeatureID(), eFeature.getContainerClass())) {
- case ModulemapPackage.UTILITY_JAR_MAPPING__PROJECT_NAME :
- return PROJECT_NAME_EDEFAULT == null ? projectName != null : !PROJECT_NAME_EDEFAULT.equals(projectName);
- case ModulemapPackage.UTILITY_JAR_MAPPING__URI :
- return URI_EDEFAULT == null ? uri != null : !URI_EDEFAULT.equals(uri);
- }
- return eDynamicIsSet(eFeature);
- }
-
- /**
- * @generated This field/method will be replaced during code generation.
- */
- public void eSet(EStructuralFeature eFeature, Object newValue) {
- switch (eDerivedStructuralFeatureID(eFeature.getFeatureID(), eFeature.getContainerClass())) {
- case ModulemapPackage.UTILITY_JAR_MAPPING__PROJECT_NAME :
- setProjectName((String) newValue);
- return;
- case ModulemapPackage.UTILITY_JAR_MAPPING__URI :
- setUri((String) newValue);
- return;
- }
- eDynamicSet(eFeature, newValue);
- }
-
- /**
- * @generated This field/method will be replaced during code generation.
- */
- public void eUnset(EStructuralFeature eFeature) {
- switch (eDerivedStructuralFeatureID(eFeature.getFeatureID(), eFeature.getContainerClass())) {
- case ModulemapPackage.UTILITY_JAR_MAPPING__PROJECT_NAME :
- setProjectName(PROJECT_NAME_EDEFAULT);
- return;
- case ModulemapPackage.UTILITY_JAR_MAPPING__URI :
- setUri(URI_EDEFAULT);
- return;
- }
- eDynamicUnset(eFeature);
- }
-
- /**
- * @generated This field/method will be replaced during code generation.
- */
- public String toString() {
- if (eIsProxy())
- return super.toString();
-
- StringBuffer result = new StringBuffer(super.toString());
- result.append(EARCreationResourceHandler.getString("UtilityJARMappingImpl_UI_0", new Object[]{projectName, uri})); //$NON-NLS-1$
- return result.toString();
- }
-
-} //UtilityJARMappingImpl
diff --git a/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/internal/modulecore/util/EarEditAdapterFactory.java b/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/internal/modulecore/util/EarEditAdapterFactory.java
deleted file mode 100644
index 889db8005..000000000
--- a/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/internal/modulecore/util/EarEditAdapterFactory.java
+++ /dev/null
@@ -1,54 +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.modulecore.util;
-
-import org.eclipse.core.runtime.IAdapterFactory;
-import org.eclipse.jst.j2ee.componentcore.util.EARArtifactEdit;
-import org.eclipse.jst.j2ee.internal.project.J2EEProjectUtilities;
-import org.eclipse.wst.common.componentcore.ArtifactEdit;
-import org.eclipse.wst.common.componentcore.internal.ArtifactEditModel;
-
-
-/**
- * <p>
- * Adapts {@see org.eclipse.wst.common.modulecore.ArtifactEditModel}s to
- * {@see org.eclipse.jst.j2ee.internal.modulecore.util.EARArtifactEdit}&nbsp; facades.
- * </p>
- */
-public class EarEditAdapterFactory implements IAdapterFactory {
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.core.runtime.IAdapterFactory#getAdapter(java.lang.Object, java.lang.Class)
- */
- public Object getAdapter(Object adaptableObject, Class adapterType) {
-
- if (adapterType == EARArtifactEdit.ADAPTER_TYPE || adapterType == ArtifactEdit.ADAPTER_TYPE) {
- ArtifactEditModel editModel = (ArtifactEditModel) adaptableObject;
- if (J2EEProjectUtilities.isEARProject(editModel.getProject()))
- return new EARArtifactEdit((ArtifactEditModel) adaptableObject);
- }
- return null;
-
- }
-
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.core.runtime.IAdapterFactory#getAdapterList()
- */
- public Class[] getAdapterList() {
-
- return new Class[]{ArtifactEdit.class, EARArtifactEdit.class};
- }
-}
diff --git a/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/internal/moduleextension/EarModuleExtension.java b/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/internal/moduleextension/EarModuleExtension.java
deleted file mode 100644
index 71c0defc1..000000000
--- a/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/internal/moduleextension/EarModuleExtension.java
+++ /dev/null
@@ -1,45 +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 Sep 19, 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.moduleextension;
-
-import org.eclipse.jst.j2ee.internal.archive.operations.ImportOption;
-import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
-import org.eclipse.wst.common.frameworks.datamodel.IDataModelOperation;
-
-
-
-/**
- * @author cbridgha
- *
- * To change the template for this generated type comment go to Window>Preferences>Java>Code
- * Generation>Code and Comments
- */
-public interface EarModuleExtension {
-
- /**
- * Return a default instance of the J2EEModuleCreationDataModel.
- *
- * @return
- */
- IDataModel createProjectDataModel();
-
- IDataModel createImportDataModel();
-
- IDataModelOperation createProjectCreationOperation(IDataModel dataModel);
-
- IDataModelOperation createProjectCreationOperation(ImportOption option);
-}
diff --git a/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/internal/moduleextension/EarModuleExtensionImpl.java b/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/internal/moduleextension/EarModuleExtensionImpl.java
deleted file mode 100644
index d67120d17..000000000
--- a/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/internal/moduleextension/EarModuleExtensionImpl.java
+++ /dev/null
@@ -1,48 +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 Sep 29, 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.moduleextension;
-
-import org.eclipse.jst.j2ee.internal.archive.operations.ImportOption;
-import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
-import org.eclipse.wst.common.frameworks.datamodel.IDataModelOperation;
-
-
-public abstract class EarModuleExtensionImpl implements EarModuleExtension {
- /**
- *
- */
- public EarModuleExtensionImpl() {
- super();
- // TODO Auto-generated constructor stub
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.jst.j2ee.internal.internal.moduleextension.EarModuleExtension#createProjectCreationOperation(com.ibm.etools.archive.ear.operations.ImportOption)
- */
- public IDataModelOperation createProjectCreationOperation(ImportOption option) {
- if (option.getArchiveType() == ImportOption.MODULE)
- return option.getModel().getDefaultOperation();
- return null;
- }
-
- public IDataModelOperation createProjectCreationOperation(IDataModel dataModel) {
- return dataModel.getDefaultOperation();
- }
-
-}
diff --git a/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/internal/moduleextension/EarModuleExtensionRegistry.java b/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/internal/moduleextension/EarModuleExtensionRegistry.java
deleted file mode 100644
index 3a9ed1419..000000000
--- a/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/internal/moduleextension/EarModuleExtensionRegistry.java
+++ /dev/null
@@ -1,72 +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 Oct 29, 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.moduleextension;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IConfigurationElement;
-import org.eclipse.jem.util.RegistryReader;
-import org.eclipse.jst.j2ee.internal.plugin.J2EEPlugin;
-
-/**
- * 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 EarModuleExtensionRegistry extends RegistryReader {
-
- static final String EXTENSION_NAME = "EARModuleExtension"; //$NON-NLS-1$
- static final String ELEMENT_EARMODULE_EXTENSION = "earModuleExtension"; //$NON-NLS-1$
- static final String MODULE_EXTENSION_CLASS = "extensionClass"; //$NON-NLS-1$
- private static EarModuleExtensionRegistry INSTANCE = null;
-
- public EarModuleExtensionRegistry() {
- super(J2EEPlugin.PLUGIN_ID, EXTENSION_NAME);
- }
-
- public static EarModuleExtensionRegistry getInstance() {
- if (INSTANCE == null) {
- INSTANCE = new EarModuleExtensionRegistry();
- INSTANCE.readRegistry();
- }
- return INSTANCE;
- }
-
- /**
- * readElement() - parse and deal w/ an extension like: <earModuleExtension extensionClass =
- * "com.ibm.etools.web.plugin.WebModuleExtensionImpl"/>
- */
- public boolean readElement(IConfigurationElement element) {
- if (!element.getName().equals(ELEMENT_EARMODULE_EXTENSION))
- return false;
-
- EarModuleExtension extension = null;
- try {
- extension = (EarModuleExtension) element.createExecutableExtension(MODULE_EXTENSION_CLASS);
- } catch (CoreException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- if (extension != null)
- addModuleExtension(extension);
- return true;
- }
-
-
- private static void addModuleExtension(EarModuleExtension ext) {
- EarModuleManager.registerModuleExtension(ext);
- }
-
-}
diff --git a/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/internal/moduleextension/EarModuleManager.java b/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/internal/moduleextension/EarModuleManager.java
deleted file mode 100644
index 14d2cfb6f..000000000
--- a/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/internal/moduleextension/EarModuleManager.java
+++ /dev/null
@@ -1,94 +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 Sep 19, 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.moduleextension;
-
-import java.util.HashMap;
-
-import org.eclipse.jst.j2ee.internal.project.J2EEProjectUtilities;
-
-
-/**
- * @author cbridgha
- *
- * To change the template for this generated type comment go to Window>Preferences>Java>Code
- * Generation>Code and Comments
- */
-public class EarModuleManager {
- static HashMap moduleExtensions = new HashMap();
-
-
- /**
- * @return
- */
- public static HashMap getModuleExtensions() {
- return moduleExtensions;
- }
-
- public static EarModuleExtension getModuleExtension(String key) {
- //Make sure the registry is loaded
- EarModuleExtensionRegistry.getInstance();
- return (EarModuleExtension) moduleExtensions.get(key);
- }
-
- /**
- * @return
- */
- public static EjbModuleExtension getEJBModuleExtension() {
- return (EjbModuleExtension) getModuleExtension(J2EEProjectUtilities.EJB);
- }
-
- /**
- * @return
- */
- public static JcaModuleExtension getJCAModuleExtension() {
- return (JcaModuleExtension) getModuleExtension(J2EEProjectUtilities.JCA);
- }
-
- /**
- * @return
- */
- public static WebModuleExtension getWebModuleExtension() {
- return (WebModuleExtension) getModuleExtension(J2EEProjectUtilities.DYNAMIC_WEB);
- }
-
- public static boolean hasEJBModuleExtension() {
- return (EjbModuleExtension) getModuleExtension(J2EEProjectUtilities.EJB) != null;
- }
-
- public static boolean hasJCAModuleExtension() {
- return (JcaModuleExtension) getModuleExtension(J2EEProjectUtilities.JCA) != null;
- }
-
- public static boolean hasWebModuleExtension() {
- return getModuleExtension(J2EEProjectUtilities.DYNAMIC_WEB) != null;
- }
-
- public static void registerModuleExtension(EarModuleExtension ext) {
- if (ext instanceof WebModuleExtension)
- moduleExtensions.put(J2EEProjectUtilities.DYNAMIC_WEB, ext);
- else if (ext instanceof EjbModuleExtension)
- moduleExtensions.put(J2EEProjectUtilities.EJB, ext);
- else if (ext instanceof JcaModuleExtension)
- moduleExtensions.put(J2EEProjectUtilities.JCA, ext);
- else
- moduleExtensions.put(J2EEProjectUtilities.ENTERPRISE_APPLICATION, ext);
- }
-
- public static void removeModuleExtension(String key) {
- moduleExtensions.remove(key);
- }
-}
diff --git a/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/internal/moduleextension/EjbModuleExtension.java b/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/internal/moduleextension/EjbModuleExtension.java
deleted file mode 100644
index fba78ee72..000000000
--- a/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/internal/moduleextension/EjbModuleExtension.java
+++ /dev/null
@@ -1,52 +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 Sep 19, 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.moduleextension;
-
-import org.eclipse.core.resources.IProject;
-import org.eclipse.jst.j2ee.ejb.EJBJar;
-import org.eclipse.wst.common.frameworks.datamodel.IDataModelOperation;
-
-
-
-/**
- * @author cbridgha
- *
- * To change the template for this generated type comment go to Window>Preferences>Java>Code
- * Generation>Code and Comments
- */
-public interface EjbModuleExtension extends EarModuleExtension {
-
- //void initializeEjbReferencesToModule(J2EENature nature, UpdateModuleReferencesInEARProjectCommand cmd);
-
- //J2EEJavaProjectInfo createProjectInfo();
-
- //J2EEImportOperationOLD createImportOperation(IProject proj, EJBJarFile ejbJarFile);
-
- EJBJar getEJBJar(IProject aProject);
-
- IProject getDefinedEJBClientJARProject(IProject anEJBProject);
-
- IDataModelOperation createEJBClientJARProject(
- final String clientProjectName,
- final String srcFolderName,
- final String ejbProjectName,
- final String earProjectName,
- final org.eclipse.wst.common.project.facet.core.runtime.IRuntime runtime);
-
- IDataModelOperation createEJBClientJARProject(IProject ejbProject);
-
-}
diff --git a/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/internal/moduleextension/JcaModuleExtension.java b/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/internal/moduleextension/JcaModuleExtension.java
deleted file mode 100644
index 92ca9ca7f..000000000
--- a/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/internal/moduleextension/JcaModuleExtension.java
+++ /dev/null
@@ -1,36 +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 Sep 19, 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.moduleextension;
-
-//import org.eclipse.jst.j2ee.internal.earcreation.UpdateModuleReferencesInEARProjectCommand;
-//import org.eclipse.jst.j2ee.internal.project.J2EENature;
-
-
-/**
- * @author cbridgha
- *
- * To change the template for this generated type comment go to Window>Preferences>Java>Code
- * Generation>Code and Comments
- */
-public interface JcaModuleExtension extends EarModuleExtension {
-
- //void initializeEjbReferencesToModule(J2EENature nature, UpdateModuleReferencesInEARProjectCommand cmd);
-
- //J2EEJavaProjectInfo createProjectInfo();
-
- //J2EEImportOperation createImportOperation(IProject proj, RARFile rarFile);
-}
diff --git a/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/internal/moduleextension/WebModuleExtension.java b/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/internal/moduleextension/WebModuleExtension.java
deleted file mode 100644
index cf9a5d031..000000000
--- a/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/internal/moduleextension/WebModuleExtension.java
+++ /dev/null
@@ -1,58 +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 Sep 19, 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.moduleextension;
-
-import java.util.Set;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.jst.j2ee.application.Module;
-import org.eclipse.jst.j2ee.application.WebModule;
-import org.eclipse.jst.j2ee.internal.project.J2EEJavaProjectInfo;
-//import org.eclipse.jst.j2ee.internal.project.J2EENature;
-
-
-/**
- * @author cbridgha
- *
- * To change the template for this generated type comment go to Window>Preferences>Java>Code
- * Generation>Code and Comments
- */
-public interface WebModuleExtension extends EarModuleExtension {
-
- static final String WEBSETTINGS_FILE_URI = ".j2ee"; //$NON-NLS-1$
-
-// void initializeEjbReferencesToModule(J2EENature nature, UpdateModuleReferencesInEARProjectCommand command);
-
- void addWLPProjects(IProject aProject, Set projectsToBuild);
-
-
- void setContextRootForModuleMapping(WebModule m, IProject nestedProject) throws CoreException;
-
- //J2EEImportOperationOLD createImportOperation(IProject nestedProject, WARFile warFile,
- // EARImportConfiguration importConfig);
-
- String getContentFolder(IProject project, IFile webSettingsFile);
-
- J2EEJavaProjectInfo createProjectInfo();
-
- boolean compareWebContextRoot(Module module, IProject project) throws CoreException;
-
- boolean hasRuntime(IProject project);
-
-}
diff --git a/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/internal/project/facet/EARFacetProjectCreationDataModelProvider.java b/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/internal/project/facet/EARFacetProjectCreationDataModelProvider.java
deleted file mode 100644
index 919012b07..000000000
--- a/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/internal/project/facet/EARFacetProjectCreationDataModelProvider.java
+++ /dev/null
@@ -1,34 +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.project.facet;
-
-import java.util.ArrayList;
-import java.util.Collection;
-
-import org.eclipse.jst.j2ee.project.facet.IJ2EEFacetConstants;
-import org.eclipse.wst.common.componentcore.datamodel.FacetProjectCreationDataModelProvider;
-import org.eclipse.wst.common.project.facet.core.IProjectFacet;
-
-public class EARFacetProjectCreationDataModelProvider extends FacetProjectCreationDataModelProvider {
-
- public EARFacetProjectCreationDataModelProvider() {
- super();
- }
-
- public void init() {
- super.init();
-
- Collection<IProjectFacet> requiredFacets = new ArrayList<IProjectFacet>();
- requiredFacets.add(IJ2EEFacetConstants.ENTERPRISE_APPLICATION_FACET);
- setProperty(REQUIRED_FACETS_COLLECTION, requiredFacets);
- }
-
-}
diff --git a/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/internal/project/facet/UtilityFacetInstallDataModelProvider.java b/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/internal/project/facet/UtilityFacetInstallDataModelProvider.java
deleted file mode 100644
index fb7bdb48c..000000000
--- a/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/internal/project/facet/UtilityFacetInstallDataModelProvider.java
+++ /dev/null
@@ -1,72 +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.project.facet;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.jdt.core.IClasspathEntry;
-import org.eclipse.jdt.core.IJavaProject;
-import org.eclipse.jdt.core.JavaCore;
-import org.eclipse.jem.util.logger.proxy.Logger;
-import org.eclipse.jst.common.project.facet.core.JavaFacet;
-import org.eclipse.jst.j2ee.internal.plugin.IJ2EEModuleConstants;
-import org.eclipse.jst.j2ee.project.facet.IUtilityFacetInstallDataModelProperties;
-import org.eclipse.jst.j2ee.project.facet.J2EEModuleFacetInstallDataModelProvider;
-import org.eclipse.wst.common.project.facet.core.IFacetedProject;
-import org.eclipse.wst.common.project.facet.core.IFacetedProjectWorkingCopy;
-import org.eclipse.wst.common.project.facet.core.IProjectFacetVersion;
-
-public class UtilityFacetInstallDataModelProvider extends J2EEModuleFacetInstallDataModelProvider implements IUtilityFacetInstallDataModelProperties {
- public UtilityFacetInstallDataModelProvider()
- {
- super();
- }
-
- public Object getDefaultProperty(String propertyName) {
- if (FACET_ID.equals(propertyName)) {
- return UTILITY;
- } else if (propertyName.equals(MODULE_URI)) {
- String projectName = model.getStringProperty(FACET_PROJECT_NAME).replace(' ', '_');
- return projectName + IJ2EEModuleConstants.JAR_EXT;
- }
- else if( propertyName.equals( CONFIG_FOLDER ) )
- {
- final IFacetedProjectWorkingCopy fpjwc
- = (IFacetedProjectWorkingCopy) getProperty( FACETED_PROJECT_WORKING_COPY );
-
- final IFacetedProject fpj = fpjwc.getFacetedProject();
-
- if( fpj.hasProjectFacet( JavaFacet.FACET ) )
- {
- try
- {
- final IJavaProject jpj = JavaCore.create( fpj.getProject() );
-
- for( IClasspathEntry cpe : jpj.getRawClasspath() )
- {
- if( cpe.getEntryKind() == IClasspathEntry.CPE_SOURCE )
- {
- return cpe.getPath().removeFirstSegments( 1 ).toPortableString();
- }
- }
- }
- catch( CoreException e )
- {
- Logger.getLogger().logError(e);
- }
- }
- }
- return super.getDefaultProperty(propertyName);
- }
-
- protected int convertFacetVersionToJ2EEVersion(IProjectFacetVersion version) {
- return 0;
- }
-}
diff --git a/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/project/facet/EARFacetProjectCreationDataModelProvider.java b/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/project/facet/EARFacetProjectCreationDataModelProvider.java
deleted file mode 100644
index ccca86779..000000000
--- a/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/project/facet/EARFacetProjectCreationDataModelProvider.java
+++ /dev/null
@@ -1,24 +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.project.facet;
-
-/**
- * This class was not intended to be public API. Please use {@link org.eclipse.jst.j2ee.earcreation.IEarFacetInstallDataModelProperties}
- *
- * @deprecated
- * @see org.eclipse.jst.j2ee.internal.project.facet.EARFacetProjectCreationDataModelProvider
- */
-public class EARFacetProjectCreationDataModelProvider extends org.eclipse.jst.j2ee.internal.project.facet.EARFacetProjectCreationDataModelProvider {
-
- public EARFacetProjectCreationDataModelProvider() {
- super();
- }
-}
diff --git a/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/project/facet/EARFacetUtils.java b/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/project/facet/EARFacetUtils.java
deleted file mode 100644
index 924a50bed..000000000
--- a/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/project/facet/EARFacetUtils.java
+++ /dev/null
@@ -1,26 +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.project.facet;
-
-import org.eclipse.wst.common.componentcore.internal.util.IModuleConstants;
-import org.eclipse.wst.common.project.facet.core.IProjectFacet;
-import org.eclipse.wst.common.project.facet.core.IProjectFacetVersion;
-import org.eclipse.wst.common.project.facet.core.ProjectFacetsManager;
-
-public class EARFacetUtils {
-
- public static final IProjectFacet EAR_FACET = ProjectFacetsManager.getProjectFacet(IModuleConstants.JST_EAR_MODULE);
- public static final IProjectFacetVersion EAR_12 = EAR_FACET.getVersion("1.2"); //$NON-NLS-1$
- public static final IProjectFacetVersion EAR_13 = EAR_FACET.getVersion("1.3"); //$NON-NLS-1$
- public static final IProjectFacetVersion EAR_14 = EAR_FACET.getVersion("1.4"); //$NON-NLS-1$
-
-
-}
diff --git a/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/project/facet/EarFacetInstallDelegate.java b/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/project/facet/EarFacetInstallDelegate.java
deleted file mode 100644
index 8b949531a..000000000
--- a/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/project/facet/EarFacetInstallDelegate.java
+++ /dev/null
@@ -1,77 +0,0 @@
-/******************************************************************************
- * Copyright (c) 2005 BEA Systems, Inc.
- * 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:
- * Konstantin Komissarchik - initial API and implementation
- ******************************************************************************/
-
-package org.eclipse.jst.j2ee.project.facet;
-
-import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.Path;
-import org.eclipse.jem.util.logger.proxy.Logger;
-import org.eclipse.jst.common.project.facet.WtpUtils;
-import org.eclipse.jst.j2ee.componentcore.util.EARArtifactEdit;
-import org.eclipse.jst.j2ee.internal.J2EEConstants;
-import org.eclipse.jst.j2ee.internal.common.J2EEVersionUtil;
-import org.eclipse.jst.j2ee.internal.earcreation.IEarFacetInstallDataModelProperties;
-import org.eclipse.wst.common.componentcore.ComponentCore;
-import org.eclipse.wst.common.componentcore.datamodel.FacetDataModelProvider;
-import org.eclipse.wst.common.componentcore.resources.IVirtualComponent;
-import org.eclipse.wst.common.componentcore.resources.IVirtualFolder;
-import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
-import org.eclipse.wst.common.frameworks.datamodel.IDataModelOperation;
-import org.eclipse.wst.common.project.facet.core.IDelegate;
-import org.eclipse.wst.common.project.facet.core.IProjectFacetVersion;
-
-public final class EarFacetInstallDelegate implements IDelegate {
-
- public void execute(final IProject project, final IProjectFacetVersion fv, final Object cfg, final IProgressMonitor monitor) throws CoreException {
- if (monitor != null) {
- monitor.beginTask("", 1); //$NON-NLS-1$
- }
-
- try {
- IDataModel model = (IDataModel) cfg;
-
- if (monitor != null) {
- monitor.worked(1);
- }
- // Add WTP natures.
-
- WtpUtils.addNaturestoEAR(project);
-
- final IVirtualComponent c = ComponentCore.createComponent(project, false);
- c.create(0, null);
-
- final IVirtualFolder earroot = c.getRootFolder();
- earroot.createLink(new Path("/" + model.getStringProperty(IEarFacetInstallDataModelProperties.CONTENT_DIR)), 0, null); //$NON-NLS-1$
-
- if (!earroot.getFile(J2EEConstants.APPLICATION_DD_URI).exists()) {
- String ver = fv.getVersionString();
- int nVer = J2EEVersionUtil.convertVersionStringToInt(ver);
- EARArtifactEdit.createDeploymentDescriptor(project, nVer);
- }
-
- try {
- ((IDataModelOperation) model.getProperty(FacetDataModelProvider.NOTIFICATION_OPERATION)).execute(monitor, null);
- } catch (ExecutionException e) {
- Logger.getLogger().logError(e);
- }
- }
-
- finally {
- if (monitor != null) {
- monitor.done();
- }
- }
- }
-
-}
diff --git a/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/project/facet/EarFacetPostInstallDelegate.java b/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/project/facet/EarFacetPostInstallDelegate.java
deleted file mode 100644
index fee5cac65..000000000
--- a/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/project/facet/EarFacetPostInstallDelegate.java
+++ /dev/null
@@ -1,90 +0,0 @@
-/******************************************************************************
- * Copyright (c) 2005 BEA Systems, Inc.
- * 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:
- * Konstantin Komissarchik - initial API and implementation
- ******************************************************************************/
-
-package org.eclipse.jst.j2ee.project.facet;
-
-import java.util.ArrayList;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Set;
-
-import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.jem.util.logger.proxy.Logger;
-import org.eclipse.jst.j2ee.application.internal.operations.AddComponentToEnterpriseApplicationDataModelProvider;
-import org.eclipse.jst.j2ee.internal.earcreation.IEarFacetInstallDataModelProperties;
-import org.eclipse.jst.j2ee.internal.project.J2EEProjectUtilities;
-import org.eclipse.wst.common.componentcore.ComponentCore;
-import org.eclipse.wst.common.componentcore.datamodel.properties.ICreateReferenceComponentsDataModelProperties;
-import org.eclipse.wst.common.componentcore.resources.IVirtualComponent;
-import org.eclipse.wst.common.frameworks.datamodel.DataModelFactory;
-import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
-import org.eclipse.wst.common.project.facet.core.IDelegate;
-import org.eclipse.wst.common.project.facet.core.IProjectFacetVersion;
-
-public final class EarFacetPostInstallDelegate implements IDelegate {
-
- public void execute(final IProject project, final IProjectFacetVersion fv, final Object cfg, final IProgressMonitor monitor) throws CoreException {
- if (monitor != null) {
- monitor.beginTask("", 1); //$NON-NLS-1$
- }
-
- try {
- IDataModel model = (IDataModel) cfg;
-
- if (monitor != null) {
- monitor.worked(1);
- }
-
- final IVirtualComponent c = ComponentCore.createComponent(project);
-
- Set dependentProjects = new HashSet();
- dependentProjects.addAll((List) model.getProperty(IEarFacetInstallDataModelProperties.J2EE_PROJECTS_LIST));
- dependentProjects.addAll((List) model.getProperty(IEarFacetInstallDataModelProperties.JAVA_PROJECT_LIST));
- if (!dependentProjects.isEmpty()) {
- List dependentComponents = new ArrayList(dependentProjects.size());
- for (Iterator iterator = dependentProjects.iterator(); iterator.hasNext();) {
- IProject depProject = (IProject) iterator.next();
- IVirtualComponent depComp = ComponentCore.createComponent(depProject);
- if (depComp == null) {
- JavaProjectMigrationOperation utilOp = J2EEProjectUtilities.createFlexJavaProjectForProjectOperation(depProject);
- utilOp.execute(null, null);
- depComp = ComponentCore.createComponent(depProject);
- }
-
- dependentComponents.add(depComp);
- }
-
- final IDataModel dataModel = DataModelFactory.createDataModel(new AddComponentToEnterpriseApplicationDataModelProvider());
- dataModel.setProperty(ICreateReferenceComponentsDataModelProperties.SOURCE_COMPONENT, c);
- List modList = (List) dataModel.getProperty(ICreateReferenceComponentsDataModelProperties.TARGET_COMPONENT_LIST);
- modList.addAll(dependentComponents);
- dataModel.setProperty(ICreateReferenceComponentsDataModelProperties.TARGET_COMPONENT_LIST, modList);
- try {
- dataModel.getDefaultOperation().execute(null, null);
- } catch (ExecutionException e) {
- Logger.getLogger().logError(e);
- }
- }
-
- }
-
- finally {
- if (monitor != null) {
- monitor.done();
- }
- }
- }
-
-}
diff --git a/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/project/facet/EarFacetRuntimeHandler.java b/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/project/facet/EarFacetRuntimeHandler.java
deleted file mode 100644
index 4dd10c7b8..000000000
--- a/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/project/facet/EarFacetRuntimeHandler.java
+++ /dev/null
@@ -1,214 +0,0 @@
-/******************************************************************************
- * Copyright (c) 2006 BEA Systems, Inc.
- * 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:
- * Konstantin Komissarchik - initial API and implementation
- ******************************************************************************/
-
-package org.eclipse.jst.j2ee.project.facet;
-
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.Set;
-
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.SubProgressMonitor;
-import org.eclipse.wst.common.componentcore.ComponentCore;
-import org.eclipse.wst.common.componentcore.resources.IVirtualComponent;
-import org.eclipse.wst.common.componentcore.resources.IVirtualReference;
-import org.eclipse.wst.common.project.facet.core.IDelegate;
-import org.eclipse.wst.common.project.facet.core.IFacetedProject;
-import org.eclipse.wst.common.project.facet.core.IProjectFacetVersion;
-import org.eclipse.wst.common.project.facet.core.ProjectFacetsManager;
-import org.eclipse.wst.common.project.facet.core.runtime.IRuntime;
-
-/**
- * @author <a href="mailto:kosta@bea.com">Konstantin Komissarchik</a>
- */
-
-public final class EarFacetRuntimeHandler
-{
- /**
- * Private constructor. This class is not meant to be instantiated.
- */
-
- private EarFacetRuntimeHandler() {}
-
- public static void updateModuleProjectRuntime( final IProject earProject,
- final IProject moduleProject,
- final IProgressMonitor monitor )
-
- throws CoreException
-
- {
- if( monitor != null )
- {
- monitor.beginTask( "", 1 );
- }
-
- try
- {
- final IFacetedProject earFacetedProject
- = ProjectFacetsManager.create( earProject );
-
- final IRuntime earRuntime = earFacetedProject.getRuntime();
-
- final IFacetedProject moduleFacetedProject
- = ProjectFacetsManager.create( moduleProject );
-
- if( moduleFacetedProject != null &&
- ! equals( earRuntime, moduleFacetedProject.getRuntime() ) )
- {
- boolean supports = true;
-
- if( earRuntime != null )
- {
- for( Iterator itr = moduleFacetedProject.getProjectFacets().iterator();
- itr.hasNext(); )
- {
- final IProjectFacetVersion fver
- = (IProjectFacetVersion) itr.next();
-
- if( ! earRuntime.supports( fver ) )
- {
- supports = false;
- break;
- }
- }
- }
-
- if( supports )
- {
- moduleFacetedProject.setRuntime( earRuntime, submon( monitor, 1 ) );
- }
- }
- }
- finally
- {
- if( monitor != null )
- {
- monitor.done();
- }
- }
- }
-
- public static void updateModuleProjectRuntime( final IProject earProject,
- final Set moduleProjects,
- final IProgressMonitor monitor )
-
- throws CoreException
-
- {
- if( monitor != null )
- {
- monitor.beginTask( "", moduleProjects.size() );
- }
-
- try
- {
- for( Iterator itr = moduleProjects.iterator(); itr.hasNext(); )
- {
- final IProject moduleProject = (IProject) itr.next();
-
- updateModuleProjectRuntime( earProject, moduleProject,
- submon( monitor, 1 ) );
- }
- }
- finally
- {
- if( monitor != null )
- {
- monitor.done();
- }
- }
- }
-
- public static final class RuntimeChangedDelegate
-
- implements IDelegate
-
- {
- public void execute( final IProject project,
- final IProjectFacetVersion fv,
- final Object cfg,
- final IProgressMonitor monitor )
-
- throws CoreException
-
- {
- if( monitor != null )
- {
- monitor.beginTask( "", 10 ); //$NON-NLS-1$
- }
-
- try
- {
- // Compile the list of projects referenced by this ear project.
-
- final Set moduleProjects = new HashSet();
-
- final IVirtualComponent earvc
- = ComponentCore.createComponent( project );
-
- final IVirtualReference[] vrefs = earvc.getReferences();
-
- for( int i = 0; i < vrefs.length; i++ )
- {
- final IVirtualReference vref = vrefs[ i ];
- final IVirtualComponent vc = vref.getReferencedComponent();
-
- moduleProjects.add( vc.getProject() );
- }
-
- if( monitor != null )
- {
- monitor.worked( 1 );
- }
-
- // Attempt to change the runtime for each of the referenced projects.
-
- updateModuleProjectRuntime( project, moduleProjects,
- submon( monitor, 9 ) );
- }
- finally
- {
- if( monitor != null )
- {
- monitor.done();
- }
- }
- }
- }
-
- private static IProgressMonitor submon( final IProgressMonitor parent,
- final int ticks )
- {
- return ( parent == null ? null : new SubProgressMonitor( parent, ticks ) );
- }
-
- private static boolean equals( final Object obj1,
- final Object obj2 )
- {
- if( obj1 == obj2 )
- {
- return true;
- }
- else if( obj1 == null || obj2 == null )
- {
- return false;
- }
- else
- {
- return obj1.equals( obj2 );
- }
- }
-
-
-
-}
diff --git a/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/project/facet/EarFacetValidator.java b/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/project/facet/EarFacetValidator.java
deleted file mode 100644
index 024ec3e3d..000000000
--- a/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/project/facet/EarFacetValidator.java
+++ /dev/null
@@ -1,138 +0,0 @@
-/******************************************************************************
- * Copyright (c) 2005 BEA Systems, Inc.
- * 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:
- * Konstantin Komissarchik - initial API and implementation
- ******************************************************************************/
-
-package org.eclipse.jst.j2ee.project.facet;
-
-import org.eclipse.core.resources.IMarker;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.jst.j2ee.internal.plugin.J2EEPlugin;
-import org.eclipse.osgi.util.NLS;
-import org.eclipse.wst.common.componentcore.ComponentCore;
-import org.eclipse.wst.common.componentcore.resources.IVirtualComponent;
-import org.eclipse.wst.common.componentcore.resources.IVirtualReference;
-import org.eclipse.wst.common.project.facet.core.IFacetedProject;
-import org.eclipse.wst.common.project.facet.core.IFacetedProjectValidator;
-import org.eclipse.wst.common.project.facet.core.ProjectFacetsManager;
-import org.eclipse.wst.common.project.facet.core.runtime.IRuntime;
-
-/**
- * @author <a href="mailto:kosta@bea.com">Konstantin Komissarchik</a>
- */
-
-public final class EarFacetValidator
-
- implements IFacetedProjectValidator
-
-{
- private static final String MARKER_ID
- = J2EEPlugin.PLUGIN_ID + ".differentRuntimesDetected";
-
- public void validate( final IFacetedProject fproj )
-
- throws CoreException
-
- {
- final IVirtualComponent vc
- = ComponentCore.createComponent( fproj.getProject() );
-
- if( vc == null )
- {
- return;
- }
-
- if( fproj.hasProjectFacet( EARFacetUtils.EAR_FACET ) )
- {
- fproj.getProject().deleteMarkers( MARKER_ID, false,
- IResource.DEPTH_ZERO );
-
- final IVirtualReference[] refs = vc.getReferences();
-
- for( int i = 0; i < refs.length; i++ )
- {
- final IVirtualReference ref = refs[ i ];
- final IVirtualComponent refvc = ref.getReferencedComponent();
-
- if( refvc != null && !refvc.isBinary())
- {
- final IProject refpj = refvc.getProject();
- validate( fproj, ProjectFacetsManager.create( refpj ) );
- }
- }
- }
- else
- {
- final IVirtualComponent[] referencing
- = vc.getReferencingComponents();
-
- for( int i = 0; i < referencing.length; i++ )
- {
- final IVirtualComponent refvc = referencing[ i ];
-
- final IFacetedProject reffpj
- = ProjectFacetsManager.create( refvc.getProject() );
-
- if( reffpj.hasProjectFacet( EARFacetUtils.EAR_FACET ) )
- {
- validate( reffpj );
- }
- }
- }
- }
-
- private void validate( final IFacetedProject ear,
- final IFacetedProject module )
-
- throws CoreException
-
- {
- final IRuntime earRuntime = ear.getRuntime();
- final IRuntime moduleRuntime = module.getRuntime();
-
- if( earRuntime == null && moduleRuntime != null )
- {
- // Should this also be a warning?
- }
- else if( earRuntime != null && moduleRuntime == null )
- {
- // Should this also be a warning?
- }
- else if( earRuntime != null && moduleRuntime != null &&
- ! earRuntime.equals( moduleRuntime ) )
- {
- final String msg
- = NLS.bind( Resources.targetingDifferentRuntimes,
- module.getProject().getName() );
-
- final IMarker m = ear.createWarningMarker( MARKER_ID, msg );
-
- m.setAttribute( "moduleProject", module.getProject().getName() );
- m.setAttribute( "runtime1", ear.getRuntime().getName() );
- m.setAttribute( "runtime2", module.getRuntime().getName() );
- }
- }
-
- private static final class Resources
-
- extends NLS
-
- {
- public static String targetingDifferentRuntimes;
-
- static
- {
- initializeMessages( EarFacetValidator.class.getName(),
- Resources.class );
- }
- }
-
-}
diff --git a/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/project/facet/EarFacetValidator.properties b/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/project/facet/EarFacetValidator.properties
deleted file mode 100644
index edb3d0d3d..000000000
--- a/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/project/facet/EarFacetValidator.properties
+++ /dev/null
@@ -1,11 +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
-###############################################################################
-targetingDifferentRuntimes = Referenced module project {0} is targeting a different runtime.
diff --git a/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/project/facet/EarFacetVersionChangeDelegate.java b/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/project/facet/EarFacetVersionChangeDelegate.java
deleted file mode 100644
index e121e6b05..000000000
--- a/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/project/facet/EarFacetVersionChangeDelegate.java
+++ /dev/null
@@ -1,92 +0,0 @@
-/******************************************************************************
- * Copyright (c) 2005 BEA Systems, Inc.
- * 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:
- * Konstantin Komissarchik - initial API and implementation
- ******************************************************************************/
-
-package org.eclipse.jst.j2ee.project.facet;
-
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-/**
- * Warning clean-up 12/05/2005
- */
-//import org.eclipse.wst.common.componentcore.ComponentCore;
-//import org.eclipse.wst.common.componentcore.resources.IVirtualComponent;
-import org.eclipse.wst.common.project.facet.core.IDelegate;
-import org.eclipse.wst.common.project.facet.core.IProjectFacetVersion;
-
-/**
- * @author <a href="mailto:kosta@bea.com">Konstantin Komissarchik</a>
- */
-
-public final class EarFacetVersionChangeDelegate
-
- implements IDelegate
-
-{
- public void execute( final IProject project,
- final IProjectFacetVersion fv,
- final Object cfg,
- final IProgressMonitor monitor )
-
- throws CoreException
-
- {
- if( monitor != null )
- {
- monitor.beginTask( "", 1 );
- }
-
- try
- {
- /**
- * Warning clean-up 12/05/2005
- */
- //final IVirtualComponent c = ComponentCore.createComponent(project);
-
-// final StructureEdit edit
-// = StructureEdit.getStructureEditForWrite( project );
-//
-// try
-// {
-// final ComponentType oldctype
-// = StructureEdit.getComponentType( c );
-//
-// final ComponentType newctype
-// = ComponentcoreFactory.eINSTANCE.createComponentType();
-//
-// newctype.setComponentTypeId( oldctype.getComponentTypeId() );
-// newctype.setVersion( fv.getVersionString() );
-// newctype.getProperties().addAll( oldctype.getProperties() );
-//
-// StructureEdit.setComponentType( c, newctype );
-//
-// edit.saveIfNecessary( null );
-// }
-// finally
-// {
-// edit.dispose();
-// }
-
- if( monitor != null )
- {
- monitor.worked( 1 );
- }
- }
- finally
- {
- if( monitor != null )
- {
- monitor.done();
- }
- }
- }
-
-}
diff --git a/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/project/facet/IJavaProjectMigrationDataModelProperties.java b/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/project/facet/IJavaProjectMigrationDataModelProperties.java
deleted file mode 100644
index 34bd30d3c..000000000
--- a/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/project/facet/IJavaProjectMigrationDataModelProperties.java
+++ /dev/null
@@ -1,26 +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.project.facet;
-
-
-public interface IJavaProjectMigrationDataModelProperties {
-
- /**
- * Required
- */
- public static final String PROJECT_NAME = "IJavaProjectMigrationDataModelProperties.PROJECT_NAME"; //$NON-NLS-1$
-
- /**
- * Optional
- */
- public static final String ADD_TO_EAR = "IJavaProjectMigrationDataModelProperties.ADD_TO_EAR"; //$NON-NLS-1$
-
-}
diff --git a/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/project/facet/IJavaUtilityProjectCreationDataModelProperties.java b/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/project/facet/IJavaUtilityProjectCreationDataModelProperties.java
deleted file mode 100644
index 73344f2ee..000000000
--- a/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/project/facet/IJavaUtilityProjectCreationDataModelProperties.java
+++ /dev/null
@@ -1,30 +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.project.facet;
-
-import org.eclipse.wst.common.frameworks.datamodel.IDataModelProperties;
-
-public interface IJavaUtilityProjectCreationDataModelProperties extends IDataModelProperties {
- /**
- * This field should not be used. It is not part of the API and may be modified in the future.
- */
- public static Class _provider_class = JavaUtilityProjectCreationDataModelProvider.class;
-
- public static final String PROJECT_NAME = "IJavaUtilityProjectCreationDataModelProperties.PROJECT_NAME"; //$NON-NLS-1$
-
-// public static final String PROJECT_LOCATION = "IJavaUtilityProjectCreationDataModelProperties.PROJECT_LOCATION"; //$NON-NLS-1$
-
- public static final String EAR_PROJECT_NAME = "IJavaUtilityProjectCreationDataModelProperties.EAR_PROJECT_NAME"; //$NON-NLS-1$
-
- public static final String RUNTIME = "IJavaUtilityProjectCreationDataModelProperties.RUNTIME"; //$NON-NLS-1$
-
- public static final String SOURCE_FOLDER = "IJavaUtilityProjectCreationDataModelProperties.SOURCE_FOLDER"; //$NON-NLS-1$
-}
diff --git a/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/project/facet/IUtilityFacetInstallDataModelProperties.java b/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/project/facet/IUtilityFacetInstallDataModelProperties.java
deleted file mode 100644
index 2f1520755..000000000
--- a/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/project/facet/IUtilityFacetInstallDataModelProperties.java
+++ /dev/null
@@ -1,19 +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.project.facet;
-
-public interface IUtilityFacetInstallDataModelProperties extends IJ2EEModuleFacetInstallDataModelProperties {
-
- /**
- * This field should not be used. It is not part of the API and may be modified in the future.
- */
- public static Class _provider_class = org.eclipse.jst.j2ee.internal.project.facet.UtilityFacetInstallDataModelProvider.class;
-}
diff --git a/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/project/facet/JavaProjectMigrationDataModelProvider.java b/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/project/facet/JavaProjectMigrationDataModelProvider.java
deleted file mode 100644
index a60d0cc99..000000000
--- a/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/project/facet/JavaProjectMigrationDataModelProvider.java
+++ /dev/null
@@ -1,64 +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.project.facet;
-
-import java.util.Set;
-
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.wst.common.frameworks.datamodel.AbstractDataModelProvider;
-import org.eclipse.wst.common.frameworks.datamodel.DataModelEvent;
-import org.eclipse.wst.common.frameworks.datamodel.IDataModelOperation;
-
-/**
- * This dataModel is a common super class used for creation of WTP Components.
- *
- * This class (and all its fields and methods) is likely to change during the WTP 1.0 milestones as
- * the new project structures are adopted. Use at your own risk.
- *
- * @plannedfor WTP 1.0
- */
-public class JavaProjectMigrationDataModelProvider extends AbstractDataModelProvider implements IJavaProjectMigrationDataModelProperties {
-
- public void init() {
- super.init();
- }
-
- public Set getPropertyNames() {
- Set propertyNames = super.getPropertyNames();
- propertyNames.add(PROJECT_NAME);
- propertyNames.add(ADD_TO_EAR);
- return propertyNames;
- }
-
- public void propertyChanged(DataModelEvent event) {
- if (event.getFlag() == DataModelEvent.VALUE_CHG) {
- event.getDataModel();
- }
- }
-
- public boolean propertySet(String propertyName, Object propertyValue) {
- return true;
- }
-
- public Object getDefaultProperty(String propertyName) {
- return super.getDefaultProperty(propertyName);
- }
-
- public IStatus validate(String propertyName) {
-
- return OK_STATUS;
- }
-
- public IDataModelOperation getDefaultOperation() {
- return new JavaProjectMigrationOperation(model);
- }
-
-}
diff --git a/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/project/facet/JavaProjectMigrationOperation.java b/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/project/facet/JavaProjectMigrationOperation.java
deleted file mode 100644
index e6fcb8d08..000000000
--- a/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/project/facet/JavaProjectMigrationOperation.java
+++ /dev/null
@@ -1,99 +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.project.facet;
-
-import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.jdt.core.IJavaProject;
-import org.eclipse.jdt.core.JavaCore;
-import org.eclipse.jem.util.logger.proxy.Logger;
-import org.eclipse.jem.workbench.utility.JemProjectUtilities;
-import org.eclipse.jst.common.project.facet.JavaFacetInstallDataModelProvider;
-import org.eclipse.jst.common.project.facet.JavaFacetUtils;
-import org.eclipse.jst.j2ee.internal.project.J2EEProjectUtilities;
-import org.eclipse.wst.common.componentcore.datamodel.FacetProjectCreationDataModelProvider;
-import org.eclipse.wst.common.componentcore.datamodel.properties.IFacetDataModelProperties;
-import org.eclipse.wst.common.componentcore.datamodel.properties.IFacetProjectCreationDataModelProperties;
-import org.eclipse.wst.common.componentcore.datamodel.properties.IFacetProjectCreationDataModelProperties.FacetDataModelMap;
-import org.eclipse.wst.common.frameworks.datamodel.AbstractDataModelOperation;
-import org.eclipse.wst.common.frameworks.datamodel.DataModelFactory;
-import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
-import org.eclipse.wst.common.project.facet.core.IProjectFacetVersion;
-
-
-public class JavaProjectMigrationOperation extends AbstractDataModelOperation implements IJavaProjectMigrationDataModelProperties {
-
-
-
- public JavaProjectMigrationOperation(IDataModel model) {
- super(model);
- }
-
- public IStatus execute(IProgressMonitor monitor, IAdaptable info) {
-
-
-
- IDataModel jdm = DataModelFactory.createDataModel(new JavaFacetInstallDataModelProvider());
-
- jdm.setProperty(IFacetDataModelProperties.FACET_PROJECT_NAME, model.getStringProperty(PROJECT_NAME));
-
- jdm.setProperty(IFacetDataModelProperties.FACET_VERSION, getJavaFacetVersion() );
-
- IDataModel udm = DataModelFactory.createDataModel(new UtilityFacetInstallDataModelProvider());
- try {
- if(model.isPropertySet(ADD_TO_EAR)){
- udm.setProperty(IJ2EEModuleFacetInstallDataModelProperties.ADD_TO_EAR, model.getProperty(ADD_TO_EAR));
- }
- udm.setProperty(IFacetDataModelProperties.FACET_PROJECT_NAME, model.getStringProperty(PROJECT_NAME));
- udm.setProperty(IFacetDataModelProperties.FACET_VERSION_STR, "1.0"); //$NON-NLS-1$
- udm.setProperty(IJ2EEModuleFacetInstallDataModelProperties.MODULE_URI,
- model.getStringProperty(PROJECT_NAME) + ".jar"); //$NON-NLS-1$
- // we do not want to add to ear by default
- udm.setBooleanProperty(IJ2EEModuleFacetInstallDataModelProperties.ADD_TO_EAR, false);
- } catch (Exception e) {
- Logger.getLogger().logError(e);
- }
-
- IDataModel dm = DataModelFactory.createDataModel(new FacetProjectCreationDataModelProvider());
- dm.setProperty(IFacetProjectCreationDataModelProperties.FACET_PROJECT_NAME, model.getStringProperty(PROJECT_NAME));
-
- FacetDataModelMap map = (FacetDataModelMap) dm.getProperty(IFacetProjectCreationDataModelProperties.FACET_DM_MAP);
- map.add(jdm);
- map.add(udm);
-
- try {
- dm.getDefaultOperation().execute(monitor, null);
- } catch (ExecutionException e) {
- Logger.getLogger().logError(e);
- }
- return OK_STATUS;
- }
-
- private IProjectFacetVersion getJavaFacetVersion(){
-
- IProject project = J2EEProjectUtilities.getProject( model.getStringProperty(PROJECT_NAME) );
- IJavaProject jProj = JemProjectUtilities.getJavaProject( project );
- String jdtVersion = jProj.getOption(JavaCore.COMPILER_COMPLIANCE, true );
-
- if (jdtVersion.startsWith("1.3")) { //$NON-NLS-1$
- return JavaFacetUtils.JAVA_13;
- } else if (jdtVersion.startsWith("1.4")) { //$NON-NLS-1$
- return JavaFacetUtils.JAVA_14;
- }else if (jdtVersion.startsWith("1.5")) { //$NON-NLS-1$
- return JavaFacetUtils.JAVA_50;
- }
- return JavaFacetUtils.JAVA_60;
- }
-}
diff --git a/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/project/facet/JavaUtilityProjectCreationDataModelProvider.java b/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/project/facet/JavaUtilityProjectCreationDataModelProvider.java
deleted file mode 100644
index ba73143ba..000000000
--- a/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/project/facet/JavaUtilityProjectCreationDataModelProvider.java
+++ /dev/null
@@ -1,43 +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.project.facet;
-
-
-import java.util.Set;
-
-import org.eclipse.wst.common.frameworks.datamodel.AbstractDataModelProvider;
-import org.eclipse.wst.common.frameworks.datamodel.IDataModelOperation;
-
-
-
-public class JavaUtilityProjectCreationDataModelProvider
- extends AbstractDataModelProvider implements IJavaUtilityProjectCreationDataModelProperties{
-
- public JavaUtilityProjectCreationDataModelProvider() {
- super();
- }
-
- public Set getPropertyNames() {
- Set propertyNames = super.getPropertyNames();
- propertyNames.add(PROJECT_NAME);
- //propertyNames.add(PROJECT_LOCATION);
- propertyNames.add(EAR_PROJECT_NAME);
- propertyNames.add(RUNTIME);
- propertyNames.add(SOURCE_FOLDER);
- return propertyNames;
- }
-
-
- public IDataModelOperation getDefaultOperation() {
- return new JavaUtilityProjectCreationOperation(model);
- }
-
-}
diff --git a/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/project/facet/JavaUtilityProjectCreationOperation.java b/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/project/facet/JavaUtilityProjectCreationOperation.java
deleted file mode 100644
index a7baf7597..000000000
--- a/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/project/facet/JavaUtilityProjectCreationOperation.java
+++ /dev/null
@@ -1,83 +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.project.facet;
-
-
-
-import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.jem.util.logger.proxy.Logger;
-import org.eclipse.jst.common.project.facet.JavaFacetInstallDataModelProvider;
-import org.eclipse.jst.j2ee.internal.project.J2EEProjectUtilities;
-import org.eclipse.wst.common.componentcore.datamodel.properties.IFacetProjectCreationDataModelProperties.FacetDataModelMap;
-import org.eclipse.wst.common.componentcore.internal.operation.FacetProjectCreationOperation;
-import org.eclipse.wst.common.componentcore.internal.util.IModuleConstants;
-import org.eclipse.wst.common.frameworks.datamodel.AbstractDataModelOperation;
-import org.eclipse.wst.common.frameworks.datamodel.DataModelFactory;
-import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
-import org.eclipse.wst.common.project.facet.core.runtime.IRuntime;
-
-public class JavaUtilityProjectCreationOperation extends AbstractDataModelOperation implements IJavaUtilityProjectCreationDataModelProperties{
-
-
-
- public JavaUtilityProjectCreationOperation(IDataModel model) {
- super(model);
- }
-
-
- public IStatus execute(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
-
- IStatus stat = OK_STATUS;
-
- String projectName = model.getStringProperty( IJavaUtilityProjectCreationDataModelProperties.PROJECT_NAME );
- String earProjectName = model.getStringProperty( IJavaUtilityProjectCreationDataModelProperties.EAR_PROJECT_NAME );;
- String javaSourceFolder = model.getStringProperty( IJavaUtilityProjectCreationDataModelProperties.SOURCE_FOLDER );
-
- org.eclipse.wst.common.project.facet.core.runtime.IRuntime runtime = (IRuntime) model.getProperty(IJavaUtilityProjectCreationDataModelProperties.RUNTIME);
-
- IDataModel dm = DataModelFactory.createDataModel(new UtilityProjectCreationDataModelProvider());
-
-
- //IDataModel pdm = dm.getNestedModel( IFacetProjectCreationDataModelProperties.NESTED_PROJECT_DM );
- //pdm.setStringProperty( IProjectCreationPropertiesNew.PROJECT_LOCATION, model.getStringProperty( IJavaUtilityProjectCreationDataModelProperties.PROJECT_LOCATION ) );
-
- FacetDataModelMap map = (FacetDataModelMap) dm.getProperty(UtilityProjectCreationDataModelProvider.FACET_DM_MAP);
-
- IDataModel javadm = map.getFacetDataModel( IModuleConstants.JST_JAVA );
- IDataModel utildm = map.getFacetDataModel( J2EEProjectUtilities.UTILITY );
-
-
- javadm.setProperty( JavaFacetInstallDataModelProvider.FACET_PROJECT_NAME,
- projectName);
-
-
- javadm.setProperty( JavaFacetInstallDataModelProvider.SOURCE_FOLDER_NAME,
- javaSourceFolder);
-
-
- utildm.setProperty( IUtilityFacetInstallDataModelProperties.EAR_PROJECT_NAME, earProjectName);
-
- utildm.setProperty( IUtilityFacetInstallDataModelProperties.FACET_RUNTIME, runtime );
- dm.setProperty(UtilityProjectCreationDataModelProvider.FACET_RUNTIME, runtime);
-
- FacetProjectCreationOperation op = new FacetProjectCreationOperation(dm);
- try {
- stat = op.execute( monitor, null );
- } catch (ExecutionException e) {
- Logger.getLogger().logError(e);
- }
- return stat;
- }
-
-}
diff --git a/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/project/facet/UtilityFacetInstallDataModelProvider.java b/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/project/facet/UtilityFacetInstallDataModelProvider.java
deleted file mode 100644
index 05b5c5c84..000000000
--- a/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/project/facet/UtilityFacetInstallDataModelProvider.java
+++ /dev/null
@@ -1,25 +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.project.facet;
-
-/**
- * This class was not intended to be public API. Please use {@link org.eclipse.jst.j2ee.project.facet.IUtilityFacetInstallDataModelProperties}
- *
- * @deprecated
- * @see org.eclipse.jst.j2ee.internal.project.facet.UtilityFacetInstallDataModelProvider
- */
-
-public class UtilityFacetInstallDataModelProvider extends org.eclipse.jst.j2ee.internal.project.facet.UtilityFacetInstallDataModelProvider {
- public UtilityFacetInstallDataModelProvider()
- {
- super();
- }
-}
diff --git a/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/project/facet/UtilityFacetInstallDelegate.java b/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/project/facet/UtilityFacetInstallDelegate.java
deleted file mode 100644
index 8b839c695..000000000
--- a/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/project/facet/UtilityFacetInstallDelegate.java
+++ /dev/null
@@ -1,128 +0,0 @@
-/******************************************************************************
- * Copyright (c) 2005 BEA Systems, Inc.
- * 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:
- * Konstantin Komissarchik - initial API and implementation
- ******************************************************************************/
-
-package org.eclipse.jst.j2ee.project.facet;
-
-import java.lang.reflect.InvocationTargetException;
-
-import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.core.resources.IContainer;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.Path;
-import org.eclipse.jdt.core.IClasspathEntry;
-import org.eclipse.jdt.core.IJavaProject;
-import org.eclipse.jdt.core.JavaCore;
-import org.eclipse.jem.util.logger.proxy.Logger;
-import org.eclipse.jst.common.project.facet.WtpUtils;
-import org.eclipse.jst.common.project.facet.core.ClasspathHelper;
-import org.eclipse.jst.j2ee.internal.common.classpath.J2EEComponentClasspathContainer;
-import org.eclipse.jst.j2ee.internal.common.classpath.J2EEComponentClasspathContainerUtils;
-import org.eclipse.wst.common.componentcore.ComponentCore;
-import org.eclipse.wst.common.componentcore.datamodel.FacetDataModelProvider;
-import org.eclipse.wst.common.componentcore.resources.IVirtualComponent;
-import org.eclipse.wst.common.componentcore.resources.IVirtualFolder;
-import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
-import org.eclipse.wst.common.frameworks.datamodel.IDataModelOperation;
-import org.eclipse.wst.common.project.facet.core.IDelegate;
-import org.eclipse.wst.common.project.facet.core.IProjectFacetVersion;
-
-public final class UtilityFacetInstallDelegate extends J2EEFacetInstallDelegate implements IDelegate {
-
- public void execute(final IProject project, final IProjectFacetVersion fv, final Object cfg, final IProgressMonitor monitor) throws CoreException {
- if (monitor != null) {
- monitor.beginTask("", 1); //$NON-NLS-1$
- }
-
- try {
-
- final IDataModel model = (IDataModel) cfg;
-
- // Add WTP natures.
-
- WtpUtils.addNatures(project);
-
- // Setup the flexible project structure.
-
- final IVirtualComponent c = ComponentCore.createComponent(project, false);
-
- c.create(0, null);
-
- final IVirtualFolder jsrc = c.getRootFolder();
- final IJavaProject jproj = JavaCore.create(project);
-
- final IClasspathEntry[] cp = jproj.getRawClasspath();
-
- for (int i = 0; i < cp.length; i++) {
- final IClasspathEntry cpe = cp[i];
-
- if (cpe.getEntryKind() == IClasspathEntry.CPE_SOURCE) {
- IPath path = cpe.getPath().removeFirstSegments(1);
- if (path.isEmpty()) {
- path = new Path("/"); //$NON-NLS-1$
- }
- jsrc.createLink(path, 0, null);
- }
- }
-
-// final IWorkspace ws = ResourcesPlugin.getWorkspace();
-
- final IVirtualFolder root = c.getRootFolder();
-
- IContainer container = null;
-
- if (root.getProjectRelativePath().segmentCount() == 0) {
- container = project;
- } else {
- container = project.getFolder(root.getProjectRelativePath());
- }
-
- try {
- if (container != null)
- createManifest(project, container, monitor);
- } catch (InvocationTargetException e) {
- Logger.getLogger().logError(e);
- } catch (InterruptedException e) {
- Logger.getLogger().logError(e);
- }
-
-
- ClasspathHelper.removeClasspathEntries(project, fv);
-
- if (!ClasspathHelper.addClasspathEntries(project, fv)) {
- // TODO: Support the no runtime case.
- // ClasspathHelper.addClasspathEntries( project, fv, <something> );
- }
-
- if(J2EEComponentClasspathContainerUtils.getDefaultUseEARLibraries()){
- final IPath earLibContainer = new Path(J2EEComponentClasspathContainer.CONTAINER_ID);
- addToClasspath(jproj, JavaCore.newContainerEntry(earLibContainer));
- }
-
- try {
- ((IDataModelOperation) model.getProperty(FacetDataModelProvider.NOTIFICATION_OPERATION)).execute(monitor, null);
- } catch (ExecutionException e) {
- Logger.getLogger().logError(e);
- }
- if (monitor != null) {
- monitor.worked(1);
- }
- } catch (Exception e) {
- Logger.getLogger().logError(e);
- } finally {
- if (monitor != null) {
- monitor.done();
- }
- }
- }
-}
diff --git a/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/project/facet/UtilityFacetPostInstallDelegate.java b/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/project/facet/UtilityFacetPostInstallDelegate.java
deleted file mode 100644
index 8145285ea..000000000
--- a/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/project/facet/UtilityFacetPostInstallDelegate.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/******************************************************************************
- * Copyright (c) 2005 BEA Systems, Inc.
- * 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:
- * Konstantin Komissarchik - initial API and implementation
- ******************************************************************************/
-
-package org.eclipse.jst.j2ee.project.facet;
-
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.jem.util.logger.proxy.Logger;
-import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
-import org.eclipse.wst.common.project.facet.core.IDelegate;
-import org.eclipse.wst.common.project.facet.core.IProjectFacetVersion;
-import org.eclipse.wst.common.project.facet.core.runtime.IRuntime;
-
-public final class UtilityFacetPostInstallDelegate extends J2EEFacetInstallDelegate implements IDelegate {
-
- public void execute(final IProject project, final IProjectFacetVersion fv, final Object cfg, final IProgressMonitor monitor) throws CoreException {
- if (monitor != null) {
- monitor.beginTask("", 1); //$NON-NLS-1$
- }
-
- try {
-
- final IDataModel model = (IDataModel) cfg;
-
- // Associate with an EAR, if necessary.
- if (model.getBooleanProperty(IUtilityFacetInstallDataModelProperties.ADD_TO_EAR)) {
- final String earProjectName = model.getStringProperty(IUtilityFacetInstallDataModelProperties.EAR_PROJECT_NAME);
- if (earProjectName != null && earProjectName != "") //$NON-NLS-1$
- {
- final String moduleURI = model.getStringProperty(IJ2EEModuleFacetInstallDataModelProperties.MODULE_URI);
-
- installAndAddModuletoEAR( null,
- earProjectName,
- (IRuntime) model.getProperty(IJ2EEFacetInstallDataModelProperties.FACET_RUNTIME),
- project,
- moduleURI,
- monitor );
- }
- }
- } catch (Exception e) {
- Logger.getLogger().logError(e);
- } finally {
- if (monitor != null) {
- monitor.done();
- }
- }
- }
-}
diff --git a/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/project/facet/UtilityFacetUnInstallDelegate.java b/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/project/facet/UtilityFacetUnInstallDelegate.java
deleted file mode 100644
index a5f3eadca..000000000
--- a/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/project/facet/UtilityFacetUnInstallDelegate.java
+++ /dev/null
@@ -1,72 +0,0 @@
-/******************************************************************************
- * Copyright (c) 2005 BEA Systems, Inc.
- * 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:
- * Konstantin Komissarchik - initial API and implementation
- ******************************************************************************/
-
-package org.eclipse.jst.j2ee.project.facet;
-
-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.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.Path;
-import org.eclipse.jst.common.project.facet.WtpUtils;
-import org.eclipse.jst.common.project.facet.core.ClasspathHelper;
-import org.eclipse.jst.j2ee.internal.J2EEConstants;
-import org.eclipse.wst.common.componentcore.ComponentCore;
-import org.eclipse.wst.common.componentcore.internal.StructureEdit;
-import org.eclipse.wst.common.componentcore.resources.IVirtualComponent;
-import org.eclipse.wst.common.componentcore.resources.IVirtualFolder;
-import org.eclipse.wst.common.project.facet.core.IDelegate;
-import org.eclipse.wst.common.project.facet.core.IProjectFacetVersion;
-
-public final class UtilityFacetUnInstallDelegate extends J2EEFacetInstallDelegate implements IDelegate {
-
- public void execute(final IProject project, final IProjectFacetVersion fv, final Object cfg, final IProgressMonitor monitor) throws CoreException {
- if (monitor != null) {
- monitor.beginTask("", 1); //$NON-NLS-1$
- }
-
- try{
- //remove .component file
- IFile file = project.getFile( StructureEdit.MODULE_META_FILE_NAME );
- file.delete( true, monitor );
-
- //remove manifest file
- final IVirtualComponent c = ComponentCore.createComponent(project);
- final IVirtualFolder root = c.getRootFolder();
- IContainer container = null;
-
- if (root.getProjectRelativePath().segmentCount() == 0) {
- container = project;
- } else {
- container = project.getFolder(root.getProjectRelativePath());
- }
-
- IFile manifestFile = container.getFile(new Path(J2EEConstants.MANIFEST_URI));
- manifestFile.delete( true, monitor );
-
- IFolder manifestFolder = container.getFolder( new Path(J2EEConstants.META_INF) );
- manifestFolder.delete( true, monitor );
-
- //remove module core nature
- WtpUtils.removeNatures( project );
-
- //remove server class path container
- ClasspathHelper.removeClasspathEntries( project, fv );
-
- }finally {
- if (monitor != null) {
- monitor.done();
- }
- }
- }
-}
diff --git a/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/project/facet/UtilityProjectCreationDataModelProvider.java b/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/project/facet/UtilityProjectCreationDataModelProvider.java
deleted file mode 100644
index 6de9a4d2b..000000000
--- a/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/project/facet/UtilityProjectCreationDataModelProvider.java
+++ /dev/null
@@ -1,68 +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.project.facet;
-
-import java.util.ArrayList;
-import java.util.Collection;
-
-import org.eclipse.jst.common.project.facet.IJavaFacetInstallDataModelProperties;
-import org.eclipse.jst.common.project.facet.JavaFacetUtils;
-import org.eclipse.jst.j2ee.internal.project.J2EEProjectUtilities;
-import org.eclipse.wst.common.frameworks.datamodel.DataModelEvent;
-import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
-import org.eclipse.wst.common.frameworks.datamodel.IDataModelListener;
-import org.eclipse.wst.common.project.facet.core.IProjectFacet;
-import org.eclipse.wst.project.facet.ProductManager;
-
-public class UtilityProjectCreationDataModelProvider extends J2EEFacetProjectCreationDataModelProvider {
-
- public UtilityProjectCreationDataModelProvider() {
- super();
- }
-
- public void init() {
- super.init();
-
- Collection<IProjectFacet> requiredFacets = new ArrayList<IProjectFacet>();
- requiredFacets.add(JavaFacetUtils.JAVA_FACET);
- requiredFacets.add(IJ2EEFacetConstants.UTILITY_FACET);
- setProperty(REQUIRED_FACETS_COLLECTION, requiredFacets);
-
- FacetDataModelMap map = (FacetDataModelMap) getProperty(FACET_DM_MAP);
- IDataModel javaFacet = map.getFacetDataModel(JavaFacetUtils.JAVA_FACET.getId());
- // If applicable, keep project structure optimized by making output directory the same as the content root
- if (ProductManager.shouldUseSingleRootStructure())
- javaFacet.setProperty(IJavaFacetInstallDataModelProperties.DEFAULT_OUTPUT_FOLDER_NAME, javaFacet.getStringProperty(IJavaFacetInstallDataModelProperties.SOURCE_FOLDER_NAME));
- IDataModel utilFacet = map.getFacetDataModel(IJ2EEFacetConstants.UTILITY_FACET.getId());
- utilFacet.addListener(new IDataModelListener() {
- public void propertyChanged(DataModelEvent event) {
- if (IJ2EEModuleFacetInstallDataModelProperties.EAR_PROJECT_NAME.equals(event.getPropertyName())) {
- if (isPropertySet(EAR_PROJECT_NAME))
- setProperty(EAR_PROJECT_NAME, event.getProperty());
- else
- model.notifyPropertyChange(EAR_PROJECT_NAME, IDataModel.DEFAULT_CHG);
- }else if (IJ2EEModuleFacetInstallDataModelProperties.ADD_TO_EAR.equals(event.getPropertyName())) {
- setProperty(ADD_TO_EAR, event.getProperty());
- }
- }
- });
-
- }
-
- public boolean propertySet(String propertyName, Object propertyValue) {
- if( propertyName.equals( MODULE_URI )){
- FacetDataModelMap map = (FacetDataModelMap) getProperty(FACET_DM_MAP);
- IDataModel utilFacet = map.getFacetDataModel( J2EEProjectUtilities.UTILITY );
- utilFacet.setProperty( IJ2EEModuleFacetInstallDataModelProperties.MODULE_URI, propertyValue );
- }
- return super.propertySet(propertyName, propertyValue);
- }
-}

Back to the top