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/eclipse/jst')
-rw-r--r--plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/application/internal/operations/AddComponentToEnterpriseApplicationDataModelProvider.java65
-rw-r--r--plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/application/internal/operations/AddComponentToEnterpriseApplicationOp.java142
-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/ClassPathSelection.java861
-rw-r--r--plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/application/internal/operations/ClasspathElement.java452
-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.java673
-rw-r--r--plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/application/internal/operations/ExtendedImportFactory.java36
-rw-r--r--plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/application/internal/operations/ExtendedImportRegistry.java95
-rw-r--r--plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/application/internal/operations/FlexibleJavaProjectCreationDataModelProvider.java93
-rw-r--r--plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/application/internal/operations/FlexibleJavaProjectCreationOperation.java58
-rw-r--r--plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/application/internal/operations/IAddComponentToEnterpriseApplicationDataModelProperties.java23
-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/J2EEArtifactExportDataModelProvider.java228
-rw-r--r--plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/application/internal/operations/J2EEArtifactImportDataModelProvider.java231
-rw-r--r--plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/application/internal/operations/J2EEComponentCreationDataModelProvider.java721
-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.java61
-rw-r--r--plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/application/internal/operations/J2EEUtilityJarImportDataModelProvider.java60
-rw-r--r--plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/application/internal/operations/J2EEUtilityJarImportOperationNew.java133
-rw-r--r--plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/application/internal/operations/J2EEUtilityJarListImportDataModelProvider.java338
-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/componentcore/util/EARArtifactEdit.java570
-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/internal/earcreation/DefaultJ2EEComponentCreationDataModelProvider.java420
-rw-r--r--plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/internal/earcreation/EARCreationResourceHandler.java105
-rw-r--r--plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/internal/earcreation/EarComponentCreationDataModelProvider.java236
-rw-r--r--plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/internal/earcreation/EarComponentCreationFacetOperation.java127
-rw-r--r--plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/internal/earcreation/EarFacetInstallDataModelProvider.java74
-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.java23
-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/project/facet/EARFacetProjectCreationDataModelProvider.java30
-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.java114
-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.properties1
-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/EarUtil.java105
-rw-r--r--plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/project/facet/IJavaProjectMigrationDataModelProperties.java21
-rw-r--r--plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/project/facet/IJavaUtilityProjectCreationDataModelProperties.java24
-rw-r--r--plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/project/facet/IUtilityFacetInstallDataModelProperties.java18
-rw-r--r--plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/project/facet/JavaProjectMigrationDataModelProvider.java63
-rw-r--r--plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/project/facet/JavaProjectMigrationOperation.java70
-rw-r--r--plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/project/facet/JavaUtilityComponentCreationDataModelProvider.java39
-rw-r--r--plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/project/facet/JavaUtilityComponentCreationFacetOperation.java71
-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.java28
-rw-r--r--plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/project/facet/UtilityFacetInstallDelegate.java151
-rw-r--r--plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/project/facet/UtilityProjectCreationDataModelProvider.java33
77 files changed, 0 insertions, 9863 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 a1d2e1c65..000000000
--- a/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/application/internal/operations/AddComponentToEnterpriseApplicationDataModelProvider.java
+++ /dev/null
@@ -1,65 +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;
-
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-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 Set getPropertyNames() {
- Set propertyNames = super.getPropertyNames();
- propertyNames.add(TARGET_COMPONENTS_TO_URI_MAP);
- return propertyNames;
- }
-
- public IDataModelOperation getDefaultOperation() {
- return new AddComponentToEnterpriseApplicationOp(model);
- }
-
- 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 (J2EEProjectUtilities.isDynamicWebProject(project)) {
- name += ".war"; //$NON-NLS-1$
- } else if (J2EEProjectUtilities.isEJBProject(project)) {
- name += ".jar"; //$NON-NLS-1$
- } else if (J2EEProjectUtilities.isApplicationClientProject(project)) {
- name += ".jar"; //$NON-NLS-1$
- } else if (J2EEProjectUtilities.isJCAProject(project)) {
- name += ".rar"; //$NON-NLS-1$
- }
- map.put(component, name);
- }
- return map;
- }
- return super.getDefaultProperty(propertyName);
- }
-
-}
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 4358e139c..000000000
--- a/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/application/internal/operations/AddComponentToEnterpriseApplicationOp.java
+++ /dev/null
@@ -1,142 +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;
-
-import java.util.List;
-import java.util.Map;
-import java.util.Properties;
-
-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.emf.ecore.EPackage;
-import org.eclipse.jem.util.logger.proxy.Logger;
-import org.eclipse.jst.j2ee.application.Application;
-import org.eclipse.jst.j2ee.application.ApplicationPackage;
-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.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.resources.IVirtualComponent;
-import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
-
-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 {
- super.execute(monitor, info);
- updateEARDD(monitor);
- return OK_STATUS;
- }
-
-
- protected void updateEARDD(IProgressMonitor monitor) {
-
- EARArtifactEdit earEdit = null;
- StructureEdit se = null;
- try {
- IVirtualComponent sourceComp = (IVirtualComponent) model.getProperty(ICreateReferenceComponentsDataModelProperties.SOURCE_COMPONENT);
- //TEMP workaround for use during ear creation before facet is added, this should be reverted when 115924 is fixed.
- earEdit = new EARArtifactEdit(sourceComp.getProject(), false, true);
- //earEdit = EARArtifactEdit.getEARArtifactEditForWrite(sourceComp.getProject());
- se = StructureEdit.getStructureEditForWrite(sourceComp.getProject());
- if (earEdit != null) {
- Application application = earEdit.getApplication();
- List list = (List) model.getProperty(ICreateReferenceComponentsDataModelProperties.TARGET_COMPONENT_LIST);
- 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;
- IVirtualComponent wc = (IVirtualComponent) list.get(i);
- WorkbenchComponent earwc = se.getComponent();
- try {
- compse = StructureEdit.getStructureEditForWrite(wc.getProject());
- WorkbenchComponent refwc = compse.getComponent();
- ReferencedComponent ref = se.findReferencedComponent(earwc, refwc);
- Module mod = addModule(application, wc, (String) map.get(wc));
- ref.setDependentObject(mod);
- } finally {
- if (compse != null) {
- compse.saveIfNecessary(monitor);
- compse.dispose();
- }
- }
- }
- }
- }
- se.saveIfNecessary(monitor);
- earEdit.saveIfNecessary(monitor);
- } catch (Exception e) {
- Logger.getLogger().logError(e);
- } finally {
- if (earEdit != null)
- earEdit.dispose();
- if (se != null)
- se.dispose();
- }
- }
-
- protected Module createNewModule(IVirtualComponent wc) {
- if (J2EEProjectUtilities.isDynamicWebProject(wc.getProject())) {
- return ((ApplicationPackage) EPackage.Registry.INSTANCE.getEPackage(ApplicationPackage.eNS_URI)).getApplicationFactory().createWebModule();
- } else if (J2EEProjectUtilities.isEJBProject(wc.getProject())) {
- return ((ApplicationPackage) EPackage.Registry.INSTANCE.getEPackage(ApplicationPackage.eNS_URI)).getApplicationFactory().createEjbModule();
- } else if (J2EEProjectUtilities.isApplicationClientProject(wc.getProject())) {
- return ((ApplicationPackage) EPackage.Registry.INSTANCE.getEPackage(ApplicationPackage.eNS_URI)).getApplicationFactory().createJavaClientModule();
- } else if (J2EEProjectUtilities.isJCAProject(wc.getProject())) {
- return ((ApplicationPackage) EPackage.Registry.INSTANCE.getEPackage(ApplicationPackage.eNS_URI)).getApplicationFactory().createConnectorModule();
- }
- return null;
- }
-
- protected Module addModule(Application application, IVirtualComponent wc, String name) {
- Application dd = application;
- Module existingModule = dd.getFirstModule(name);
-
- if (existingModule == null) {
- existingModule = createNewModule(wc);
- if (existingModule != null) {
- existingModule.setUri(name);
- if (existingModule instanceof WebModule) {
- Properties props = wc.getMetaProperties();
- String contextroot = ""; //$NON-NLS-1$
- if ((props != null) && (props.containsKey(J2EEConstants.CONTEXTROOT)))
- contextroot = props.getProperty(J2EEConstants.CONTEXTROOT);
- ((WebModule) existingModule).setContextRoot(contextroot);
- }
- dd.getModules().add(existingModule);
- }
- }
- return existingModule;
- }
-
- 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/AddWebComponentToEARDataModelProvider.java b/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/application/internal/operations/AddWebComponentToEARDataModelProvider.java
deleted file mode 100644
index 867ba9f8f..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, 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 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/ClassPathSelection.java b/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/application/internal/operations/ClassPathSelection.java
deleted file mode 100644
index ea04d418f..000000000
--- a/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/application/internal/operations/ClassPathSelection.java
+++ /dev/null
@@ -1,861 +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 java.io.FileNotFoundException;
-import java.io.IOException;
-import java.util.ArrayList;
-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.emf.common.util.URI;
-import org.eclipse.jdt.core.IClasspathEntry;
-import org.eclipse.jem.util.logger.proxy.Logger;
-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.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.util.EARArtifactEdit;
-import org.eclipse.jst.j2ee.internal.archive.operations.ComponentLoadStrategyImpl;
-import org.eclipse.jst.j2ee.internal.archive.operations.EARComponentLoadStrategyImpl;
-import org.eclipse.jst.j2ee.internal.project.J2EEProjectUtilities;
-import org.eclipse.wst.common.componentcore.UnresolveableURIException;
-import org.eclipse.wst.common.componentcore.internal.impl.ModuleURIUtil;
-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 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) {
- Archive a1 = (Archive) o1;
- Archive a2 = (Archive) o2;
- return a1.getURI().compareTo(a2.getURI());
- }
- };
-
- 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();
- }
-
- /**
- * 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 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;
- }
-
- /**
- * @param element
- */
- private void setInvalidProject(ClasspathElement element) {
- IProject earProj = element.getEarProject();
- //IVirtualComponent[] component = ComponentUtilities.getComponent(earProj.getName());
- IVirtualComponent component = ComponentUtilities.getComponent(earProj.getName());
- EARArtifactEdit edit = null;
- try {
- edit = EARArtifactEdit.getEARArtifactEditForRead(component);
- if (edit != null) {
- String moduleName = element.getRelativeText();
- if(moduleName != null) {
- IVirtualComponent modComponent = edit.getModule(moduleName);
- if(modComponent != null) {
- IProject mappedProject = modComponent.getProject();
- element.setProject(mappedProject);
- }
- }
- }
- } finally {
- if(edit != null) {
- edit.dispose();
- edit = null;
- }
- }
- }
-
- /**
- * 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) {
- LoadStrategy loader = anArchive.getLoadStrategy();
- if (loader instanceof ComponentLoadStrategyImpl)
- return ((ComponentLoadStrategyImpl) loader).getComponent().getProject();
- 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 void initializeElements() {
- ejbToClientJARs = J2EEProjectUtilities.collectEJBClientJARs(getEARFile());
- clientToEJBJARs = reverse(ejbToClientJARs);
- classpathElements = new ArrayList();
- urisToElements = new HashMap();
- String[] cp = new String[0];
- try {
- cp = archive.getManifest().getClassPathTokenized();
- } catch (ManifestException ex) {
- Logger.getLogger().logError(ex);
- }
- List archives = getEARFile().getArchiveFiles();
- Archive other = null;
- ClasspathElement element = null;
- for (int i = 0; i < cp.length; i++) {
- String cpEntry = cp[i];
- String uri = ArchiveUtil.deriveEARRelativeURI(cpEntry, archive);
- other = getArchive(uri, archives);
- if (other != null && ArchiveUtil.isValidDependency(other, archive)) {
- element = createElement(archive, other, cpEntry);
- archives.remove(other);
- } else {
- element = createInvalidElement(cpEntry);
- if (element.representsImportedJar()) {
- element.setValid(true);
- element.setProject(getProject(archive));
- }
- if (other != null)
- element.setProject(getProject(other));
- }
- addClasspathElement(element, uri);
- }
- 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 = (Archive) archives.get(i);
- if (other != archive && ArchiveUtil.isValidDependency(other, archive)) {
- IProject project = getProject(other);
- if (null == targetProjectName || null == project || !project.getName().equals(targetProjectName)) {
- element = createElement(archive, other, null);
- element.setProject(getProject(other));
- addClasspathElement(element, other.getURI());
- }
- }
- }
-
- 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 ){
- /**
- * Warning clean-up 12/05/2005
- */
- //String uri = J2EEProjectUtilities.getResolvedPathForArchiveComponent(referencedComponent.getName()).toString();
- String unresolvedURI = "";
- try {
- unresolvedURI = ModuleURIUtil.getArchiveName(URI.createURI(ModuleURIUtil.getHandleString(referencedComponent)));
- } catch (UnresolveableURIException e) {
- e.printStackTrace();
- }
- URI archiveURI = URI.createURI(unresolvedURI);
-
- boolean alreadyInList = false;
- Iterator iter = getClasspathElements().iterator();
- while(iter.hasNext()){
- ClasspathElement tmpelement = (ClasspathElement)iter.next();
- if( tmpelement.getText().equals(archiveURI.lastSegment())){
- 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);
- }
- }
- }
- }
- }
- }
-
- 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);
- }
-
- /**
- * @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);
- }
-
- public String toString() {
- StringBuffer sb = new StringBuffer();
- for (int i = 0; i < classpathElements.size(); i++) {
- ClasspathElement element = (ClasspathElement) classpathElements.get(i);
- if (element.isSelected()) {
- 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(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();
- Archive target = element.getTargetArchive();
- if (uri == null || target == null)
- return null;
- Archive oppositeJAR = null;
- switch (element.getJarType()) {
- case (ClasspathElement.EJB_CLIENT_JAR) :
- oppositeJAR = (Archive) clientToEJBJARs.get(target);
- break;
- case (ClasspathElement.EJB_JAR) :
- oppositeJAR = (Archive) ejbToClientJARs.get(target);
- break;
- default :
- break;
- }
- if (oppositeJAR != null)
- return getClasspathElement(oppositeJAR.getURI());
-
- 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;
- Archive myClientJar = (Archive) ejbToClientJARs.get(archive);
- return myClientJar != null && myClientJar == element.getTargetArchive();
- }
-
- 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 75b04e213..000000000
--- a/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/application/internal/operations/ClasspathElement.java
+++ /dev/null
@@ -1,452 +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;
-
-
-
-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.UnresolveableURIException;
-import org.eclipse.wst.common.componentcore.internal.impl.ModuleURIUtil;
-
-
-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;
- /**
- * 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;
-
- public ClasspathElement(Archive anArchive) {
- super();
- archive = anArchive;
- }
-
- public ClasspathElement(IProject project) {
- super();
- this.project = project;
- }
-
- public ClasspathElement(URI aArchiveURI) {
- super();
- archiveURI = aArchiveURI;
- }
-
- protected void computeRelativeText() {
- if (archive != null) {
- relativeText = J2EEProjectUtilities.computeRelativeText(archive.getURI(), 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 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;
- }
-
- /**
- * 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);
- }
- java.io.File file = new java.io.File(resourcePath);
- if( file.exists() || J2EEPlugin.getWorkspace().getRoot().exists(new Path(resourcePath))){
- return new IClasspathEntry[]{JavaCore.newLibraryEntry( new Path(resourcePath), null, null, true)};
- }else{
- return new IClasspathEntry[]{JavaCore.newVariableEntry( new Path(resourcePath), 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;
- }
-
- /**
- * @param archive
- */
- public void setTargetArchive(Archive archive) {
- targetArchive = archive;
- }
-
- 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/DefaultJ2EEComponentCreationOperation.java b/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/application/internal/operations/DefaultJ2EEComponentCreationOperation.java
deleted file mode 100644
index 5bfb1a189..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, 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 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 fa19f643c..000000000
--- a/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/application/internal/operations/EARComponentImportDataModelProvider.java
+++ /dev/null
@@ -1,673 +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 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.IPath;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Path;
-import org.eclipse.jem.util.emf.workbench.ProjectUtilities;
-import org.eclipse.jst.j2ee.application.WebModule;
-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.EARFile;
-import org.eclipse.jst.j2ee.commonarchivecore.internal.EJBJarFile;
-import org.eclipse.jst.j2ee.commonarchivecore.internal.ModuleFile;
-import org.eclipse.jst.j2ee.commonarchivecore.internal.WARFile;
-import org.eclipse.jst.j2ee.commonarchivecore.internal.exception.OpenFailureException;
-import org.eclipse.jst.j2ee.commonarchivecore.internal.impl.FileImpl;
-import org.eclipse.jst.j2ee.commonarchivecore.internal.impl.WARFileImpl;
-import org.eclipse.jst.j2ee.commonarchivecore.internal.util.ArchiveUtil;
-import org.eclipse.jst.j2ee.datamodel.properties.IAddWebComponentToEnterpriseApplicationDataModelProperties;
-import org.eclipse.jst.j2ee.datamodel.properties.IEARComponentImportDataModelProperties;
-import org.eclipse.jst.j2ee.datamodel.properties.IEarComponentCreationDataModelProperties;
-import org.eclipse.jst.j2ee.datamodel.properties.IJ2EEComponentImportDataModelProperties;
-import org.eclipse.jst.j2ee.datamodel.properties.IJ2EEModuleImportDataModelProperties;
-import org.eclipse.jst.j2ee.datamodel.properties.IJavaComponentCreationDataModelProperties;
-import org.eclipse.jst.j2ee.datamodel.properties.IJavaUtilityJarImportDataModelProperties;
-import org.eclipse.jst.j2ee.ejb.EJBJar;
-import org.eclipse.jst.j2ee.internal.J2EEVersionConstants;
-import org.eclipse.jst.j2ee.internal.archive.operations.EARComponentImportOperation;
-import org.eclipse.jst.j2ee.internal.common.XMLResource;
-import org.eclipse.jst.j2ee.internal.earcreation.EARCreationResourceHandler;
-import org.eclipse.jst.j2ee.internal.earcreation.EarComponentCreationDataModelProvider;
-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.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.plugin.WTPCommonPlugin;
-import org.eclipse.wst.server.core.IRuntime;
-import org.eclipse.wst.server.core.ServerCore;
-
-/**
- * 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$
-
-
- private IDataModelListener nestedListener = new IDataModelListener() {
- public void propertyChanged(DataModelEvent event) {
- if (event.getPropertyName().equals(COMPONENT_NAME)) {
- model.notifyPropertyChange(NESTED_PROJECTS_VALIDATION, IDataModel.DEFAULT_CHG);
- }
- }
- };
-
- private Hashtable ejbJarToClientJarModels = new Hashtable();
-
- private Hashtable clientJarToEjbJarModels = new Hashtable();
-
- 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(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(RUNTIME_TARGET_ID) && 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(RUNTIME_TARGET_ID, propertyValue);
- }
- }
- }
-
- 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)) {
- throw new RuntimeException(propertyName + " is an unsettable property"); //$NON-NLS-1$
- }
- boolean doSet = super.propertySet(propertyName, propertyValue);
- if (NESTED_MODULE_ROOT.equals(propertyName)) {
- changeModuleCreationLocationForAll(getProjectModels(), (String) propertyValue);
- } else if (FILE_NAME.equals(propertyName)) {
- setProperty(MODULE_MODELS_LIST, getModuleModels());
- setProperty(UTILITY_LIST, null);
-
-
- IDataModel earProjectModel = model.getNestedModel(NESTED_MODEL_J2EE_COMPONENT_CREATION);
- if (getArchiveFile() != null) {
- earProjectModel.setIntProperty(IEarComponentCreationDataModelProperties.COMPONENT_VERSION, ArchiveUtil.getFastSpecVersion((ModuleFile) getArchiveFile()));
- }
-
- 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);
- } 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(IJ2EEModuleImportDataModelProperties.EAR_COMPONENT_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);
- }
- IProject project = ProjectUtilities.getProject(getStringProperty(PROJECT_NAME));
- if (null != project && project.exists()) {
- IRuntime target = ServerCore.getProjectProperties(project).getRuntimeTarget();
- if (null != target) {
- setProperty(RUNTIME_TARGET_ID, target.getId());
- }
- }
- } else if (COMPONENT_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(IJ2EEModuleImportDataModelProperties.EAR_COMPONENT_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_COMPONENT_NAME, propertyValue);
- }
- }
- return doSet;
- }
-
- public List getAllUtilitiesExceptEJBClients(EARFile earFile) {
- List clientList = (List) getProperty(EJB_CLIENT_LIST);
- List list = getAllUtilities(earFile);
- for (int i = list.size() - 1; i > -1; i--) {
- FileImpl file = (FileImpl) list.get(i);
- boolean shouldRemove = false;
- for (int j = 0; j < clientList.size() && !shouldRemove; j++) {
- IDataModel localModel = (IDataModel) clientList.get(j);
- if (localModel.getProperty(IJ2EEComponentImportDataModelProperties.FILE) == file) {
- shouldRemove = true;
- }
- }
-
- if (shouldRemove) {
- list.remove(i);
- }
- }
- return list;
- }
-
- public static List getAllUtilities(EARFile earFile) {
- List files = earFile.getFiles();
- List utilJars = new ArrayList();
- for (int i = 0; i < files.size(); i++) {
- FileImpl file = (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((WARFile) file));
- }
- }
- return utilJars;
- }
-
- public static List getWebLibs(WARFile warFile) {
- return ((WARFileImpl) warFile).getLibArchives();
- }
-
-
- protected boolean forceResetOnPreserveMetaData() {
- return false;
- }
-
- public IStatus validate(String propertyName) {
- if (propertyName.equals(NESTED_PROJECTS_VALIDATION)) {
- String earProjectName = getStringProperty(PROJECT_NAME);
- List subProjects = getSelectedModels();
- IDataModel subDataModel = null;
- String tempProjectName = null;
- Archive tempArchive = null;
- IStatus tempStatus = null;
- Hashtable projects = new Hashtable(4);
- for (int i = 0; i < subProjects.size(); i++) {
- subDataModel = (IDataModel) subProjects.get(i);
- tempProjectName = subDataModel.getStringProperty(PROJECT_NAME);
- // TODO: add manual validation
- // IStatus status = ProjectCreationDataModel.validateProjectName(tempProjectName);
- // if (!status.isOK()) {
- // return status;
- // }
- tempArchive = (Archive) subDataModel.getProperty(FILE);
- // if (!overwrite && subDataModel.getProject().exists()) {
- // return
- // WTPCommonPlugin.createErrorStatus(EARCreationResourceHandler.getString("EARImportDataModel_UI_0",
- // new Object[]{tempProjectName, tempArchive.getURI()})); //$NON-NLS-1$
- // }
- tempStatus = subDataModel.validate();
- if (!tempStatus.isOK()) {
- return tempStatus;
- }
- if (tempProjectName.equals(earProjectName)) {
- return WTPCommonPlugin.createErrorStatus(EARCreationResourceHandler.getString("EARImportDataModel_UI_1", new Object[]{tempProjectName, tempArchive.getURI()})); //$NON-NLS-1$
- } else if (!WTPPlugin.isPlatformCaseSensitive()) {
- if (tempProjectName.toLowerCase().equals(earProjectName.toLowerCase())) {
- return WTPCommonPlugin.createErrorStatus(EARCreationResourceHandler.getString("EARImportDataModel_UI_1", new Object[]{tempProjectName, tempArchive.getURI()})); //$NON-NLS-1$
- }
- }
- if (projects.containsKey(tempProjectName)) {
- return WTPCommonPlugin.createErrorStatus(EARCreationResourceHandler.getString("EARImportDataModel_UI_2", new Object[]{tempProjectName, tempArchive.getURI(), ((Archive) projects.get(tempProjectName)).getURI()})); //$NON-NLS-1$
- } 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.getString("EARImportDataModel_UI_2", new Object[]{tempProjectName, tempArchive.getURI(), ((Archive) projects.get(currentKey)).getURI()})); //$NON-NLS-1$
- }
- }
- }
- projects.put(tempProjectName, tempArchive);
- }
- }
- // TODO: check context root is not inside current working
- // directory...this is invalid
- return super.validate(propertyName);
- }
-
- private void changeModuleCreationLocationForAll(List projects, String property) {
- IDataModel localModel = null;
- for (int i = 0; null != projects && i < projects.size(); i++) {
- localModel = (IDataModel) projects.get(i);
- IPath newPath = new Path(property);
- newPath = newPath.append((String) localModel.getProperty(IJ2EEComponentImportDataModelProperties.PROJECT_NAME));
- // model.setProperty(J2EEComponentCreationDataModel.PROJECT_LOCATION,
- // newPath.toOSString());
- }
- }
-
- 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 utilityJars) {
- updateUtilityModels(utilityJars, SELECTED_MODELS_LIST, UTILITY_MODELS_LIST);
- }
-
- private void updateUtilityModels(List utilityJars, String selectedProperty, String listTypeProperty) {
- boolean allSelected = true;
- List selectedList = (List) getProperty(selectedProperty);
- List 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 utilityModels = (List) getProperty(listTypeProperty);
- Archive currentArchive = null;
- IDataModel currentUtilityModel = null;
- boolean utilityJarsModified = false;
- // Add missing
- for (int i = 0; null != utilityJars && i < utilityJars.size(); i++) {
- currentArchive = (Archive) 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.FILE) == currentArchive) {
- added = true;
- }
- }
- if (!added) {
- if (!isPropertySet(listTypeProperty)) {
- utilityModels = new ArrayList();
- setProperty(listTypeProperty, utilityModels);
- }
- IDataModel localModel = DataModelFactory.createDataModel(new J2EEUtilityJarImportDataModelProvider());
- localModel.setProperty(IJavaUtilityJarImportDataModelProperties.FILE, currentArchive);
- localModel.setProperty(IJavaUtilityJarImportDataModelProperties.EAR_PROJECT_NAME, getStringProperty(PROJECT_NAME));
- localModel.setProperty(IJavaUtilityJarImportDataModelProperties.EAR_COMPONENT_NAME, getStringProperty(COMPONENT_NAME));
- localModel.setProperty(IJavaComponentCreationDataModelProperties.RUNTIME_TARGET_ID, getStringProperty(RUNTIME_TARGET_ID));
- 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 = (Archive) currentUtilityModel.getProperty(IJavaUtilityJarImportDataModelProperties.FILE);
- if (null == utilityJars || !utilityJars.contains(currentArchive)) {
- currentUtilityModel.removeListener(nestedListener);
- currentUtilityModel.dispose();
- utilityModels.remove(currentUtilityModel);
- utilityJarsModified = true;
- }
- }
- allList = getProjectModels();
- if (allSelected) {
- List newList = new ArrayList();
- newList.addAll(allList);
- setProperty(SELECTED_MODELS_LIST, newList);
- } else {
- trimSelection();
- }
- if (utilityJarsModified) {
- model.notifyPropertyChange(NESTED_PROJECTS_VALIDATION, IDataModel.VALUE_CHG);
- }
- }
-
- private List getModuleModels() {
- if (getArchiveFile() == null)
- return Collections.EMPTY_LIST;
- List moduleFiles = getEARFile().getModuleFiles();
- List moduleModels = new ArrayList();
- List clientJarArchives = new ArrayList();
- IDataModel localModel;
- String earProjectName = getStringProperty(PROJECT_NAME);
- String earComponentName = getStringProperty(COMPONENT_NAME);
- List defaultModuleNames = new ArrayList();
- defaultModuleNames.add(earProjectName);
- List collidingModuleNames = null;
- Hashtable ejbJarsWithClients = new Hashtable();
- for (int i = 0; i < moduleFiles.size(); i++) {
- localModel = null;
- ModuleFile temp = (ModuleFile) moduleFiles.get(i);
- if (temp.isApplicationClientFile()) {
- localModel = DataModelFactory.createDataModel(new AppClientComponentImportDataModelProvider());
- } else if (temp.isWARFile()) {
- WebModuleExtension webExt = EarModuleManager.getWebModuleExtension();
- if (webExt != null) {
- localModel = webExt.createImportDataModel();
- WebModule webModule = (WebModule) getEARFile().getModule(temp.getURI(), null);
- if (null != webModule && null != webModule.getContextRoot()) {
- localModel.setProperty(IAddWebComponentToEnterpriseApplicationDataModelProperties.CONTEXT_ROOT, webModule.getContextRoot());
- }
- }
- } else if (temp.isEJBJarFile()) {
- EjbModuleExtension ejbExt = EarModuleManager.getEJBModuleExtension();
- if (ejbExt != null) {
- localModel = ejbExt.createImportDataModel();
- }
- EJBJar jar = ((EJBJarFile) temp).getDeploymentDescriptor();
- if (jar != null) {
- if (jar.getEjbClientJar() != null) {
- String clientName = jar.getEjbClientJar();
- try {
- Archive clientArchive = (Archive) getEARFile().getFile(clientName);
- clientJarArchives.add(clientArchive);
- ejbJarsWithClients.put(localModel, clientArchive);
- } catch (Exception e) {
- // TODO: handle exception
- }
- }
- }
- } else if (temp.isRARFile()) {
- JcaModuleExtension rarExt = EarModuleManager.getJCAModuleExtension();
- if (rarExt != null) {
- localModel = rarExt.createImportDataModel();
- }
- }
- if (localModel != null) {
- localModel.setProperty(FILE, temp);
- localModel.setProperty(IJ2EEModuleImportDataModelProperties.EAR_COMPONENT_NAME, earComponentName);
- localModel.setBooleanProperty(IJ2EEModuleImportDataModelProperties.ADD_TO_EAR, false);
- localModel.setProperty(RUNTIME_TARGET_ID, getProperty(RUNTIME_TARGET_ID));
- localModel.addListener(this);
- localModel.addListener(nestedListener);
- moduleModels.add(localModel);
- String moduleName = localModel.getStringProperty(IJ2EEModuleImportDataModelProperties.PROJECT_NAME);
- if (defaultModuleNames.contains(moduleName)) {
- if (collidingModuleNames == null) {
- collidingModuleNames = new ArrayList();
- }
- collidingModuleNames.add(moduleName);
- } else {
- defaultModuleNames.add(moduleName);
- }
- }
- }
- updateUtilityModels(clientJarArchives, EJB_CLIENT_LIST, EJB_CLIENT_LIST);
- List clientModelList = (List) getProperty(EJB_CLIENT_LIST);
- Enumeration ejbModels = ejbJarsWithClients.keys();
- ejbJarToClientJarModels.clear();
- clientJarToEjbJarModels.clear();
- while (ejbModels.hasMoreElements()) {
- Object ejbModel = ejbModels.nextElement();
- Object archive = ejbJarsWithClients.get(ejbModel);
- Object clientModel = null;
- for (int i = 0; clientModel == null && i < clientModelList.size(); i++) {
- if (((IDataModel) clientModelList.get(i)).getProperty(FILE) == archive) {
- clientModel = clientModelList.get(i);
- }
- }
- ejbJarToClientJarModels.put(ejbModel, clientModel);
- clientJarToEjbJarModels.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)) {
- ModuleFile module = (ModuleFile) localModel.getProperty(IJ2EEModuleImportDataModelProperties.FILE);
- 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(FILE) == anArchive) {
- return true;
- }
- }
- return false;
- }
-
- private List getProjectModels() {
- List temp = new ArrayList();
- 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;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.jst.j2ee.internal.internal.application.operations.J2EEImportDataModel#dispose()
- */
- public void dispose() {
- super.dispose();
- List list = getProjectModels();
- for (int i = 0; i < list.size(); i++) {
- ((IDataModel) list.get(i)).dispose();
- }
- EARFile earFile = getEARFile();
- if (earFile != null)
- earFile.close();
- }
-
- // 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 EarComponentCreationDataModelProvider());
- }
-
- public IDataModelOperation getDefaultOperation() {
- return new EARComponentImportOperation(model);
- }
-
-}
diff --git a/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/application/internal/operations/ExtendedImportFactory.java b/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/application/internal/operations/ExtendedImportFactory.java
deleted file mode 100644
index 282d15a8a..000000000
--- a/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/application/internal/operations/ExtendedImportFactory.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 Jun 21, 2004
- * @author jsholl
- */
-package org.eclipse.jst.j2ee.application.internal.operations;
-
-import java.lang.reflect.InvocationTargetException;
-
-import org.eclipse.core.runtime.IProgressMonitor;
-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.wst.common.frameworks.datamodel.IDataModel;
-
-
-/**
- * @author jsholl
- */
-public interface ExtendedImportFactory {
-
- public Archive openArchive(ArchiveOptions archiveOptions, String uri) throws OpenFailureException;
-
- public void importModuleFile(IDataModel model, IProgressMonitor monitor) throws InvocationTargetException, InterruptedException;
-
- public int getSpecVersion(Archive archive);
-}
diff --git a/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/application/internal/operations/ExtendedImportRegistry.java b/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/application/internal/operations/ExtendedImportRegistry.java
deleted file mode 100644
index fdfc974c6..000000000
--- a/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/application/internal/operations/ExtendedImportRegistry.java
+++ /dev/null
@@ -1,95 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-/*
- * Created on Jun 21, 2004
- * @author jsholl
- */
-package org.eclipse.jst.j2ee.application.internal.operations;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IConfigurationElement;
-import org.eclipse.jem.util.RegistryReader;
-import org.eclipse.jem.util.logger.proxy.Logger;
-import org.eclipse.jst.j2ee.internal.plugin.J2EEPlugin;
-
-/**
- * @author jsholl
- */
-public class ExtendedImportRegistry extends RegistryReader {
-
- private static final String PLUGIN_ID = J2EEPlugin.PLUGIN_ID;
-
- private static final String EXTENSION_ID = "ExtendedModuleImport"; //$NON-NLS-1$
-
- private static final String FACTORY_CLASS = "factoryClass"; //$NON-NLS-1$
-
- private static final String MODULE_TYPE = "moduleType"; //$NON-NLS-1$
-
- public static final String EJB_TYPE = "EJB"; //$NON-NLS-1$
-
- private List ejbConfigurationElements = null;
-
- private List ejbFactories = null;
-
- private static ExtendedImportRegistry instance = null;
-
- public static ExtendedImportRegistry getInstance() {
- //if (null == instance) {
- instance = new ExtendedImportRegistry();
- //}
- return instance;
- }
-
- private ExtendedImportRegistry() {
- super(PLUGIN_ID, EXTENSION_ID);
- readRegistry();
- }
-
- /**
- * returns a List of ExtendedFactories;
- *
- * @param type
- * @return
- */
- public List getFactories(String type) {
- if (type.equals(EJB_TYPE)) {
- if (ejbFactories == null) {
- ejbFactories = new ArrayList();
- for (int i = 0; null != ejbConfigurationElements && i < ejbConfigurationElements.size(); i++) {
- try {
- ejbFactories.add(((IConfigurationElement) ejbConfigurationElements.get(i)).createExecutableExtension(FACTORY_CLASS));
- } catch (CoreException e) {
- Logger.getLogger().logError(e);
- }
- }
- }
- return ejbFactories;
- }
- return null;
- }
-
- public boolean readElement(IConfigurationElement element) {
- String moduleType = element.getAttribute(MODULE_TYPE);
- if (null != moduleType) {
- if (moduleType.equals(EJB_TYPE)) {
- if (ejbConfigurationElements == null) {
- ejbConfigurationElements = new ArrayList();
- }
- ejbConfigurationElements.add(element);
- return true;
- }
- }
- return false;
- }
-}
diff --git a/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/application/internal/operations/FlexibleJavaProjectCreationDataModelProvider.java b/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/application/internal/operations/FlexibleJavaProjectCreationDataModelProvider.java
deleted file mode 100644
index d65d73397..000000000
--- a/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/application/internal/operations/FlexibleJavaProjectCreationDataModelProvider.java
+++ /dev/null
@@ -1,93 +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 java.util.Set;
-
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.jst.common.jdt.internal.integration.JavaProjectCreationDataModelProvider;
-import org.eclipse.jst.j2ee.internal.servertarget.J2EEProjectServerTargetDataModelProvider;
-import org.eclipse.jst.j2ee.project.datamodel.properties.IFlexibleJavaProjectCreationDataModelProperties;
-import org.eclipse.jst.j2ee.project.datamodel.properties.IJ2EEProjectServerTargetDataModelProperties;
-import org.eclipse.wst.common.componentcore.datamodel.FlexibleProjectCreationDataModelProvider;
-import org.eclipse.wst.common.frameworks.datamodel.DataModelFactory;
-import org.eclipse.wst.common.frameworks.datamodel.DataModelPropertyDescriptor;
-import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
-import org.eclipse.wst.common.frameworks.datamodel.IDataModelOperation;
-
-public class FlexibleJavaProjectCreationDataModelProvider extends FlexibleProjectCreationDataModelProvider implements IFlexibleJavaProjectCreationDataModelProperties {
-
- public FlexibleJavaProjectCreationDataModelProvider() {
- super();
- }
-
- public void init() {
- super.init();
- IDataModel serverTargetModel = DataModelFactory.createDataModel(new J2EEProjectServerTargetDataModelProvider());
- model.addNestedModel(NESTED_MODEL_SERVER_TARGET, serverTargetModel);
- }
-
- protected void initNestedProjectModel() {
- IDataModel javaProjModel = DataModelFactory.createDataModel(new JavaProjectCreationDataModelProvider());
- model.addNestedModel(NESTED_MODEL_PROJECT_CREATION, javaProjModel);
- }
-
- public Set getPropertyNames() {
- Set propertyNames = super.getPropertyNames();
- propertyNames.add(NESTED_MODEL_SERVER_TARGET);
- propertyNames.add(ADD_SERVER_TARGET);
- propertyNames.add(RUNTIME_TARGET_ID);
- return propertyNames;
- }
-
- public Object getDefaultProperty(String propertyName) {
- if (propertyName.equals(ADD_SERVER_TARGET)) {
- return Boolean.TRUE;
- }
- return super.getDefaultProperty(propertyName);
- }
-
- public boolean propertySet(String propertyName, Object propertyValue) {
- boolean status = super.propertySet(propertyName, propertyValue);
- if (PROJECT_NAME.equals(propertyName)) {
- IDataModel projModel = model.getNestedModel(NESTED_MODEL_SERVER_TARGET);
- projModel.setProperty(IJ2EEProjectServerTargetDataModelProperties.PROJECT_NAME, propertyValue);
- } else if (RUNTIME_TARGET_ID.equals(propertyName)) {
- IDataModel projModel = model.getNestedModel(NESTED_MODEL_SERVER_TARGET);
- projModel.setProperty(IJ2EEProjectServerTargetDataModelProperties.RUNTIME_TARGET_ID, propertyValue);
- }
- return status;
- }
-
- public IDataModelOperation getDefaultOperation() {
- return new FlexibleJavaProjectCreationOperation(model);
- }
-
-
- public DataModelPropertyDescriptor[] getValidPropertyDescriptors(String propertyName) {
- if (propertyName.equals(RUNTIME_TARGET_ID)) {
- IDataModel serverTargetModel = model.getNestedModel(NESTED_MODEL_SERVER_TARGET);
- return serverTargetModel.getValidPropertyDescriptors(IJ2EEProjectServerTargetDataModelProperties.RUNTIME_TARGET_ID);
- }
- return null;
- }
-
- public IStatus validate(String propertyName) {
- IStatus status = super.validate(propertyName);
- if (!status.isOK()) {
- return status;
- } else if (propertyName.equals(NESTED_MODEL_SERVER_TARGET)) {
- IDataModel stModel = model.getNestedModel(NESTED_MODEL_SERVER_TARGET);
- return stModel.validate();
- }
- return OK_STATUS;
- }
-}
diff --git a/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/application/internal/operations/FlexibleJavaProjectCreationOperation.java b/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/application/internal/operations/FlexibleJavaProjectCreationOperation.java
deleted file mode 100644
index e3b220df9..000000000
--- a/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/application/internal/operations/FlexibleJavaProjectCreationOperation.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
- *******************************************************************************/
-package org.eclipse.jst.j2ee.application.internal.operations;
-
-import java.lang.reflect.InvocationTargetException;
-
-import org.eclipse.core.commands.ExecutionException;
-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.internal.plugin.JavaEMFNature;
-import org.eclipse.jem.util.logger.proxy.Logger;
-import org.eclipse.jst.j2ee.project.datamodel.properties.IFlexibleJavaProjectCreationDataModelProperties;
-import org.eclipse.wst.common.componentcore.internal.operation.FlexibleProjectCreationOperation;
-import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
-import org.eclipse.wst.common.frameworks.datamodel.IDataModelOperation;
-
-public class FlexibleJavaProjectCreationOperation extends FlexibleProjectCreationOperation implements IFlexibleJavaProjectCreationDataModelProperties{
-
- public FlexibleJavaProjectCreationOperation(IDataModel model) {
- super(model);
- }
- private void addServerTarget(IProgressMonitor monitor) throws CoreException, InvocationTargetException, InterruptedException, ExecutionException{
- IDataModel serverModel = model.getNestedModel(NESTED_MODEL_SERVER_TARGET);
- IDataModelOperation op = serverModel.getDefaultOperation();
- op.execute(monitor, null);
- }
-
- public IStatus execute(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
- IStatus status = super.execute(monitor, info);
- try {
- createJavaEMFNature();
- addServerTarget(monitor);
- } catch (ExecutionException e) {
- Logger.getLogger().log(e);
- } catch (CoreException e) {
- Logger.getLogger().log(e);
- } catch (InvocationTargetException e) {
- Logger.getLogger().log(e);
- } catch (InterruptedException e) {
- Logger.getLogger().log(e);
- }
- return status;
- }
- protected void createJavaEMFNature() throws CoreException {
- JavaEMFNature nature = JavaEMFNature.createRuntime(getProject());
- nature.getResourceSet();
- }
-}
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 507746476..000000000
--- a/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/application/internal/operations/IAddComponentToEnterpriseApplicationDataModelProperties.java
+++ /dev/null
@@ -1,23 +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.wst.common.componentcore.datamodel.properties.ICreateReferenceComponentsDataModelProperties;
-
-public interface IAddComponentToEnterpriseApplicationDataModelProperties extends ICreateReferenceComponentsDataModelProperties {
-
- /**
- * Returns a Map which maps Components in the TARGET_COMPONENT_LIST list to the name Strings
- * that should be used when adding them to the ear.
- */
- public static final String TARGET_COMPONENTS_TO_URI_MAP = "IAddComponentToEnterpriseApplicationDataModelProperties.TARGET_COMPONENTS_TO_URI_MAP";
-
-}
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/J2EEArtifactExportDataModelProvider.java b/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/application/internal/operations/J2EEArtifactExportDataModelProvider.java
deleted file mode 100644
index 460e9de4e..000000000
--- a/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/application/internal/operations/J2EEArtifactExportDataModelProvider.java
+++ /dev/null
@@ -1,228 +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 java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Set;
-
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.resources.IWorkspace;
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Path;
-import org.eclipse.jst.j2ee.datamodel.properties.IJ2EEComponentExportDataModelProperties;
-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.internal.plugin.WTPCommonMessages;
-import org.eclipse.wst.common.frameworks.internal.plugin.WTPCommonPlugin;
-
-public abstract class J2EEArtifactExportDataModelProvider extends AbstractDataModelProvider implements IJ2EEComponentExportDataModelProperties {
-
- public HashMap componentMap;
-
- public J2EEArtifactExportDataModelProvider() {
- super();
- }
-
- public Set getPropertyNames() {
- Set propertyNames = super.getPropertyNames();
- propertyNames.add(COMPONENT_NAME);
- propertyNames.add(PROJECT_NAME);
- propertyNames.add(ARCHIVE_DESTINATION);
- propertyNames.add(EXPORT_SOURCE_FILES);
- propertyNames.add(OVERWRITE_EXISTING);
- propertyNames.add(RUN_BUILD);
- propertyNames.add(COMPONENT);
- 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;
- }
- return super.getDefaultProperty(propertyName);
- }
-
- public boolean propertySet(String propertyName, Object propertyValue) {
- boolean set = super.propertySet(propertyName, propertyValue);
- if (propertyName.equals(COMPONENT_NAME)) {
- if (getComponentMap().isEmpty())
- intializeComponentMap();
- IVirtualComponent component = (IVirtualComponent) getComponentMap().get(propertyValue);
- if (null != component && component.getName().equals(propertyValue)) {
- setProperty(COMPONENT, component);
- setProperty(PROJECT_NAME, component.getProject().getName());
- } else {
- setProperty(COMPONENT, null);
- setProperty(PROJECT_NAME, null);
- }
- }
- 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(COMPONENT_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);
- }
- 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 (COMPONENT_NAME.equals(propertyName)) {
- String componentName = (String) model.getProperty(COMPONENT_NAME);
- if (componentName == null || componentName.equals("")) //$NON-NLS-1$
- return WTPCommonPlugin.createErrorStatus(WTPCommonPlugin.getResourceString(WTPCommonMessages.MODULE_EXISTS_ERROR));
- IVirtualComponent component = (IVirtualComponent) componentMap.get(componentName);
- if (component == null) {
- return WTPCommonPlugin.createErrorStatus(WTPCommonPlugin.getResourceString(WTPCommonMessages.MODULE_EXISTS_ERROR));
- }
- if (!J2EEProjectUtilities.getJ2EEProjectType(component.getProject()).equals(getProjectType())) {
- return WTPCommonPlugin.createErrorStatus(getWrongComponentTypeString(componentName));
- }
- }
- 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;
- }
-
-}
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 4b26ef7c5..000000000
--- a/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/application/internal/operations/J2EEArtifactImportDataModelProvider.java
+++ /dev/null
@@ -1,231 +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 java.util.ArrayList;
-import java.util.List;
-import java.util.Set;
-
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Path;
-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.project.datamodel.properties.IFlexibleJavaProjectCreationDataModelProperties;
-import org.eclipse.wst.common.componentcore.datamodel.properties.IComponentCreationDataModelProperties;
-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;
-
-public abstract class J2EEArtifactImportDataModelProvider extends AbstractDataModelProvider implements IJ2EEComponentImportDataModelProperties, IDataModelListener {
-
- private static final String USE_DEFAULT_COMPONENT_NAME = "J2EEArtifactImportDataModelProvider.USE_DEFAULT_COMPONENT_NAME"; //$NON-NLS-1$
-
- /**
- * Extended attributes
- */
- protected static final String RUNTIME_TARGET_ID = IFlexibleJavaProjectCreationDataModelProperties.RUNTIME_TARGET_ID;
-
- private IDataModel componentCreationDM;
- private OpenFailureException cachedOpenFailureException = 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_COMPONENT_NAME);
- propertyNames.add(COMPONENT_NAME);
- return propertyNames;
- }
-
- public void init() {
- super.init();
- componentCreationDM = createJ2EEComponentCreationDataModel();
- componentCreationDM.setBooleanProperty(IComponentCreationDataModelProperties.CREATE_DEFAULT_FILES, 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_COMPONENT_NAME)) {
- return Boolean.TRUE;
- }
- return super.getDefaultProperty(propertyName);
- }
-
- private boolean settingFileName = false;
-
- public boolean propertySet(String propertyName, Object propertyValue) {
- if (propertyName.equals(FILE)) {
- if (!settingFileName) {
- setProperty(FILE_NAME, null);
- }
- updateDefaultComponentName();
- return true;
- } else if (propertyName.equals(SAVE_FILTER) && getArchiveFile() != null) {
- getArchiveFile().setSaveFilter(getSaveFilter());
- } else if (FILE_NAME.equals(propertyName)) {
- try {
- cachedOpenFailureException = null;
- handleArchiveSetup((String) propertyValue);
- } catch (OpenFailureException oe) {
- cachedOpenFailureException = oe;
- }
- } else if (COMPONENT_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(IJ2EEComponentImportDataModelProperties.COMPONENT_NAME, propertyValue);
- } catch (Exception e) {}
- }
- setProperty(PROJECT_NAME,propertyValue);
- }
- return true;
- }
-
- private boolean doingComponentUpdate;
-
- private void updateDefaultComponentName() {
- Archive archive = getArchiveFile();
- if (null != archive && getBooleanProperty(USE_DEFAULT_COMPONENT_NAME)) {
- try {
- doingComponentUpdate = true;
- Path path = new Path(archive.getURI());
- String defaultProjectName = path.segment(path.segmentCount() - 1);
- if (defaultProjectName.indexOf('.') > 0) {
- defaultProjectName = defaultProjectName.substring(0, defaultProjectName.lastIndexOf('.'));
- }
- setProperty(COMPONENT_NAME, defaultProjectName);
- } finally {
- doingComponentUpdate = false;
- }
-
- }
- }
-
- private boolean handleArchiveSetup(String fileName) throws OpenFailureException {
- try {
- settingFileName = true;
- Archive archive = getArchiveFile();
- if (archive != null) {
- archive.close();
- setProperty(FILE, null);
- }
- String uri = getStringProperty(FILE_NAME);
- if (!archiveExistsOnFile())
- return false;
- archive = openArchive(uri);
- if (null != archive) {
- archive.setSaveFilter(getSaveFilter());
- }
- setProperty(FILE, archive);
- return archive != null;
- } finally {
- settingFileName = false;
- }
-
- }
-
- protected abstract Archive openArchive(String uri) throws OpenFailureException;
-
- private boolean closeModuleFile() {
- if (null != getArchiveFile()) {
- getArchiveFile().close();
- }
- return true;
- }
-
- public IStatus validate(String propertyName) {
- if (FILE_NAME.equals(propertyName) && !isPropertySet(FILE)) {
- 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 (cachedOpenFailureException != null) {
- return WTPCommonPlugin.createErrorStatus(WTPCommonPlugin.getResourceString(cachedOpenFailureException.getMessage()));
- } else if (fileName != null && !archiveExistsOnFile()) {
- return WTPCommonPlugin.createErrorStatus(WTPCommonPlugin.getResourceString(WTPCommonMessages.FILE_DOES_NOT_EXIST_ERROR, new Object[]{ArchiveUtil.getModuleFileTypeName(getType())}));
- }
- }
- 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))
- closeModuleFile();
- super.dispose();
- }
-
- protected final void setArchiveFile(Archive archiveFile) {
- setProperty(FILE, archiveFile);
- }
-
- 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(COMPONENT_NAME) && getBooleanProperty(USE_DEFAULT_COMPONENT_NAME)) {
- setBooleanProperty(USE_DEFAULT_COMPONENT_NAME, false);
- }
- }
-}
diff --git a/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/application/internal/operations/J2EEComponentCreationDataModelProvider.java b/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/application/internal/operations/J2EEComponentCreationDataModelProvider.java
deleted file mode 100644
index 881bc4f8d..000000000
--- a/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/application/internal/operations/J2EEComponentCreationDataModelProvider.java
+++ /dev/null
@@ -1,721 +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;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Set;
-
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.jem.util.emf.workbench.ProjectUtilities;
-import org.eclipse.jst.j2ee.datamodel.properties.IJ2EEComponentCreationDataModelProperties;
-import org.eclipse.jst.j2ee.internal.J2EEVersionConstants;
-import org.eclipse.jst.j2ee.internal.archive.operations.JavaComponentCreationDataModelProvider;
-import org.eclipse.jst.j2ee.internal.common.J2EEVersionUtil;
-import org.eclipse.jst.j2ee.internal.earcreation.EARCreationResourceHandler;
-import org.eclipse.jst.j2ee.internal.earcreation.EarComponentCreationDataModelProvider;
-import org.eclipse.jst.j2ee.internal.project.J2EECreationResourceHandler;
-import org.eclipse.jst.j2ee.internal.project.J2EEProjectUtilities;
-import org.eclipse.wst.common.componentcore.ComponentCore;
-import org.eclipse.wst.common.componentcore.ModuleCoreNature;
-import org.eclipse.wst.common.componentcore.datamodel.properties.IComponentCreationDataModelProperties;
-import org.eclipse.wst.common.componentcore.internal.StructureEdit;
-import org.eclipse.wst.common.componentcore.internal.WorkbenchComponent;
-import org.eclipse.wst.common.componentcore.resources.IVirtualComponent;
-import org.eclipse.wst.common.componentcore.resources.IVirtualReference;
-import org.eclipse.wst.common.frameworks.datamodel.DataModelEvent;
-import org.eclipse.wst.common.frameworks.datamodel.DataModelFactory;
-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.server.core.IModuleType;
-import org.eclipse.wst.server.core.IRuntime;
-import org.eclipse.wst.server.core.IRuntimeType;
-import org.eclipse.wst.server.core.ServerUtil;
-
-public abstract class J2EEComponentCreationDataModelProvider extends JavaComponentCreationDataModelProvider implements IJ2EEComponentCreationDataModelProperties, IAnnotationsDataModel {
-
- private IDataModel earCreationDM = null;
- private static String MODULE_NOT_SUPPORTED = "MODULE_NOT_SUPPORTED"; //$NON-NLS-1$
- private static String MODULEVERSION_NOT_SUPPORTED = "VERSION_NOT_SUPPORTED"; //$NON-NLS-1$
- private static String OK = "OK"; //$NON-NLS-1$
-
- public void init() {
- super.init();
- model.setProperty(COMPONENT_VERSION, getDefaultProperty(COMPONENT_VERSION));
-
- IDataModel dm = DataModelFactory.createDataModel(createAddComponentToEAR());
- model.setProperty(NESTED_ADD_COMPONENT_TO_EAR_DM, dm);
- propertySet(CLASSPATH_SELECTION, null);
- model.setProperty(NESTED_UPDATE_MANIFEST_DM, DataModelFactory.createDataModel(UpdateManifestDataModelProvider.class));
- model.setProperty(USE_ANNOTATIONS, Boolean.FALSE);
- }
-
- public AddComponentToEnterpriseApplicationDataModelProvider createAddComponentToEAR() {
- return new AddComponentToEnterpriseApplicationDataModelProvider();
- }
-
- public Set getPropertyNames() {
- Set propertyNames = super.getPropertyNames();
- propertyNames.add(EAR_COMPONENT_NAME);
- propertyNames.add(EAR_COMPONENT_DEPLOY_NAME);
- propertyNames.add(ADD_TO_EAR);
- propertyNames.add(UI_SHOW_EAR_SECTION);
- propertyNames.add(DD_FOLDER);
- propertyNames.add(COMPONENT_VERSION);
- propertyNames.add(VALID_COMPONENT_VERSIONS_FOR_PROJECT_RUNTIME);
- propertyNames.add(NESTED_ADD_COMPONENT_TO_EAR_DM);
- propertyNames.add(CLASSPATH_SELECTION);
- propertyNames.add(NESTED_EAR_COMPONENT_CREATION_DM);
- propertyNames.add(NESTED_UPDATE_MANIFEST_DM);
- propertyNames.add(EAR_COMPONENT_PROJECT);
- propertyNames.add(USE_ANNOTATIONS);
- return propertyNames;
- }
-
- public Object getDefaultProperty(String propertyName) {
- if (propertyName.equals(ADD_TO_EAR)) {
- return Boolean.FALSE;
- } else if (propertyName.equals(UI_SHOW_EAR_SECTION)) {
- return Boolean.TRUE;
- } else if (propertyName.equals(EAR_COMPONENT_NAME)) {
- return getDataModel().getStringProperty(COMPONENT_NAME) + "EAR"; //$NON-NLS-1$
- } else if (propertyName.equals(COMPONENT_VERSION)) {
- return getDefaultComponentVersion();
- } else if (propertyName.equals(NESTED_EAR_COMPONENT_CREATION_DM))
- return getDefaultEarCreationDM();
- return super.getDefaultProperty(propertyName);
- }
-
- private Object getDefaultEarCreationDM() {
- if (earCreationDM == null) {
- earCreationDM = DataModelFactory.createDataModel(new EarComponentCreationDataModelProvider());
- setProperty(NESTED_EAR_COMPONENT_CREATION_DM, earCreationDM);
- }
- return earCreationDM;
- }
-
- public boolean isPropertyEnabled(String propertyName) {
- if (EAR_COMPONENT_NAME.equals(propertyName)) {
- return getBooleanProperty(ADD_TO_EAR);
- }
- return super.isPropertyEnabled(propertyName);
- }
-
-
- public boolean propertySet(String propertyName, Object propertyValue) {
- boolean status = super.propertySet(propertyName, propertyValue);
- if (propertyName.equals(EAR_COMPONENT_NAME)) {
- model.setProperty(EAR_COMPONENT_DEPLOY_NAME, propertyValue);
- IProject earProj = getEARProject();
- IDataModel earDM = (IDataModel) model.getProperty(NESTED_EAR_COMPONENT_CREATION_DM);
- earDM.setProperty(IJ2EEComponentCreationDataModelProperties.EAR_COMPONENT_PROJECT, earProj);
- model.setProperty(EAR_COMPONENT_PROJECT, earProj);
-
- } else if (propertyName.equals(COMPONENT_NAME)) {
-
- if (getBooleanProperty(ADD_TO_EAR)) {
- if (!model.isPropertySet(EAR_COMPONENT_NAME)) {
- model.notifyPropertyChange(EAR_COMPONENT_NAME, IDataModel.VALID_VALUES_CHG);
- model.setProperty(EAR_COMPONENT_DEPLOY_NAME, getProperty(EAR_COMPONENT_NAME));
- IDataModel earDM = (IDataModel) model.getProperty(NESTED_EAR_COMPONENT_CREATION_DM);
- IProject earProject = getEARProject();
- model.setProperty(EAR_COMPONENT_PROJECT, earProject);
- if (earDM != null && earProject != null)
- earDM.setProperty(IJ2EEComponentCreationDataModelProperties.EAR_COMPONENT_PROJECT, earProject);
- }
- }
- } else if (propertyName.equals(ADD_TO_EAR)) {
- model.notifyPropertyChange(EAR_COMPONENT_NAME, IDataModel.ENABLE_CHG);
- model.notifyPropertyChange(NESTED_EAR_COMPONENT_CREATION_DM, IDataModel.DEFAULT_CHG);
- IProject earProj = getEARProject();
- model.setProperty(EAR_COMPONENT_PROJECT, earProj);
- IDataModel earDM = (IDataModel) model.getProperty(NESTED_EAR_COMPONENT_CREATION_DM);
- if (earDM != null && earProj != null) {
- earDM.setProperty(IJ2EEComponentCreationDataModelProperties.EAR_COMPONENT_PROJECT, earProj);
- earDM.setProperty(COMPONENT_VERSION, new Integer(getJ2EEVersion()));
- }
-
- } else if (propertyName.equals(COMPONENT_VERSION)) {
- if (getJ2EEVersion() < J2EEVersionConstants.VERSION_1_3)
- setProperty(USE_ANNOTATIONS, Boolean.FALSE);
- model.notifyPropertyChange(USE_ANNOTATIONS, DataModelEvent.ENABLE_CHG);
- model.notifyPropertyChange(EAR_COMPONENT_NAME, DataModelEvent.VALID_VALUES_CHG);
- if (getBooleanProperty(ADD_TO_EAR)) {
- IDataModel earDM = (IDataModel) model.getProperty(NESTED_EAR_COMPONENT_CREATION_DM);
- earDM.setProperty(COMPONENT_VERSION, new Integer(getJ2EEVersion()));
- }
- // this will force to reload all the server types which are valid for this component
- // version
- model.notifyPropertyChange(RUNTIME_TARGET_ID, DataModelEvent.VALID_VALUES_CHG);
- } else if (RUNTIME_TARGET_ID.equals(propertyName)) {
- setProperty(ADD_TO_EAR, new Boolean(isEARSupported()));
-
- IDataModel earDM = (IDataModel) model.getProperty(NESTED_EAR_COMPONENT_CREATION_DM);
- earDM.setProperty(RUNTIME_TARGET_ID, propertyValue);
- }
- return status;
- }
-
- protected IProject getEARProject() {
- String earProjname = (String) model.getProperty(EAR_COMPONENT_NAME);
- IDataModel earDM = (IDataModel) model.getProperty(NESTED_EAR_COMPONENT_CREATION_DM);
- earDM.setProperty(IComponentCreationDataModelProperties.PROJECT_NAME, earProjname);
-
- if (earProjname != null && !earProjname.equals("") && validate(EAR_COMPONENT_NAME).isOK()) //$NON-NLS-1$
- return ProjectUtilities.getProject(earProjname);
- return null;
- }
-
-
- public DataModelPropertyDescriptor getPropertyDescriptor(String propertyName){
- if (propertyName.equals(RUNTIME_TARGET_ID)) {
- String propertyValue = (String)getProperty(propertyName);
- if( propertyValue != null ){
- IRuntime runtime = getServerTargetByID(propertyValue);
- if( runtime != null )
- return new DataModelPropertyDescriptor(propertyValue, runtime.getName());
- }
- }
- return super.getPropertyDescriptor(propertyName);
- }
-
- public DataModelPropertyDescriptor[] getValidPropertyDescriptors(String propertyName) {
- if (propertyName.equals(COMPONENT_VERSION)) {
- return getValidComponentVersionDescriptors();
- }
- if (propertyName.equals(EAR_COMPONENT_NAME)) {
- int j2eeVersion = getJ2EEVersion();
- return getEARPropertyDescriptor(j2eeVersion);
- } else if (propertyName.equals(RUNTIME_TARGET_ID)) {
- return validJ2EEServerPropertyDescriptors();
- }
- return super.getValidPropertyDescriptors(propertyName);
- }
-
- protected String isvalidJComponentVersionsSupportedByServer() {
- String serverID = model.getStringProperty(RUNTIME_TARGET_ID);
- IRuntime runtime = getServerTargetByID(serverID);
-
- if (serverID.equals("") || runtime == null) { //$NON-NLS-1$
- return MODULEVERSION_NOT_SUPPORTED;
- }
- Integer version = (Integer) model.getProperty(COMPONENT_VERSION);
- String j2eeVer = J2EEVersionUtil.convertVersionIntToString(version.intValue());
- return isTypeSupported(runtime.getRuntimeType(), getJ2EEProjectType(), j2eeVer);
- }
-
- protected abstract String getJ2EEProjectType();
-
- protected DataModelPropertyDescriptor[] validJ2EEServerPropertyDescriptors() {
-
- Integer version = (Integer) model.getProperty(COMPONENT_VERSION);
- //int j2eeversion = convertModuleVersionToJ2EEVersion(version.intValue());
- String j2eeVersionText = J2EEVersionUtil.convertVersionIntToString(version.intValue());
-
- ArrayList validServers = new ArrayList();
-
- IDataModel projectdm = model.getNestedModel(NESTED_PROJECT_CREATION_DM);
- DataModelPropertyDescriptor[] desc = projectdm.getValidPropertyDescriptors(RUNTIME_TARGET_ID);
- for (int i = 0; i < desc.length; i++) {
- DataModelPropertyDescriptor descriptor = desc[i];
- String runtimeid = (String) descriptor.getPropertyValue();
- IRuntime runtime = getServerTargetByID(runtimeid);
- String ok = isTypeSupported(runtime.getRuntimeType(), getJ2EEProjectType(), j2eeVersionText);
- if (ok.equals(OK))
- validServers.add(descriptor);
- }
-
- if (!validServers.isEmpty()) {
- int serverTargetListSize = validServers.size();
- DataModelPropertyDescriptor[] result = new DataModelPropertyDescriptor[serverTargetListSize];
- for (int i = 0; i < validServers.size(); i++) {
- result[i] = (DataModelPropertyDescriptor) validServers.get(i);
- }
- return result;
- }
- return new DataModelPropertyDescriptor[0];
- }
-
- protected IRuntime getServerTargetByID(String id) {
- IRuntime[] targets = ServerUtil.getRuntimes("", ""); //$NON-NLS-1$ //$NON-NLS-2$
- for (int i = 0; i < targets.length; i++) {
- IRuntime target = targets[i];
- if (id.equals(target.getId()))
- return target;
- }
- return null;
- }
-
-// private List getValidServerTargets() {
-// List validServerTargets = null;
-// validServerTargets = ServerTargetHelper.getServerTargets("", ""); //$NON-NLS-1$ //$NON-NLS-2$
-// if (validServerTargets != null && validServerTargets.isEmpty())
-// validServerTargets = null;
-// if (validServerTargets == null)
-// return Collections.EMPTY_LIST;
-// return validServerTargets;
-// }
-
-
- protected String isTypeSupported(IRuntimeType type, String moduleID, String j2eeVersion) {
- IModuleType[] moduleTypes = type.getModuleTypes();
-
- boolean moduleFound = false;
- boolean moduleVersionFound = false;
-
- if (moduleTypes != null) {
- int size = moduleTypes.length;
-
- for (int i = 0; i < size; i++) {
- IModuleType moduleType = moduleTypes[i];
-
- if (matches(moduleType.getId(), moduleID)) {
- moduleFound = true;
- String version = moduleType.getVersion();
- if (version.equals(j2eeVersion) || version.equals("*")) { //$NON-NLS-1$
- moduleVersionFound = true;
- return OK;
- }
- if (i < size)
- continue;
- }
- }
- }
- if (!moduleFound)
- return MODULE_NOT_SUPPORTED;
- if (!moduleVersionFound)
- return MODULEVERSION_NOT_SUPPORTED;
- return ""; //$NON-NLS-1$
- }
-
-
- protected static String[] getServerVersions(IRuntimeType type, String moduleID) {
- List list = new ArrayList();
- if (type == null)
- return null;
- IModuleType[] moduleTypes = type.getModuleTypes();
- if (moduleTypes != null) {
- int size = moduleTypes.length;
- for (int i = 0; i < size; i++) {
- IModuleType moduleType = moduleTypes[i];
- if (matches(moduleType.getId(), moduleID)) {
- list.add(moduleType.getVersion());
- }
-
- }
- }
- String[] versions = null;
- if (!list.isEmpty()) {
- versions = new String[list.size()];
- list.toArray(versions);
- }
- return versions;
- }
-
- protected static boolean matches(String serverTypeID, String j2eeModuleID) {
-
- if (serverTypeID.equals("jst") || serverTypeID.equals("jst.*")) //$NON-NLS-1$ //$NON-NLS-2$
- return j2eeModuleID.equals(J2EEProjectUtilities.DYNAMIC_WEB) || j2eeModuleID.equals(J2EEProjectUtilities.EJB) || j2eeModuleID.equals(J2EEProjectUtilities.ENTERPRISE_APPLICATION) || j2eeModuleID.equals(J2EEProjectUtilities.APPLICATION_CLIENT) || j2eeModuleID.equals(J2EEProjectUtilities.JCA);
-
- else if (serverTypeID.equals(J2EEProjectUtilities.DYNAMIC_WEB))
- return j2eeModuleID.equals(J2EEProjectUtilities.DYNAMIC_WEB);
-
- else if (serverTypeID.equals(J2EEProjectUtilities.EJB))
- return j2eeModuleID.equals(J2EEProjectUtilities.EJB);
-
- else if (serverTypeID.equals(J2EEProjectUtilities.JCA))
- return j2eeModuleID.equals(J2EEProjectUtilities.JCA);
-
- else if (serverTypeID.equals(J2EEProjectUtilities.APPLICATION_CLIENT))
- return j2eeModuleID.equals(J2EEProjectUtilities.APPLICATION_CLIENT);
-
- else if (serverTypeID.equals(J2EEProjectUtilities.ENTERPRISE_APPLICATION))
- return j2eeModuleID.equals(J2EEProjectUtilities.ENTERPRISE_APPLICATION) || j2eeModuleID.equals(J2EEProjectUtilities.APPLICATION_CLIENT) || j2eeModuleID.equals(J2EEProjectUtilities.JCA);
-
- return false;
- }
-
-
-
- private DataModelPropertyDescriptor[] getEARPropertyDescriptor(int j2eeVersion) {
- StructureEdit mc = null;
- ArrayList earDescriptorList = new ArrayList();
-
- IProject[] projs = ProjectUtilities.getAllProjects();
-
- for (int index = 0; index < projs.length; index++) {
- IProject flexProject = projs[index];
- try {
- if (flexProject != null) {
- if (ModuleCoreNature.isFlexibleProject(flexProject)) {
- IVirtualComponent comp = ComponentCore.createComponent(flexProject);
- if (J2EEProjectUtilities.isEARProject(comp.getProject())) {
- String sVer = J2EEProjectUtilities.getJ2EEProjectVersion(comp.getProject());
- int ver = J2EEVersionUtil.convertVersionStringToInt(sVer);
- if (j2eeVersion <= ver) {
- DataModelPropertyDescriptor desc = new DataModelPropertyDescriptor(comp.getProject().getName());
- earDescriptorList.add(desc);
- }
- }
- }
- }
- } finally {
- if (mc != null)
- mc.dispose();
- }
- }
- DataModelPropertyDescriptor[] descriptors = new DataModelPropertyDescriptor[earDescriptorList.size()];
- for (int i = 0; i < descriptors.length; i++) {
- DataModelPropertyDescriptor desc = (DataModelPropertyDescriptor) earDescriptorList.get(i);
- descriptors[i] = new DataModelPropertyDescriptor(desc.getPropertyDescription(), desc.getPropertyDescription());
- }
- return descriptors;
- }
-
-
-
- public IProject getProject() {
- String projName = getDataModel().getStringProperty(IComponentCreationDataModelProperties.PROJECT_NAME);
- if (projName != null && projName.length() > 0)
- return ProjectUtilities.getProject(projName);
- return null;
- }
-
- public WorkbenchComponent getTargetWorkbenchComponent() {
- StructureEdit core = null;
- try {
- IProject flexProject = getProject();
- if (flexProject != null) {
- core = StructureEdit.getStructureEditForRead(getProject());
- if (core != null) {
- String componentName = getProperty(COMPONENT_NAME) != null ? getProperty(COMPONENT_NAME).toString() : null;
- if (componentName != null)
- return core.getComponent();
- }
- }
- } finally {
- if (core != null)
- core.dispose();
- }
- return null;
- }
-
- protected boolean isEARSupported() {
- if (this instanceof EarComponentCreationDataModelProvider)
- return false;
- String serverID = model.getStringProperty(RUNTIME_TARGET_ID);
- IRuntime runtime = getServerTargetByID(serverID);
- Integer version = (Integer) model.getProperty(COMPONENT_VERSION);
- int nj2eeVer = convertModuleVersionToJ2EEVersion(version.intValue());
- String j2eeVer = J2EEVersionUtil.getJ2EETextVersion(nj2eeVer);
-
- if (runtime != null) {
- String msg = isTypeSupported(runtime.getRuntimeType(), J2EEProjectUtilities.ENTERPRISE_APPLICATION, j2eeVer);
- if (msg.equals(OK)) {
- return true;
- }
- }
- return false;
- }
-
- protected boolean validateComponentAlreadyInEar() {
- //IVirtualComponent component = ComponentCore.createComponent(getProject(), getModuleName());
-
- IProject earProj = (IProject) model.getProperty(EAR_COMPONENT_PROJECT);
- if (earProj != null && earProj.exists()) {
- IVirtualComponent earComp = ComponentCore.createComponent(earProj);
- if (earComp != null && earComp.exists()) {
- IVirtualReference[] refs = earComp.getReferences();
- for (int i = 0; i < refs.length; i++) {
- IVirtualReference ref = refs[i];
- IVirtualComponent referencedComp = ref.getReferencedComponent();
- if (referencedComp.getName().equalsIgnoreCase(getModuleName()))
- return true;
- }
- }
- }
- return false;
- }
-
- public IStatus validate(String propertyName) {
- if (EAR_COMPONENT_NAME.equals(propertyName) && getBooleanProperty(ADD_TO_EAR)) {
- return validateEARModuleNameProperty();
- } else if (COMPONENT_VERSION.equals(propertyName)) {
- return validateComponentVersionProperty();
- } else if (propertyName.equals(VALID_COMPONENT_VERSIONS_FOR_PROJECT_RUNTIME)) {
- return OK_STATUS;
- } else if (propertyName.equals(ADD_TO_EAR)) {
- boolean val = getBooleanProperty(ADD_TO_EAR);
- if (val) {
- String serverID = model.getStringProperty(RUNTIME_TARGET_ID);
- IRuntime runtime = getServerTargetByID(serverID);
- if (serverID.equals("") || runtime == null) { //$NON-NLS-1$
- String msg = EARCreationResourceHandler.SERVER_TARGET_NOT_SUPPORT_EAR;
- return WTPCommonPlugin.createErrorStatus(msg);
- }
- Integer version = (Integer) model.getProperty(COMPONENT_VERSION);
- int nj2eeVer = convertModuleVersionToJ2EEVersion(version.intValue());
- String j2eeVer = J2EEVersionUtil.getJ2EETextVersion(nj2eeVer);
- String msg = isTypeSupported(runtime.getRuntimeType(), J2EEProjectUtilities.ENTERPRISE_APPLICATION, j2eeVer);
- if (!msg.equals(OK)) {
- msg = EARCreationResourceHandler.SERVER_TARGET_NOT_SUPPORT_EAR;
- return WTPCommonPlugin.createErrorStatus(msg);
- }
- if (validateComponentAlreadyInEar()) {
- msg = J2EECreationResourceHandler.COMPONENT_ALREADYINEAR;
- return WTPCommonPlugin.createErrorStatus(msg);
- }
- }
- } else if (propertyName.equals(PROJECT_NAME)) {
- if (!isCreatingEarComponent()) {
- String projName = getDataModel().getStringProperty(IComponentCreationDataModelProperties.PROJECT_NAME);
- IDataModel earDM = (IDataModel) model.getProperty(NESTED_EAR_COMPONENT_CREATION_DM);
- IProject earProj = (IProject) earDM.getProperty(EAR_COMPONENT_PROJECT);
- if (earProj != null) {
- String earProjName = earProj.getName();
- if (earProjName.equalsIgnoreCase(projName)) {
- String msg = msg = EARCreationResourceHandler.EAR_PROJECTNAME_SAMEAS_MODULE;
- return WTPCommonPlugin.createErrorStatus(msg);
- }
- }
- }
- }
- return super.validate(propertyName);
- }
-
- protected boolean isCreatingEarComponent() {
- return false;
- }
-
- private IStatus validateComponentVersionProperty() {
- int componentVersion = model.getIntProperty(COMPONENT_VERSION);
- String result = isvalidJComponentVersionsSupportedByServer();
- if (result.equals(MODULEVERSION_NOT_SUPPORTED)) {
- return WTPCommonPlugin.createErrorStatus(WTPCommonPlugin.getResourceString(WTPCommonMessages.SPEC_LEVEL_NOT_FOUND));
- } else if (result.equals(MODULE_NOT_SUPPORTED)) {
- return WTPCommonPlugin.createErrorStatus(WTPCommonPlugin.getResourceString(WTPCommonMessages.MODULE_NOT_SUPPORTED));
- }
- if (componentVersion == -1)
- return WTPCommonPlugin.createErrorStatus(WTPCommonPlugin.getResourceString(WTPCommonMessages.SPEC_LEVEL_NOT_FOUND));
- return OK_STATUS;
- }
-
- private IStatus validateEARModuleNameProperty() {
- IStatus status = OK_STATUS;
- String earName = getStringProperty(EAR_COMPONENT_NAME);
- if (status.isOK()) {
- if (earName.indexOf("#") != -1 || earName.indexOf("/") != -1) { //$NON-NLS-1$ //$NON-NLS-2$
- String errorMessage = WTPCommonPlugin.getResourceString(WTPCommonMessages.ERR_INVALID_CHARS);
- return WTPCommonPlugin.createErrorStatus(errorMessage);
- } else if (earName == null || earName.equals("")) { //$NON-NLS-1$
- String errorMessage = WTPCommonPlugin.getResourceString(WTPCommonMessages.ERR_EMPTY_MODULE_NAME);
- return WTPCommonPlugin.createErrorStatus(errorMessage);
- }
- } else
- return status;
- // IProject earProject =
- // applicationCreationDataModel.getTargetProject();
- // if (null != earProject && earProject.exists()) {
- // if (earProject.isOpen()) {
- // try {
- // EARNatureRuntime earNature = (EARNatureRuntime)
- // earProject.getNature(IEARNatureConstants.NATURE_ID);
- // if (earNature == null) {
- // return
- // WTPCommonPlugin.createErrorStatus(WTPCommonPlugin.getResourceString(WTPCommonMessages.PROJECT_NOT_EAR,
- // new Object[]{earProject.getName()}));
- // } else if (earNature.getJ2EEVersion() < getJ2EEVersion()) {
- // String earVersion =
- // EnterpriseApplicationCreationDataModel.getVersionString(earNature.getJ2EEVersion());
- // return
- // WTPCommonPlugin.createErrorStatus(WTPCommonPlugin.getResourceString(WTPCommonMessages.INCOMPATABLE_J2EE_VERSIONS,
- // new Object[]{earProject.getName(), earVersion}));
- // }
- // return OK_STATUS;
- // } catch (CoreException e) {
- // return new Status(IStatus.ERROR, J2EEPlugin.PLUGIN_ID, -1, null, e);
- // }
- // }
- // return
- // WTPCommonPlugin.createErrorStatus(WTPCommonPlugin.getResourceString(WTPCommonMessages.PROJECT_ClOSED,
- // new Object[]{earProject.getName()}));
- // } else if (null != earProject && null != getTargetProject()) {
- // if (earProject.getName().equals(getTargetProject().getName())) {
- // return
- // WTPCommonPlugin.createErrorStatus(WTPCommonPlugin.getResourceString(WTPCommonMessages.SAME_MODULE_AND_EAR_NAME,
- // new Object[]{earProject.getName()}));
- // } else if (!CoreFileSystemLibrary.isCaseSensitive()) {
- // if
- // (earProject.getName().toLowerCase().equals(getTargetProject().getName().toLowerCase()))
- // {
- // return
- // WTPCommonPlugin.createErrorStatus(WTPCommonPlugin.getResourceString(WTPCommonMessages.SAME_MODULE_AND_EAR_NAME,
- // new Object[]{earProject.getName()}));
- // }
- // }
- // }
- // IStatus status =
- // applicationCreationDataModel.validateProperty(EnterpriseApplicationCreationDataModel.PROJECT_NAME);
- // if (status.isOK()) {
- // status =
- // applicationCreationDataModel.validateProperty(EnterpriseApplicationCreationDataModel.PROJECT_LOCATION);
- // }
- // return status;
-
- return WTPCommonPlugin.OK_STATUS;
- }
-
- public final ClassPathSelection getClassPathSelection() {
- // boolean createNew = false;
- // if (null == cachedSelection ||
- // !getApplicationCreationDataModel().getTargetProject().getName().equals(cachedSelection.getEARFile().getURI()))
- // {
- // createNew = true;
- // }
- // // close an existing cachedSelection
- // if (createNew && cachedSelection != null) {
- // EARFile earFile = cachedSelection.getEARFile();
- // if (earFile != null)
- // earFile.close();
- // }
- //
- // if (createNew && getTargetProject() != null) {
- // cachedSelection =
- // ClasspathSelectionHelper.createClasspathSelection(getTargetProject(),
- // getModuleExtension(),
- // getApplicationCreationDataModel().getTargetProject(),
- // getModuleType());
- // }
- // return cachedSelection;
- return null;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.wst.common.frameworks.internal.operation.WTPOperationDataModel#dispose()
- */
- public void dispose() {
- super.dispose();
- }
-
- // public void propertyChanged(WTPOperationDataModelEvent event) {
- // super.propertyChanged(event);
- // if (event.getDataModel() == addComponentToEARDataModel && event.getFlag()
- // == WTPOperationDataModelEvent.PROPERTY_CHG &&
- // event.getPropertyName().equals(ArtifactEditOperationDataModel.PROJECT_NAME))
- // {
- // earComponentCreationDataModel.setProperty(EARComponentCreationDataModel.COMPONENT_NAME,
- // event.getProperty());
- // }
- // }
- protected final IDataModel getAddComponentToEARDataModel() {
- // return (AddComponentToEnterpriseApplicationDataModel)
- // model.getProperty(NESTED_ADD_COMPONENT_TO_EAR_DM);
- return (IDataModel) model.getProperty(NESTED_ADD_COMPONENT_TO_EAR_DM);
- }
-
- protected final IDataModel getUpdateManifestDataModel() {
- return (IDataModel) model.getProperty(NESTED_UPDATE_MANIFEST_DM);
- }
-
- public String getModuleName() {
- return getDataModel().getStringProperty(COMPONENT_NAME);
- }
-
- public final int getJ2EEVersion() {
- return convertModuleVersionToJ2EEVersion(getIntProperty(COMPONENT_VERSION));
- }
-
- /**
- * Subclasses should override to convert the j2eeVersion to a module version id. By default we
- * return the j2eeVersion which is fine if no conversion is necessary.
- *
- * @param integer
- * @return
- */
- protected Integer convertJ2EEVersionToModuleVersion(Integer j2eeVersion) {
- return j2eeVersion;
- }
-
- protected abstract int convertModuleVersionToJ2EEVersion(int moduleVersion);
-
- protected abstract DataModelPropertyDescriptor[] getValidComponentVersionDescriptors();
-
-
-// private DataModelPropertyDescriptor[] validExistingProjectsDescriptors() {
-//
-// IProject[] workspaceProjects = ProjectUtilities.getAllProjects();
-// List items = new ArrayList();
-// for (int i = 0; i < workspaceProjects.length; i++) {
-// IProject project = workspaceProjects[i];
-// try {
-// if (project.hasNature(IModuleConstants.MODULE_NATURE_ID)) {
-// items.add(project.getName());
-// }
-// } catch (CoreException ce) {
-// // Ignore
-// }
-// }
-//
-// DataModelPropertyDescriptor[] descriptors = new DataModelPropertyDescriptor[items.size()];
-// for (int i = 0; i < descriptors.length; i++) {
-// descriptors[i] = new DataModelPropertyDescriptor(items.get(i));
-// }
-// return descriptors;
-//
-//
-// // StructureEdit mc = null;
-// // ArrayList earDescriptorList = new ArrayList();
-// //
-// // IProject[] projs = ProjectUtilities.getAllProjects();
-// //
-// // for (int index = 0; index < projs.length; index++) {
-// // IProject flexProject = projs[index];
-// // try {
-// // if (flexProject != null) {
-// // IFlexibleProject fProject = ComponentCore.createFlexibleProject(flexProject);
-// // if ( fProject.isFlexible()){
-// // IVirtualComponent[] comps = fProject.getComponents();
-// // int earVersion = 0;
-// // for( int i=0; i< comps.length; i++ ){
-// // if( comps[i].getComponentTypeId().equals(IModuleConstants.JST_EAR_MODULE)){
-// // String sVer = comps[i].getVersion();
-// // int ver = J2EEVersionUtil.convertVersionStringToInt(sVer);
-// // if (j2eeVersion <= ver) {
-// // DataModelPropertyDescriptor desc = new
-// // DataModelPropertyDescriptor(comps[i].getComponentHandle(), comps[i].getName());
-// // earDescriptorList.add(desc);
-// // }
-// // }
-// // }
-// // }
-// // }
-// // } finally {
-// // if (mc != null)
-// // mc.dispose();
-// // }
-// // }
-// // DataModelPropertyDescriptor[] descriptors = new
-// // DataModelPropertyDescriptor[earDescriptorList.size()];
-// // for (int i = 0; i < descriptors.length; i++) {
-// // DataModelPropertyDescriptor desc = (DataModelPropertyDescriptor)earDescriptorList.get(i);
-// // descriptors[i] = new DataModelPropertyDescriptor(desc.getPropertyDescription(),
-// // desc.getPropertyDescription());
-// // }
-// // return descriptors;
-//
-//
-// }
-} \ 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 2451b313c..000000000
--- a/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/application/internal/operations/J2EEComponentImportDataModelProvider.java
+++ /dev/null
@@ -1,61 +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 java.util.Set;
-
-import org.eclipse.jst.j2ee.commonarchivecore.internal.ModuleFile;
-import org.eclipse.jst.j2ee.commonarchivecore.internal.util.ArchiveUtil;
-import org.eclipse.jst.j2ee.datamodel.properties.IJ2EEComponentCreationDataModelProperties;
-import org.eclipse.jst.j2ee.datamodel.properties.IJ2EEModuleImportDataModelProperties;
-import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
-
-/**
- * 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;
- }
-
- private int getModuleSpecVersion() {
- if (!isPropertySet(EXTENDED_IMPORT_FACTORY)) {
- return ArchiveUtil.getFastSpecVersion(getModuleFile());
- }
- ExtendedImportFactory factory = (ExtendedImportFactory) getProperty(EXTENDED_IMPORT_FACTORY);
- return factory.getSpecVersion(getModuleFile());
- }
-
- public boolean propertySet(String propertyName, Object propertyValue) {
- boolean set = super.propertySet(propertyName, propertyValue);
- if (propertyName.equals(FILE)) {
- IDataModel moduleDM = model.getNestedModel(NESTED_MODEL_J2EE_COMPONENT_CREATION);
- if (getModuleFile() != null) {
- moduleDM.setIntProperty(IJ2EEComponentCreationDataModelProperties.COMPONENT_VERSION, getModuleSpecVersion());
- model.notifyPropertyChange(PROJECT_NAME, IDataModel.VALID_VALUES_CHG);
- }
- }
- return set;
- }
-
- protected ModuleFile getModuleFile() {
- return (ModuleFile) getArchiveFile();
- }
-}
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 16e4ff05b..000000000
--- a/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/application/internal/operations/J2EEUtilityJarImportDataModelProvider.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-/*
- * Created on Dec 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.internal.archive.operations.JavaComponentCreationDataModelProvider;
-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_COMPONENT_NAME);
- 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 JavaComponentCreationDataModelProvider());
- }
-
- 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 889658738..000000000
--- a/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/application/internal/operations/J2EEUtilityJarImportOperationNew.java
+++ /dev/null
@@ -1,133 +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.core.commands.ExecutionException;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.runtime.IAdaptable;
-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.SubProgressMonitor;
-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.logger.proxy.Logger;
-import org.eclipse.jem.workbench.utility.JemProjectUtilities;
-import org.eclipse.jst.j2ee.commonarchivecore.internal.Archive;
-import org.eclipse.jst.j2ee.commonarchivecore.internal.exception.SaveFailureException;
-import org.eclipse.jst.j2ee.datamodel.properties.IJ2EEComponentImportDataModelProperties;
-import org.eclipse.jst.j2ee.datamodel.properties.IJavaComponentCreationDataModelProperties;
-import org.eclipse.jst.j2ee.internal.archive.operations.J2EEJavaComponentSaveStrategyImpl;
-import org.eclipse.jst.j2ee.internal.project.J2EEProjectUtilities;
-import org.eclipse.jst.j2ee.project.facet.IJ2EEModuleFacetInstallDataModelProperties;
-import org.eclipse.jst.j2ee.project.facet.UtilityProjectCreationDataModelProvider;
-import org.eclipse.wst.common.componentcore.ComponentCore;
-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.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;
-import org.eclipse.wst.common.project.facet.core.runtime.IRuntime;
-import org.eclipse.wst.common.project.facet.core.runtime.RuntimeManager;
-import org.eclipse.wst.server.core.ServerCore;
-
-/**
- * @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 AbstractDataModelOperation {
-
- public J2EEUtilityJarImportOperationNew(IDataModel dataModel) {
- super(dataModel);
- }
-
- public IStatus execute(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
- IDataModel utilityCreationDataModel = DataModelFactory.createDataModel(new UtilityProjectCreationDataModelProvider());
- String projectName = model.getStringProperty(IJ2EEComponentImportDataModelProperties.PROJECT_NAME);
- utilityCreationDataModel.setStringProperty(IFacetProjectCreationDataModelProperties.FACET_PROJECT_NAME, projectName);
- String runtime = model.getStringProperty(IJavaComponentCreationDataModelProperties.RUNTIME_TARGET_ID);
- IRuntime facetRuntime = null;
- try {
- runtime = ServerCore.findRuntime(runtime).getName();
- facetRuntime = RuntimeManager.getRuntime(runtime);
- } catch (Exception e) {
- // proceed with facetRuntime = null
- }
- utilityCreationDataModel.setProperty(IFacetProjectCreationDataModelProperties.FACET_RUNTIME, facetRuntime);
- FacetDataModelMap map = (FacetDataModelMap)utilityCreationDataModel.getProperty(IFacetProjectCreationDataModelProperties.FACET_DM_MAP);
- map.getFacetDataModel(J2EEProjectUtilities.UTILITY).setBooleanProperty(IJ2EEModuleFacetInstallDataModelProperties.ADD_TO_EAR, false);
-
- utilityCreationDataModel.getDefaultOperation().execute(monitor, info);
-
- IProject javaProject = ProjectUtilities.getProject(projectName);
- IVirtualComponent component = ComponentCore.createComponent(javaProject);
-
- Archive jarFile = (Archive) model.getProperty(IJ2EEComponentImportDataModelProperties.FILE);
-
- J2EEJavaComponentSaveStrategyImpl strat = new J2EEJavaComponentSaveStrategyImpl(component);
-
- strat.setProgressMonitor(new SubProgressMonitor(monitor, 1));
- try {
- jarFile.save(strat);
- // To fix the defect that throws dup classpath exception.
- // Because JemProjectUtilities.appendJavaClassPath() does not check dups, we have to
- // check it here.
- // check if JRE_CONTAINER is in the classpath. if not add it
- IJavaProject javaProj = JemProjectUtilities.getJavaProject(javaProject);
- IClasspathEntry[] classpath = javaProj.getRawClasspath();
- String jrePathName = "org.eclipse.jdt.launching.JRE_CONTAINER"; //$NON-NLS-1$
- boolean exists = false;
- for (int i = 0; i < classpath.length; i++) {
- if (classpath[i].getEntryKind() != IClasspathEntry.CPE_CONTAINER)
- continue;
- IPath path = classpath[i].getPath();
- if (path.segmentCount() > 0) {
- String name = path.segment(0).toString();
- if (jrePathName.equals(name)) {
- exists = true;
- break;
- }
- }
- }
- if (!exists) {
- /**
- * Warning clean-up 12/05/2005
- */
- //IClasspathEntry newEntry = JavaCore.newContainerEntry(new Path(jrePathName));
- JemProjectUtilities.appendJavaClassPath(javaProject, JavaCore.newContainerEntry(new Path("org.eclipse.jdt.launching.JRE_CONTAINER"))); //$NON-NLS-1$)
- JemProjectUtilities.forceClasspathReload(javaProject);
- }
- } catch (SaveFailureException e) {
- Logger.getLogger().logError(e);
- } catch (JavaModelException je) {
- Logger.getLogger().logError(je);
- }
- 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/J2EEUtilityJarListImportDataModelProvider.java b/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/application/internal/operations/J2EEUtilityJarListImportDataModelProvider.java
deleted file mode 100644
index b92188d53..000000000
--- a/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/application/internal/operations/J2EEUtilityJarListImportDataModelProvider.java
+++ /dev/null
@@ -1,338 +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 May 13, 2004
- *
- * TODO 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.io.File;
-import java.util.ArrayList;
-import java.util.Arrays;
-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.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.wst.common.frameworks.datamodel.AbstractDataModelProvider;
-import org.eclipse.wst.common.frameworks.datamodel.DataModelPropertyDescriptor;
-import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
-
-/**
- * @author mdelder
- *
- * TODO To change the template for this generated type comment go to Window - Preferences - Java -
- * Code Generation - Code and Comments
- */
-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);
- 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));
- }
-
- /*
- * (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.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.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() {
- List projects = Arrays.asList(ResourcesPlugin.getWorkspace().getRoot().getProjects());
- List projectsWithNature = new ArrayList();
-
- for (int i = 0; i < projects.size(); i++) {
- IProject project = (IProject) projects.get(i);
- //TODO filter only on ear projects
- if (project.isOpen()) {
- projectsWithNature.add(project.getFullPath().toString());
- }
- }
-
- return ProjectUtilities.getProjectNamesWithoutForwardSlash((String[]) projectsWithNature.toArray(new String[projectsWithNature.size()]));
- }
-
- public IStatus validate(String propertyName) {
- if (EAR_PROJECT.equals(propertyName) /* && isSet(EAR_PROJECT) */) {
- String earProjectName = getStringProperty(EAR_PROJECT);
- 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 (PROJECT_ROOT.equals(propertyName)) {
- return validateProjectRoot();
- }
- return 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/RemoveComponentFromEnterpriseApplicationOperation.java b/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/application/internal/operations/RemoveComponentFromEnterpriseApplicationOperation.java
deleted file mode 100644
index 95ef8cae8..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 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.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.componentcore.util.EARArtifactEdit;
-import org.eclipse.jst.j2ee.internal.project.J2EEProjectUtilities;
-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.frameworks.datamodel.IDataModel;
-
-public class RemoveComponentFromEnterpriseApplicationOperation extends RemoveReferenceComponentOperation {
-
-
- public RemoveComponentFromEnterpriseApplicationOperation(IDataModel model) {
- super(model);
- }
-
- public IStatus execute(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
- super.execute(monitor, info);
- updateEARDD(monitor);
- return OK_STATUS;
- }
-
-
- protected void updateEARDD(IProgressMonitor monitor) {
-
- EARArtifactEdit earEdit = null;
- try {
- IVirtualComponent comp = (IVirtualComponent) model.getProperty(ICreateReferenceComponentsDataModelProperties.SOURCE_COMPONENT);
- if (!comp.getProject().isAccessible()) return;
- earEdit = EARArtifactEdit.getEARArtifactEditForWrite(comp.getProject());
- if (earEdit != null) {
- Application application = earEdit.getApplication();
- 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);
- removeModule(application, wc);
- }
- }
- }
- earEdit.saveIfNecessary(monitor);
- } catch (Exception e) {
- Logger.getLogger().logError(e);
- } finally {
- if (earEdit != null)
- earEdit.dispose();
- }
- }
-
- protected void removeModule(Application application, IVirtualComponent wc) {
- Application dd = application;
- String name = wc.getName();
- if (J2EEProjectUtilities.isDynamicWebProject(wc.getProject())) {
- name += ".war"; //$NON-NLS-1$
- } else if (J2EEProjectUtilities.isEJBProject(wc.getProject())) {
- name += ".jar"; //$NON-NLS-1$
- } else if (J2EEProjectUtilities.isApplicationClientProject(wc.getProject())) {
- name += ".jar"; //$NON-NLS-1$
- } else if (J2EEProjectUtilities.isJCAProject(wc.getProject())) {
- name += ".rar"; //$NON-NLS-1$
- }
- Module existingModule = dd.getFirstModule(name);
- dd.getModules().remove(existingModule);
-
- }
-
- 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/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 5a7c6116b..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, 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 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/componentcore/util/EARArtifactEdit.java b/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/componentcore/util/EARArtifactEdit.java
deleted file mode 100644
index 26eaaf96f..000000000
--- a/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/componentcore/util/EARArtifactEdit.java
+++ /dev/null
@@ -1,570 +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.componentcore.util;
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-
-import org.eclipse.core.resources.IProject;
-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.logger.proxy.Logger;
-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.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.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.internal.project.J2EEProjectUtilities;
-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.WorkbenchComponent;
-import org.eclipse.wst.common.componentcore.internal.impl.ModuleURIUtil;
-import org.eclipse.wst.common.componentcore.internal.util.IArtifactEditFactory;
-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{
-
- public static final Class ADAPTER_TYPE = EARArtifactEdit.class;
-
- /**
- *
- */
- public EARArtifactEdit() {
- super();
- }
-
- /**
- * @param aHandle
- * @param toAccessAsReadOnly
- * @throws IllegalArgumentException
- */
- public EARArtifactEdit(IProject aProject, boolean toAccessAsReadOnly) throws IllegalArgumentException {
- super(aProject, toAccessAsReadOnly);
- }
-
- //This should be revereted to protected when 115924 is fixed
- public EARArtifactEdit(IProject aProject, boolean toAccessAsReadOnly, boolean forCreate) throws IllegalArgumentException {
- super(aProject, toAccessAsReadOnly, forCreate, J2EEProjectUtilities.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 J2EEProjectUtilities.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() {
- return getApplicationXmiResource().getJ2EEVersionID();
- }
-
- /**
- *
- * @return ApplicationResource from (@link getDeploymentDescriptorResource())
- *
- */
-
- public ApplicationResource getApplicationXmiResource() {
- 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() {
- return (Application) getDeploymentDescriptorRoot();
- }
-
- /**
- * <p>
- * Retrieves the resource from the {@see ArtifactEditModel}
- * </p>
- *
- * @return Resource
- *
- */
-
- public Resource getDeploymentDescriptorResource() {
- 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) {
- 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) {
- if (currentURI != null) {
- IVirtualComponent comp = ComponentCore.createComponent(getProject());
- if (comp == null)
- return false;
- IVirtualReference[] refComponents = comp.getReferences();
- if (refComponents.length == 0)
- return false;
- for (int i = 0; i < refComponents.length; i++) {
- if (refComponents[i].getRuntimePath().equals(currentURI))
- return true;
- }
- } // if
- return false;
- } // uriExists
-
-
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.jst.j2ee.internal.modulecore.util.EnterpriseArtifactEdit#createModelRoot()
- */
- public EObject createModelRoot() {
- return createModelRoot(getJ2EEVersion());
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.jst.j2ee.internal.modulecore.util.EnterpriseArtifactEdit#createModelRoot(java.lang.Integer)
- */
- public EObject createModelRoot(int version) {
- 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() {
- List utilityModuleTypes = new ArrayList();
- utilityModuleTypes.add(J2EEProjectUtilities.UTILITY);
- return getComponentReferences(utilityModuleTypes);
- }
-
- public String getModuleURI(IVirtualComponent moduleComp) {
-
- StructureEdit core = null;
- try {
- core = StructureEdit.getStructureEditForRead(getProject());
- WorkbenchComponent component = core.getComponent();
- List referencedComponents = component.getReferencedComponents();
-
- for (int i=0; i<referencedComponents.size(); i++) {
- ReferencedComponent ref = (ReferencedComponent) referencedComponents.get(i);
- if( !moduleComp.isBinary()) {
- if (ref.getHandle().equals(ModuleURIUtil.fullyQualifyURI(moduleComp.getProject()))) {
- if (ref.getDependentObject()!=null)
- return ((Module)ref.getDependentObject()).getUri();
- //If dependent object is not set, assume compname is module name + proper extension
- if (J2EEProjectUtilities.isDynamicWebProject(moduleComp.getProject()) || J2EEProjectUtilities.isStaticWebProject(moduleComp.getProject()))
- return moduleComp.getName()+IJ2EEModuleConstants.WAR_EXT;
- if (J2EEProjectUtilities.isJCAProject(moduleComp.getProject()))
- return moduleComp.getName()+IJ2EEModuleConstants.RAR_EXT;
- return moduleComp.getName()+IJ2EEModuleConstants.JAR_EXT;
- }
-
- }
- else if (moduleComp.isBinary()) {
- if (ref.getHandle().equals(ModuleURIUtil.archiveComponentfullyQualifyURI(moduleComp.getName())));
- return ((Module)ref.getDependentObject()).getUri();
- }
- }
- } finally {
- if (core != null)
- core.dispose();
- }
- return null;
- }
-
- public IVirtualComponent getModuleByManifestURI(final String uri){
- StructureEdit core = null;
- try {
- core = StructureEdit.getStructureEditForRead(getProject());
- WorkbenchComponent component = core.getComponent();
- List referencedComponents = component.getReferencedComponents();
-
- for (int i=0; i<referencedComponents.size(); i++) {
- ReferencedComponent ref = (ReferencedComponent) referencedComponents.get(i);
- if(ref.getDependentObject() != null){
- Module module = (Module)ref.getDependentObject();
- if(uri.equals(module.getUri())){
- String componentName;
- try {
- componentName = ModuleURIUtil.getArchiveName(ref.getHandle());
- return getModule(componentName);
- } catch (UnresolveableURIException e) {
- Logger.getLogger().logError(e);
- }
- }
- }
- }
- } finally {
- if (core != null)
- core.dispose();
- }
- 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
- */
- 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
- */
- public IVirtualReference[] getJ2EEModuleReferences() {
- List j2eeTypes = new ArrayList();
- j2eeTypes.add(J2EEProjectUtilities.APPLICATION_CLIENT);
- j2eeTypes.add(J2EEProjectUtilities.JCA);
- j2eeTypes.add(J2EEProjectUtilities.EJB);
- j2eeTypes.add(J2EEProjectUtilities.DYNAMIC_WEB);
- return getComponentReferences(j2eeTypes);
- }
-
- /**
- * 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
- */
- public IVirtualReference[] getComponentReferences() {
- return getComponentReferences(Collections.EMPTY_LIST);
- }
- /**
- * This method will return the IVirtualReference to the component of the given name
- *
- * @return - IVirtualReference or null if not found
- */
- public IVirtualReference getComponentReference(String componentName) {
- IVirtualReference[] refs = getComponentReferences(Collections.EMPTY_LIST);
- for (int i = 0; i < refs.length; i++) {
- IVirtualReference reference = refs[i];
- if (reference.getReferencedComponent().getName().equals(componentName))
- return reference;
-
- }
- return null;
- }
-
- private IVirtualReference[] getComponentReferences(List componentTypes) {
- List components = new ArrayList();
- IVirtualComponent earComponent = getComponent();
- if (earComponent != null && J2EEProjectUtilities.isEARProject(earComponent.getProject())) {
- IVirtualReference[] refComponents = earComponent.getReferences();
- for (int i = 0; i < refComponents.length; i++) {
- IVirtualComponent module = refComponents[i].getReferencedComponent();
- if (module == null || module.getProject() == null || !module.getProject().isAccessible())
- 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(J2EEProjectUtilities.getJ2EEProjectType(module.getProject()))) {
- components.add(refComponents[i]);
- }
- }
- }
- }
- return (IVirtualReference[]) components.toArray(new IVirtualReference[components.size()]);
- }
-
- public ArtifactEdit createArtifactEditForRead(IVirtualComponent aComponent) {
-
- return getEARArtifactEditForRead(aComponent);
- }
-
- public ArtifactEdit createArtifactEditForWrite(IVirtualComponent aComponent) {
-
- return getEARArtifactEditForWrite(aComponent);
- }
-
- public Archive asArchive(boolean includeSource) throws OpenFailureException {
- EARComponentLoadStrategyImpl loader = new EARComponentLoadStrategyImpl(getComponent());
- loader.setExportSource(includeSource);
- String uri = ModuleURIUtil.getHandleString(getComponent());
- return CommonarchiveFactory.eINSTANCE.openEARFile(loader, uri);
- }
-
- public static void createDeploymentDescriptor(IProject project, int version) {
- EARArtifactEdit earEdit = new EARArtifactEdit(project,false,true);
- try {
- earEdit.createModelRoot(version);
- earEdit.save(null);
- } finally {
- earEdit.dispose();
- }
- }
-}
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/internal/earcreation/DefaultJ2EEComponentCreationDataModelProvider.java b/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/internal/earcreation/DefaultJ2EEComponentCreationDataModelProvider.java
deleted file mode 100644
index 90836a7cf..000000000
--- a/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/internal/earcreation/DefaultJ2EEComponentCreationDataModelProvider.java
+++ /dev/null
@@ -1,420 +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 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.datamodel.properties.IJ2EEComponentCreationDataModelProperties;
-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.IJ2EEModuleFacetInstallDataModelProperties;
-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.frameworks.internal.plugin.WTPCommonMessages;
-import org.eclipse.wst.common.frameworks.internal.plugin.WTPCommonPlugin;
-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);
-
- 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);
- }
- }
- 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);
- }
- }
- 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);
- }
- }
- }
-
- 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(IJ2EEComponentCreationDataModelProperties.PROJECT_NAME);
- projectName = WTPPlugin.isPlatformCaseSensitive() ? actualProjectName : actualProjectName.toLowerCase();
- list.add(projectName);
- errorNoSelection = false;
- }
- if (getBooleanProperty(CREATE_EJB)) {
- actualProjectName = ejbModel.getStringProperty(IJ2EEComponentCreationDataModelProperties.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(IJ2EEComponentCreationDataModelProperties.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(IJ2EEComponentCreationDataModelProperties.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 (propertyName.equals(APPCLIENT_COMPONENT_NAME)) {
- return validateComponentName(getStringProperty(APPCLIENT_COMPONENT_NAME));
- }
- if (propertyName.equals(WEB_COMPONENT_NAME)) {
- return validateComponentName(getStringProperty(WEB_COMPONENT_NAME));
- }
- if (propertyName.equals(EJB_COMPONENT_NAME)) {
- return validateComponentName(getStringProperty(EJB_COMPONENT_NAME));
- }
- if (propertyName.equals(CONNECTOR_COMPONENT_NAME)) {
- return validateComponentName(getStringProperty(CONNECTOR_COMPONENT_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);
- }
-
- private void setNestedJ2EEVersion(Object j2eeVersion) {
- int j2eeVer = ((Integer) j2eeVersion).intValue();
- if (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);
- }
- if (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);
- }
- if (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);
- }
- if (clientFacetModel != null){
- String facetVersionString = J2EEVersionUtil.convertVersionIntToString(j2eeVer);
- IProjectFacetVersion facetVersion = ProjectFacetsManager.getProjectFacet(clientFacetModel.getStringProperty(IFacetDataModelProperties.FACET_ID)).getVersion(facetVersionString);
- clientFacetModel.setProperty(IFacetDataModelProperties.FACET_VERSION, 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) || propertyName.equals(CONNECTOR_COMPONENT_NAME)) {
- int version = getIntProperty(J2EE_VERSION);
- boolean result = version > J2EEVersionConstants.J2EE_1_2_ID;
- return result;
- }
- 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 1909982d6..000000000
--- a/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/internal/earcreation/EARCreationResourceHandler.java
+++ /dev/null
@@ -1,105 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jst.j2ee.internal.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_0;
- public static String J2EEUtilityJarListImportOperation_UI_1;
- 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 EARImportDataModel_UI_0;
- public static String EARImportDataModel_UI_1;
- public static String EARImportDataModel_UI_2;
- public static String EARImportDataModel_UI_3;
- 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/EarComponentCreationDataModelProvider.java b/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/internal/earcreation/EarComponentCreationDataModelProvider.java
deleted file mode 100644
index 2b9fe878e..000000000
--- a/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/internal/earcreation/EarComponentCreationDataModelProvider.java
+++ /dev/null
@@ -1,236 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jst.j2ee.internal.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.IPath;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.emf.ecore.EClass;
-import org.eclipse.jem.util.emf.workbench.ProjectUtilities;
-import org.eclipse.jst.j2ee.application.internal.operations.J2EEComponentCreationDataModelProvider;
-import org.eclipse.jst.j2ee.commonarchivecore.internal.impl.CommonarchiveFactoryImpl;
-import org.eclipse.jst.j2ee.datamodel.properties.IEarComponentCreationDataModelProperties;
-import org.eclipse.jst.j2ee.internal.J2EEVersionConstants;
-import org.eclipse.jst.j2ee.internal.common.J2EEVersionUtil;
-import org.eclipse.jst.j2ee.internal.plugin.J2EEPlugin;
-import org.eclipse.jst.j2ee.internal.project.J2EEProjectUtilities;
-import org.eclipse.jst.j2ee.project.facet.EARFacetProjectCreationDataModelProvider;
-import org.eclipse.wst.common.componentcore.ComponentCore;
-import org.eclipse.wst.common.componentcore.resources.IVirtualComponent;
-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.frameworks.internal.plugin.WTPCommonPlugin;
-import org.eclipse.wst.server.core.IRuntime;
-import org.eclipse.wst.server.core.IRuntimeType;
-import org.eclipse.wst.server.core.ServerCore;
-
-/**
- * @deprecated
- * @see EARFacetProjectCreationDataModelProvider
- */
-
-public class EarComponentCreationDataModelProvider extends J2EEComponentCreationDataModelProvider implements IEarComponentCreationDataModelProperties {
-
- public IDataModelOperation getDefaultOperation() {
- //return new EARComponentCreationOperation(model);
- return new EarComponentCreationFacetOperation(model);
- }
-
- /**
- * @return Returns the default J2EE spec level based on the Global J2EE
- * Preference
- */
- protected Integer getDefaultComponentVersion() {
- int highestJ2EEPref = J2EEPlugin.getDefault().getJ2EEPreferences().getHighestJ2EEVersionID();
- switch (highestJ2EEPref) {
- case (J2EEVersionConstants.J2EE_1_4_ID):
- return new Integer(J2EEVersionConstants.J2EE_1_4_ID);
- case (J2EEVersionConstants.J2EE_1_3_ID):
- return new Integer(J2EEVersionConstants.J2EE_1_3_ID);
- case (J2EEVersionConstants.J2EE_1_2_ID):
- return new Integer(J2EEVersionConstants.J2EE_1_2_ID);
- default:
- return new Integer(J2EEVersionConstants.J2EE_1_4_ID);
- }
- }
-
- public Set getPropertyNames(){
- Set propertyNames = super.getPropertyNames();
- propertyNames.add(J2EE_PROJECTS_LIST);
- propertyNames.add(JAVA_PROJECT_LIST);
- return propertyNames;
- }
-
- public Object getDefaultProperty(String propertyName) {
- if (propertyName.equals(DD_FOLDER)) {
- return IPath.SEPARATOR + "META_INF"; //$NON-NLS-1$
- } else if (propertyName.equals(UI_SHOW_EAR_SECTION)) {
- return Boolean.FALSE;
- } else if (propertyName.equals(J2EE_PROJECTS_LIST)) {
- return Collections.EMPTY_LIST;
- }else if (propertyName.equals(JAVA_PROJECT_LIST)){
- return Collections.EMPTY_LIST;
- } else if(propertyName.equals(NESTED_EAR_COMPONENT_CREATION_DM)){
- return model;
- }
- return super.getDefaultProperty(propertyName);
- }
-
- public DataModelPropertyDescriptor getPropertyDescriptor(String propertyName) {
- if (propertyName.equals(COMPONENT_VERSION)) {
- Integer propertyValue = (Integer) getProperty(propertyName);
- String description = null;
- switch (propertyValue.intValue()) {
- case J2EEVersionConstants.VERSION_1_2:
- description = J2EEVersionConstants.VERSION_1_2_TEXT;
- break;
- case J2EEVersionConstants.VERSION_1_3:
- description = J2EEVersionConstants.VERSION_1_3_TEXT;
- break;
- case J2EEVersionConstants.VERSION_1_4:
- default:
- description = J2EEVersionConstants.VERSION_1_4_TEXT;
- break;
- }
- return new DataModelPropertyDescriptor(propertyValue, description);
- }
- return super.getPropertyDescriptor(propertyName);
- }
-
- public DataModelPropertyDescriptor[] getValidComponentVersionDescriptors() {
- int highestJ2EEPref = J2EEPlugin.getDefault().getJ2EEPreferences().getHighestJ2EEVersionID();
- DataModelPropertyDescriptor[] descriptors = null;
- switch (highestJ2EEPref) {
- case J2EEVersionConstants.J2EE_1_2_ID:
- descriptors = new DataModelPropertyDescriptor[1];
- descriptors[0] = new DataModelPropertyDescriptor(new Integer(J2EEVersionConstants.J2EE_1_2_ID), J2EEVersionConstants.VERSION_1_2_TEXT);
- break;
- case J2EEVersionConstants.J2EE_1_3_ID:
- descriptors = new DataModelPropertyDescriptor[2];
- descriptors[0] = new DataModelPropertyDescriptor(new Integer(J2EEVersionConstants.J2EE_1_2_ID), J2EEVersionConstants.VERSION_1_2_TEXT);
- descriptors[1] = new DataModelPropertyDescriptor(new Integer(J2EEVersionConstants.J2EE_1_3_ID), J2EEVersionConstants.VERSION_1_3_TEXT);
- break;
- case J2EEVersionConstants.J2EE_1_4_ID:
- default:
- descriptors = new DataModelPropertyDescriptor[3];
- descriptors[0] = new DataModelPropertyDescriptor(new Integer(J2EEVersionConstants.J2EE_1_2_ID), J2EEVersionConstants.VERSION_1_2_TEXT);
- descriptors[1] = new DataModelPropertyDescriptor(new Integer(J2EEVersionConstants.J2EE_1_3_ID), J2EEVersionConstants.VERSION_1_3_TEXT);
- descriptors[2] = new DataModelPropertyDescriptor(new Integer(J2EEVersionConstants.J2EE_1_4_ID), J2EEVersionConstants.VERSION_1_4_TEXT);
- break;
- }
- return descriptors;
- }
-
- protected int convertModuleVersionToJ2EEVersion(int moduleVersion) {
- return moduleVersion;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.jst.j2ee.internal.internal.application.operations.J2EEModuleCreationDataModel#getModuleType()
- */
- protected EClass getComponentType() {
- return CommonarchiveFactoryImpl.getPackage().getEARFile();
- }
-
- protected String getComponentExtension() {
- return ".ear"; //$NON-NLS-1$
- }
-
- public IStatus validate(String propertyName) {
- if (propertyName.equals(PROJECT_NAME)) {
- // validate server target
- IStatus stat = super.validate(propertyName);
- if( stat.isOK()){
- String projectName = getDataModel().getStringProperty(PROJECT_NAME);
- if (projectName != null && projectName.length() != 0) {
- IProject project = ProjectUtilities.getProject(projectName);
- if (project != null) {
- IRuntime runtime = ServerCore.getProjectProperties(project).getRuntimeTarget();
- if (runtime != null) {
- IRuntimeType type = runtime.getRuntimeType();
- String typeId = type.getId();
- if (typeId.startsWith("org.eclipse.jst.server.tomcat")) { //$NON-NLS-1$
- String msg = EARCreationResourceHandler.SERVER_TARGET_NOT_SUPPORT_EAR;
- return WTPCommonPlugin.createErrorStatus(msg);
- }
- }
- }
- }
- }
- }else if(propertyName.equals(J2EE_PROJECTS_LIST)){
- return validateTargetComponentVersion((List)model.getProperty(J2EE_PROJECTS_LIST));
- }
- return super.validate(propertyName);
- }
-
- private IStatus validateTargetComponentVersion(List list) {
-
- Integer version = (Integer) model.getProperty(COMPONENT_VERSION);
- int earVersion = version.intValue();
- for (Iterator iter = list.iterator(); iter.hasNext();) {
- IProject handle = (IProject)iter.next();
- //IVirtualComponent comp = (IVirtualComponent) iter.next();
- IVirtualComponent comp = ComponentCore.createComponent(handle.getProject());
- 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;
- }
-
-
- public boolean propertySet(String propertyName, Object propertyValue) {
- boolean returnValue = super.propertySet(propertyName, propertyValue);
- if (propertyName.equals(COMPONENT_NAME)) {
- setProperty(COMPONENT_DEPLOY_NAME, getDataModel().getStringProperty(COMPONENT_NAME));
- } else if(propertyName.equals(NESTED_EAR_COMPONENT_CREATION_DM)){
- throw new RuntimeException();
- }
- return returnValue;
- }
-
- public DataModelPropertyDescriptor[] getValidPropertyDescriptors(String propertyName){
- return super.getValidPropertyDescriptors(propertyName);
- }
-
- protected boolean isCreatingEarComponent() {
- return true;
- }
-
- protected IProject getEARProject(){
- String earProjname = (String) model.getProperty(COMPONENT_NAME);
-
- IDataModel earDM = (IDataModel) model.getProperty(NESTED_EAR_COMPONENT_CREATION_DM);
- earDM.setProperty(IEarComponentCreationDataModelProperties.PROJECT_NAME, earProjname);
-
- if( earProjname != null && !earProjname.equals("") && validate(COMPONENT_NAME).isOK())
- return ProjectUtilities.getProject(earProjname);
- else
- return null;
-
- }
-
- protected String getJ2EEProjectType() {
- return J2EEProjectUtilities.ENTERPRISE_APPLICATION;
- }
-
-}
diff --git a/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/internal/earcreation/EarComponentCreationFacetOperation.java b/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/internal/earcreation/EarComponentCreationFacetOperation.java
deleted file mode 100644
index cadb98ee5..000000000
--- a/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/internal/earcreation/EarComponentCreationFacetOperation.java
+++ /dev/null
@@ -1,127 +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 java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.core.runtime.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.datamodel.properties.IEarComponentCreationDataModelProperties;
-import org.eclipse.jst.j2ee.datamodel.properties.IJ2EEComponentCreationDataModelProperties;
-import org.eclipse.jst.j2ee.datamodel.properties.IJavaComponentCreationDataModelProperties;
-import org.eclipse.jst.j2ee.project.facet.EARFacetProjectCreationDataModelProvider;
-import org.eclipse.wst.common.componentcore.ComponentCore;
-import org.eclipse.wst.common.componentcore.datamodel.FacetProjectCreationDataModelProvider;
-import org.eclipse.wst.common.componentcore.datamodel.properties.IComponentCreationDataModelProperties;
-import org.eclipse.wst.common.componentcore.datamodel.properties.ICreateReferenceComponentsDataModelProperties;
-import org.eclipse.wst.common.componentcore.datamodel.properties.IFacetDataModelProperties;
-import org.eclipse.wst.common.componentcore.datamodel.properties.IFacetProjectCreationDataModelProperties;
-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;
-import org.eclipse.wst.common.project.facet.core.IFacetedProject;
-import org.eclipse.wst.common.project.facet.core.runtime.IRuntime;
-import org.eclipse.wst.common.project.facet.core.runtime.RuntimeManager;
-import org.eclipse.wst.server.core.ServerCore;
-
-/**
- * @deprecated
- * @see EARFacetProjectCreationDataModelProvider
- */
-public class EarComponentCreationFacetOperation extends AbstractDataModelOperation implements IFacetProjectCreationDataModelProperties {
-
- public EarComponentCreationFacetOperation(IDataModel model) {
- super(model);
- }
-
- public IStatus execute(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
-
-
- IDataModel dm = DataModelFactory.createDataModel(new FacetProjectCreationDataModelProvider());
- String runtime = model.getStringProperty(IJavaComponentCreationDataModelProperties.RUNTIME_TARGET_ID);
- IRuntime facetRuntime = null;
- try {
- runtime = ServerCore.findRuntime(runtime).getName();
- facetRuntime = RuntimeManager.getRuntime(runtime);
- } catch (Exception e) {
- // proceed with facetRuntime = null
- }
- dm.setProperty(FACET_RUNTIME, facetRuntime);
- String projectName = model.getStringProperty(IComponentCreationDataModelProperties.PROJECT_NAME);
- dm.setProperty(FACET_PROJECT_NAME, projectName);
-
- IDataModel newDM = setupEarInstallAction();
- FacetDataModelMap map = (FacetDataModelMap) dm.getProperty(FACET_DM_MAP);
- map.add(newDM);
-
- IStatus stat = dm.getDefaultOperation().execute(monitor, info);
- if (stat.isOK())
- addModulesToEAR(monitor);
-
- return stat;
- }
-
- protected IDataModel setupEarInstallAction() {
- String versionStr = model.getPropertyDescriptor(IJ2EEComponentCreationDataModelProperties.COMPONENT_VERSION).getPropertyDescription();
- IDataModel earFacetInstallDataModel = DataModelFactory.createDataModel(new EarFacetInstallDataModelProvider());
- earFacetInstallDataModel.setProperty(IFacetDataModelProperties.FACET_PROJECT_NAME, model.getStringProperty(IComponentCreationDataModelProperties.PROJECT_NAME));
- earFacetInstallDataModel.setProperty(IFacetDataModelProperties.FACET_VERSION_STR, versionStr);
- return earFacetInstallDataModel;
- }
-
- protected void setRuntime(IFacetedProject facetProj) throws CoreException {
- String runtimeID = model.getStringProperty(IJavaComponentCreationDataModelProperties.RUNTIME_TARGET_ID);
- String runtimeName = ServerCore.findRuntime(runtimeID).getName();
- try {
- IRuntime runtime = RuntimeManager.getRuntime(runtimeName);
- facetProj.setRuntime(runtime, null);
- } catch (IllegalArgumentException e) {
- Logger.getLogger().logError(e);
- }
- }
-
- private IStatus addModulesToEAR(IProgressMonitor monitor) {
- IStatus stat = OK_STATUS;
- try {
- IDataModel dm = (IDataModel) model.getProperty(IJ2EEComponentCreationDataModelProperties.NESTED_ADD_COMPONENT_TO_EAR_DM);
- String projectName = model.getStringProperty(IComponentCreationDataModelProperties.PROJECT_NAME);
- IProject project = ProjectUtilities.getProject(projectName);
- IVirtualComponent component = ComponentCore.createComponent(project);
-
-
- dm.setProperty(ICreateReferenceComponentsDataModelProperties.SOURCE_COMPONENT, component);
-
- List moduleProjectsList = (List) model.getProperty(IEarComponentCreationDataModelProperties.J2EE_PROJECTS_LIST);
- if (moduleProjectsList != null && !moduleProjectsList.isEmpty()) {
- List moduleComponentsList = new ArrayList(moduleProjectsList.size());
- for (int i = 0; i < moduleProjectsList.size(); i++) {
- moduleComponentsList.add(ComponentCore.createComponent((IProject) moduleProjectsList.get(i)));
- }
- dm.setProperty(ICreateReferenceComponentsDataModelProperties.TARGET_COMPONENT_LIST, moduleComponentsList);
- stat = dm.validateProperty(ICreateReferenceComponentsDataModelProperties.TARGET_COMPONENT_LIST);
- if (stat != OK_STATUS)
- return stat;
- dm.getDefaultOperation().execute(monitor, null);
- }
- } catch (Exception e) {
- Logger.getLogger().log(e);
- }
- return stat;
- }
-}
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 4b7a63518..000000000
--- a/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/internal/earcreation/EarFacetInstallDataModelProvider.java
+++ /dev/null
@@ -1,74 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jst.j2ee.internal.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.project.J2EEProjectUtilities;
-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 J2EEProjectUtilities.ENTERPRISE_APPLICATION;
- } else if (propertyName.equals(CONTENT_DIR)) {
- return "EarContent";
- } else if (propertyName.equals(J2EE_PROJECTS_LIST) || propertyName.equals(JAVA_PROJECT_LIST)) {
- return Collections.EMPTY_LIST;
- }
- return super.getDefaultProperty(propertyName);
- }
-
- public IStatus validate(String name) {
- if (name.equals(J2EE_PROJECTS_LIST)) {
- return validateTargetComponentVersion((List) model.getProperty(J2EE_PROJECTS_LIST));
- }
- 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 9ffe4bdf5..000000000
--- a/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/internal/earcreation/IEarFacetInstallDataModelProperties.java
+++ /dev/null
@@ -1,23 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jst.j2ee.internal.earcreation;
-
-import org.eclipse.jst.j2ee.project.facet.IJ2EEFacetInstallDataModelProperties;
-
-
-public interface IEarFacetInstallDataModelProperties extends IJ2EEFacetInstallDataModelProperties {
-
- //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/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 31f97e7f4..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, 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;
-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 c593480ce..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, 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;
-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 2ff3645dd..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, 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.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/project/facet/EARFacetProjectCreationDataModelProvider.java b/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/project/facet/EARFacetProjectCreationDataModelProvider.java
deleted file mode 100644
index 21d44f09f..000000000
--- a/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/project/facet/EARFacetProjectCreationDataModelProvider.java
+++ /dev/null
@@ -1,30 +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 org.eclipse.jst.j2ee.internal.earcreation.EarFacetInstallDataModelProvider;
-import org.eclipse.wst.common.componentcore.datamodel.FacetProjectCreationDataModelProvider;
-import org.eclipse.wst.common.frameworks.datamodel.DataModelFactory;
-import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
-
-public class EARFacetProjectCreationDataModelProvider extends FacetProjectCreationDataModelProvider {
-
- public EARFacetProjectCreationDataModelProvider() {
- super();
- }
-
- public void init() {
- super.init();
- FacetDataModelMap map = (FacetDataModelMap) getProperty(FACET_DM_MAP);
- IDataModel earFacet = DataModelFactory.createDataModel(new EarFacetInstallDataModelProvider());
- map.add(earFacet);
- }
-} \ No newline at end of file
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 45d7c67e2..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, 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.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 add0beb08..000000000
--- a/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/project/facet/EarFacetInstallDelegate.java
+++ /dev/null
@@ -1,114 +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.core.runtime.Path;
-import org.eclipse.jem.util.logger.proxy.Logger;
-import org.eclipse.jst.common.project.facet.WtpUtils;
-import org.eclipse.jst.j2ee.application.internal.operations.AddComponentToEnterpriseApplicationDataModelProvider;
-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.jst.j2ee.internal.project.J2EEProjectUtilities;
-import org.eclipse.wst.common.componentcore.ComponentCore;
-import org.eclipse.wst.common.componentcore.datamodel.FacetDataModelProvider;
-import org.eclipse.wst.common.componentcore.datamodel.properties.ICreateReferenceComponentsDataModelProperties;
-import org.eclipse.wst.common.componentcore.resources.IVirtualComponent;
-import org.eclipse.wst.common.componentcore.resources.IVirtualFolder;
-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.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);
- c.create(0, null);
-
- final IVirtualFolder earroot = c.getRootFolder();
- earroot.createLink(new Path("/" + model.getStringProperty(IEarFacetInstallDataModelProperties.CONTENT_DIR)), 0, null); //$NON-NLS-1$
-
- if (!project.getFile(J2EEConstants.APPLICATION_DD_URI).exists()) {
- String ver = fv.getVersionString();
- int nVer = J2EEVersionUtil.convertVersionStringToInt(ver);
- EARArtifactEdit.createDeploymentDescriptor(project, nVer);
- }
- 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);
- }
- }
- 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/EarFacetValidator.java b/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/project/facet/EarFacetValidator.java
deleted file mode 100644
index d1c9e31b0..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 )
- {
- 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.targettingDifferentRuntimes,
- 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 targettingDifferentRuntimes;
-
- 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 17d4bab76..000000000
--- a/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/project/facet/EarFacetValidator.properties
+++ /dev/null
@@ -1 +0,0 @@
-targettingDifferentRuntimes = Referenced module project {0} is targetting 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/EarUtil.java b/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/project/facet/EarUtil.java
deleted file mode 100644
index 32fef74e4..000000000
--- a/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/project/facet/EarUtil.java
+++ /dev/null
@@ -1,105 +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.resources.IProjectDescription;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.jst.j2ee.application.Application;
-import org.eclipse.jst.j2ee.application.Module;
-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.componentcore.resources.IVirtualReference;
-
-/**
- * @author <a href="mailto:kosta@bea.com">Konstantin Komissarchik</a>
- */
-
-public final class EarUtil
-{
- public static void addModuleReference( final IProject earproj,
- final IProject moduleproj,
- final Module module )
-
- throws CoreException
-
- {
- addProjectReference( earproj, moduleproj );
- addComponentReference( earproj, moduleproj );
-
- if( module != null )
- {
- addDeploymentDescriptorEntry( earproj, module );
- }
- }
-
- private static void addProjectReference( final IProject project,
- final IProject referenced )
-
- throws CoreException
-
- {
- final IProject[] oldrefs = project.getReferencedProjects();
- final IProject[] refs = new IProject[ oldrefs.length + 1 ];
-
- System.arraycopy( oldrefs, 0, refs, 0, oldrefs.length );
- refs[ oldrefs.length ] = referenced;
-
- final IProjectDescription desc = project.getDescription();
- desc.setReferencedProjects( refs );
-
- project.setDescription( desc, null );
- }
-
- private static void addComponentReference( final IProject project,
- final IProject referenced )
- {
- final IVirtualComponent comp1
- = ComponentCore.createComponent( project, project.getName() );
-
- final IVirtualComponent comp2
- = ComponentCore.createComponent( referenced, referenced.getName() );
-
- final IVirtualReference[] oldrefs = comp1.getReferences();
-
- final IVirtualReference[] refs
- = new IVirtualReference[ oldrefs.length + 1 ];
-
- System.arraycopy( oldrefs, 0, refs, 0, oldrefs.length );
-
- refs[ oldrefs.length ]
- = ComponentCore.createReference( comp1, comp2 );
-
- comp1.setReferences( refs );
- }
-
- private static void addDeploymentDescriptorEntry( final IProject earproj,
- final Module module )
- {
-
- final EARArtifactEdit eardd
- = EARArtifactEdit.getEARArtifactEditForWrite( earproj );
-
- try
- {
- final Application app = eardd.getApplication();
- app.getModules().add( module );
- eardd.saveIfNecessary( null );
- }
- finally
- {
- eardd.dispose();
- }
- }
-
-}
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 0eab85c35..000000000
--- a/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/project/facet/IJavaProjectMigrationDataModelProperties.java
+++ /dev/null
@@ -1,21 +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$
-
-}
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 9f9093527..000000000
--- a/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/project/facet/IJavaUtilityProjectCreationDataModelProperties.java
+++ /dev/null
@@ -1,24 +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;
-
-public interface IJavaUtilityProjectCreationDataModelProperties {
-
- 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 ce202cc17..000000000
--- a/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/project/facet/IUtilityFacetInstallDataModelProperties.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.project.facet;
-
-
-
-
-public interface IUtilityFacetInstallDataModelProperties extends IJ2EEModuleFacetInstallDataModelProperties {
-
-}
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 54b310108..000000000
--- a/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/project/facet/JavaProjectMigrationDataModelProvider.java
+++ /dev/null
@@ -1,63 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-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);
- 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 b9839d386..000000000
--- a/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/project/facet/JavaProjectMigrationOperation.java
+++ /dev/null
@@ -1,70 +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 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.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;
-
-
-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_STR, "1.4"); //$NON-NLS-1$
-
- IDataModel udm = DataModelFactory.createDataModel(new UtilityFacetInstallDataModelProvider());
- try {
- udm.setProperty(IFacetDataModelProperties.FACET_PROJECT_NAME, model.getStringProperty(PROJECT_NAME));
- udm.setProperty(IFacetDataModelProperties.FACET_VERSION_STR, "1.0"); //$NON-NLS-1$
- } 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;
- }
-
-}
diff --git a/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/project/facet/JavaUtilityComponentCreationDataModelProvider.java b/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/project/facet/JavaUtilityComponentCreationDataModelProvider.java
deleted file mode 100644
index b661a11be..000000000
--- a/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/project/facet/JavaUtilityComponentCreationDataModelProvider.java
+++ /dev/null
@@ -1,39 +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.jst.j2ee.datamodel.properties.IUtilityJavaComponentCreationDataModelProperties;
-import org.eclipse.jst.j2ee.internal.archive.operations.JavaComponentCreationDataModelProvider;
-import org.eclipse.wst.common.frameworks.datamodel.IDataModelOperation;
-
-/**
- *
- * @deprecated
- * @see UtilityProjectCreationDataModelProvider
- */
-
-public class JavaUtilityComponentCreationDataModelProvider
- extends JavaComponentCreationDataModelProvider implements IUtilityJavaComponentCreationDataModelProperties{
-
- public Set getPropertyNames() {
- Set propertyNames = super.getPropertyNames();
- propertyNames.add(EAR_PROJECT_NAME);
- return propertyNames;
- }
-
- public IDataModelOperation getDefaultOperation() {
- return new JavaUtilityComponentCreationFacetOperation(model);
- }
-
-}
diff --git a/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/project/facet/JavaUtilityComponentCreationFacetOperation.java b/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/project/facet/JavaUtilityComponentCreationFacetOperation.java
deleted file mode 100644
index 7488ca215..000000000
--- a/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/project/facet/JavaUtilityComponentCreationFacetOperation.java
+++ /dev/null
@@ -1,71 +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.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.DataModelFactory;
-import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
-
-
-public class JavaUtilityComponentCreationFacetOperation extends J2EEComponentCreationFacetOperation {
-
- public JavaUtilityComponentCreationFacetOperation(IDataModel model) {
- super(model);
- }
-
- public IStatus execute(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
-
- IStatus result = OK_STATUS;
- try {
- IDataModel dm = DataModelFactory.createDataModel(new FacetProjectCreationDataModelProvider());
- dm.setProperty(IFacetProjectCreationDataModelProperties.FACET_PROJECT_NAME, (String) model.getProperty(JavaUtilityComponentCreationDataModelProvider.PROJECT_NAME));
-
- FacetDataModelMap map = (FacetDataModelMap) dm.getProperty(IFacetProjectCreationDataModelProperties.FACET_DM_MAP);
- map.add(setupJavaInstallAction());
-
- IDataModel newModel = setupUtilityInstallAction(model);
- map.add( newModel );
-
- setRuntime(newModel, dm); // Setting runtime property
-
- result = dm.getDefaultOperation().execute(monitor, null);
- } catch (ExecutionException e) {
- Logger.getLogger().logError(e);
- }
- return result;
- }
-
- protected IDataModel setupUtilityInstallAction(IDataModel aDM) {
- IDataModel dm = DataModelFactory.createDataModel(new UtilityFacetInstallDataModelProvider());
- try {
- dm.setProperty(IFacetDataModelProperties.FACET_PROJECT_NAME, model.getStringProperty(JavaUtilityComponentCreationDataModelProvider.PROJECT_NAME));
- dm.setProperty(IFacetDataModelProperties.FACET_VERSION_STR, "1.0"); //$NON-NLS-1$
- dm.setProperty(IUtilityFacetInstallDataModelProperties.RUNTIME_TARGET_ID, model.getProperty(JavaUtilityComponentCreationDataModelProvider.RUNTIME_TARGET_ID));
- dm.setProperty(IUtilityFacetInstallDataModelProperties.CONFIG_FOLDER,
- model.getProperty(JavaUtilityComponentCreationDataModelProvider.JAVASOURCE_FOLDER));
- dm.setStringProperty(IUtilityFacetInstallDataModelProperties.EAR_PROJECT_NAME,model.getStringProperty(JavaUtilityComponentCreationDataModelProvider.EAR_PROJECT_NAME));
-
- } catch (Exception e) {
- Logger.getLogger().logError(e);
- }
-
- return dm;
- }
-
-} \ No newline at end of file
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 e13df8267..000000000
--- a/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/project/facet/UtilityFacetInstallDataModelProvider.java
+++ /dev/null
@@ -1,28 +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.jst.j2ee.internal.project.J2EEProjectUtilities;
-import org.eclipse.wst.common.project.facet.core.IProjectFacetVersion;
-
-public class UtilityFacetInstallDataModelProvider extends J2EEModuleFacetInstallDataModelProvider implements IUtilityFacetInstallDataModelProperties {
-
- public Object getDefaultProperty(String propertyName) {
- if (FACET_ID.equals(propertyName)) {
- return J2EEProjectUtilities.UTILITY;
- }
- 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/UtilityFacetInstallDelegate.java b/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/project/facet/UtilityFacetInstallDelegate.java
deleted file mode 100644
index be36a1a8a..000000000
--- a/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/project/facet/UtilityFacetInstallDelegate.java
+++ /dev/null
@@ -1,151 +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 java.util.List;
-
-import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.core.resources.IContainer;
-import org.eclipse.core.resources.IProject;
-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.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.emf.workbench.ProjectUtilities;
-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.application.internal.operations.AddComponentToEnterpriseApplicationDataModelProvider;
-import org.eclipse.wst.common.componentcore.ComponentCore;
-import org.eclipse.wst.common.componentcore.datamodel.FacetDataModelProvider;
-import org.eclipse.wst.common.componentcore.datamodel.properties.ICreateReferenceComponentsDataModelProperties;
-import org.eclipse.wst.common.componentcore.resources.IVirtualComponent;
-import org.eclipse.wst.common.componentcore.resources.IVirtualFolder;
-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.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);
-
- 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> );
- }
-
-
- // 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 != "") {
- IProject earProject = ProjectUtilities.getProject(earProjectName);
- if (earProject.exists()) {
- IVirtualComponent earComp = ComponentCore.createComponent(earProject);
-
- IDataModel dataModel = DataModelFactory.createDataModel(new AddComponentToEnterpriseApplicationDataModelProvider());
- dataModel.setProperty(ICreateReferenceComponentsDataModelProperties.SOURCE_COMPONENT, earComp);
- List modList = (List) dataModel.getProperty(ICreateReferenceComponentsDataModelProperties.TARGET_COMPONENT_LIST);
- modList.add(c);
- dataModel.setProperty(ICreateReferenceComponentsDataModelProperties.TARGET_COMPONENT_LIST, modList);
- try {
- dataModel.getDefaultOperation().execute(null, null);
- } catch (ExecutionException e) {
- Logger.getLogger().logError(e);
- }
- }
- }
- }
-
-
- 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/UtilityProjectCreationDataModelProvider.java b/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/project/facet/UtilityProjectCreationDataModelProvider.java
deleted file mode 100644
index 404833d1e..000000000
--- a/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/project/facet/UtilityProjectCreationDataModelProvider.java
+++ /dev/null
@@ -1,33 +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 org.eclipse.jst.common.project.facet.JavaFacetInstallDataModelProvider;
-import org.eclipse.wst.common.componentcore.datamodel.FacetProjectCreationDataModelProvider;
-import org.eclipse.wst.common.frameworks.datamodel.DataModelFactory;
-import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
-
-public class UtilityProjectCreationDataModelProvider extends FacetProjectCreationDataModelProvider {
-
- public UtilityProjectCreationDataModelProvider() {
- super();
- }
-
- public void init() {
- super.init();
- FacetDataModelMap map = (FacetDataModelMap) getProperty(FACET_DM_MAP);
- IDataModel javaFacet = DataModelFactory.createDataModel(new JavaFacetInstallDataModelProvider());
- map.add(javaFacet);
- IDataModel utilFacet = DataModelFactory.createDataModel(new UtilityFacetInstallDataModelProvider());
- map.add(utilFacet);
- }
-
-} \ No newline at end of file

Back to the top