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/AddArchiveProjectToEAROperation.java324
-rw-r--r--plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/application/internal/operations/AddArchiveProjectsToEARDataModel.java151
-rw-r--r--plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/application/internal/operations/AddArchiveProjectsToEAROperation.java63
-rw-r--r--plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/application/internal/operations/AddArchiveToEARDataModel.java187
-rw-r--r--plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/application/internal/operations/AddComponentToEnterpriseApplicationDataModelProvider.java43
-rw-r--r--plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/application/internal/operations/AddComponentToEnterpriseApplicationOp.java124
-rw-r--r--plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/application/internal/operations/AddModuleToEARDataModel.java116
-rw-r--r--plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/application/internal/operations/AddUtilityProjectToEARDataModel.java223
-rw-r--r--plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/application/internal/operations/AddWebComponentToEARDataModelProvider.java107
-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.java651
-rw-r--r--plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/application/internal/operations/ClasspathElement.java402
-rw-r--r--plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/application/internal/operations/ClasspathSelectionHelper.java118
-rw-r--r--plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/application/internal/operations/DefaultJ2EEComponentCreationOperation.java117
-rw-r--r--plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/application/internal/operations/EARComponentCreationOperation.java181
-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/EnterpriseApplicationImportDataModelProvider.java698
-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.java84
-rw-r--r--plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/application/internal/operations/FlexibleJavaProjectCreationOperation.java57
-rw-r--r--plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/application/internal/operations/FlexibleProjectCreationDataModelProvider.java98
-rw-r--r--plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/application/internal/operations/FlexibleProjectCreationOperation.java82
-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.java183
-rw-r--r--plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/application/internal/operations/J2EEArtifactImportDataModelProvider.java211
-rw-r--r--plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/application/internal/operations/J2EEComponentCreationDataModelProvider.java598
-rw-r--r--plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/application/internal/operations/J2EEComponentCreationOperation.java263
-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.java84
-rw-r--r--plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/application/internal/operations/J2EEUtilityJarImportDataModelProvider.java48
-rw-r--r--plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/application/internal/operations/J2EEUtilityJarImportOperationNew.java80
-rw-r--r--plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/application/internal/operations/J2EEUtilityJarListImportDataModelProvider.java325
-rw-r--r--plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/application/internal/operations/J2EEUtilityJarListImportOperation.java314
-rw-r--r--plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/application/internal/operations/JARDependencyTraverser.java142
-rw-r--r--plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/application/internal/operations/JavaUtilityComponentCreationOperation.java170
-rw-r--r--plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/application/internal/operations/UpdateManifestDataModel.java137
-rw-r--r--plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/application/internal/operations/UpdateManifestOperation.java70
-rw-r--r--plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/componentcore/util/EARArtifactEdit.java509
-rw-r--r--plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/internal/earcreation/AddModuleMapCommand.java93
-rw-r--r--plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/internal/earcreation/AddModuleToEARProjectCommand.java66
-rw-r--r--plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/internal/earcreation/AddUtilityJARMapCommand.java50
-rw-r--r--plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/internal/earcreation/DefaultJ2EEComponentCreationDataModelProvider.java386
-rw-r--r--plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/internal/earcreation/EARCreationResourceHandler.java83
-rw-r--r--plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/internal/earcreation/EAREditModel.java745
-rw-r--r--plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/internal/earcreation/EAREditModelFactory.java51
-rw-r--r--plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/internal/earcreation/EARNatureRuntime.java600
-rw-r--r--plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/internal/earcreation/EarComponentCreationDataModelProvider.java208
-rw-r--r--plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/internal/earcreation/IDefaultJ2EEComponentCreationDataModelProperties.java73
-rw-r--r--plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/internal/earcreation/IEARNatureConstants.java30
-rw-r--r--plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/internal/earcreation/ILooseConfigConstants.java27
-rw-r--r--plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/internal/earcreation/LooseConfigUpdateOperation.java211
-rw-r--r--plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/internal/earcreation/ModuleInEARProjectCommand.java311
-rw-r--r--plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/internal/earcreation/ModuleMapHelper.java170
-rw-r--r--plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/internal/earcreation/RemoveModuleFromEARProjectCommand.java100
-rw-r--r--plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/internal/earcreation/RemoveUtilityJARMapCommand.java59
-rw-r--r--plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/internal/earcreation/RollupRolesCommand.java147
-rw-r--r--plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/internal/earcreation/UpdateModuleReferencesInEARProjectCommand.java180
-rw-r--r--plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/internal/earcreation/UtilityJARInEARProjectCommand.java177
-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.java52
-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/EARArtifactEditOperation.java34
-rw-r--r--plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/internal/modulecore/util/EARArtifactEditOperationDataModel.java32
-rw-r--r--plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/internal/modulecore/util/EarEditAdapterFactory.java51
-rw-r--r--plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/internal/moduleextension/EarModuleExtension.java46
-rw-r--r--plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/internal/moduleextension/EarModuleExtensionImpl.java60
-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.java89
-rw-r--r--plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/internal/moduleextension/EjbModuleExtension.java49
-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.java61
82 files changed, 0 insertions, 13135 deletions
diff --git a/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/application/internal/operations/AddArchiveProjectToEAROperation.java b/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/application/internal/operations/AddArchiveProjectToEAROperation.java
deleted file mode 100644
index d6a89e0a4..000000000
--- a/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/application/internal/operations/AddArchiveProjectToEAROperation.java
+++ /dev/null
@@ -1,324 +0,0 @@
-/***************************************************************************************************
- * Copyright (c) 2003, 2004 IBM Corporation and others. All rights reserved. This program and the
- * accompanying materials are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors: IBM Corporation - initial API and implementation
- **************************************************************************************************/
-/*
- * Created on Oct 27, 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.lang.reflect.InvocationTargetException;
-import java.util.Collections;
-import java.util.Iterator;
-import java.util.Map;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IFolder;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.NullProgressMonitor;
-import org.eclipse.core.runtime.Path;
-import org.eclipse.core.runtime.SubProgressMonitor;
-import org.eclipse.emf.common.command.AbstractCommand;
-import org.eclipse.emf.common.command.Command;
-import org.eclipse.emf.common.command.CompoundCommand;
-import org.eclipse.jem.util.logger.proxy.Logger;
-import org.eclipse.jst.j2ee.application.Application;
-import org.eclipse.jst.j2ee.application.ApplicationResource;
-import org.eclipse.jst.j2ee.application.Module;
-import org.eclipse.jst.j2ee.internal.application.impl.ApplicationResourceImpl;
-import org.eclipse.jst.j2ee.internal.archive.operations.EJBArchiveOpsResourceHandler;
-import org.eclipse.jst.j2ee.internal.earcreation.AddModuleToEARProjectCommand;
-import org.eclipse.jst.j2ee.internal.earcreation.AddUtilityJARMapCommand;
-import org.eclipse.jst.j2ee.internal.earcreation.EARNatureRuntime;
-import org.eclipse.jst.j2ee.internal.earcreation.RemoveModuleFromEARProjectCommand;
-import org.eclipse.jst.j2ee.internal.modulecore.util.EARArtifactEditOperation;
-import org.eclipse.jst.j2ee.internal.project.J2EEProjectUtilities;
-import org.eclipse.jst.j2ee.internal.servertarget.ServerTargetDataModel;
-import org.eclipse.jst.j2ee.internal.servertarget.ServerTargetOperation;
-import org.eclipse.wst.common.componentcore.internal.WorkbenchComponent;
-import org.eclipse.wst.common.frameworks.internal.operations.WTPOperation;
-import org.eclipse.wst.server.core.IRuntime;
-import org.eclipse.wst.server.core.ServerCore;
-
-public class AddArchiveProjectToEAROperation extends EARArtifactEditOperation {
-
- private IProgressMonitor monitor;
-
- private static class CopyJARFileCommand extends AbstractCommand implements Command {
-
- IProject earProject = null;
- IProgressMonitor monitor = null;
- IFile file = null;
- String uri = null;
- IFile target = null;
-
- /**
- * Constructor
- */
- public CopyJARFileCommand(IProject earProject, IProgressMonitor monitor, IFile file, String uri) {
- super();
- this.earProject = earProject;
- this.monitor = monitor;
- this.file = file;
- this.uri = uri;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.emf.common.command.Command#execute()
- */
- public void execute() {
- IPath path = null;
- try {
- path = new Path(uri);
- target = earProject.getFile(path);
- mkdirs(path);
- file.copy(target.getFullPath(), true, new SubProgressMonitor(new NullProgressMonitor(), 1));
- } catch (Exception ex) {
- Logger.getLogger().logError(ex);
- }
-
-
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.emf.common.command.Command#undo()
- */
- public void undo() {
- try {
- if (target != null)
- target.delete(true, new NullProgressMonitor());
- } catch (CoreException e) {
- Logger.getLogger().logError(e);
- }
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.emf.common.command.Command#redo()
- */
- public void redo() {
- execute();
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.emf.common.command.AbstractCommand#prepare()
- */
- protected boolean prepare() {
- return true;
- }
-
- /**
- * @param path
- * @throws CoreException
- */
- private void mkdirs(IPath path) throws CoreException {
- int segments = path.segmentCount();
- for (int i = segments - 1; i > 0; i--) {
- IFolder folder = earProject.getFolder(path.removeLastSegments(i));
- if (!folder.exists())
- folder.create(true, true, null);
- }
- }
- }
-
- public AddArchiveProjectToEAROperation(AddArchiveToEARDataModel dataModel) {
- super(dataModel);
- }
-
- protected void execute(IProgressMonitor aMonitor) throws CoreException, InvocationTargetException, InterruptedException {
- this.monitor = aMonitor;
- AddArchiveToEARDataModel dataModel = (AddArchiveToEARDataModel) operationDataModel;
- String originalID = null;
- ApplicationResource resource = null;
- String uri = dataModel.getStringProperty(AddArchiveToEARDataModel.ARCHIVE_URI);
- EARNatureRuntime nature = EARNatureRuntime.getRuntime(dataModel.getTargetProject());
- Application app = nature.getApplication();
- Module module = app.getFirstModule(uri);
- if (module != null) {
- resource = (ApplicationResource) module.eResource();
- originalID = resource.getID(module);
- }
-
- Command command = createCommand(dataModel);
- if (null != command) {
- getCommandStack().execute(command);
- }
-
- if (originalID != null) {
- module = app.getFirstModule(uri);
- resource = (ApplicationResourceImpl) module.eResource();
- resource.setID(module, originalID);
- }
-
- addServerTarget(aMonitor);
- if (!dataModel.isModuleArchive())
- updateUtilProject((AddUtilityProjectToEARDataModel) dataModel, aMonitor);
- addAllDependentJARs();
-
- }
-
- private void addAllDependentJARs() throws CoreException {
- Map dependents = computeAllDependents();
- if (dependents.isEmpty())
- return;
- Iterator iter = dependents.entrySet().iterator();
- Map.Entry entry = null;
- IResource resource = null;
- String uri = null;
- CompoundCommand compoundCommand = new CompoundCommand();
- compoundCommand.setLabel(EJBArchiveOpsResourceHandler.getString("Copy_Dep_JARS_UI")); //$NON-NLS-1$
- while (iter.hasNext()) {
- entry = (Map.Entry) iter.next();
- resource = (IResource) entry.getKey();
- uri = (String) entry.getValue();
- switch (resource.getType()) {
- case IResource.FILE :
- addDependentJARFile((IFile) resource, uri, compoundCommand);
- break;
- case IResource.PROJECT :
- addDependentJARProject((IProject) resource, uri, compoundCommand);
- break;
- }
- }
- getCommandStack().execute(compoundCommand);
- }
-
- /**
- * @param project
- * @param uri
- * @param compoundCommand
- */
- private void addDependentJARProject(IProject project, String uri, CompoundCommand compoundCommand) {
- AddUtilityJARMapCommand cmd = new AddUtilityJARMapCommand(getEARProject(), uri, project);
- compoundCommand.append(cmd);
- }
-
- /**
- * @param file
- * @param uri
- * @param compoundCommand
- * @throws CoreException
- */
- private void addDependentJARFile(IFile file, String uri, CompoundCommand compoundCommand) throws CoreException {
- CopyJARFileCommand cmd = new CopyJARFileCommand(getEARProject(), monitor, file, uri);
- compoundCommand.append(cmd);
- }
-
- protected void addServerTarget(IProgressMonitor aMonitor) throws CoreException, InvocationTargetException, InterruptedException {
- if (operationDataModel.getBooleanProperty(AddArchiveToEARDataModel.SYNC_TARGET_RUNTIME)) {
- ServerTargetDataModel model = ((AddArchiveToEARDataModel) operationDataModel).getServerTargetDataModel();
- ServerTargetOperation serverTargetOperation = new ServerTargetOperation(model);
- serverTargetOperation.doRun(aMonitor);
- }
- }
-
- /**
- * @param model
- */
- private void updateUtilProject(AddUtilityProjectToEARDataModel model, IProgressMonitor aMonitor) {
- WorkbenchComponent wbComp = (WorkbenchComponent) model.getProperty(AddArchiveToEARDataModel.ARCHIVE_MODULE);
- IProject proj = ((AddArchiveToEARDataModel)operationDataModel).getProjectForGivenComponent(wbComp);
- if (proj != null && J2EEProjectUtilities.getFirstReferencingEARProject(proj) == null) {
- createManifest(model, aMonitor);
- IRuntime runtime = ServerCore.getProjectProperties(proj).getRuntimeTarget();
- if (runtime == null)
- addRuntimeTarget(model, aMonitor);
- }
- }
-
- /**
- * @param model
- */
- private void addRuntimeTarget(AddUtilityProjectToEARDataModel model, IProgressMonitor aMonitor) {
- ServerTargetOperation op = new ServerTargetOperation(model.getServerTargetModel());
- runNestedOperation(op, aMonitor);
- }
-
- /**
- * @param model
- */
- private void createManifest(AddUtilityProjectToEARDataModel model, IProgressMonitor aMonitor) {
- UpdateManifestOperation op = new UpdateManifestOperation(model.getManifestModel());
- runNestedOperation(op, aMonitor);
- }
-
- private void runNestedOperation(WTPOperation op, IProgressMonitor aMonitor) {
- try {
- op.doRun(aMonitor);
- } catch (CoreException e) {
- Logger.getLogger().logError(e);
- } catch (InvocationTargetException e) {
- Logger.getLogger().logError(e);
- } catch (InterruptedException e) {
- Logger.getLogger().logError(e);
- }
- }
-
- /**
- * @param dataModel
- * @return
- */
- private Command createCommand(AddArchiveToEARDataModel dataModel) {
- IProject project = getArchiveProject();
- String uri = dataModel.getStringProperty(AddArchiveToEARDataModel.ARCHIVE_URI);
- EARNatureRuntime nature = EARNatureRuntime.getRuntime(dataModel.getTargetProject());
- if (project == nature.getMappedProject(uri)) {
- return null;
- }
-
- Module m = null;
- //TODO fix up ((EAREditModel) editModel).getApplication().getFirstModule(uri);
- RemoveModuleFromEARProjectCommand removeCommand = null;
- if (null != m) {
- removeCommand = new RemoveModuleFromEARProjectCommand(m, dataModel.getTargetProject());
- }
- Command addCommand = null;
- if (dataModel.isModuleArchive()) {
- String contextRoot = null;
- /*if (((AddModuleToEARDataModel) dataModel).isWebModuleArchive())
- contextRoot = dataModel.getStringProperty(iAddWebModuleToEARDataModel.CONTEXT_ROOT);
- */addCommand = new AddModuleToEARProjectCommand(project, dataModel.getTargetProject(), uri, contextRoot, null);
- } else
- addCommand = new AddUtilityJARMapCommand(dataModel.getTargetProject(), uri, project);
-
- if (null != removeCommand) {
- return removeCommand.chain(addCommand);
- }
- return addCommand;
- }
-
- private IProject getArchiveProject() {
- WorkbenchComponent wbComp = (WorkbenchComponent) operationDataModel.getProperty(AddArchiveToEARDataModel.ARCHIVE_MODULE);
- return ((AddArchiveToEARDataModel)operationDataModel).getProjectForGivenComponent(wbComp);
- }
-
- private IProject getEARProject() {
- return ((AddArchiveToEARDataModel)operationDataModel).getTargetProject();
- }
-
- private Map computeAllDependents() {
- IProject archiveProject = getArchiveProject();
- IProject earProject = getEARProject();
- if (archiveProject == null || earProject == null)
- return Collections.EMPTY_MAP;
- return new JARDependencyTraverser(archiveProject, earProject).run();
- }
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/application/internal/operations/AddArchiveProjectsToEARDataModel.java b/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/application/internal/operations/AddArchiveProjectsToEARDataModel.java
deleted file mode 100644
index 462ab5ebf..000000000
--- a/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/application/internal/operations/AddArchiveProjectsToEARDataModel.java
+++ /dev/null
@@ -1,151 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-/*
- * Created on Oct 27, 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.ArrayList;
-import java.util.Collections;
-import java.util.List;
-
-import org.eclipse.core.resources.IProject;
-import org.eclipse.jst.j2ee.internal.earcreation.IEARNatureConstants;
-import org.eclipse.wst.common.frameworks.internal.operations.WTPOperation;
-import org.eclipse.wst.common.internal.emfworkbench.operation.EditModelOperationDataModel;
-
-
-/**
- * @author jsholl
- *
- * To change the template for this generated type comment go to
- * Window>Preferences>Java>Code Generation>Code and Comments
- */
-public class AddArchiveProjectsToEARDataModel extends EditModelOperationDataModel {
- /**
- * Requred. This must be a list of IProjects. This list must contain all projects being added
- * even if there is a corresponding model in the MODULE_MODELS list.
- */
- public static final String MODULE_LIST = "AddArchiveProjectsToEARDataModel.MODULE_LIST"; //$NON-NLS-1$
-
- /**
- * Optional - This is a list of AddArchiveProjectsToEARDataModel objects. This allows for non
- * default URIs or other overrides based on the module type.
- */
- public static final String MODULE_MODELS = "AddArchiveProjectsToEARDataModel.MODULE_MODELS"; //$NON-NLS-1$
-
- /**
- * This is a convenience property to return models for all projects in the MODULE_LIST. So you
- * could have some module models defined with overrides and this property will ensure that a
- * model gets created for projects in the MODULE_LIST that do not have a model.
- */
- public static final String ALL_MODULE_MODELS = "AddModulesToEARDataModel.ALL_MODULE_MODELS"; //$NON-NLS-1$
-
- public WTPOperation getDefaultOperation() {
- return new AddArchiveProjectsToEAROperation(this);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.wst.common.frameworks.internal.operation.WTPOperationDataModel#init()
- */
- protected void init() {
- super.init();
- setProperty(EDIT_MODEL_ID, IEARNatureConstants.EDIT_MODEL_ID);
- }
-
- protected void initValidBaseProperties() {
- super.initValidBaseProperties();
- addValidBaseProperty(MODULE_LIST);
- addValidBaseProperty(MODULE_MODELS);
- addValidBaseProperty(ALL_MODULE_MODELS);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.wst.common.frameworks.internal.operation.WTPOperationDataModel#getDefaultProperty(java.lang.String)
- */
- protected Object getDefaultProperty(String propertyName) {
- if (propertyName.equals(MODULE_LIST) || propertyName.equals(MODULE_MODELS)) {
- return Collections.EMPTY_LIST;
- }
- return super.getDefaultProperty(propertyName);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.wst.common.frameworks.internal.operation.WTPOperationDataModel#doGetProperty(java.lang.String)
- */
- protected Object doGetProperty(String propertyName) {
- if (propertyName.equals(ALL_MODULE_MODELS)) {
- return computeAllModuleModels();
- }
- return super.doGetProperty(propertyName);
- }
-
- /**
- * @return
- */
- private List computeAllModuleModels() {
- List projects = (List) getProperty(MODULE_LIST);
- List models = (List) getProperty(MODULE_MODELS);
- if (!projects.isEmpty())
- return computeAllArchiveModels(projects, models);
- return models;
- }
-
- /**
- * @param projects
- * @param models
- * @return
- */
- private List computeAllArchiveModels(List projects, List models) {
- List allModels = new ArrayList(projects.size());
- String earProjName = getStringProperty(PROJECT_NAME);
- IProject project = null;
- AddArchiveToEARDataModel model = null;
- for (int i = 0; i < projects.size(); i++) {
- project = (IProject) projects.get(i);
- model = findOrCreateModel(project, models);
- if (model != null) {
- model.setProperty(AddArchiveToEARDataModel.PROJECT_NAME, earProjName);
- allModels.add(model);
- }
- }
- return allModels;
- }
-
- /**
- * @param project
- * @param models
- * @return
- */
- private AddArchiveToEARDataModel findOrCreateModel(IProject project, List models) {
- //TODO: implement for modules not projects
-// if (!models.isEmpty()) {
-// AddArchiveToEARDataModel model = null;
-// for (int i = 0; i < models.size(); i++) {
-// model = (AddArchiveToEARDataModel) models.get(i);
-// if (project.equals(model.getProperty(AddArchiveToEARDataModel.ARCHIVE_PROJECT)))
-// return model;
-// }
-// }
- //Not found so we need to create one.
- return null; //TODO fix up createArchiveModel(project);
- }
-
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/application/internal/operations/AddArchiveProjectsToEAROperation.java b/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/application/internal/operations/AddArchiveProjectsToEAROperation.java
deleted file mode 100644
index 028425e5f..000000000
--- a/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/application/internal/operations/AddArchiveProjectsToEAROperation.java
+++ /dev/null
@@ -1,63 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-/*
- * Created on Nov 26, 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.lang.reflect.InvocationTargetException;
-import java.util.List;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.wst.common.internal.emfworkbench.integration.CompoundingCommandStack;
-import org.eclipse.wst.common.internal.emfworkbench.operation.EditModelOperation;
-
-
-/**
- * @author DABERG
- *
- * To change the template for this generated type comment go to Window>Preferences>Java>Code
- * Generation>Code and Comments
- */
-public class AddArchiveProjectsToEAROperation extends EditModelOperation {
- /**
- * @param operationDataModel
- */
- public AddArchiveProjectsToEAROperation(AddArchiveProjectsToEARDataModel operationDataModel) {
- super(operationDataModel);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.wst.common.frameworks.internal.operation.WTPOperation#execute(org.eclipse.core.runtime.IProgressMonitor)
- */
- protected void execute(IProgressMonitor monitor) throws CoreException, InvocationTargetException, InterruptedException {
- AddArchiveProjectsToEARDataModel dataModel = (AddArchiveProjectsToEARDataModel) operationDataModel;
- List models = (List) dataModel.getProperty(AddArchiveProjectsToEARDataModel.ALL_MODULE_MODELS);
- if (!models.isEmpty()) {
- CompoundingCommandStack cmdStack = new CompoundingCommandStack(getCommandStack());
- AddArchiveToEARDataModel model;
- AddArchiveProjectToEAROperation op = null;
- for (int i = 0; i < models.size(); i++) {
- model = (AddArchiveToEARDataModel) models.get(i);
- op = new AddArchiveProjectToEAROperation(model);
- op.setCommandStack(cmdStack);
- op.doRun(monitor);
- }
- cmdStack.performExecution();
- }
- }
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/application/internal/operations/AddArchiveToEARDataModel.java b/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/application/internal/operations/AddArchiveToEARDataModel.java
deleted file mode 100644
index 88cd3a6d5..000000000
--- a/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/application/internal/operations/AddArchiveToEARDataModel.java
+++ /dev/null
@@ -1,187 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-/*
- * Created on Nov 25, 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 org.eclipse.core.resources.IProject;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.jem.util.logger.proxy.Logger;
-import org.eclipse.jst.j2ee.componentcore.util.EARArtifactEdit;
-import org.eclipse.jst.j2ee.internal.earcreation.EARCreationResourceHandler;
-import org.eclipse.jst.j2ee.internal.earcreation.IEARNatureConstants;
-import org.eclipse.jst.j2ee.internal.modulecore.util.EARArtifactEditOperationDataModel;
-import org.eclipse.jst.j2ee.internal.servertarget.ServerTargetDataModel;
-import org.eclipse.wst.common.componentcore.internal.StructureEdit;
-import org.eclipse.wst.common.componentcore.internal.WorkbenchComponent;
-import org.eclipse.wst.common.frameworks.internal.plugin.WTPCommonPlugin;
-import org.eclipse.wst.server.core.IRuntime;
-import org.eclipse.wst.server.core.ServerCore;
-
-//TODO delete
-/**
- * @deprecated
- *
- */
-public abstract class AddArchiveToEARDataModel extends EARArtifactEditOperationDataModel {
- /**
- * Required - This is the module that is being added to the EAR (designated by the
- * PROJECT_NAME). type = WorkbenchComponent
- */
- public static final String ARCHIVE_MODULE = "AddModuleToEARDataModel.ARCHIVE_PROJECT"; //$NON-NLS-1$
- /**
- * Optional - The URI used for the archive in the EAR project. type = String
- */
- public static final String ARCHIVE_URI = "AddModuleToEARDataModel.URI"; //$NON-NLS-1$
- /**
- * Required - This is the boolean value to sync the module target runtime to that of the EAR
- * project default - false;
- */
- public static final String SYNC_TARGET_RUNTIME = "AddModuleToEARDataModel.SYNC_TARGET_RUNTIME"; //$NON-NLS-1$
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.wst.common.internal.emfworkbench.operation.EditModelOperationDataModel#initValidBaseProperties()
- */
- protected void initValidBaseProperties() {
- super.initValidBaseProperties();
- addValidBaseProperty(ARCHIVE_MODULE);
- addValidBaseProperty(ARCHIVE_URI);
- addValidBaseProperty(SYNC_TARGET_RUNTIME);
- }
-
- protected IStatus doValidateProperty(String propertyName) {
- if (PROJECT_NAME.equals(propertyName)) {
- IProject project = getTargetProject();
- try {
- if (project == null || !project.exists() || !project.isOpen() || !project.hasNature(IEARNatureConstants.NATURE_ID)) {
- return WTPCommonPlugin.createErrorStatus(EARCreationResourceHandler.getString(EARCreationResourceHandler.ADD_PROJECT_NOT_EAR));
- }
- } catch (CoreException e) {
- Logger.getLogger().logError(e);
- }
- }
- if (ARCHIVE_MODULE.equals(propertyName)) {
-// WorkbenchComponent module = (WorkbenchComponent) getProperty(propertyName);
- IProject project = (IProject)getProperty(propertyName);
- if (null == project) {
- return WTPCommonPlugin.createErrorStatus(EARCreationResourceHandler.getString(EARCreationResourceHandler.ADD_MODULE_MODULE_NULL));
- }
-// IProject containingProj = getProjectForGivenComponent(module);
-// if (!containingProj.isOpen()) {
- if (!project.isOpen()) {
- return WTPCommonPlugin.createErrorStatus(EARCreationResourceHandler.getString(EARCreationResourceHandler.ADD_MODULE_MODULE_CLOSED));
- }
- } else if (ARCHIVE_URI.equals(propertyName)) {
- String uri = getStringProperty(ARCHIVE_URI);
- if (uri == null || uri.trim().length() == 0) {
- return WTPCommonPlugin.createErrorStatus(EARCreationResourceHandler.getString(EARCreationResourceHandler.ADD_PROJECT_URI_EMPTY));
- }
-
- EARArtifactEdit earEdit = null;
- try {
- earEdit = getEARArtifactEditForRead();
- if (earEdit.uriExists(uri)) {
- return WTPCommonPlugin.createErrorStatus(EARCreationResourceHandler.getString(EARCreationResourceHandler.ADD_PROJECT_URI_EXISTS));
- }
- } finally {
- if (earEdit != null) {
- earEdit.dispose();
- }
- }
- }
- return super.doValidateProperty(propertyName);
- }
-
- protected boolean doSetProperty(String propertyName, Object propertyValue) {
- boolean returnValue = super.doSetProperty(propertyName, propertyValue);
- if (propertyName.equals(ARCHIVE_MODULE)) {
- notifyDefaultChange(ARCHIVE_URI);
- }
- return returnValue;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.wst.common.frameworks.internal.operation.WTPOperationDataModel#getDefaultProperty(java.lang.String)
- */
- protected Object getDefaultProperty(String propertyName) {
- if (propertyName.equals(ARCHIVE_URI))
- return getDefaultArchiveURI();
- return super.getDefaultProperty(propertyName);
- }
-
- /**
- * @return
- */
- protected String getDefaultArchiveURI() {
- WorkbenchComponent module = (WorkbenchComponent) getProperty(ARCHIVE_MODULE);
- if (module != null) {
- StringBuffer b = new StringBuffer();
- b.append(module.getName().replace(' ', '_'));
- b.append('.');
- b.append(getDefaultURIExtension());
- return b.toString();
- }
- return ""; //$NON-NLS-1$
- }
-
- protected String getDefaultURIExtension() {
- return "jar"; //$NON-NLS-1$
- }
-
- public boolean isModuleArchive() {
- return false;
- }
-
- /**
- * @return
- */
- public ServerTargetDataModel getServerTargetDataModel() {
- ServerTargetDataModel model = new ServerTargetDataModel();
- IRuntime earRuntime = ServerCore.getProjectProperties(getTargetProject()).getRuntimeTarget();
- if (earRuntime != null)
- model.setProperty(ServerTargetDataModel.RUNTIME_TARGET_ID, earRuntime.getId());
- else
- model.setProperty(ServerTargetDataModel.RUNTIME_TARGET_ID, null);
- WorkbenchComponent module = (WorkbenchComponent) getProperty(ARCHIVE_MODULE);
- IProject modProject = getProjectForGivenComponent(module);
- if (modProject != null)
- model.setProperty(ServerTargetDataModel.PROJECT_NAME, modProject.getName());
- return model;
- }
-
- public IProject getProjectForGivenComponent(WorkbenchComponent wbComp) {
- IProject modProject = null;
- modProject = StructureEdit.getContainingProject(wbComp);
- return modProject;
- }
-
- public AddArchiveToEARDataModel createArchiveModel() {
- AddArchiveToEARDataModel model = null;
-// switch (ModuleType) {
-// case XMLResource.WEB_APP_TYPE :
-// model = new AddWebModuleToEARDataModel();
-// break;
-// default :
-// model = new AddModuleToEARDataModel();
-// break;
-// }
-// model = new AddUtilityProjectToEARDataModel();
- return model;
- }
-} \ No newline at end of file
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 ce54bdabf..000000000
--- a/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/application/internal/operations/AddComponentToEnterpriseApplicationDataModelProvider.java
+++ /dev/null
@@ -1,43 +0,0 @@
-package org.eclipse.jst.j2ee.application.internal.operations;
-
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.wst.common.componentcore.datamodel.properties.ICreateReferenceComponentsDataModelProperties;
-import org.eclipse.wst.common.componentcore.internal.operation.CreateReferenceComponentsDataModelProvider;
-import org.eclipse.wst.common.componentcore.resources.ComponentHandle;
-import org.eclipse.wst.common.componentcore.resources.IVirtualComponent;
-import org.eclipse.wst.common.frameworks.datamodel.IDataModelOperation;
-
-public class AddComponentToEnterpriseApplicationDataModelProvider extends CreateReferenceComponentsDataModelProvider {
-
-
- public AddComponentToEnterpriseApplicationDataModelProvider() {
- super();
-
- }
-
- public String[] getPropertyNames() {
- return super.getPropertyNames();
- }
-
- /**
- *
- */
- public IStatus validate(String propertyName) {
- return super.validate(propertyName);
- }
-
- private IVirtualComponent getEarComponent() {
- ComponentHandle handle = (ComponentHandle) getProperty(ICreateReferenceComponentsDataModelProperties.SOURCE_COMPONENT_HANDLE);
- IVirtualComponent earComponent = handle.createComponent();
- return earComponent;
- }
-
- public IDataModelOperation getDefaultOperation() {
- return new AddComponentToEnterpriseApplicationOp(model);
- }
-
- public Object getDefaultProperty(String propertyName) {
- 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 e5ed17807..000000000
--- a/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/application/internal/operations/AddComponentToEnterpriseApplicationOp.java
+++ /dev/null
@@ -1,124 +0,0 @@
-package org.eclipse.jst.j2ee.application.internal.operations;
-
-import java.util.List;
-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.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.application.ApplicationPackage;
-import org.eclipse.wst.common.componentcore.ComponentCore;
-import org.eclipse.wst.common.componentcore.datamodel.properties.ICreateReferenceComponentsDataModelProperties;
-import org.eclipse.wst.common.componentcore.internal.operation.CreateReferenceComponentsOp;
-import org.eclipse.wst.common.componentcore.internal.util.IModuleConstants;
-import org.eclipse.wst.common.componentcore.resources.ComponentHandle;
-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;
- try {
- ComponentHandle handle = (ComponentHandle) model.getProperty(ICreateReferenceComponentsDataModelProperties.SOURCE_COMPONENT_HANDLE);
- earEdit = EARArtifactEdit.getEARArtifactEditForWrite(handle);
- if(earEdit != null){
- Application application = earEdit.getApplication();
- List list = (List)model.getProperty(ICreateReferenceComponentsDataModelProperties.TARGET_COMPONENTS_HANDLE_LIST);
- if (list != null && list.size() > 0) {
- for (int i = 0; i < list.size(); i++) {
- ComponentHandle comphandle = (ComponentHandle)list.get(i);
- IVirtualComponent wc = ComponentCore.createComponent(comphandle.getProject(), comphandle.getName());
- addModule(application, wc);
- }
- }
- }
- earEdit.saveIfNecessary(monitor);
- }
- catch(Exception e){
- Logger.getLogger().logError(e);
- } finally {
- if(earEdit != null)
- earEdit.dispose();
- }
- }
- protected Module createNewModule(IVirtualComponent wc) {
-
- String type = wc.getComponentTypeId();
- if ( type.equals(IModuleConstants.JST_WEB_MODULE) ){
- return ((ApplicationPackage) EPackage.Registry.INSTANCE.getEPackage(ApplicationPackage.eNS_URI)).getApplicationFactory().createWebModule();
- }else if ( type.equals(IModuleConstants.JST_EJB_MODULE)) {
- return ((ApplicationPackage) EPackage.Registry.INSTANCE.getEPackage(ApplicationPackage.eNS_URI)).getApplicationFactory().createEjbModule();
- }else if ( type.equals(IModuleConstants.JST_APPCLIENT_MODULE)) {
- return ((ApplicationPackage) EPackage.Registry.INSTANCE.getEPackage(ApplicationPackage.eNS_URI)).getApplicationFactory().createJavaClientModule();
- }else if ( type.equals(IModuleConstants.JST_CONNECTOR_MODULE)) {
- return ((ApplicationPackage) EPackage.Registry.INSTANCE.getEPackage(ApplicationPackage.eNS_URI)).getApplicationFactory().createConnectorModule();
- }
- return null;
- }
-
- protected void addModule(Application application, IVirtualComponent wc) {
- Application dd = application;
-
- Module m = createNewModule(wc);
-
- String name = wc.getName();
- String type = wc.getComponentTypeId();
-
- if ( type.equals(IModuleConstants.JST_WEB_MODULE) ){
- name += ".war"; //$NON-NLS-1$
- }else if ( type.equals(IModuleConstants.JST_EJB_MODULE)) {
- name += ".jar"; //$NON-NLS-1$
- }else if ( type.equals(IModuleConstants.JST_APPCLIENT_MODULE)) {
- name += ".jar"; //$NON-NLS-1$
- }else if ( type.equals(IModuleConstants.JST_CONNECTOR_MODULE)) {
- name += ".rar"; //$NON-NLS-1$
- }
-
- if( m!= null){
- m.setUri(name);
- if (m instanceof WebModule) {
-
-
- Properties props = wc.getMetaProperties();
- String contextroot = ""; //$NON-NLS-1$
- if(( props != null ) && ( props.containsKey(J2EEConstants.CONTEXTROOT)))
- contextroot = props.getProperty(J2EEConstants.CONTEXTROOT);
- ((WebModule) m).setContextRoot(contextroot);
- }
- dd.getModules().add(m);
- }
- }
-
- 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/AddModuleToEARDataModel.java b/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/application/internal/operations/AddModuleToEARDataModel.java
deleted file mode 100644
index b161cba58..000000000
--- a/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/application/internal/operations/AddModuleToEARDataModel.java
+++ /dev/null
@@ -1,116 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.jst.j2ee.application.internal.operations;
-
-import org.eclipse.wst.common.componentcore.internal.WorkbenchComponent;
-import org.eclipse.wst.common.componentcore.internal.operation.ArtifactEditOperationDataModel;
-import org.eclipse.wst.common.componentcore.internal.util.IModuleConstants;
-import org.eclipse.wst.common.frameworks.internal.operations.WTPOperation;
-
-//TODO delete
-/**
- * @deprecated
- *
- */
-public class AddModuleToEARDataModel extends AddArchiveToEARDataModel {
-
- /**
- *
- */
- public static final String MODULE_PROJECT_LIST = "AddModuleToEARDataModel.MODULE_PROJECT_LIST"; //$NON-NLS-1$
-
- /**
- *
- */
- protected void initValidBaseProperties() {
- super.initValidBaseProperties();
- addValidBaseProperty(MODULE_PROJECT_LIST);
- }
-
- /**
- *
- * @param earModuleName
- * @param module
- * @return
- */
- public static AddModuleToEARDataModel createAddToEARDataModel(String earModuleName, WorkbenchComponent module) {
- AddModuleToEARDataModel model = new AddModuleToEARDataModel();
- model.setProperty(ArtifactEditOperationDataModel.MODULE_NAME, earModuleName);
- model.setProperty(AddArchiveToEARDataModel.ARCHIVE_MODULE, module);
- return model;
- }
-
- /**
- *
- * @return
- */
- public AddModuleToEARDataModel getAppropriateDataModel() {
- AddModuleToEARDataModel model = this;
- WorkbenchComponent wbComp = (WorkbenchComponent) getProperty(AddArchiveToEARDataModel.ARCHIVE_MODULE);
- if (wbComp != null && wbComp.getComponentType().getComponentTypeId() == IModuleConstants.JST_WEB_MODULE) {
- //model = AddWebModuleToEARDataModel.createAddWebModuleToEARDataModel(getStringProperty(COMPONENT_NAME), wbComp);
- model.setProperty(AddArchiveToEARDataModel.ARCHIVE_URI, getProperty(ARCHIVE_URI));
- }
- return model;
- }
-
- /**
- *
- */
- public WTPOperation getDefaultOperation() {
- return new AddArchiveProjectToEAROperation(this);
- }
-
- /**
- *
- */
- protected String getDefaultArchiveURI() {
- return ""; //$NON-NLS-1$
- //TODO: reimplement
-// IProject archiveProj = (IProject) getProperty(ARCHIVE_PROJECT);
-// J2EENature j2eeNature = J2EENature.getRegisteredRuntime(archiveProj);
-// if (j2eeNature != null) {
-// J2EEModuleNature modNature = (J2EEModuleNature) j2eeNature;
-// String existingURI = modNature.getModuleUriInFirstEAR();
-// if (existingURI != null)
-// return existingURI;
-// }
-// return super.getDefaultArchiveURI();
- }
-
- /**
- *
- */
- protected String getDefaultURIExtension() {
- WorkbenchComponent wbComp = (WorkbenchComponent) getProperty(AddArchiveToEARDataModel.ARCHIVE_MODULE);
- if (wbComp != null && wbComp.getComponentType().getComponentTypeId() == IModuleConstants.JST_WEB_MODULE)
- return "war"; //$NON-NLS-1$
- if (wbComp != null && wbComp.getComponentType().getComponentTypeId() == IModuleConstants.JST_CONNECTOR_MODULE)
- return "rar"; //$NON-NLS-1$
- return super.getDefaultURIExtension();
- }
-
- /**
- *
- */
- public boolean isModuleArchive() {
- return true;
- }
-
- /**
- *
- * @return
- */
- public boolean isWebModuleArchive() {
- return false;
- }
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/application/internal/operations/AddUtilityProjectToEARDataModel.java b/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/application/internal/operations/AddUtilityProjectToEARDataModel.java
deleted file mode 100644
index ee9f4b66f..000000000
--- a/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/application/internal/operations/AddUtilityProjectToEARDataModel.java
+++ /dev/null
@@ -1,223 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-/*
- * Created on Nov 25, 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 org.eclipse.core.resources.IProject;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.jst.j2ee.internal.common.XMLResource;
-import org.eclipse.jst.j2ee.internal.earcreation.EARCreationResourceHandler;
-import org.eclipse.jst.j2ee.internal.earcreation.EAREditModel;
-import org.eclipse.jst.j2ee.internal.earcreation.EARNatureRuntime;
-import org.eclipse.jst.j2ee.internal.earcreation.modulemap.UtilityJARMapping;
-import org.eclipse.jst.j2ee.internal.project.J2EEProjectUtilities;
-import org.eclipse.jst.j2ee.internal.servertarget.ServerTargetDataModel;
-import org.eclipse.wst.common.componentcore.internal.WorkbenchComponent;
-import org.eclipse.wst.common.componentcore.internal.util.IModuleConstants;
-import org.eclipse.wst.common.frameworks.internal.operations.WTPOperation;
-import org.eclipse.wst.common.frameworks.internal.plugin.WTPCommonPlugin;
-import org.eclipse.wst.server.core.IRuntime;
-import org.eclipse.wst.server.core.ServerCore;
-
-//TODO delete
-/**
- * @deprecated
- *
- */
-public class AddUtilityProjectToEARDataModel extends AddArchiveToEARDataModel {
- /**
- * (non-Javadoc)
- * * @deprecated - This method is deprecated module must be passed
- * @see org.eclipse.jst.j2ee.internal.internal.application.operations.AddArchiveProjectToEARDataModel#getDefaultArchiveURI()
- */
- public static AddUtilityProjectToEARDataModel createAddToEARDataModel(String earProjectName, IProject moduleProject) {
- AddUtilityProjectToEARDataModel model = new AddUtilityProjectToEARDataModel();
- model.setProperty(AddModuleToEARDataModel.PROJECT_NAME, earProjectName);
- //model.setProperty(AddModuleToEARDataModel.ARCHIVE_PROJECT, moduleProject);
- return model;
- }
- public static AddUtilityProjectToEARDataModel createAddToEARDataModel(String earModuleName, WorkbenchComponent module) {
- AddUtilityProjectToEARDataModel model = new AddUtilityProjectToEARDataModel();
- model.setProperty(AddModuleToEARDataModel.MODULE_NAME, earModuleName);
- model.setProperty(AddModuleToEARDataModel.ARCHIVE_MODULE, module);
- return model;
- }
- private static final String NESTED_MODEL_MANIFEST = "AddUtilityProjectToEARDataModel.NESTED_MODEL_MANIFEST"; //$NON-NLS-1$
- private static final String NESTED_MODEL_SERVER_TARGET = "AddUtilityProjectToEARDataModel.NESTED_MODEL_SERVER_TARGET"; //$NON-NLS-1$
-
- private UpdateManifestDataModel manifestModel;
- private ServerTargetDataModel serverTargetModel;
-
- public WTPOperation getDefaultOperation() {
- return new AddArchiveProjectToEAROperation(this);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.wst.common.frameworks.internal.operation.WTPOperationDataModel#initNestedModels()
- */
- protected void initNestedModels() {
- super.initNestedModels();
- manifestModel = new UpdateManifestDataModel();
- addNestedModel(NESTED_MODEL_MANIFEST, manifestModel);
- serverTargetModel = new ServerTargetDataModel();
- addNestedModel(NESTED_MODEL_SERVER_TARGET, serverTargetModel);
- }
-
- /**
- *
- */
- private void updateServerTargetIDs() {
- EARNatureRuntime nature = EARNatureRuntime.getRuntime(getTargetProject());
- if (nature != null) {
- serverTargetModel.setIntProperty(ServerTargetDataModel.J2EE_VERSION_ID, nature.getJ2EEVersion());
- IRuntime targetType = ServerCore.getProjectProperties(getTargetProject()).getRuntimeTarget();
- if (targetType != null)
- serverTargetModel.setProperty(ServerTargetDataModel.RUNTIME_TARGET_ID, targetType.getId());
- //We need to use the EAR type for now.
- serverTargetModel.setIntProperty(ServerTargetDataModel.DEPLOYMENT_TYPE_ID, XMLResource.APPLICATION_TYPE);
- }
- }
-
- public String getUtilityJARUriInFirstEAR(IProject utilProject) {
- Object key = new Object();
- EARNatureRuntime earNature = J2EEProjectUtilities.getFirstReferencingEARProject(utilProject);
- if (earNature != null) {
- EAREditModel model;
- UtilityJARMapping mapping;
- model = earNature.getEarEditModelForRead(key);
- try {
- mapping = model.getUtilityJARMapping(utilProject);
- if (mapping != null && mapping.getUri() != null && mapping.getUri().length() > 0)
- return mapping.getUri();
- } finally {
- model.releaseAccess(key);
- }
- }
- return null;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.wst.common.frameworks.internal.operation.WTPOperationDataModel#doSetProperty(java.lang.String,
- * java.lang.Object)
- */
- protected boolean doSetProperty(String propertyName, Object propertyValue) {
- boolean result = super.doSetProperty(propertyName, propertyValue);
- if (propertyName.equals(ARCHIVE_MODULE)) {
- WorkbenchComponent wbComp = (WorkbenchComponent) propertyValue;
- IProject proj = getProjectForGivenComponent(wbComp);
- updateManifestModel(proj);
- updateServerTargetModel(proj);
- } else if (propertyName.equals(PROJECT_NAME))
- updateServerTargetIDs();
- return result;
- }
-
- /**
- * @param proj
- */
- private void updateServerTargetModel(IProject proj) {
- if (proj != null) {
- serverTargetModel.setProperty(ServerTargetDataModel.PROJECT_NAME, proj.getName());
- }
- }
-
- private void updateManifestModel(IProject proj) {
- if (proj != null)
- manifestModel.setProperty(UpdateManifestDataModel.PROJECT_NAME, proj.getName());
- else
- manifestModel.setProperty(UpdateManifestDataModel.PROJECT_NAME, null);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.jst.j2ee.internal.internal.application.operations.AddArchiveProjectToEARDataModel#getDefaultArchiveURI()
- */
- protected String getDefaultArchiveURI() {
- WorkbenchComponent wbComp = (WorkbenchComponent) getProperty(ARCHIVE_MODULE);
- return wbComp.getHandle().toString();
- //TODO: port
-// IProject project = (IProject) getProperty(ARCHIVE_PROJECT);
-// if (project != null) {
-// String defaultURI = getUtilityJARUriInFirstEAR(project);
-// if (defaultURI != null)
-// return defaultURI;
-// }
-// return super.getDefaultArchiveURI();
- }
-
- protected IStatus doValidateProperty(String propertyName) {
- if (ARCHIVE_MODULE.equals(propertyName)) {
- IStatus status = super.doValidateProperty(propertyName);
- if (!status.isOK()) {
- return status;
- }
- //TODO redo without editmodel
-// Object key = new Object();
-// EAREditModel editModel = null;
-// try {
-// editModel = (EAREditModel) getEditModelForRead(key);
-// if (null != editModel.getUtilityJARMapping((IProject) getProperty(ARCHIVE_PROJECT))) {
-// return WTPCommonPlugin.createErrorStatus(EARCreationResourceHandler.getString(EARCreationResourceHandler.ADD_PROJECT_UTIL_MAPPED));
-// }
-// } finally {
-// if (null != editModel) {
-// editModel.releaseAccess(key);
-// }
-// }
- WorkbenchComponent wbComp = (WorkbenchComponent) getProperty(ARCHIVE_MODULE);
- if (isWebOrClientModule(wbComp) || !isJavaModule(wbComp)) {
- return WTPCommonPlugin.createErrorStatus(EARCreationResourceHandler.getString(EARCreationResourceHandler.ADD_PROJECT_NOT_JAVA));
- }
- } else if (ARCHIVE_URI.equals(propertyName)) {
- IStatus status = super.doValidateProperty(propertyName);
- if (!status.isOK()) {
- return status;
- }
- if (!getStringProperty(ARCHIVE_URI).endsWith(".jar")) { //$NON-NLS-1$
- return WTPCommonPlugin.createErrorStatus(EARCreationResourceHandler.getString(EARCreationResourceHandler.ADD_PROJECT_UTIL_URI));
- }
- }
- return super.doValidateProperty(propertyName);
- }
-
- private boolean isJavaModule(WorkbenchComponent wbComp) {
- return wbComp.getComponentType().getComponentTypeId().equals(IModuleConstants.JST_UTILITY_MODULE);
- }
-
- private boolean isWebOrClientModule(WorkbenchComponent wbComp) {
- String typeID = wbComp.getComponentType().getComponentTypeId();
- return typeID.equals(IModuleConstants.JST_WEB_MODULE) || typeID.equals(IModuleConstants.JST_APPCLIENT_MODULE);
- }
-
- /**
- * @return Returns the manifestModel.
- */
- public UpdateManifestDataModel getManifestModel() {
- return manifestModel;
- }
-
- /**
- * @return Returns the serverTargetModel.
- */
- public ServerTargetDataModel getServerTargetModel() {
- return serverTargetModel;
- }
-
-} \ No newline at end of file
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 a41ea1d94..000000000
--- a/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/application/internal/operations/AddWebComponentToEARDataModelProvider.java
+++ /dev/null
@@ -1,107 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.jst.j2ee.application.internal.operations;
-
-import java.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 String[] getPropertyNames() {
- String[] props = new String[]{CONTEXT_ROOT};
- return combineProperties(super.getPropertyNames(), props);
- }
-
- /**
- *
- */
- 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("Context_Root_cannot_be_empty_2", new Object[]{contextRoot}), null); //$NON-NLS-1$
- }
- 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("The_character_is_invalid_in_a_context_root",invalidChar); //$NON-NLS-1$
- return J2EEPlugin.newErrorStatus(errorStatus, null);
- }
- }
- }
- }
- else
- return J2EEPlugin.newErrorStatus(ProjectSupportResourceHandler.getString("Names_cannot_begin_or_end_with_whitespace_5", new Object[]{contextRoot}), null); //$NON-NLS-1$
- return OK_STATUS;
- }
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/application/internal/operations/AppClientComponentExportDataModelProvider.java b/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/application/internal/operations/AppClientComponentExportDataModelProvider.java
deleted file mode 100644
index 8ec4b81b4..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, 2004, 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.wst.common.componentcore.internal.util.IModuleConstants;
-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 getComponentID() {
- return IModuleConstants.JST_APPCLIENT_MODULE;
- }
- /**
- * 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 8b89be723..000000000
--- a/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/application/internal/operations/ClassPathSelection.java
+++ /dev/null
@@ -1,651 +0,0 @@
-/***************************************************************************************************
- * Copyright (c) 2003, 2004 IBM Corporation and others. All rights reserved. This program and the
- * accompanying materials are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors: IBM Corporation - initial API and implementation
- **************************************************************************************************/
-package org.eclipse.jst.j2ee.application.internal.operations;
-
-
-
-import java.io.FileNotFoundException;
-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.IFile;
-import org.eclipse.core.resources.IProject;
-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.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.strategy.LoadStrategy;
-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.J2EEComponentUtilities;
-import org.eclipse.jst.j2ee.internal.project.J2EEProjectUtilities;
-import org.eclipse.wst.common.componentcore.resources.IVirtualComponent;
-
-
-public class ClassPathSelection {
- protected Archive archive;
- protected IProject earProject;
- 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);
- element.setText(referencedArchive.getURI());
- element.setTargetArchive(referencedArchive);
- element.setEarProject(earProject);
- 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;
- }
-
- /**
- * @param element
- */
- private void setInvalidProject(ClasspathElement element) {
- IProject earProj = element.getEarProject();
- IVirtualComponent component = J2EEComponentUtilities.getComponent(earProj.getName())[0];
- 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;
- }
-
- /**
- * 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);
- if (anArchive.getURI().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());
- }
- }
- }
- }
-
- private void initializeEARProject(EARFile earFile) {
- LoadStrategy loadStrat = earFile.getLoadStrategy();
- if (loadStrat instanceof EARComponentLoadStrategyImpl)
- 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;
- }
-
- protected 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;
- }
-
-} \ No newline at end of file
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 dd178eca8..000000000
--- a/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/application/internal/operations/ClasspathElement.java
+++ /dev/null
@@ -1,402 +0,0 @@
-/***************************************************************************************************
- * Copyright (c) 2003, 2004 IBM Corporation and others. All rights reserved. This program and the
- * accompanying materials are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors: IBM Corporation - initial API and implementation
- **************************************************************************************************/
-package org.eclipse.jst.j2ee.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.jdt.core.IClasspathEntry;
-import org.eclipse.jdt.core.JavaCore;
-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.project.J2EEProjectUtilities;
-
-
-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;
-
- public ClasspathElement(Archive anArchive) {
- super();
- archive = anArchive;
- }
-
- public ClasspathElement(IProject project) {
- super();
- this.project = project;
- }
-
- 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());
- }
-
- /**
- * 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 (!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.getFile(getText()).getFullPath();
- 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;
- }
-
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/application/internal/operations/ClasspathSelectionHelper.java b/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/application/internal/operations/ClasspathSelectionHelper.java
deleted file mode 100644
index 8e2590d1e..000000000
--- a/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/application/internal/operations/ClasspathSelectionHelper.java
+++ /dev/null
@@ -1,118 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-/*
- * Created on Nov 14, 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.resources.IProject;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.emf.ecore.EClass;
-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.commonarchivecore.internal.CommonarchiveFactory;
-import org.eclipse.jst.j2ee.commonarchivecore.internal.CommonarchivePackage;
-import org.eclipse.jst.j2ee.commonarchivecore.internal.EARFile;
-import org.eclipse.jst.j2ee.commonarchivecore.internal.ModuleFile;
-import org.eclipse.jst.j2ee.commonarchivecore.internal.exception.OpenFailureException;
-import org.eclipse.jst.j2ee.commonarchivecore.internal.helpers.ArchiveManifest;
-import org.eclipse.jst.j2ee.commonarchivecore.internal.helpers.ArchiveManifestImpl;
-import org.eclipse.jst.j2ee.commonarchivecore.internal.strategy.NullLoadStrategyImpl;
-import org.eclipse.jst.j2ee.internal.earcreation.EAREditModel;
-import org.eclipse.jst.j2ee.internal.earcreation.EARNatureRuntime;
-import org.eclipse.jst.j2ee.internal.earcreation.IEARNatureConstants;
-
-/**
- * @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 ClasspathSelectionHelper {
-
- public static ClassPathSelection createClasspathSelection(IProject moduleProject, String moduleExtension, IProject earProject, EClass moduleType) {
- // if(true){
- // return null;
- // }
-
- if (earProject == null || !earProject.exists()) {
- return null;
- }
- EARFile earFile = null;
- try {
- EARNatureRuntime earNature = (EARNatureRuntime) earProject.getNature(IEARNatureConstants.NATURE_ID);
- earFile = (EARFile)earNature.asArchive();
-
- CommonarchiveFactory factory = getCommonArchiveFactory();
- CommonarchivePackage pkg = getCommonArchiveFactory().getCommonarchivePackage();
- ModuleFile bogusModuleFile = null;
- if (moduleType == pkg.getEJBJarFile())
- bogusModuleFile = factory.createEJBJarFile();
- else if (moduleType == pkg.getApplicationClientFile())
- bogusModuleFile = factory.createApplicationClientFile();
- else if (moduleType == pkg.getWARFile())
- bogusModuleFile = factory.createWARFile();
- else if (moduleType == pkg.getRARFile())
- bogusModuleFile = factory.createRARFile();
-
- bogusModuleFile.setURI(getUniqueUriInEAR(moduleProject, moduleExtension, earNature));
- bogusModuleFile.setManifest((ArchiveManifest) new ArchiveManifestImpl());
- bogusModuleFile.setLoadStrategy(new NullLoadStrategyImpl());
- earFile.getFiles().add(bogusModuleFile);
-
- return new ClassPathSelection(bogusModuleFile, moduleProject.getName(), earFile);
- } catch (CoreException e) {
- Logger.getLogger().logError(e);
- } catch (OpenFailureException e) {
- Logger.getLogger().logError(e);
- } finally {
- // The client of the ClasspathSelection has the responsibility of closing
- // the EARFile
- // if(earFile != null)
- // earFile.close();
- }
- return null;
-
- }
-
- protected static CommonarchiveFactory getCommonArchiveFactory() {
- return ((CommonarchivePackage) EPackage.Registry.INSTANCE.getEPackage(CommonarchivePackage.eNS_URI)).getCommonarchiveFactory();
- }
-
- protected static String getUniqueUriInEAR(IProject moduleProject, String moduleExtension, EARNatureRuntime earNature) {
- String base = moduleProject.getName().replace(' ', '_');
- String result = base + moduleExtension;
- EAREditModel earEditModel = null;
- Object key = new Object();
- try {
- if (earNature == null)
- return result;
- earEditModel = earNature.getEarEditModelForRead(key);
- Application app = earEditModel.getApplication();
- if (app == null)
- return result;
- int counter = 1;
- while (app.getFirstModule(result) != null)
- result = base + (counter++) + moduleExtension;
- } finally {
- if (null != earEditModel) {
- earEditModel.releaseAccess(key);
- }
- earEditModel = null;
- }
- return result;
- }
-
-} \ No newline at end of file
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 d51543666..000000000
--- a/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/application/internal/operations/DefaultJ2EEComponentCreationOperation.java
+++ /dev/null
@@ -1,117 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 2004, 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.util.logger.proxy.Logger;
-import org.eclipse.jst.j2ee.datamodel.properties.IJ2EEComponentCreationDataModelProperties;
-import org.eclipse.jst.j2ee.internal.earcreation.IDefaultJ2EEComponentCreationDataModelProperties;
-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;
-
-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 {
- IDataModel model = getDataModel();
- if (model.getBooleanProperty(CREATE_EJB)) {
- IDataModel ejbModel = model.getNestedModel(NESTED_MODEL_EJB);
- ejbModel.setProperty(IJ2EEComponentCreationDataModelProperties.COMPONENT_NAME, model.getStringProperty(EJB_COMPONENT_NAME));
- ejbModel.setProperty(IJ2EEComponentCreationDataModelProperties.PROJECT_NAME, model.getStringProperty(EJB_COMPONENT_NAME));
- ejbModel.setProperty(IJ2EEComponentCreationDataModelProperties.ADD_TO_EAR, Boolean.FALSE);
- createEJBComponent(ejbModel, monitor);
- }
- if (model.getBooleanProperty(CREATE_WEB)) {
- IDataModel webModel = model.getNestedModel(NESTED_MODEL_WEB);
- webModel.setProperty(IJ2EEComponentCreationDataModelProperties.COMPONENT_NAME, model.getStringProperty(WEB_COMPONENT_NAME));
- webModel.setProperty(IJ2EEComponentCreationDataModelProperties.PROJECT_NAME, model.getStringProperty(WEB_COMPONENT_NAME));
- webModel.setProperty(IJ2EEComponentCreationDataModelProperties.ADD_TO_EAR, Boolean.FALSE);
- createWebJ2EEComponent(webModel, monitor);
- }
- if (model.getBooleanProperty(CREATE_CONNECTOR)) {
- IDataModel conModel = model.getNestedModel(NESTED_MODEL_JCA);
- conModel.setProperty(IJ2EEComponentCreationDataModelProperties.COMPONENT_NAME, model.getStringProperty(CONNECTOR_COMPONENT_NAME));
- conModel.setProperty(IJ2EEComponentCreationDataModelProperties.PROJECT_NAME, model.getStringProperty(CONNECTOR_COMPONENT_NAME));
- conModel.setProperty(IJ2EEComponentCreationDataModelProperties.ADD_TO_EAR, Boolean.FALSE);
- createRarJ2EEComponent(conModel, monitor);
- }
- if (model.getBooleanProperty(CREATE_APPCLIENT)) {
- IDataModel clientModel = model.getNestedModel(NESTED_MODEL_CLIENT);
- clientModel.setProperty(IJ2EEComponentCreationDataModelProperties.COMPONENT_NAME, model.getStringProperty(APPCLIENT_COMPONENT_NAME));
- clientModel.setProperty(IJ2EEComponentCreationDataModelProperties.PROJECT_NAME, model.getStringProperty(APPCLIENT_COMPONENT_NAME));
- clientModel.setProperty(IJ2EEComponentCreationDataModelProperties.ADD_TO_EAR, Boolean.FALSE);
- createAppClientComponent(clientModel, 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);
- 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);
- 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);
- 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);
- WTPActivityBridge.getInstance().enableActivity(ENTERPRISE_JAVA, true);
-
- }
-
- 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/EARComponentCreationOperation.java b/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/application/internal/operations/EARComponentCreationOperation.java
deleted file mode 100644
index 84d7da7fd..000000000
--- a/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/application/internal/operations/EARComponentCreationOperation.java
+++ /dev/null
@@ -1,181 +0,0 @@
-package org.eclipse.jst.j2ee.application.internal.operations;
-
-import java.lang.reflect.InvocationTargetException;
-import java.util.List;
-
-import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Path;
-import org.eclipse.jem.util.emf.workbench.ProjectUtilities;
-import org.eclipse.jem.util.logger.proxy.Logger;
-import org.eclipse.jst.common.jdt.internal.integration.IJavaProjectMigrationDataModelProperties;
-import org.eclipse.jst.common.jdt.internal.integration.JavaProjectMigrationDataModelProvider;
-import org.eclipse.jst.j2ee.componentcore.util.EARArtifactEdit;
-import org.eclipse.jst.j2ee.datamodel.properties.IEarComponentCreationDataModelProperties;
-import org.eclipse.jst.j2ee.internal.J2EEConstants;
-import org.eclipse.jst.j2ee.internal.common.J2EEVersionUtil;
-import org.eclipse.wst.common.componentcore.ComponentCore;
-import org.eclipse.wst.common.componentcore.datamodel.properties.ICreateReferenceComponentsDataModelProperties;
-import org.eclipse.wst.common.componentcore.internal.WorkbenchComponent;
-import org.eclipse.wst.common.componentcore.internal.operation.ComponentCreationOperation;
-import org.eclipse.wst.common.componentcore.internal.operation.CreateReferenceComponentsDataModelProvider;
-import org.eclipse.wst.common.componentcore.internal.util.IModuleConstants;
-import org.eclipse.wst.common.componentcore.resources.ComponentHandle;
-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;
-
-public class EARComponentCreationOperation extends ComponentCreationOperation implements IEarComponentCreationDataModelProperties{
-
- public EARComponentCreationOperation(IDataModel model) {
- super(model);
- }
- /* (non-Javadoc)
- * @see org.eclipse.jst.j2ee.application.operations.J2EEComponentCreationOperation#createAndLinkJ2EEComponents()
- */
- protected void createAndLinkJ2EEComponentsForMultipleComponents() throws CoreException {
- IVirtualComponent component = ComponentCore.createComponent(getProject(), getModuleDeployName());
- component.create(0, null);
- //create and link META-INF folder
- IVirtualFolder root = component.getRootFolder().getFolder(new Path("/")); //$NON-NLS-1$
- root.createLink(new Path("/" + getModuleName()), 0, null); //$NON-NLS-1$
-
- IVirtualFolder metaInfFolder = root.getFolder(J2EEConstants.META_INF);
- metaInfFolder.create(IResource.FORCE, null);
- }
-
- protected void createAndLinkJ2EEComponentsForSingleComponent() throws CoreException {
- IVirtualComponent component = ComponentCore.createComponent(getProject(), getModuleDeployName());
- component.create(0, null);
- //create and link META-INF folder
- IVirtualFolder root = component.getRootFolder().getFolder(new Path("/")); //$NON-NLS-1$
- root.createLink(new Path("/" + getModuleName()), 0, null); //$NON-NLS-1$
-
- IVirtualFolder metaInfFolder = root.getFolder(J2EEConstants.META_INF);
- metaInfFolder.create(IResource.FORCE, null);
- }
-
- public IProject getProject() {
- String projName = model.getStringProperty(PROJECT_NAME);
- return ProjectUtilities.getProject( projName );
- }
-
- protected void createDeploymentDescriptor(IProgressMonitor monitor) throws CoreException, InvocationTargetException, InterruptedException {
- EARArtifactEdit earEdit = null;
- try {
- ComponentHandle handle = ComponentHandle.create(getProject(),getDataModel().getStringProperty(COMPONENT_DEPLOY_NAME));
- earEdit = EARArtifactEdit.getEARArtifactEditForWrite(handle);
- Integer version = (Integer)getDataModel().getProperty(COMPONENT_VERSION);
- earEdit.createModelRoot(version.intValue());
- earEdit.save(monitor);
- } finally {
- if (earEdit != null)
- earEdit.dispose();
- }
- }
-
- public IStatus execute(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
- try {
- super.execute(IModuleConstants.JST_EAR_MODULE, monitor, info);
- if (getDataModel().getBooleanProperty(CREATE_DEFAULT_FILES)) {
- createDeploymentDescriptor(monitor);
- }
- addModulesToEAR(monitor);
- } catch (CoreException e) {
- Logger.getLogger().log(e.getMessage());
- } catch (InvocationTargetException e) {
- Logger.getLogger().log(e.getMessage());
- } catch (InterruptedException e) {
- Logger.getLogger().log(e.getMessage());
- }
- return OK_STATUS;
- }
-
- private IStatus addModulesToEAR(IProgressMonitor monitor) {
- IStatus stat = OK_STATUS;
- try{
- IDataModel dm = (IDataModel)model.getProperty(NESTED_ADD_COMPONENT_TO_EAR_DM);
- IVirtualComponent component = ComponentCore.createComponent(getProject(), model.getStringProperty(COMPONENT_DEPLOY_NAME));
- dm.setProperty(ICreateReferenceComponentsDataModelProperties.SOURCE_COMPONENT_HANDLE, component.getComponentHandle());
-
- List modulesList = (List)model.getProperty(J2EE_COMPONENT_LIST);
- if (modulesList != null && !modulesList.isEmpty()) {
- dm.setProperty(ICreateReferenceComponentsDataModelProperties.TARGET_COMPONENTS_HANDLE_LIST, modulesList);
- stat = dm.validateProperty(ICreateReferenceComponentsDataModelProperties.TARGET_COMPONENTS_HANDLE_LIST);
- if( stat != OK_STATUS )
- return stat;
- dm.getDefaultOperation().execute(monitor, null);
- }
- List javaProjectsList = (List)model.getProperty(JAVA_PROJECT_LIST);
- if( !javaProjectsList.isEmpty()){
-
- for( int i=0; i< javaProjectsList.size(); i++){
- IProject proj = (IProject) javaProjectsList.get(i);
- IDataModel migrationdm = DataModelFactory.createDataModel( new JavaProjectMigrationDataModelProvider());
- migrationdm.setProperty(IJavaProjectMigrationDataModelProperties.PROJECT_NAME, proj.getName());
- migrationdm.getDefaultOperation().execute(monitor, null);
-
-
- IDataModel refdm = DataModelFactory.createDataModel( new CreateReferenceComponentsDataModelProvider());
- List targetCompList = (List) refdm.getProperty(ICreateReferenceComponentsDataModelProperties.TARGET_COMPONENTS_HANDLE_LIST);
-
- IVirtualComponent targetcomponent = ComponentCore.createComponent(proj, proj.getName());
- targetCompList.add(targetcomponent.getComponentHandle());
-
- refdm.setProperty(ICreateReferenceComponentsDataModelProperties.SOURCE_COMPONENT_HANDLE, component.getComponentHandle());
- refdm.setProperty(ICreateReferenceComponentsDataModelProperties.TARGET_COMPONENTS_HANDLE_LIST, targetCompList);
- refdm.getDefaultOperation().execute(monitor, null);
- }
- }
-
- } catch(Exception e) {
- Logger.getLogger().log(e);
- }
- return OK_STATUS;
- }
-
- protected void addResources(WorkbenchComponent component ){
- //Default
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jst.j2ee.application.operations.J2EEComponentCreationOperation#getVersion()
- */
- protected String getVersion() {
- int version = getDataModel().getIntProperty(COMPONENT_VERSION);
- return J2EEVersionUtil.getJ2EETextVersion(version);
- }
-
- public IStatus redo(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
- return null;
- }
- public IStatus undo(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
- return null;
- }
-
-/* protected void setupComponentType(String typeID) {
- IVirtualComponent component = ComponentCore.createComponent(getProject(), getModuleDeployName());
- ComponentType componentType = ComponentcoreFactory.eINSTANCE.createComponentType();
- componentType.setComponentTypeId(typeID);
- componentType.setVersion(getVersion());
- StructureEdit.setComponentType(component, componentType);
- }*/
-
- public String getModuleName() {
- return getDataModel().getStringProperty(COMPONENT_NAME);
- }
-
- public String getModuleDeployName() {
- return getDataModel().getStringProperty(COMPONENT_DEPLOY_NAME);
- }
- protected List getProperties() {
- // TODO Auto-generated method stub
- return null;
- }
-} \ No newline at end of file
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 a1d7f5d2c..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, 2004, 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.wst.common.componentcore.internal.util.IModuleConstants;
-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 getComponentID() {
- return IModuleConstants.JST_EAR_MODULE;
- }
- /**
- * 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/EnterpriseApplicationImportDataModelProvider.java b/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/application/internal/operations/EnterpriseApplicationImportDataModelProvider.java
deleted file mode 100644
index 7f28f32ac..000000000
--- a/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/application/internal/operations/EnterpriseApplicationImportDataModelProvider.java
+++ /dev/null
@@ -1,698 +0,0 @@
-/***************************************************************************************************
- * Copyright (c) 2003, 2004 IBM Corporation and others. All rights reserved. This program and the
- * accompanying materials are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors: IBM Corporation - initial API and implementation
- **************************************************************************************************/
-package org.eclipse.jst.j2ee.application.internal.operations;
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.Enumeration;
-import java.util.Hashtable;
-import java.util.List;
-
-import org.eclipse.core.internal.localstore.CoreFileSystemLibrary;
-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.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.plugin.WTPCommonPlugin;
-import org.eclipse.wst.server.core.IRuntime;
-import org.eclipse.wst.server.core.ServerCore;
-
-//TODO rename to EARComponentImportDataModelProvider
-/**
- * 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 EnterpriseApplicationImportDataModelProvider extends J2EEArtifactImportDataModelProvider implements IAnnotationsDataModel, IEARComponentImportDataModelProperties {
-
- /**
- * Optional, type Boolean, default false, This flag is set to allow nested projects (module
- * projects & utility projects to be overwritten or not.
- */
- public static final String OVERWRITE_NESTED_PROJECTS = "EARImportDataModel.OVERWRITE_NESTED_PROJECTS"; //$NON-NLS-1$
-
- /**
- * Booleam, default is true. When all the module projects are added to the ear, this controls
- * whether their server targets will be set to be the same as the one set on the ear.
- */
- public static final String SYNC_SERVER_TARGETS_WITH_EAR = "EARImportDataModel.SYNC_SERVER_TARGETS_WITH_EAR"; //$NON-NLS-1$
-
- /**
- * 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(PROJECT_NAME)) {
- model.notifyPropertyChange(NESTED_PROJECTS_VALIDATION, IDataModel.DEFAULT_CHG);
- }
- }
- };
-
- private Hashtable ejbJarToClientJarModels = new Hashtable();
-
- private Hashtable clientJarToEjbJarModels = new Hashtable();
-
- public String[] getPropertyNames() {
- return combineProperties(super.getPropertyNames(), new String[]{NESTED_MODULE_ROOT, UTILITY_LIST, MODULE_MODELS_LIST, EJB_CLIENT_LIST, UTILITY_MODELS_LIST, NESTED_PROJECTS_VALIDATION, SELECTED_MODELS_LIST, OVERWRITE_NESTED_PROJECTS, SYNC_SERVER_TARGETS_WITH_EAR, USE_ANNOTATIONS, ALL_PROJECT_MODELS_LIST, UNHANDLED_PROJECT_MODELS_LIST, HANDLED_PROJECT_MODELS_LIST});
- }
-
- 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 (OVERWRITE_NESTED_PROJECTS.equals(propertyName)) {
- return Boolean.FALSE;
- } else if (SYNC_SERVER_TARGETS_WITH_EAR.equals(propertyName)) {
- return Boolean.TRUE;
- } 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());
- }
- // if (event.getPropertyName().equals(J2EEArtifactImportDataModel.SERVER_TARGET_ID)) {
- // changeModuleServerTargets((List) getProperty(MODULE_MODELS_LIST));
- // }
- }
-
- /**
- * @param list
- */
- private void changeModuleServerTargets(List projectModels) {
- // IDataModel nestedModel = null;
- // for (int i = 0; i < projectModels.size(); i++) {
- // nestedModel = (IDataModel) projectModels.get(i);
- // nestedModel.setProperty(J2EEArtifactImportDataModel.SERVER_TARGET_ID,
- // getProperty(ServerTargetDataModel.RUNTIME_TARGET_ID));
- // }
- }
-
- 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");
- }
- if (OVERWRITE_NESTED_PROJECTS.equals(propertyName)) {
- List projectModels = getProjectModels();
- IDataModel nestedModel = null;
- for (int i = 0; i < projectModels.size(); i++) {
- nestedModel = (IDataModel) projectModels.get(i);
- }
- }
- 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 (RUNTIME_TARGET_ID.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);
- nestedModel.setProperty(RUNTIME_TARGET_ID, 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());
- }
- }
- }
- return doSet;
- }
-
- private List getUtilitiesForMetaDataImport(EARFile earFile) {
- List list = getAllUtilitiesExceptEJBClients(earFile);
- for (int i = list.size() - 1; i > -1; i--) {
- Archive archive = (Archive) list.get(i);
- if (!archive.containsFile(".project")) { //$NON-NLS-1$
- list.remove(archive);
- }
- }
- return list;
- }
-
- 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 model = (IDataModel) clientList.get(j);
- if (model.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)) {
- boolean overwrite = getBooleanProperty(OVERWRITE_NESTED_PROJECTS);
- 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 (!CoreFileSystemLibrary.isCaseSensitive()) {
- 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 (!CoreFileSystemLibrary.isCaseSensitive()) {
- 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 model = null;
- for (int i = 0; null != projects && i < projects.size(); i++) {
- model = (IDataModel) projects.get(i);
- IPath newPath = new Path(property);
- newPath = newPath.append((String) model.getProperty(IJ2EEComponentImportDataModelProperties.PROJECT_NAME));
- // model.setProperty(J2EEComponentCreationDataModel.PROJECT_LOCATION,
- // newPath.toOSString());
- }
- }
-
- private void changeModuleCreationLocationForNameChange(List projects) {
- IDataModel model = null;
- for (int i = 0; null != projects && i < projects.size(); i++) {
- model = (IDataModel) projects.get(i);
- if (isPropertySet(NESTED_MODULE_ROOT)) {
- IPath newPath = new Path((String) getProperty(NESTED_MODULE_ROOT));
- newPath = newPath.append((String) model.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 model = DataModelFactory.createDataModel(new J2EEUtilityJarImportDataModelProvider());
- model.setProperty(IJavaUtilityJarImportDataModelProperties.FILE, currentArchive);
- model.setProperty(IJavaUtilityJarImportDataModelProperties.EAR_PROJECT_NAME, getStringProperty(PROJECT_NAME));
- model.setProperty(IJavaUtilityJarImportDataModelProperties.EAR_COMPONENT_NAME, getStringProperty(COMPONENT_NAME));
- utilityModels.add(model);
- model.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);
- List defaultModuleNames = new ArrayList();
- 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, earProjectName);
- 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 model = null;
- for (int i = 0; i < modelsToCheck.size(); i++) {
- model = (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(IEarComponentCreationDataModelProperties.RUNTIME_TARGET_ID)) {
- IProject project = ProjectUtilities.getProject(getStringProperty(PROJECT_NAME));
- if (null == project || !project.exists()) {
- return true;
- }
- } else 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);
- }
-
-} \ No newline at end of file
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 2d177ee37..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, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-/*
- * Created on Jun 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);
-} \ No newline at end of file
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 bd18c95d8..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, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-/*
- * Created on Jun 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;
- }
-} \ No newline at end of file
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 29dc201c2..000000000
--- a/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/application/internal/operations/FlexibleJavaProjectCreationDataModelProvider.java
+++ /dev/null
@@ -1,84 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 2004, 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.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.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 String[] getPropertyNames() {
- String[] props = new String[]{NESTED_MODEL_SERVER_TARGET, ADD_SERVER_TARGET, RUNTIME_TARGET_ID};
- return combineProperties(super.getPropertyNames(), props);
- }
- 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 7ac96b170..000000000
--- a/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/application/internal/operations/FlexibleJavaProjectCreationOperation.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 2004, 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.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/FlexibleProjectCreationDataModelProvider.java b/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/application/internal/operations/FlexibleProjectCreationDataModelProvider.java
deleted file mode 100644
index 66a1d6433..000000000
--- a/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/application/internal/operations/FlexibleProjectCreationDataModelProvider.java
+++ /dev/null
@@ -1,98 +0,0 @@
-package org.eclipse.jst.j2ee.application.internal.operations;
-
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.IStatus;
-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.datamodel.properties.IFlexibleProjectCreationDataModelProperties;
-import org.eclipse.wst.common.frameworks.internal.operations.IProjectCreationProperties;
-import org.eclipse.wst.common.frameworks.internal.operations.ProjectCreationDataModelProvider;
-
-public class FlexibleProjectCreationDataModelProvider extends AbstractDataModelProvider
- implements IFlexibleProjectCreationDataModelProperties {
-
- public FlexibleProjectCreationDataModelProvider() {
- super();
-
- }
- public void init() {
- super.init();
- initNestedProjectModel();
- }
- protected void initNestedProjectModel() {
- IDataModel projModel = DataModelFactory.createDataModel(new ProjectCreationDataModelProvider());
- model.addNestedModel(NESTED_MODEL_PROJECT_CREATION, projModel);
- }
-
- public String[] getPropertyNames() {
- return new String[] {PROJECT_NAME, PROJECT_LOCATION, NESTED_MODEL_PROJECT_CREATION};
- }
-
- public Object getDefaultProperty(String propertyName) {
- if (PROJECT_LOCATION.equals(propertyName)) {
- return getDefaultLocation();
- }
- 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_PROJECT_CREATION);
- projModel.setProperty(IProjectCreationProperties.PROJECT_NAME, propertyValue);
- } else if (PROJECT_LOCATION.equals(propertyName)) {
- IDataModel projModel = model.getNestedModel(NESTED_MODEL_PROJECT_CREATION);
- projModel.setProperty(IProjectCreationProperties.PROJECT_LOCATION, propertyValue);
- }
- return status;
- }
-
- public IStatus validate(String propertyName) {
- if (PROJECT_NAME.equals(propertyName)) {
- return validateProjectName();
- } else if (PROJECT_LOCATION.equals(propertyName)) {
- return validateProjectLocation();
- }
- return OK_STATUS;
- }
-
- private IStatus validateProjectName() {
- IDataModel projModel = model.getNestedModel(NESTED_MODEL_PROJECT_CREATION);
- return projModel.validateProperty(IProjectCreationProperties.PROJECT_NAME);
- }
- private IStatus validateProjectLocation() {
- IDataModel projModel = model.getNestedModel(NESTED_MODEL_PROJECT_CREATION);
- return projModel.validateProperty(IProjectCreationProperties.PROJECT_LOCATION);
- }
-
- private String getDefaultLocation() {
- IPath path = getRootLocation();
- String projectName = (String) getProperty(PROJECT_NAME);
- if (projectName != null)
- path = path.append(projectName);
- return path.toOSString();
- }
-
- private IPath getRootLocation() {
- return ResourcesPlugin.getWorkspace().getRoot().getLocation();
- }
-//
-// protected void initNestedModels() {
-// super.initNestedModels();
-// initProjectModel();
-// addNestedModel(NESTED_MODEL_PROJECT_CREATION, projectDataModel);
-//
-// serverTargetDataModel = new J2EEProjectServerTargetDataModel();
-// addNestedModel(NESTED_MODEL_SERVER_TARGET, serverTargetDataModel);
-// }
-
-// protected void initProjectModel() {
-// projectDataModel = new ProjectCreationDataModel();
-// }
-//
- public IDataModelOperation getDefaultOperation() {
- return new FlexibleProjectCreationOperation(model);
- }
-}
diff --git a/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/application/internal/operations/FlexibleProjectCreationOperation.java b/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/application/internal/operations/FlexibleProjectCreationOperation.java
deleted file mode 100644
index 8d4b41455..000000000
--- a/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/application/internal/operations/FlexibleProjectCreationOperation.java
+++ /dev/null
@@ -1,82 +0,0 @@
-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.resources.ResourcesPlugin;
-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.wst.common.componentcore.internal.ProjectComponents;
-import org.eclipse.wst.common.componentcore.internal.StructureEdit;
-import org.eclipse.wst.common.componentcore.internal.util.IModuleConstants;
-import org.eclipse.wst.common.frameworks.datamodel.AbstractDataModelOperation;
-import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
-import org.eclipse.wst.common.frameworks.datamodel.IDataModelOperation;
-import org.eclipse.wst.common.frameworks.datamodel.properties.IFlexibleProjectCreationDataModelProperties;
-import org.eclipse.wst.common.frameworks.internal.WTPProjectUtilities;
-
-public class FlexibleProjectCreationOperation extends AbstractDataModelOperation {
-
- public FlexibleProjectCreationOperation(IDataModel model) {
- super(model);
- // TODO Auto-generated constructor stub
- }
-
- public IStatus execute(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
- try {
- createProject(monitor);
- WTPProjectUtilities.addNatureToProjectLast(getProject(), IModuleConstants.MODULE_NATURE_ID);
- } catch (CoreException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- } catch (InvocationTargetException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- } catch (InterruptedException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- createInitialWTPModulesFile();
- return OK_STATUS;
- }
-
- private void createProject(IProgressMonitor monitor) throws CoreException, InvocationTargetException, InterruptedException, ExecutionException {
- IDataModel projModel = model.getNestedModel(IFlexibleProjectCreationDataModelProperties.NESTED_MODEL_PROJECT_CREATION);
- IDataModelOperation op = projModel.getDefaultOperation();
- op.execute(monitor, null);
- }
-
- private void createInitialWTPModulesFile() {
- StructureEdit moduleCore = null;
- try {
- IProject containingProject = getProject();
- moduleCore = StructureEdit.getStructureEditForWrite(containingProject);
- moduleCore.prepareProjectComponentsIfNecessary();
- ProjectComponents projectModules = moduleCore.getComponentModelRoot();
- moduleCore.saveIfNecessary(null);
- } finally {
- if(moduleCore != null)
- moduleCore.dispose();
- }
- }
-
- protected IProject getProject() {
- String name = model.getStringProperty(IFlexibleProjectCreationDataModelProperties.PROJECT_NAME);
- if (name != null && name.length() > 0)
- return ResourcesPlugin.getWorkspace().getRoot().getProject(name);
- return null;
- }
-
- 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/IAnnotationsDataModel.java b/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/application/internal/operations/IAnnotationsDataModel.java
deleted file mode 100644
index d636f870f..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, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jst.j2ee.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$
-
-} \ No newline at end of file
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 e85903b60..000000000
--- a/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/application/internal/operations/J2EEArtifactExportDataModelProvider.java
+++ /dev/null
@@ -1,183 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 2004, 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 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.common.componentcore.util.ComponentUtilities;
-import org.eclipse.jst.j2ee.datamodel.properties.IJ2EEComponentExportDataModelProperties;
-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 J2EEArtifactExportDataModelProvider() {
- super();
- }
-
- public String[] getPropertyNames() {
- return new String[] { COMPONENT_NAME, ARCHIVE_DESTINATION, EXPORT_SOURCE_FILES, OVERWRITE_EXISTING, RUN_BUILD };
- }
-
- protected abstract String getComponentID();
-
- 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);
- }
-
- /**
- * Populate the resource name combo with connector 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 (wbComps[i].getComponentTypeId().equals(getComponentID()))
- relevantComponents.add(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());
- }
- Object[] components = relevantComponents.toArray(new Object[relevantComponents.size()]);
- 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(""))
- return WTPCommonPlugin.createErrorStatus(WTPCommonPlugin.getResourceString(WTPCommonMessages.MODULE_EXISTS_ERROR));
- IVirtualComponent[] component = ComponentUtilities.getComponent(componentName);
- if (component.length == 0 || component[0] == null) {
- return WTPCommonPlugin.createErrorStatus(WTPCommonPlugin.getResourceString(WTPCommonMessages.MODULE_EXISTS_ERROR));
- }
- if (!component[0].getComponentTypeId().equals(getComponentID())) {
- 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)); //$NON-NLS-1$);
- } else if (model.isPropertySet(ARCHIVE_DESTINATION) && !validateModuleType(archiveLocation)) {
- return WTPCommonPlugin.createErrorStatus(WTPCommonPlugin.getResourceString(WTPCommonMessages.DESTINATION_ARCHIVE_SHOULD_END_WITH, new Object[] { getModuleExtension() })); //$NON-NLS-1$);
- } 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) == Path.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 55af444e1..000000000
--- a/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/application/internal/operations/J2EEArtifactImportDataModelProvider.java
+++ /dev/null
@@ -1,211 +0,0 @@
-/***************************************************************************************************
- * Copyright (c) 2003, 2004 IBM Corporation and others. All rights reserved. This program and the
- * accompanying materials are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors: IBM Corporation - initial API and implementation
- **************************************************************************************************/
-package org.eclipse.jst.j2ee.application.internal.operations;
-
-import org.eclipse.core.resources.IProject;
-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.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.ComponentCore;
-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.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 DEFAULT_COMPONENT_NAME = "J2EEImportDataModel.DEFAULT_PROJECT_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 String[] getPropertyNames() {
- return new String[]{FILE_NAME, FILE, SAVE_FILTER, OVERWRITE_HANDLER, CLOSE_ARCHIVE_ON_DISPOSE, COMPONENT, COMPONENT_NAME, PROJECT_NAME, DEFAULT_COMPONENT_NAME, FILE_SELECTION_HISTORY};
- }
-
- 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);
- }
-
- private IProject getProject() {
- String projName = model.getStringProperty(COMPONENT_NAME);
- return ProjectUtilities.getProject(projName);
- }
-
-
- public Object getDefaultProperty(String propertyName) {
- if (propertyName.equals(COMPONENT_NAME)) {
- return componentCreationDM.getProperty(IComponentCreationDataModelProperties.COMPONENT_NAME);
- } else if (propertyName.equals(PROJECT_NAME)) {
- return componentCreationDM.getProperty(IComponentCreationDataModelProperties.PROJECT_NAME);
- } else if (propertyName.equals(COMPONENT)) {
- return ComponentCore.createComponent(getProject(), getStringProperty(COMPONENT_NAME));
- } else if (propertyName.equals(CLOSE_ARCHIVE_ON_DISPOSE)) {
- return Boolean.TRUE;
- } else if (propertyName.equals(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(COMPONENT_NAME)) {
- componentCreationDM.setProperty(IComponentCreationDataModelProperties.COMPONENT_NAME, propertyValue);
- } 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;
- }
- }
- return true;
- }
-
- private void updateDefaultComponentName() {
- Archive archive = getArchiveFile();
- if (null != archive && getBooleanProperty(DEFAULT_COMPONENT_NAME)) {
- Path path = new Path(archive.getURI());
- String defaultProjectName = path.segment(path.segmentCount() - 1);
- if (defaultProjectName.indexOf('.') > 0) {
- defaultProjectName = defaultProjectName.substring(0, defaultProjectName.lastIndexOf('.'));
- if (defaultProjectName.indexOf('.') > 0) {
- defaultProjectName = defaultProjectName.replace('.', '_');
- }
- }
- componentCreationDM.setProperty(IComponentCreationDataModelProperties.COMPONENT_NAME, defaultProjectName);
- model.notifyPropertyChange(COMPONENT_NAME, IDataModel.DEFAULT_CHG);
- setBooleanProperty(DEFAULT_COMPONENT_NAME, true);
- }
- }
-
- private boolean handleArchiveSetup(String fileName) throws OpenFailureException {
- Archive archive = getArchiveFile();
- if (archive != null) {
- archive.close();
- }
- String uri = getStringProperty(FILE_NAME);
- if (!archiveExistsOnFile())
- return false;
- archive = openArchive(uri);
- if (null != archive) {
- archive.setSaveFilter(getSaveFilter());
- }
- try {
- settingFileName = true;
- setProperty(FILE, archive);
- } finally {
- settingFileName = false;
- }
- return archive != null;
- }
-
- 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)) {
- String fileName = (String) getProperty(FILE_NAME);
- if (fileName != null && fileName.equals("")) { //$NON-NLS-1$
- return WTPCommonPlugin.createErrorStatus(WTPCommonPlugin.getResourceString(WTPCommonMessages.ARCHIVE_FILE_NAME_EMPTY_ERROR, new Object[]{ArchiveUtil.getModuleFileTypeName(getType())})); //$NON-NLS-1$);
- } else if (cachedOpenFailureException != null) {
- return WTPCommonPlugin.createErrorStatus(WTPCommonPlugin.getResourceString(cachedOpenFailureException.getMessage())); //$NON-NLS-1$);
- } 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 void propertyChanged(DataModelEvent event) {
- }
-} \ No newline at end of file
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 853d95e35..000000000
--- a/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/application/internal/operations/J2EEComponentCreationDataModelProvider.java
+++ /dev/null
@@ -1,598 +0,0 @@
-package org.eclipse.jst.j2ee.application.internal.operations;
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-
-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.IEarComponentCreationDataModelProperties;
-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.servertarget.ServerTargetHelper;
-import org.eclipse.wst.common.componentcore.ComponentCore;
-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.internal.util.IModuleConstants;
-import org.eclipse.wst.common.componentcore.resources.ComponentHandle;
-import org.eclipse.wst.common.componentcore.resources.IFlexibleProject;
-import org.eclipse.wst.common.componentcore.resources.IVirtualComponent;
-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.FlexibleJavaProjectPreferenceUtil;
-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;
-
-public abstract class J2EEComponentCreationDataModelProvider extends JavaComponentCreationDataModelProvider implements IJ2EEComponentCreationDataModelProperties, IAnnotationsDataModel {
-
- private IDataModel earCreationDM = null;
- private static String MODULE_NOT_SUPPORTED = "MODULE_NOT_SUPPORTED";
- private static String MODULEVERSION_NOT_SUPPORTED = "VERSION_NOT_SUPPORTED";
- private static String OK = "OK";
-
- 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, new UpdateManifestDataModel());
- model.setProperty(USE_ANNOTATIONS, Boolean.FALSE);
- }
-
- public AddComponentToEnterpriseApplicationDataModelProvider createAddComponentToEAR() {
- return new AddComponentToEnterpriseApplicationDataModelProvider();
- }
-
- public String[] getPropertyNames() {
- String[] props = new String[]{EAR_COMPONENT_NAME, EAR_COMPONENT_DEPLOY_NAME, ADD_TO_EAR, UI_SHOW_EAR_SECTION, DD_FOLDER, COMPONENT_VERSION, VALID_COMPONENT_VERSIONS_FOR_PROJECT_RUNTIME, NESTED_ADD_COMPONENT_TO_EAR_DM, CLASSPATH_SELECTION, NESTED_EAR_COMPONENT_CREATION_DM, NESTED_UPDATE_MANIFEST_DM, EAR_COMPONENT_HANDLE, USE_ANNOTATIONS};
- return combineProperties(super.getPropertyNames(), props);
- }
-
- 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";
- } 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);
- ComponentHandle handle = computeEARHandle();
- IDataModel earDM = (IDataModel) model.getProperty(NESTED_EAR_COMPONENT_CREATION_DM);
- earDM.setProperty(IJ2EEComponentCreationDataModelProperties.EAR_COMPONENT_HANDLE, handle);
- model.setProperty(EAR_COMPONENT_HANDLE, handle);
-
- } 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);
- ComponentHandle handle = computeEARHandle();
- model.setProperty(EAR_COMPONENT_HANDLE, handle);
- if (earDM != null && handle != null)
- earDM.setProperty(IJ2EEComponentCreationDataModelProperties.EAR_COMPONENT_HANDLE, handle);
- }
- }
- } 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);
- ComponentHandle handle = computeEARHandle();
- model.setProperty(EAR_COMPONENT_HANDLE, handle);
- IDataModel earDM = (IDataModel) model.getProperty(NESTED_EAR_COMPONENT_CREATION_DM);
- if (earDM != null && handle != null){
- earDM.setProperty(IJ2EEComponentCreationDataModelProperties.EAR_COMPONENT_HANDLE, handle);
- 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
- if(!FlexibleJavaProjectPreferenceUtil.getMultipleModulesPerProjectProp()){
- 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;
- }
-
- private ComponentHandle computeEARHandle(){
- String earProjname = (String) model.getProperty(EAR_COMPONENT_NAME);
-
- IDataModel earDM = (IDataModel) model.getProperty(NESTED_EAR_COMPONENT_CREATION_DM);
- earDM.setProperty(IEarComponentCreationDataModelProperties.PROJECT_NAME, earProjname);
-
- ComponentHandle handle = null;
-
- if( earProjname != null && !earProjname.equals("") && validate(EAR_COMPONENT_NAME).isOK()){
- handle = ComponentHandle.create(ProjectUtilities.getProject(earProjname), earProjname);
- }
- return handle;
- }
-
-
- 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 ){
- return MODULEVERSION_NOT_SUPPORTED;
- }
- Integer version = (Integer)model.getProperty(COMPONENT_VERSION);
- int nj2eeVer = convertModuleVersionToJ2EEVersion(version.intValue());
- String j2eeVer = J2EEVersionUtil.getJ2EETextVersion(nj2eeVer);
- return isTypeSupported(runtime.getRuntimeType(), getComponentID(), j2eeVer);
- }
-
- protected DataModelPropertyDescriptor[] validJ2EEServerPropertyDescriptors(){
-
- Integer version = (Integer)model.getProperty(COMPONENT_VERSION);
- int j2eeversion = convertModuleVersionToJ2EEVersion(version.intValue());
- String j2eeVersionText = J2EEVersionUtil.getJ2EETextVersion(j2eeversion);
-
- 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 name = descriptor.getPropertyDescription();
- String runtimeid = (String)descriptor.getPropertyValue();
- IRuntime runtime = getServerTargetByID( runtimeid );
- String ok = isTypeSupported( runtime.getRuntimeType(), getComponentID(), 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) {
- List targets = getValidServerTargets();
- IRuntime target;
- for (int i = 0; i < targets.size(); i++) {
- target = (IRuntime) targets.get(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("*") ){
- moduleVersionFound = true;
- return OK;
- }else{
- if( i < size )
- continue;
- }
- }
- }
- }
- if( !moduleFound ){
- return MODULE_NOT_SUPPORTED;
- }else{
- if(!moduleVersionFound)
- return MODULEVERSION_NOT_SUPPORTED;
- }
-
- return "";
- }
-
-
- 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("j2ee")) {
- if (j2eeModuleID.equals(IModuleConstants.JST_WEB_MODULE) || j2eeModuleID.equals(IModuleConstants.JST_EJB_MODULE) || j2eeModuleID.equals(IModuleConstants.JST_EAR_MODULE) || j2eeModuleID.equals(IModuleConstants.JST_APPCLIENT_MODULE) || j2eeModuleID.equals(IModuleConstants.JST_CONNECTOR_MODULE)) {
- return true;
- }
- }else if (serverTypeID.equals("j2ee.*")) {
- if (j2eeModuleID.equals(IModuleConstants.JST_WEB_MODULE) || j2eeModuleID.equals(IModuleConstants.JST_EJB_MODULE) || j2eeModuleID.equals(IModuleConstants.JST_EAR_MODULE) || j2eeModuleID.equals(IModuleConstants.JST_APPCLIENT_MODULE) || j2eeModuleID.equals(IModuleConstants.JST_CONNECTOR_MODULE)) {
- return true;
- }
- } else if (serverTypeID.equals("j2ee.web")) {//$NON-NLS-1$
- if (j2eeModuleID.equals(IModuleConstants.JST_WEB_MODULE)) {
- return true;
- }
- } else if (serverTypeID.equals("j2ee.ejb")) {//$NON-NLS-1$
- if (j2eeModuleID.equals(IModuleConstants.JST_EJB_MODULE)) {
- return true;
- }
- } else if (serverTypeID.equals("j2ee.ear")) {//$NON-NLS-1$
- if (j2eeModuleID.equals(IModuleConstants.JST_EAR_MODULE) || j2eeModuleID.equals(IModuleConstants.JST_APPCLIENT_MODULE) || j2eeModuleID.equals(IModuleConstants.JST_CONNECTOR_MODULE)) {
- return true;
- }
- }
- 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) {
- 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;
- }
-
-
-
- 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.findComponentByName(componentName);
- }
- }
- } 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(), IModuleConstants.JST_EAR_MODULE, j2eeVer);
- if( msg.equals(OK)){
- 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 ){
- String msg = EARCreationResourceHandler.getString(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(), IModuleConstants.JST_EAR_MODULE, j2eeVer);
- if( !msg.equals(OK)){
- msg = EARCreationResourceHandler.getString(EARCreationResourceHandler.SERVER_TARGET_NOT_SUPPORT_EAR);
- return WTPCommonPlugin.createErrorStatus(msg);
- }
- }
- }
- return super.validate(propertyName);
- }
-
- 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$
- String errorMessage = WTPCommonPlugin.getResourceString(WTPCommonMessages.ERR_INVALID_CHARS); //$NON-NLS-1$
- 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 UpdateManifestDataModel getUpdateManifestDataModel() {
- return (UpdateManifestDataModel) 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();
-
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/application/internal/operations/J2EEComponentCreationOperation.java b/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/application/internal/operations/J2EEComponentCreationOperation.java
deleted file mode 100644
index 2167f5cdc..000000000
--- a/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/application/internal/operations/J2EEComponentCreationOperation.java
+++ /dev/null
@@ -1,263 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 2004, 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.IOException;
-import java.lang.reflect.InvocationTargetException;
-import java.util.List;
-
-import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.core.resources.ICommand;
-import org.eclipse.core.resources.IContainer;
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IProjectDescription;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IConfigurationElement;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.Path;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.emf.common.util.EList;
-import org.eclipse.jem.util.emf.workbench.ProjectUtilities;
-import org.eclipse.jem.util.logger.proxy.Logger;
-import org.eclipse.jst.common.internal.annotations.controller.AnnotationsControllerManager;
-import org.eclipse.jst.common.internal.annotations.controller.AnnotationsControllerManager.Descriptor;
-import org.eclipse.jst.j2ee.datamodel.properties.IEarComponentCreationDataModelProperties;
-import org.eclipse.jst.j2ee.datamodel.properties.IJ2EEComponentCreationDataModelProperties;
-import org.eclipse.jst.j2ee.internal.J2EEConstants;
-import org.eclipse.jst.j2ee.internal.common.UpdateProjectClasspath;
-import org.eclipse.jst.j2ee.internal.project.ManifestFileCreationAction;
-import org.eclipse.wst.common.componentcore.ComponentCore;
-import org.eclipse.wst.common.componentcore.datamodel.properties.ICreateReferenceComponentsDataModelProperties;
-import org.eclipse.wst.common.componentcore.internal.ComponentType;
-import org.eclipse.wst.common.componentcore.internal.ComponentcoreFactory;
-import org.eclipse.wst.common.componentcore.internal.Property;
-import org.eclipse.wst.common.componentcore.internal.StructureEdit;
-import org.eclipse.wst.common.componentcore.internal.operation.ComponentCreationOperation;
-import org.eclipse.wst.common.componentcore.internal.util.IModuleConstants;
-import org.eclipse.wst.common.componentcore.resources.ComponentHandle;
-import org.eclipse.wst.common.componentcore.resources.IVirtualComponent;
-import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
-import org.eclipse.wst.common.frameworks.internal.FlexibleJavaProjectPreferenceUtil;
-
-public abstract class J2EEComponentCreationOperation extends ComponentCreationOperation implements IJ2EEComponentCreationDataModelProperties, IAnnotationsDataModel {
- /**
- * name of the template emitter to be used to generate the deployment
- * descriptor from the tags
- */
- protected static final String TEMPLATE_EMITTER = "org.eclipse.jst.j2ee.ejb.annotations.emitter.template"; //$NON-NLS-1$
-
- /**
- * id of the builder used to kick off generation of web metadata based on
- * parsing of annotations
- */
- protected static final String BUILDER_ID = "builderId"; //$NON-NLS-1$
-
- public J2EEComponentCreationOperation(IDataModel model) {
- super(model);
- }
-
- protected void execute(String componentType, IProgressMonitor monitor) throws CoreException, InvocationTargetException, InterruptedException {
- super.execute(componentType, monitor, null);
-
- if (model.getBooleanProperty(CREATE_DEFAULT_FILES)) {
- createDeploymentDescriptor(monitor);
- createManifest(monitor);
- }
-
- addSrcFolderToProject();
- if (model.getBooleanProperty(USE_ANNOTATIONS))
- addAnnotationsBuilder();
-
- linkToEARIfNecessary(monitor);
- }
-
- protected abstract void createDeploymentDescriptor(IProgressMonitor monitor) throws CoreException, InvocationTargetException, InterruptedException;
-
- public void linkToEARIfNecessary(IProgressMonitor monitor) throws CoreException, InvocationTargetException, InterruptedException {
- if (model.getBooleanProperty(ADD_TO_EAR)) {
- createEARComponentIfNecessary(monitor);
- runAddToEAROperation(monitor);
- }
- }
-
- /**
- * @param moduleModel
- * @param monitor
- * @throws CoreException
- * @throws InvocationTargetException
- * @throws InterruptedException
- */
- protected void runAddToEAROperation(IProgressMonitor monitor) throws CoreException, InvocationTargetException, InterruptedException {
-
- IVirtualComponent component = ComponentCore.createComponent(getProject(), getModuleDeployName());
- IDataModel dm = (IDataModel)model.getProperty(NESTED_ADD_COMPONENT_TO_EAR_DM);
- ComponentHandle earhandle = (ComponentHandle) model.getProperty(EAR_COMPONENT_HANDLE);
- dm.setProperty(ICreateReferenceComponentsDataModelProperties.SOURCE_COMPONENT_HANDLE, earhandle);
-
- List modList = (List) dm.getProperty(ICreateReferenceComponentsDataModelProperties.TARGET_COMPONENTS_HANDLE_LIST);
- modList.add(component.getComponentHandle());
- dm.setProperty(ICreateReferenceComponentsDataModelProperties.TARGET_COMPONENTS_HANDLE_LIST, modList);
- try {
- dm.getDefaultOperation().execute(monitor, null);
- } catch (ExecutionException e) {
- Logger.getLogger().log(e);
- }
- }
-
- /**
- * @param moduleModel
- * @param monitor
- * @throws CoreException
- * @throws InvocationTargetException
- * @throws InterruptedException
- */
- protected void createEARComponentIfNecessary(IProgressMonitor monitor) throws CoreException, InvocationTargetException, InterruptedException {
- IDataModel earModel = (IDataModel) model.getProperty(NESTED_EAR_COMPONENT_CREATION_DM);
- ComponentHandle handle = (ComponentHandle)model.getProperty(EAR_COMPONENT_HANDLE);
-
- earModel.setProperty(IEarComponentCreationDataModelProperties.COMPONENT_NAME, handle.getName());
- earModel.setProperty(IEarComponentCreationDataModelProperties.PROJECT_NAME, handle.getProject().getName());
-
- try {
- earModel.getDefaultOperation().execute(monitor, null);
- } catch (ExecutionException e) {
- Logger.getLogger().log(e.getMessage());
- }
-
- }
-
- public String getModuleName() {
- return (String) model.getProperty(COMPONENT_NAME);
- }
-
- public String getModuleDeployName() {
- return (String) model.getProperty(COMPONENT_DEPLOY_NAME);
- }
-
- protected abstract String getVersion();
-
- protected void setupComponentType(String typeID) {
- IVirtualComponent component = ComponentCore.createComponent(getProject(), getModuleDeployName());
- ComponentType componentType = ComponentcoreFactory.eINSTANCE.createComponentType();
- componentType.setComponentTypeId(typeID);
- componentType.setVersion(getVersion());
- List newProps = getProperties();
- EList existingProps = componentType.getProperties();
- if (newProps != null && !newProps.isEmpty()) {
- for (int i = 0; i < newProps.size(); i++) {
- existingProps.add(newProps.get(i));
- }
- }
- Property javaOutputProp = getOutputProperty();
- if(javaOutputProp != null)
- existingProps.add(javaOutputProp);
- StructureEdit.setComponentType(component, componentType);
- }
-
- // Should return null if no additional properties needed
- protected List getProperties() {
- return null;
- }
-
- /**
- * @param monitor
- */
- protected void createManifest(IProgressMonitor monitor) throws CoreException, InvocationTargetException, InterruptedException {
-
- String manifestFolder = model.getStringProperty(MANIFEST_FOLDER);
- IContainer container = getProject().getFolder(manifestFolder);
-
- IFile file = container.getFile(new Path(J2EEConstants.MANIFEST_SHORT_NAME));
-
- try {
- ManifestFileCreationAction.createManifestFile(file, getProject());
- } catch (CoreException e) {
- Logger.getLogger().log(e);
- } catch (IOException e) {
- Logger.getLogger().log(e);
- }
- // UpdateManifestOperation op = new
- // UpdateManifestOperation(((J2EEModuleCreationDataModel)
- // operationDataModel).getUpdateManifestDataModel());
- // op.doRun(monitor);
-
- }
-
- /**
- * This method is intended for internal use only. This method will add the
- * annotations builder for Xdoclet to the targetted project. This needs to
- * be removed from the operation and set up to be more extensible throughout
- * the workbench.
- *
- * @see EJBModuleCreationOperation#execute(IProgressMonitor)
- *
- */
- protected final void addAnnotationsBuilder() {
- //If there is an extended annotations processor, let it add itself instead of xdoclet
- Descriptor descriptor = AnnotationsControllerManager.INSTANCE.getDescriptor(ProjectUtilities.getProject(model.getStringProperty(PROJECT_NAME)));
- if (descriptor!=null)
- return;
- try {
- // Find the xdoclet builder from the extension registry
- IConfigurationElement[] configurationElements = Platform.getExtensionRegistry().getConfigurationElementsFor(TEMPLATE_EMITTER);
- String builderID = configurationElements[0].getNamespace() + "." + configurationElements[0].getAttribute(BUILDER_ID); //$NON-NLS-1$
- IProject project = ProjectUtilities.getProject(model.getProperty(PROJECT_NAME));
- if(project != null && project.isAccessible()) {
- IProjectDescription description = project.getDescription();
- ICommand[] commands = description.getBuildSpec();
- boolean found = false;
- // Check if the builder is already set on the project
- for (int i = 0; i < commands.length; ++i) {
- if (commands[i].getBuilderName().equals(builderID)) {
- found = true;
- break;
- }
- }
- // If the builder is not on the project, add it
- if (!found) {
- ICommand command = description.newCommand();
- command.setBuilderName(builderID);
- ICommand[] newCommands = new ICommand[commands.length + 1];
- System.arraycopy(commands, 0, newCommands, 0, commands.length);
- newCommands[commands.length] = command;
- IProjectDescription desc = project.getDescription();
- desc.setBuildSpec(newCommands);
- project.setDescription(desc, null);
- }
- }
- } catch (Exception e) {
- // Ignore
- }
- }
-
- private void addSrcFolderToProject() {
- UpdateProjectClasspath update = new UpdateProjectClasspath(model.getStringProperty(JAVASOURCE_FOLDER), model.getStringProperty(COMPONENT_NAME), ProjectUtilities.getProject(model.getStringProperty(PROJECT_NAME)));
- }
-
- protected Property getOutputProperty() {
- String javaSourceFolder = model.getStringProperty(JAVASOURCE_FOLDER);
- if(javaSourceFolder != null && !javaSourceFolder.equals("")) {
- Property prop = ComponentcoreFactory.eINSTANCE.createProperty();
- IPath newOutputPath = null;
- if(FlexibleJavaProjectPreferenceUtil.getMultipleModulesPerProjectProp())
- newOutputPath= Path.fromOSString("/bin/" + getComponentName() + Path.SEPARATOR);
- else
- newOutputPath = Path.fromOSString("/bin/");
- // need a java property constant
- prop.setName(IModuleConstants.PROJ_REL_JAVA_OUTPUT_PATH);
- prop.setValue(newOutputPath.toString());
- return prop;
- }
- return null;
- }
-}
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 40368e955..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, 2004, 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 d5722ba6e..000000000
--- a/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/application/internal/operations/J2EEComponentImportDataModelProvider.java
+++ /dev/null
@@ -1,84 +0,0 @@
-/***************************************************************************************************
- * Copyright (c) 2003, 2004 IBM Corporation and others. All rights reserved. This program and the
- * accompanying materials are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors: IBM Corporation - initial API and implementation
- **************************************************************************************************/
-package org.eclipse.jst.j2ee.application.internal.operations;
-
-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 String[] getPropertyNames() {
- return combineProperties(super.getPropertyNames(), new String[]{EXTENDED_IMPORT_FACTORY});
- }
-
- 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);
- }
- // } else if (propertyName.equals(PROJECT_NAME)) {
- // IProject project = getProject();
- // if (null != project && project.exists()) {
- // String[] requiredNatures = (String[])
- // getJ2EEModuleCreationDataModel().getProjectDataModel().getProperty(ProjectCreationDataModel.PROJECT_NATURES);
- // if (null != requiredNatures) {
- // try {
- // for (int i = 0; i < requiredNatures.length; i++) {
- // if (!project.hasNature(requiredNatures[i])) {
- // return doSet;
- // }
- // }
- // } catch (CoreException e) {
- // return doSet;
- // }
- // IRuntime target = ServerCore.getProjectProperties(project).getRuntimeTarget();
- // if (null != target) {
- // setProperty(SERVER_TARGET_ID, target.getId());
- // }
- // setBooleanProperty(ADD_TO_EAR, false);
- // }
- // }
- // getJ2EEModuleCreationDataModel().setBooleanProperty(J2EEArtifactCreationDataModelOld.IS_ENABLED,
- // null == project || !project.exists());
- // } else if (propertyName.equals(PRESERVE_PROJECT_METADATA)) {
- // JavaProjectCreationDataModel jdm =
- // getJ2EEModuleCreationDataModel().getJavaProjectCreationDataModel();
- // jdm.setBooleanProperty(JavaProjectCreationDataModel.CREATE_SOURCE_FOLDERS,
- // !getBooleanProperty(BINARY));
- }
- return set;
- }
-
- protected ModuleFile getModuleFile() {
- return (ModuleFile) getArchiveFile();
- }
-} \ No newline at end of file
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 522b27ae9..000000000
--- a/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/application/internal/operations/J2EEUtilityJarImportDataModelProvider.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-/*
- * Created on 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 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 String[] getPropertyNames() {
- return combineProperties(super.getPropertyNames(), new String[]{EAR_COMPONENT_NAME, EAR_PROJECT_NAME});
- }
-
- 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());
- }
-} \ No newline at end of file
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 0836330a8..000000000
--- a/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/application/internal/operations/J2EEUtilityJarImportOperationNew.java
+++ /dev/null
@@ -1,80 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jst.j2ee.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.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Path;
-import org.eclipse.core.runtime.SubProgressMonitor;
-import org.eclipse.jdt.core.JavaCore;
-import org.eclipse.jdt.core.JavaModelException;
-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.IJavaUtilityJarImportDataModelProperties;
-import org.eclipse.jst.j2ee.internal.archive.operations.J2EEJavaComponentSaveStrategyImpl;
-import org.eclipse.wst.common.componentcore.resources.IVirtualComponent;
-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 - 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 nestedComonentCreationDM = model.getNestedModel(IJavaUtilityJarImportDataModelProperties.NESTED_MODEL_J2EE_COMPONENT_CREATION);
- IVirtualComponent component = (IVirtualComponent) model.getProperty(IJavaUtilityJarImportDataModelProperties.COMPONENT);
-
- if (!component.exists()) {
- model.getNestedModel(IJavaUtilityJarImportDataModelProperties.NESTED_MODEL_J2EE_COMPONENT_CREATION).getDefaultOperation().execute(monitor, info);
- }
-
- IProject javaProject = component.getProject();
- Archive jarFile = (Archive) model.getProperty(IJavaUtilityJarImportDataModelProperties.FILE);
-
- J2EEJavaComponentSaveStrategyImpl strat = new J2EEJavaComponentSaveStrategyImpl(component);
-
- strat.setProgressMonitor(new SubProgressMonitor(monitor, 1));
- try {
- jarFile.save(strat);
- 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 e) {
- Logger.getLogger().logError(e);
- }
- 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;
- }
-
-} \ No newline at end of file
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 e6ae0169c..000000000
--- a/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/application/internal/operations/J2EEUtilityJarListImportDataModelProvider.java
+++ /dev/null
@@ -1,325 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-/*
- * Created on 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 org.eclipse.core.resources.IPathVariableManager;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.jem.util.emf.workbench.ProjectUtilities;
-import org.eclipse.jem.util.emf.workbench.nature.EMFNature;
-import org.eclipse.jst.j2ee.datamodel.properties.IJ2EEUtilityJarListImportDataModelProperties;
-import org.eclipse.jst.j2ee.internal.earcreation.EARCreationResourceHandler;
-import org.eclipse.jst.j2ee.internal.earcreation.IEARNatureConstants;
-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 String[] getPropertyNames() {
- return new String[]{EAR_PROJECT, CREATE_PROJECT, LINK_IMPORT, CREATE_LINKED_PROJECT, COPY, BINARY_IMPORT, UTILITY_JAR_LIST, AVAILABLE_JARS_DIRECTORY, PROJECT_ROOT, OVERRIDE_PROJECT_ROOT, OVERWRITE_IF_NECESSARY, CREATE_LINKED_PATH_VARIABLE, LINKED_PATH_VARIABLE};
- }
-
- 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);
- if (EMFNature.hasRuntime(project, IEARNatureConstants.NATURE_ID) && 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() || !earProject.hasNature(IEARNatureConstants.NATURE_ID))
- return new Status(IStatus.ERROR, J2EEPlugin.PLUGIN_ID, 0, EARCreationResourceHandler.getString("J2EEUtilityJarListImportDataModel_Specify_Valid_Project"), null); //$NON-NLS-1$
- return Status.OK_STATUS;
- } catch (CoreException e) {
- return new Status(IStatus.ERROR, J2EEPlugin.PLUGIN_ID, 0, EARCreationResourceHandler.getString("J2EEUtilityJarListImportDataModel_Specify_Valid_Project"), e); //$NON-NLS-1$
- }
- }
- return new Status(IStatus.ERROR, J2EEPlugin.PLUGIN_ID, 0, EARCreationResourceHandler.getString("J2EEUtilityJarListImportDataModel_Specify_Valid_Project"), null); //$NON-NLS-1$
-
- } 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.getString("J2EEUtilityJarListImportDataModel_Select_Jar"), null); //$NON-NLS-1$
-
- /* 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.getString("J2EEUtilityJarListImportDataModel_Specify_Linked_Path"), null); //$NON-NLS-1$
- } 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.getString("J2EEUtilityJarListImportDataModel.0"), null); //$NON-NLS-1$
- }
- 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;
- // }
-
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/application/internal/operations/J2EEUtilityJarListImportOperation.java b/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/application/internal/operations/J2EEUtilityJarListImportOperation.java
deleted file mode 100644
index fdae94596..000000000
--- a/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/application/internal/operations/J2EEUtilityJarListImportOperation.java
+++ /dev/null
@@ -1,314 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-/*
- * Created on 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.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
-import java.io.File;
-import java.io.FileInputStream;
-import java.lang.reflect.InvocationTargetException;
-
-import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IPathVariableManager;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IProjectDescription;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.resources.IWorkspace;
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.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.Status;
-import org.eclipse.core.runtime.SubProgressMonitor;
-import org.eclipse.jdt.core.IClasspathEntry;
-import org.eclipse.jdt.core.IPackageFragmentRoot;
-import org.eclipse.jdt.core.JavaCore;
-import org.eclipse.jdt.internal.core.ClasspathEntry;
-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.CommonarchiveFactory;
-import org.eclipse.jst.j2ee.commonarchivecore.internal.exception.OpenFailureException;
-import org.eclipse.jst.j2ee.datamodel.properties.IJ2EEUtilityJarListImportDataModelProperties;
-import org.eclipse.jst.j2ee.datamodel.properties.IJavaUtilityJarImportDataModelProperties;
-import org.eclipse.jst.j2ee.internal.earcreation.EARCreationResourceHandler;
-import org.eclipse.jst.j2ee.internal.plugin.J2EEPlugin;
-import org.eclipse.wst.common.frameworks.datamodel.AbstractDataModelOperation;
-import org.eclipse.wst.common.frameworks.datamodel.DataModelFactory;
-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 J2EEUtilityJarListImportOperation extends AbstractDataModelOperation {
-
- /**
- * @param operationDataModel
- */
- public J2EEUtilityJarListImportOperation(IDataModel operationDataModel) {
- super(operationDataModel);
- }
-
- /**
- *
- */
- public J2EEUtilityJarListImportOperation() {
- super();
- }
-
- public IStatus execute(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
- Object[] utilityJars = (Object[]) model.getProperty(IJ2EEUtilityJarListImportDataModelProperties.UTILITY_JAR_LIST);
- if (utilityJars == null || utilityJars.length == 0)
- return null;
-
- monitor.beginTask(EARCreationResourceHandler.getString("J2EEUtilityJarListImportOperation_UI_0"), utilityJars.length); //$NON-NLS-1$
-
- String earProject = model.getStringProperty(IJ2EEUtilityJarListImportDataModelProperties.EAR_PROJECT);
- boolean isBinary = model.getBooleanProperty(IJ2EEUtilityJarListImportDataModelProperties.BINARY_IMPORT);
- // if model.getBooleanProperty(J2EEUtilityJarListImportDataModel.COPY) then isLinked =
- // createProject = false;
- boolean isLinked = (model.getBooleanProperty(IJ2EEUtilityJarListImportDataModelProperties.LINK_IMPORT) || model.getBooleanProperty(IJ2EEUtilityJarListImportDataModelProperties.CREATE_LINKED_PROJECT));
- boolean createProject = (model.getBooleanProperty(IJ2EEUtilityJarListImportDataModelProperties.CREATE_PROJECT) || model.getBooleanProperty(IJ2EEUtilityJarListImportDataModelProperties.CREATE_LINKED_PROJECT));
- boolean overrideProjectRoot = model.getBooleanProperty(IJ2EEUtilityJarListImportDataModelProperties.OVERRIDE_PROJECT_ROOT);
- String projectRoot = model.getStringProperty(IJ2EEUtilityJarListImportDataModelProperties.PROJECT_ROOT);
-
- File utilityJar = null;
- IDataModel importModel = null;
- IWorkspace root = ResourcesPlugin.getWorkspace();
- for (int i = 0; i < utilityJars.length; i++) {
- utilityJar = (File) utilityJars[i];
- monitor.subTask(EARCreationResourceHandler.getString("J2EEUtilityJarListImportOperation_UI_1") + utilityJar.getAbsolutePath()); //$NON-NLS-1$
-
- try {
-
- if (createProject) {
-
- if (!isLinked) {
- Archive archive = CommonarchiveFactory.eINSTANCE.primOpenArchive(utilityJar.getAbsolutePath());
-
- importModel = DataModelFactory.createDataModel(new J2EEUtilityJarImportDataModelProvider());
- importModel.setProperty(IJavaUtilityJarImportDataModelProperties.FILE, archive);
-
- // if (overrideProjectRoot && projectRoot != null && projectRoot.length() >
- // 0)
- // importModel.getJ2eeArtifactCreationDataModel().setProperty(J2EEComponentCreationDataModel.PROJECT_LOCATION,
- // projectRoot);
- //
- // importModel.getJ2eeArtifactCreationDataModel().setBooleanProperty(J2EEComponentCreationDataModel.ADD_SERVER_TARGET,
- // true);
- importModel.setProperty(IJavaUtilityJarImportDataModelProperties.EAR_PROJECT_NAME, earProject);
-
- importModel.getDefaultOperation().execute(new SubProgressMonitor(monitor, 1), info);
- } else {
- createProjectWithLinkedJar(utilityJar, new SubProgressMonitor(monitor, 1));
- }
-
- String utilityJarProjectName = (importModel != null) ? importModel.getStringProperty(IJavaUtilityJarImportDataModelProperties.PROJECT_NAME) : getUtilityJarProjectName(utilityJar);
-
- IProject utilityJarProject = root.getRoot().getProject(utilityJarProjectName);
- linkArchiveToEAR(earProject, utilityJar.getName(), utilityJarProject, new SubProgressMonitor(monitor, 1));
- importModel = null;
- } else {
-
- IProject targetEARProject = root.getRoot().getProject(earProject);
- if (!isLinked)
- createCopiedArchive(targetEARProject, utilityJar.getName(), utilityJar, new SubProgressMonitor(monitor, 1));
- else
- createLinkedArchive(targetEARProject, utilityJar.getName(), utilityJar, new SubProgressMonitor(monitor, 1));
-
- }
-
- } catch (OpenFailureException e) {
- Logger.getLogger().logError(e);
- } catch (InvocationTargetException e) {
- Logger.getLogger().logError(e);
- } catch (InterruptedException e) {
- Logger.getLogger().logError(e);
- } catch (Exception e) {
- Logger.getLogger().logError(e);
- }
-
- monitor.worked(1);
- }
- monitor.done();
- return OK_STATUS;
- }
-
- /**
- * @param utilityJar
- * @return
- */
- private String getUtilityJarProjectName(File utilityJar) {
- String name = null;
- if (utilityJar != null) {
- int len = utilityJar.getName().indexOf('.');
- name = utilityJar.getName().substring(0, len);
- }
- return name;
- }
-
- protected IPath getLinkedPath(File archiveFile) throws CoreException {
- String linkedPathVariable = model.getStringProperty(IJ2EEUtilityJarListImportDataModelProperties.LINKED_PATH_VARIABLE);
-
- if (linkedPathVariable == null || linkedPathVariable.length() == 0)
- return new Path(archiveFile.getAbsolutePath());
- createLinkedPathVariableIfNecessary(linkedPathVariable, archiveFile.getParentFile());
- return new Path(linkedPathVariable).append(archiveFile.getName());
- }
-
- /**
- * @param linkedPathVariable
- * @param archiveFile
- */
- protected void createLinkedPathVariableIfNecessary(String linkedPathVariable, File archiveFile) throws CoreException {
- IPathVariableManager manager = ResourcesPlugin.getWorkspace().getPathVariableManager();
- IPath linkedPath = new Path(archiveFile.getAbsolutePath());
- manager.setValue(linkedPathVariable, linkedPath);
-
- }
-
- protected void createProjectWithLinkedJar(File jarFile, IProgressMonitor monitor) throws CoreException {
- try {
- boolean overrideProjectRoot = model.getBooleanProperty(IJ2EEUtilityJarListImportDataModelProperties.OVERRIDE_PROJECT_ROOT);
- String projectRoot = model.getStringProperty(IJ2EEUtilityJarListImportDataModelProperties.PROJECT_ROOT);
-
- IWorkspace root = ResourcesPlugin.getWorkspace();
- IProject project = root.getRoot().getProject(getUtilityJarProjectName(jarFile));
- IProjectDescription description = null;
- if (project.exists()) {
- if (!project.isOpen())
- return;
- description = project.getDescription();
- ProjectUtilities.addNatureToProject(project, JavaCore.NATURE_ID);
- } else {
- project.create(new SubProgressMonitor(monitor, 1));
- description = root.newProjectDescription(project.getName());
- description.setNatureIds(new String[]{JavaCore.NATURE_ID});
- if (overrideProjectRoot)
- description.setLocation(new Path(projectRoot));
- else
- description.setLocation(null);
- project.open(new SubProgressMonitor(monitor, 1));
- project.setDescription(description, new SubProgressMonitor(monitor, 1));
- }
- createLinkedArchive(project, jarFile.getName(), jarFile, monitor);
-
- JemProjectUtilities.forceClasspathReload(project);
- } catch (Exception e) {
- Logger.getLogger().logError(e);
- throw new CoreException(new Status(IStatus.ERROR, J2EEPlugin.PLUGIN_ID, 0, EARCreationResourceHandler.getString("J2EEUtilityJarListImportOperation_UI_2"), e)); //$NON-NLS-1$
- }
- }
-
- protected void createLinkedArchive(IProject project, String linkedFileName, File archiveFile, IProgressMonitor monitor) throws Exception {
- IFile linkedJarFile = null;
- IPath pathToArchive = getLinkedPath(archiveFile);
- boolean overwriteIfNecessary = model.getBooleanProperty(IJ2EEUtilityJarListImportDataModelProperties.OVERWRITE_IF_NECESSARY);
- linkedJarFile = project.getFile(linkedFileName);
- if (linkedJarFile.exists()) {
- if (overwriteIfNecessary)
- linkedJarFile.delete(true, true, new SubProgressMonitor(monitor, 1));
- else
- return;
- }
- linkedJarFile.createLink(pathToArchive, IResource.ALLOW_MISSING_LOCAL, new SubProgressMonitor(monitor, 1));
-
- if (project.hasNature(JavaCore.NATURE_ID)) {
- IClasspathEntry entry = new ClasspathEntry(IPackageFragmentRoot.K_BINARY, IClasspathEntry.CPE_LIBRARY, linkedJarFile.getFullPath(), ClasspathEntry.INCLUDE_ALL, ClasspathEntry.EXCLUDE_NONE, null, // source
- // attachment
- null, // source attachment root
- null, // custom output location
- false, null, false, null);
-
- JemProjectUtilities.appendJavaClassPath(project, entry);
- }
- }
-
- protected void createCopiedArchive(IProject project, String jarFileName, File archiveFile, IProgressMonitor monitor) throws Exception {
-
- IPath pathToArchive = new Path(archiveFile.getAbsolutePath());
-
- boolean overwriteIfNecessary = model.getBooleanProperty(IJ2EEUtilityJarListImportDataModelProperties.OVERWRITE_IF_NECESSARY);
- IFile copiedJarFile = project.getFile(jarFileName);
- if (copiedJarFile.exists()) {
- if (overwriteIfNecessary)
- copiedJarFile.delete(true, true, new SubProgressMonitor(monitor, 1));
- else
- return;
- }
- FileInputStream fileInputStream = null;
- ByteArrayOutputStream bos = null;
- ByteArrayInputStream jarFileInputStream = null;
- try {
- fileInputStream = new FileInputStream(pathToArchive.toOSString());
- bos = new ByteArrayOutputStream();
- byte[] data = new byte[4096];
- try {
- int bytesRead = 0;
- while ((bytesRead = fileInputStream.read(data)) > 0)
- bos.write(data, 0, bytesRead);
- // clear space for GC
- data = null;
- } finally {
- fileInputStream.close();
- }
-
- jarFileInputStream = new ByteArrayInputStream(bos.toByteArray());
- copiedJarFile.create(jarFileInputStream, 0, new SubProgressMonitor(monitor, 1));
-
- if (project.hasNature(JavaCore.NATURE_ID)) {
- IClasspathEntry entry = new ClasspathEntry(IPackageFragmentRoot.K_BINARY, IClasspathEntry.CPE_LIBRARY, copiedJarFile.getFullPath(), ClasspathEntry.INCLUDE_ALL, ClasspathEntry.EXCLUDE_NONE, null, // source
- // attachment
- null, // source attachment root
- null, // custom output location
- false, null, false, null);
-
- JemProjectUtilities.appendJavaClassPath(project, entry);
- }
- } finally {
- if (bos != null)
- bos.close();
- if (jarFileInputStream != null)
- jarFileInputStream.close();
- }
- }
-
- public void linkArchiveToEAR(String earProjectName, String uriMapping, IProject utlityProject, IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
- AddUtilityProjectToEARDataModel addArchiveProjectToEARDataModel = AddUtilityProjectToEARDataModel.createAddToEARDataModel(earProjectName, utlityProject);
- addArchiveProjectToEARDataModel.setProperty(AddModuleToEARDataModel.ARCHIVE_URI, uriMapping);
- addArchiveProjectToEARDataModel.setBooleanProperty(AddArchiveToEARDataModel.SYNC_TARGET_RUNTIME, true);
- addArchiveProjectToEARDataModel.getDefaultOperation().run(monitor);
- }
-
- 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;
- }
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/application/internal/operations/JARDependencyTraverser.java b/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/application/internal/operations/JARDependencyTraverser.java
deleted file mode 100644
index 900408bad..000000000
--- a/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/application/internal/operations/JARDependencyTraverser.java
+++ /dev/null
@@ -1,142 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-/*
- * Created on Sep 13, 2004
- *
- * 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.Collections;
-import java.util.HashMap;
-import java.util.Map;
-
-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.jst.j2ee.commonarchivecore.internal.Archive;
-import org.eclipse.jst.j2ee.commonarchivecore.internal.helpers.RuntimeClasspathEntry;
-import org.eclipse.jst.j2ee.internal.common.ClasspathModel;
-import org.eclipse.jst.j2ee.internal.earcreation.EAREditModel;
-import org.eclipse.jst.j2ee.internal.earcreation.EARNatureRuntime;
-import org.eclipse.jst.j2ee.internal.project.J2EEProjectUtilities;
-
-
-/**
- * @author schacher Helper class used to compute all the dependencies for a JAR being added to an
- * EAR
- */
-class JARDependencyTraverser {
-
- private IProject archiveProject;
- private IProject earProject;
- private Map result;
- private EAREditModel earEditModel;
-
- public JARDependencyTraverser(IProject anArchiveProject, IProject anEarProject) {
- super();
- this.archiveProject = anArchiveProject;
- this.earProject = anEarProject;
- }
-
- //Returns a map where the keys are instances of IResource, and the values
- // are uris within an EAR
- public Map run() {
- EARNatureRuntime[] earNatures = J2EEProjectUtilities.getReferencingEARProjects(archiveProject);
- if (earNatures == null || earNatures.length == 0 || (earNatures.length == 1 && earNatures[0].getProject() == earProject))
- return Collections.EMPTY_MAP;
-
- result = new HashMap();
- EARNatureRuntime runtime = EARNatureRuntime.getRuntime(earProject);
- if (runtime == null)
- return Collections.EMPTY_MAP;
-
- earEditModel = runtime.getEarEditModelForRead(this);
- try {
- for (int i = 0; i < earNatures.length; i++) {
- if (earNatures[i].getProject() != earProject) {
- traverseClasspath(earNatures[i]);
- }
- }
- return result;
- } finally {
- if (earEditModel != null)
- earEditModel.releaseAccess(this);
- }
- }
-
- private void traverseClasspath(EARNatureRuntime anEARNature) {
- ClasspathModel model = new ClasspathModel(null);
- model.setProject(archiveProject);
- //TODO enable this line when this class in migrated to use EARArtifactEdit
- //model.setSelectedEARNature(anEARNature);
- ClassPathSelection cpSelection = model.getClassPathSelection();
- Archive anArchive = model.getArchive();
- RuntimeClasspathEntry[] entries = anArchive.getDependencyClassPath();
- Archive referencedArchive = null;
- for (int i = 0; i < entries.length; i++) {
- RuntimeClasspathEntry entry = entries[i];
- referencedArchive = entry.getReferencedArchive();
- if (entry.isWebLib() || referencedArchive == null)
- continue;
- String uri = referencedArchive.getURI();
- if (uri == null)
- continue;
- ClasspathElement elmt = cpSelection.getClasspathElement(uri);
- if (elmt == null)
- continue;
- IResource resource = elmt.getResource();
- if (resource != null)
- addResult(resource, uri);
- }
- }
-
- private void addResult(IResource res, String uri) {
- if (result.containsKey(res))
- return;
- boolean exists = false;
- switch (res.getType()) {
- case IResource.FILE :
- exists = containsJARFile((IFile) res, uri);
- break;
- case IResource.PROJECT :
- exists = earEditModel.hasMappingToProject((IProject) res);
- break;
- default :
- return;
- }
- if (!exists)
- result.put(res, uri);
- }
-
-
- /**
- * @param file
- * @param uri
- * @return
- */
- private boolean containsJARFile(IFile file, String uri) {
- IPath path = null;
- try {
- path = new Path(uri);
- } catch (IllegalArgumentException tooBad) {
- return true;
- }
- IFile existing = earProject.getFile(path);
- return (existing != null && existing.exists());
-
- }
-
-
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/application/internal/operations/JavaUtilityComponentCreationOperation.java b/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/application/internal/operations/JavaUtilityComponentCreationOperation.java
deleted file mode 100644
index 0a76128ac..000000000
--- a/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/application/internal/operations/JavaUtilityComponentCreationOperation.java
+++ /dev/null
@@ -1,170 +0,0 @@
-/***************************************************************************************************
- * Copyright (c) 2003, 2004 IBM Corporation and others. All rights reserved. This program and the
- * accompanying materials are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors: IBM Corporation - initial API and implementation
- **************************************************************************************************/
-/*
- * Created on Nov 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.application.internal.operations;
-
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.core.resources.IContainer;
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.runtime.CoreException;
-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.jem.util.logger.proxy.Logger;
-import org.eclipse.jst.j2ee.datamodel.properties.IJavaComponentCreationDataModelProperties;
-import org.eclipse.jst.j2ee.internal.J2EEConstants;
-import org.eclipse.jst.j2ee.internal.common.UpdateProjectClasspath;
-import org.eclipse.jst.j2ee.internal.project.ManifestFileCreationAction;
-import org.eclipse.wst.common.componentcore.ComponentCore;
-import org.eclipse.wst.common.componentcore.internal.ComponentcoreFactory;
-import org.eclipse.wst.common.componentcore.internal.Property;
-import org.eclipse.wst.common.componentcore.internal.operation.ComponentCreationOperation;
-import org.eclipse.wst.common.componentcore.internal.util.IModuleConstants;
-import org.eclipse.wst.common.componentcore.resources.IVirtualComponent;
-import org.eclipse.wst.common.componentcore.resources.IVirtualFolder;
-import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
-import org.eclipse.wst.common.frameworks.internal.FlexibleJavaProjectPreferenceUtil;
-
-public class JavaUtilityComponentCreationOperation extends ComponentCreationOperation implements IJavaComponentCreationDataModelProperties{
- /**
- * @param dataModel
- */
- public JavaUtilityComponentCreationOperation(IDataModel dataModel) {
- super(dataModel);
- }
- /* (non-Javadoc)
- * @see org.eclipse.core.commands.operations.AbstractOperation#execute(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable)
- */
- public IStatus execute(IProgressMonitor monitor, IAdaptable info) {
- super.execute(IModuleConstants.JST_UTILITY_MODULE, monitor, info);
- createManifest(monitor);
- addSrcFolderToProject();
- return OK_STATUS;
- }
-
- public IStatus execute(String componentType, IProgressMonitor monitor, IAdaptable info) {
- super.execute(componentType, monitor, info);
- createManifest(monitor);
- addSrcFolderToProject();
- return OK_STATUS;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.core.commands.operations.AbstractOperation#redo(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable)
- */
- public IStatus redo(IProgressMonitor monitor, IAdaptable info) {
- return null;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.core.commands.operations.AbstractOperation#undo(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable)
- */
- public IStatus undo(IProgressMonitor monitor, IAdaptable info) {
- return null;
- }
-
- protected void createAndLinkJ2EEComponentsForMultipleComponents() throws CoreException {
- IVirtualComponent component = ComponentCore.createComponent(getProject(), getComponentDeployName());
- component.create(0, null);
- //create and link javaSource Source Folder
- IVirtualFolder javaSourceFolder = component.getRootFolder().getFolder(new Path("/")); //$NON-NLS-1$
- javaSourceFolder.createLink(new Path("/" + getJavaSourceFolder()), 0, null);
-
- //create and link META-INF folder
- IVirtualFolder metaInfFolder = component.getRootFolder().getFolder(new Path("/" + J2EEConstants.META_INF)); //$NON-NLS-1$
- metaInfFolder.createLink(new Path("/" + getComponentName() + "/" + J2EEConstants.META_INF), 0, null);
-
- }
-
- protected void createAndLinkJ2EEComponentsForSingleComponent() throws CoreException {
- IVirtualComponent component = ComponentCore.createComponent(getProject(), getComponentDeployName());
- component.create(0, null);
- //create and link javaSource Source Folder
-
- IVirtualFolder javaSourceFolder = component.getRootFolder().getFolder(new Path("/")); //$NON-NLS-1$
- javaSourceFolder.createLink(new Path("/" + getJavaSourceFolder()), 0, null);
-
- //create and link META-INF folder
- IVirtualFolder metaInfFolder = component.getRootFolder().getFolder(new Path("/" + J2EEConstants.META_INF)); //$NON-NLS-1$
- metaInfFolder.createLink(new Path("/" + J2EEConstants.META_INF), 0, null);
- }
-
- protected void createManifest(IProgressMonitor monitor) {
- IContainer container = getProject().getFolder( getManifestFolder() );
- IFile file = container.getFile( new Path(J2EEConstants.MANIFEST_SHORT_NAME));
- try {
- ManifestFileCreationAction.createManifestFile(file, getProject());
- } catch (CoreException e) {
- Logger.getLogger().log(e);
- } catch (IOException e) {
- Logger.getLogger().log(e);
- }
- }
-
- private void addSrcFolderToProject() {
- UpdateProjectClasspath update = new UpdateProjectClasspath(getJavaSourceFolder(), getComponentName(), getProject());
- }
-
- String getJavaSourceFolder(){
- String folder = model.getStringProperty(JAVASOURCE_FOLDER);
- String ret = "";
- if( !folder.equals("/")){
- ret = model.getStringProperty(JAVASOURCE_FOLDER);
- }
- return ret;
- }
-
- String getManifestFolder(){
- return model.getStringProperty(MANIFEST_FOLDER);
- }
- /* (non-Javadoc)
- * @see org.eclipse.wst.common.modulecore.internal.operation.ComponentCreationOperationEx#getVersion()
- */
- protected String getVersion() {
- return null;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.wst.common.modulecore.internal.operation.ComponentCreationOperationEx#getProperties()
- */
- protected List getProperties() {
- List newProps = new ArrayList();
- Property outputProperty = getOutputProperty();
- if(outputProperty != null)
- newProps.add(outputProperty);
- return newProps;
- }
-
- protected Property getOutputProperty() {
- String javaSourceFolder = model.getStringProperty(JAVASOURCE_FOLDER);
- if(javaSourceFolder != null && !javaSourceFolder.equals("")) {
- Property prop = ComponentcoreFactory.eINSTANCE.createProperty();
- IPath newOutputPath = null;
- if(FlexibleJavaProjectPreferenceUtil.getMultipleModulesPerProjectProp())
- newOutputPath = Path.fromOSString("/bin/" + getComponentName() + Path.SEPARATOR);
- else
- newOutputPath = Path.fromOSString("/bin/");
- // need a java property constant
- prop.setName(IModuleConstants.PROJ_REL_JAVA_OUTPUT_PATH);
- prop.setValue(newOutputPath.toString());
- return prop;
- }
- return null;
- }
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/application/internal/operations/UpdateManifestDataModel.java b/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/application/internal/operations/UpdateManifestDataModel.java
deleted file mode 100644
index add0b2d7c..000000000
--- a/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/application/internal/operations/UpdateManifestDataModel.java
+++ /dev/null
@@ -1,137 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-/*
- * Created on 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.StringTokenizer;
-
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.wst.common.frameworks.internal.operations.WTPOperation;
-import org.eclipse.wst.common.frameworks.internal.operations.WTPOperationDataModel;
-import org.eclipse.wst.common.frameworks.internal.operations.WTPOperationDataModelEvent;
-
-/**
- * @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 UpdateManifestDataModel extends WTPOperationDataModel {
-
- /**
- * 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$
-
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.wst.common.frameworks.internal.operation.WTPOperationDataModel#getDefaultOperation()
- */
- public WTPOperation getDefaultOperation() {
- return new UpdateManifestOperation(this);
- }
-
- protected void init() {
- super.init();
- }
-
- protected void initValidBaseProperties() {
- super.initValidBaseProperties();
- addValidBaseProperty(PROJECT_NAME);
- addValidBaseProperty(JAR_LIST);
- addValidBaseProperty(JAR_LIST_TEXT_UI);
- addValidBaseProperty(MERGE);
- addValidBaseProperty(MAIN_CLASS);
- addValidBaseProperty(MANIFEST_FILE);
- }
-
- protected 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 void propertyChanged(WTPOperationDataModelEvent event) {
- super.propertyChanged(event);
- if (event.getPropertyName().equals(JAR_LIST)) {
- String text = getClasspathAsString();
- propertyChanged(new WTPOperationDataModelEvent(this, JAR_LIST_TEXT_UI, event.getFlag()));
- }
- }
-
- 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;
- }
-} \ No newline at end of file
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 a628dbd27..000000000
--- a/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/application/internal/operations/UpdateManifestOperation.java
+++ /dev/null
@@ -1,70 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-/*
- * Created on 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.lang.reflect.InvocationTargetException;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-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.internal.enablement.nonui.WFTWrappedException;
-import org.eclipse.wst.common.frameworks.internal.operations.WTPOperation;
-
-
-/**
- * @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 WTPOperation {
-
- public UpdateManifestOperation(UpdateManifestDataModel dataModel) {
- super(dataModel);
- }
-
- protected void execute(IProgressMonitor monitor) throws CoreException, InvocationTargetException, InterruptedException {
- UpdateManifestDataModel dataModel = (UpdateManifestDataModel) operationDataModel;
- IFile file = (IFile)dataModel.getProperty(UpdateManifestDataModel.MANIFEST_FILE);
-
- String classPathValue = dataModel.getClasspathAsString();
- try {
- ArchiveManifest mf = J2EEProjectUtilities.readManifest(file);
-
- if (mf == null)
- mf = new ArchiveManifestImpl();
- mf.addVersionIfNecessary();
- if (dataModel.getBooleanProperty(UpdateManifestDataModel.MERGE)) {
- mf.mergeClassPath(ArchiveUtil.getTokens(classPathValue));
- } else {
- mf.setClassPath(classPathValue);
- }
- if (dataModel.isSet(UpdateManifestDataModel.MAIN_CLASS)) {
- mf.setMainClass(dataModel.getStringProperty(UpdateManifestDataModel.MAIN_CLASS));
- }
-
- J2EEProjectUtilities.writeManifest(file, mf);
- } catch (java.io.IOException ex) {
- throw new WFTWrappedException(ex);
- }
- }
-
-} \ No newline at end of file
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 bb227a7a9..000000000
--- a/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/componentcore/util/EARArtifactEdit.java
+++ /dev/null
@@ -1,509 +0,0 @@
-/***************************************************************************************************
- * Copyright (c) 2003, 2004 IBM Corporation and others. All rights reserved. This program and the
- * accompanying materials are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors: IBM Corporation - initial API and implementation
- **************************************************************************************************/
-
-package org.eclipse.jst.j2ee.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.jst.j2ee.application.Application;
-import org.eclipse.jst.j2ee.application.ApplicationFactory;
-import org.eclipse.jst.j2ee.application.ApplicationResource;
-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.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.StructureEdit;
-import org.eclipse.wst.common.componentcore.internal.util.IArtifactEditFactory;
-import org.eclipse.wst.common.componentcore.internal.util.IModuleConstants;
-import org.eclipse.wst.common.componentcore.resources.ComponentHandle;
-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;
- /**
- * <p>
- * Identifier used to group and query common artifact edits.
- * </p>
- */
- public static String TYPE_ID = "jst.ear"; //$NON-NLS-1$
-
-
- /**
- *
- */
- public EARArtifactEdit() {
- super();
- // TODO Auto-generated constructor stub
- }
-
- /**
- * @param aHandle
- * @param toAccessAsReadOnly
- * @throws IllegalArgumentException
- */
- public EARArtifactEdit(ComponentHandle aHandle, boolean toAccessAsReadOnly) throws IllegalArgumentException {
- super(aHandle, toAccessAsReadOnly);
- // TODO Auto-generated constructor stub
- }
-
- /**
- * <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(ComponentHandle aHandle) {
- EARArtifactEdit artifactEdit = null;
- try {
- artifactEdit = new EARArtifactEdit(aHandle, true);
- } catch (IllegalArgumentException 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(ComponentHandle aHandle) {
- EARArtifactEdit artifactEdit = null;
- try {
- artifactEdit = new EARArtifactEdit(aHandle, false);
- } catch (IllegalArgumentException 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) {
- try {
- if (isValidEARModule(aModule)) {
- IProject project = aModule.getProject();
- ModuleCoreNature nature = ModuleCoreNature.getModuleCoreNature(project);
- return new EARArtifactEdit(nature, aModule, true);
- }
- } catch (UnresolveableURIException uue) {
- //Ignore
- }
- return null;
- }
-
-
- /**
- * <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) {
- try {
- if (isValidEARModule(aModule)) {
- IProject project = aModule.getProject();
- ModuleCoreNature nature = ModuleCoreNature.getModuleCoreNature(project);
- return new EARArtifactEdit(nature, aModule, false);
- }
- } catch (UnresolveableURIException uue) {
- //Ignore
- }
- return null;
- }
-
- /**
- * @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;
- /* and match the JST_WEB_MODULE type */
- if (!TYPE_ID.equals(aModule.getComponentTypeId()))
- return false;
- return true;
- }
-
- /**
- * <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}
- */
-
-
- public 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(getComponentHandle().getProject(), getComponentHandle().getName());
- 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 - a list of IVirtualReferences for utility modules in the EAR
- */
- public List getUtilityModuleReferences() {
- List utilityModuleTypes = new ArrayList();
- utilityModuleTypes.add(IModuleConstants.JST_UTILITY_MODULE);
- return getComponentReferences(utilityModuleTypes);
- }
-
- public String getModuleURI(IVirtualComponent moduleComp) {
- IVirtualComponent comp = getModule(moduleComp.getName());
- if(comp != null) {
- if(comp.getComponentTypeId().equals(IModuleConstants.JST_EJB_MODULE) ||
- comp.getComponentTypeId().equals(IModuleConstants.JST_APPCLIENT_MODULE) ||
- comp.getComponentTypeId().equals(IModuleConstants.JST_UTILITY_MODULE))
- return comp.getName().concat(IJ2EEModuleConstants.JAR_EXT);
- else if (comp.getComponentTypeId().equals((IModuleConstants.JST_WEB_MODULE)))
- return comp.getName().concat(IJ2EEModuleConstants.WAR_EXT);
- else if (comp.getComponentTypeId().equals((IModuleConstants.JST_CONNECTOR_MODULE)))
- return comp.getName().concat(IJ2EEModuleConstants.RAR_EXT);
-
-
- }
- 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()));
- List references = getJ2EEModuleReferences();
- references.addAll(getUtilityModuleReferences());
- for(int i = 0; i < references.size(); i++) {
- IVirtualReference ref = (IVirtualReference)references.get(i);
- IVirtualComponent component = ref.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 - a list of IVirtualReferences for J2EE modules in the EAR
- */
- public List getJ2EEModuleReferences() {
- List j2eeTypes = new ArrayList();
- j2eeTypes.add(IModuleConstants.JST_APPCLIENT_MODULE);
- j2eeTypes.add(IModuleConstants.JST_CONNECTOR_MODULE);
- j2eeTypes.add(IModuleConstants.JST_EJB_MODULE);
- j2eeTypes.add(IModuleConstants.JST_WEB_MODULE);
- return getComponentReferences(j2eeTypes);
- }
-
- /**
- * This method will return the list of IVirtualReferences for all of the components
- * contained in this EAR application.
- *
- * @return - a list of IVirtualReferences for components in the EAR
- */
- public List getComponentReferences() {
- return getComponentReferences(Collections.EMPTY_LIST);
- }
-
- private List getComponentReferences(List componentTypes) {
- List components = new ArrayList();
- IVirtualComponent earComponent = getComponent();
- if (earComponent.getComponentTypeId().equals(IModuleConstants.JST_EAR_MODULE)) {
- IVirtualReference[] refComponents = earComponent.getReferences();
- for (int i = 0; i < refComponents.length; i++) {
- IVirtualComponent module = refComponents[i].getReferencedComponent();
- //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(module.getComponentTypeId())) {
- components.add(refComponents[i]);
- }
- }
- }
- }
- return components;
- }
-
- public ArtifactEdit createArtifactEditForRead(IVirtualComponent aComponent) {
-
- return getEARArtifactEditForRead(aComponent);
- }
-
- public ArtifactEdit createArtifactEditForWrite(IVirtualComponent aComponent) {
-
- return getEARArtifactEditForWrite(aComponent);
- }
-
- public Archive asArchive(boolean includeSource) throws OpenFailureException {
- EARComponentLoadStrategyImpl loader = new EARComponentLoadStrategyImpl(getComponent());
- loader.setExportSource(includeSource);
- String uri = getComponent().getComponentHandle().toString();
- return CommonarchiveFactory.eINSTANCE.openEARFile(loader, uri);
- }
-
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/internal/earcreation/AddModuleMapCommand.java b/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/internal/earcreation/AddModuleMapCommand.java
deleted file mode 100644
index 4ed59c1a6..000000000
--- a/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/internal/earcreation/AddModuleMapCommand.java
+++ /dev/null
@@ -1,93 +0,0 @@
-/***************************************************************************************************
- * Copyright (c) 2003, 2004 IBM Corporation and others. All rights reserved. This program and the
- * accompanying materials are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors: IBM Corporation - initial API and implementation
- **************************************************************************************************/
-package org.eclipse.jst.j2ee.internal.earcreation;
-
-
-
-import org.eclipse.core.resources.IProject;
-import org.eclipse.emf.common.command.AbstractCommand;
-import org.eclipse.jst.j2ee.application.Module;
-import org.eclipse.jst.j2ee.internal.earcreation.modulemap.ModuleMapping;
-
-
-public class AddModuleMapCommand extends AbstractCommand {
- protected EAREditModel editModel;
- protected Module module;
- protected IProject project;
- protected ModuleMapping map;
-
- /**
- * AddModuleMapCommand constructor comment.
- */
- protected AddModuleMapCommand() {
- super();
- }
-
- /**
- * AddModuleMapCommand constructor comment.
- */
- public AddModuleMapCommand(EAREditModel earEditModel, Module aModule, IProject aProject) {
- this(EARCreationResourceHandler.getString("Set_project_UI_")); //$NON-NLS-1$
- editModel = earEditModel;
- module = aModule;
- project = aProject;
- }
-
- /**
- * AddModuleMapCommand constructor comment.
- *
- * @param label
- * java.lang.String
- */
- protected AddModuleMapCommand(String label) {
- super(label);
- }
-
- /**
- * AddModuleMapCommand constructor comment.
- *
- * @param label
- * java.lang.String
- * @param description
- * java.lang.String
- */
- protected AddModuleMapCommand(String label, String description) {
- super(label, description);
- }
-
- public boolean canUndo() {
- return map != null;
- }
-
- /**
- * This will perform the command activity required for the effect. The effect of calling execute
- * when canExecute returns false, or when canExecute hasn't been called, is undefined.
- */
- public void execute() {
- map = editModel.addModuleMapping(module, project);
- }
-
- protected boolean prepare() {
- return true;
- }
-
- /**
- * This will again perform the command activity required to redo the effect after undoing the
- * effect. The effect, if any, of calling redo before undo is called is undefined. Note that if
- * you implement redo to call execute then any derived class will be restricted to by that
- * decision also.
- */
- public void redo() {
- execute();
- }
-
- public void undo() {
- editModel.getModuleMappings().remove(map);
- }
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/internal/earcreation/AddModuleToEARProjectCommand.java b/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/internal/earcreation/AddModuleToEARProjectCommand.java
deleted file mode 100644
index bfab7dd2a..000000000
--- a/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/internal/earcreation/AddModuleToEARProjectCommand.java
+++ /dev/null
@@ -1,66 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jst.j2ee.internal.earcreation;
-
-
-
-import org.eclipse.core.resources.IProject;
-
-
-
-/**
- * Insert the type's description here. Creation date: (03/29/01 4:48:46 PM)
- *
- * @author: Administrator
- */
-public class AddModuleToEARProjectCommand extends ModuleInEARProjectCommand {
- public AddModuleToEARProjectCommand(IProject aNestedJ2EEProject, IProject anEarProject, String uri, String contextRoot, String altDD) {
- super(aNestedJ2EEProject, anEarProject, uri, contextRoot, altDD);
- }
-
- protected void addModule() {
-
- super.addModule();
- moduleSuccessful = true;
- }
-
- protected void addModuleMapping() {
- mapSuccessful = true; // Set this first, because failure in super will turn it to false
- super.addModuleMapping();
- }
-
- public boolean canExecute() {
- return super.canExecute() && EARNatureRuntime.getRuntime(getEarProject()) != null && org.eclipse.jst.j2ee.internal.project.J2EENature.getRegisteredRuntime(getNestedJ2EEProject()) != null;
- }
-
- protected void primExecute() {
- addModule();
- if (moduleSuccessful)
- addModuleMapping();
- }
-
- protected void primUndo() {
- if (mapSuccessful) {
- removeModuleMapping();
- mapSuccessful = false;
- }
- if (moduleSuccessful) {
- removeModule();
- moduleSuccessful = false;
- }
-
- }
-
- // override
- public String getLabel() {
- return label == null ? EARCreationResourceHandler.getString("Add_Module_Command_Label_UI_") : label;//$NON-NLS-1$
- }
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/internal/earcreation/AddUtilityJARMapCommand.java b/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/internal/earcreation/AddUtilityJARMapCommand.java
deleted file mode 100644
index e9d70ccc4..000000000
--- a/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/internal/earcreation/AddUtilityJARMapCommand.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/***************************************************************************************************
- * Copyright (c) 2003, 2004 IBM Corporation and others. All rights reserved. This program and the
- * accompanying materials are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors: IBM Corporation - initial API and implementation
- **************************************************************************************************/
-package org.eclipse.jst.j2ee.internal.earcreation;
-
-
-import org.eclipse.core.resources.IProject;
-
-
-public class AddUtilityJARMapCommand extends UtilityJARInEARProjectCommand {
-
- public static final String LABEL = EARCreationResourceHandler.getString("Add_Utility_JAR_UI"); //$NON-NLS-1$
-
- /**
- * AddModuleMapCommand constructor comment.
- */
- public AddUtilityJARMapCommand(EAREditModel earEditModel, String aUri, IProject aProject) {
- super(earEditModel, aUri, aProject, LABEL);
- }
-
- public AddUtilityJARMapCommand(IProject anEarProject, String aUri, IProject aProject) {
- super(anEarProject, aUri, aProject, LABEL);
- }
-
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.jst.j2ee.internal.internal.internal.earcreation.UtilityJARInEARProjectCommand#primExecute()
- */
- protected void primExecute() {
- addMapping();
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.jst.j2ee.internal.internal.internal.earcreation.UtilityJARInEARProjectCommand#primUndo()
- */
- protected void primUndo() {
- removeMapping();
- }
-
-
-} \ 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 703569465..000000000
--- a/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/internal/earcreation/DefaultJ2EEComponentCreationDataModelProvider.java
+++ /dev/null
@@ -1,386 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 2004, 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 org.eclipse.core.internal.localstore.CoreFileSystemLibrary;
-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.AppClientComponentCreationDataModelProvider;
-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.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.plugin.WTPCommonMessages;
-import org.eclipse.wst.common.frameworks.internal.plugin.WTPCommonPlugin;
-
-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 webModel;
- private IDataModel jcaModel;
- private IDataModel clientModel;
-
- public DefaultJ2EEComponentCreationDataModelProvider() {
- super();
- }
-
- public String[] getPropertyNames() {
- String[] props = new String[] { PROJECT_NAME, EAR_COMPONENT_NAME, APPCLIENT_COMPONENT_NAME, WEB_COMPONENT_NAME, EJB_COMPONENT_NAME, CONNECTOR_COMPONENT_NAME, J2EE_VERSION, CREATE_EJB, CREATE_WEB, CREATE_APPCLIENT, CREATE_CONNECTOR, MODULE_NAME_COLLISIONS_VALIDATION, ENABLED,
- NESTED_MODEL_CLIENT, NESTED_MODEL_EJB, NESTED_MODEL_JCA, NESTED_MODEL_WEB };
- return props;
- }
-
-
- public IDataModelOperation getDefaultOperation() {
- return new DefaultJ2EEComponentCreationOperation(getDataModel());
- }
-
- public void init() {
- initNestedCreationModels();
- super.init();
- }
-
- protected void initNestedCreationModels() {
- clientModel = DataModelFactory.createDataModel(new AppClientComponentCreationDataModelProvider());
- model.addNestedModel(NESTED_MODEL_CLIENT, clientModel);
- EjbModuleExtension ejbExt = EarModuleManager.getEJBModuleExtension();
- if (ejbExt != null) {
- ejbModel = ejbExt.createProjectDataModel();
- if (ejbModel != null)
- model.addNestedModel(NESTED_MODEL_EJB, ejbModel);
- }
- WebModuleExtension webExt = EarModuleManager.getWebModuleExtension();
- if (webExt != null) {
- webModel = webExt.createProjectDataModel();
- if (webModel != null)
- model.addNestedModel(NESTED_MODEL_WEB, webModel);
- }
- JcaModuleExtension rarExt = EarModuleManager.getJCAModuleExtension();
- if (rarExt != null) {
- jcaModel = rarExt.createProjectDataModel();
- if (jcaModel != null)
- model.addNestedModel(NESTED_MODEL_JCA, jcaModel);
- }
- }
-
- 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;
- }
- if (propertyName.startsWith(CREATE_BASE))
- notifyEnablement(convertPropertyNameToInt(propertyName));
- if (propertyName.equals(EAR_COMPONENT_NAME)) {
- setDefaultComponentNames((String) 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 = CoreFileSystemLibrary.isCaseSensitive() ? actualProjectName : actualProjectName.toLowerCase();
- list.add(projectName);
- errorNoSelection = false;
- }
- if (getBooleanProperty(CREATE_EJB)) {
- actualProjectName = ejbModel.getStringProperty(IJ2EEComponentCreationDataModelProperties.PROJECT_NAME);
- projectName = CoreFileSystemLibrary.isCaseSensitive() ? 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 = CoreFileSystemLibrary.isCaseSensitive() ? 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 = CoreFileSystemLibrary.isCaseSensitive() ? 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.getString("NoModulesSelected"), null); //$NON-NLS-1$
- }
- }
-
- 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); //$NON-NLS-1$
- 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(IJ2EEComponentCreationDataModelProperties.COMPONENT_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 (ejbModel != null) {
- int ejbVersion = J2EEVersionUtil.convertJ2EEVersionIDToEJBVersionID(j2eeVer);
- ejbModel.setIntProperty(IJ2EEComponentCreationDataModelProperties.COMPONENT_VERSION, ejbVersion);
- }
- if (webModel != null) {
- int webVersion = J2EEVersionUtil.convertJ2EEVersionIDToWebVersionID(j2eeVer);
- webModel.setIntProperty(IJ2EEComponentCreationDataModelProperties.COMPONENT_VERSION, webVersion);
- }
- if (jcaModel != null) {
- int jcaVersion = J2EEVersionUtil.convertJ2EEVersionIDToConnectorVersionID(j2eeVer);
- jcaModel.setIntProperty(IJ2EEComponentCreationDataModelProperties.COMPONENT_VERSION, jcaVersion);
- }
- if (clientModel != null)
- clientModel.setProperty(IJ2EEComponentCreationDataModelProperties.COMPONENT_VERSION, j2eeVersion);
- }
-
- private void setNestedComponentName(int flag, String compName) {
- IDataModel model = getNestedModel(flag);
- if (model != null) {
- model.setProperty(IJ2EEComponentCreationDataModelProperties.COMPONENT_NAME, compName);
- }
- }
-
- private IStatus validateNestedProjectName(int flag) {
- IDataModel model = getNestedModel(flag);
- if (model != null) {
- String createProperty = null;
- switch (flag) {
- case EJB:
- createProperty = CREATE_EJB;
- break;
- case WEB:
- createProperty = CREATE_WEB;
- break;
- case CLIENT:
- createProperty = CREATE_APPCLIENT;
- break;
- case RAR:
- createProperty = CREATE_CONNECTOR;
- break;
- }
- if (null != createProperty && getBooleanProperty(createProperty)) {
- return model.validateProperty(IJ2EEComponentCreationDataModelProperties.PROJECT_NAME);
- }
- }
- return J2EEPlugin.OK_STATUS;
- }
-
- 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;
- if (result)
- return getBooleanProperty(CREATE_CONNECTOR);
- 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 90c8f6f3d..000000000
--- a/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/internal/earcreation/EARCreationResourceHandler.java
+++ /dev/null
@@ -1,83 +0,0 @@
-/***************************************************************************************************
- * Copyright (c) 2003, 2004 IBM Corporation and others. All rights reserved. This program and the
- * accompanying materials are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors: IBM Corporation - initial API and implementation
- **************************************************************************************************/
-package org.eclipse.jst.j2ee.internal.earcreation;
-
-
-
-import java.text.MessageFormat;
-import java.util.MissingResourceException;
-import java.util.ResourceBundle;
-
-public class EARCreationResourceHandler {
-
- public static final String ADD_MODULE_MODULE_TYPE = "1"; //$NON-NLS-1$
- public static final String ADD_MODULE_MODULE_EXISTS = "2"; //$NON-NLS-1$
- public static final String ADD_MODULE_MODULE_CLOSED = "3"; //$NON-NLS-1$
- public static final String ADD_MODULE_MODULE_NULL = "4"; //$NON-NLS-1$
- public static final String ADD_PROJECT_URI_EXISTS = "5"; //$NON-NLS-1$
- public static final String ADD_PROJECT_NOT_JAVA = "6"; //$NON-NLS-1$
- public static final String ADD_PROJECT_UTIL_URI = "7"; //$NON-NLS-1$
- public static final String ADD_PROJECT_UTIL_MAPPED = "8"; //$NON-NLS-1$
- public static final String ADD_PROJECT_NOT_EAR = "9"; //$NON-NLS-1$
- public static final String ADD_PROJECT_URI_EMPTY = "10"; //$NON-NLS-1$
- public static final String NOT_AN_APP_CLIENT = "11"; //$NON-NLS-1$
- public static final String NOT_AN_EAR = "12"; //$NON-NLS-1$
- public static final String NOT_AN_EJB = "13"; //$NON-NLS-1$
- public static final String NOT_A_RAR = "14"; //$NON-NLS-1$
- public static final String NOT_A_WAR = "15"; //$NON-NLS-1$
- public static final String SERVER_TARGET_NOT_SUPPORT_EAR = "16"; //$NON-NLS-1$
-
- private static ResourceBundle fgResourceBundle;
-
-
-
- /**
- * Returns the resource bundle used by all classes in this Project
- */
- public static ResourceBundle getResourceBundle() {
- try {
- return ResourceBundle.getBundle("earcreation");//$NON-NLS-1$
- } catch (MissingResourceException e) {
- // does nothing - this method will return null and
- // getString(String, String) will return the key
- // it was called with
- }
- return null;
- }
-
- public static String getString(String key) {
- if (fgResourceBundle == null) {
- fgResourceBundle = getResourceBundle();
- }
-
- if (fgResourceBundle != null) {
- try {
- return fgResourceBundle.getString(key);
- } catch (MissingResourceException e) {
- return "!" + key + "!";//$NON-NLS-2$//$NON-NLS-1$
- }
- }
- return "!" + key + "!";//$NON-NLS-2$//$NON-NLS-1$
- }
-
- public static String getString(String key, Object[] args) {
-
- try {
- return MessageFormat.format(getString(key), args);
- } catch (IllegalArgumentException e) {
- return getString(key);
- }
-
- }
-
- public static void nlsConcatenationFinder() {
- // used to tag methods which have concatenated strings
- }
-
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/internal/earcreation/EAREditModel.java b/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/internal/earcreation/EAREditModel.java
deleted file mode 100644
index f967f7606..000000000
--- a/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/internal/earcreation/EAREditModel.java
+++ /dev/null
@@ -1,745 +0,0 @@
-/***************************************************************************************************
- * Copyright (c) 2003, 2004 IBM Corporation and others. All rights reserved. This program and the
- * accompanying materials are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors: IBM Corporation - initial API and implementation
- **************************************************************************************************/
-package org.eclipse.jst.j2ee.internal.earcreation;
-
-
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IProjectDescription;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.emf.common.util.URI;
-import org.eclipse.emf.common.util.WrappedException;
-import org.eclipse.emf.ecore.EPackage;
-import org.eclipse.emf.ecore.resource.Resource;
-import org.eclipse.emf.ecore.xmi.XMIResource;
-import org.eclipse.jem.util.emf.workbench.ProjectUtilities;
-import org.eclipse.jst.j2ee.application.Application;
-import org.eclipse.jst.j2ee.application.ApplicationResource;
-import org.eclipse.jst.j2ee.application.Module;
-import org.eclipse.jst.j2ee.internal.J2EEConstants;
-import org.eclipse.jst.j2ee.internal.application.ApplicationPackage;
-import org.eclipse.jst.j2ee.internal.common.XMLResource;
-import org.eclipse.jst.j2ee.internal.earcreation.modulemap.EARProjectMap;
-import org.eclipse.jst.j2ee.internal.earcreation.modulemap.ModuleMapping;
-import org.eclipse.jst.j2ee.internal.earcreation.modulemap.ModulemapPackage;
-import org.eclipse.jst.j2ee.internal.earcreation.modulemap.UtilityJARMapping;
-import org.eclipse.jst.j2ee.internal.moduleextension.EarModuleManager;
-import org.eclipse.wst.common.frameworks.internal.SaveFailedException;
-import org.eclipse.wst.common.internal.emfworkbench.EMFWorkbenchContext;
-import org.eclipse.wst.common.internal.emfworkbench.integration.EditModelEvent;
-
-/**
- *
- * @deprecated
- * Use
- * <p>
- * EARArtifactEdit
- * </p>
- *
- */
-public class EAREditModel extends org.eclipse.jst.j2ee.internal.J2EEEditModel {
- private boolean stopListenerNotifications = false;
- //TODO this is a hack until the DOM adaptors are working
- public static final String MODULE_MAP_URI = "META-INF/.modulemaps"; //$NON-NLS-1$
- public static final URI MODULE_MAP_URI_OBJ = URI.createURI(MODULE_MAP_URI);
-
- /**
- * EJBSaveModel constructor comment.
- *
- * @param Object
- * editModelID - An editModelID to identify the EditModel
- */
- public EAREditModel(String editModelID, EMFWorkbenchContext context, boolean readOnly) {
- super(editModelID, context, readOnly);
- }// EAREditModel
-
- /**
- * EJBSaveModel constructor comment.
- *
- * @param Object
- * editModelID - An editModelID to identify the EditModel
- */
- public EAREditModel(String editModelID, EMFWorkbenchContext context, boolean readOnly, boolean accessUnkownResourcesAsReadOnly) {
- super(editModelID, context, readOnly, accessUnkownResourcesAsReadOnly);
- }// EAREditModel
-
- /**
- * Adds the module mapping to a project.
- *
- * @param Module
- * module - The module to add
- * @param IProject
- * project - The current project.
- * @return ModuleMapping
- */
- public ModuleMapping addModuleMapping(Module module, IProject aProject) {
-
- ModuleMapping map = ((ModulemapPackage) EPackage.Registry.INSTANCE.getEPackage(ModulemapPackage.eNS_URI)).getModulemapFactory().createModuleMapping();
- map.setModule(module);
- map.setProjectName(aProject.getName());
- getEARProjectMap().getMappings().add(map);
-
- return map;
- }// ModuleMapping
-
- /**
- * Adds a utility jar mapping to a project.
- *
- * @param String
- * uri - Utility jar uri.
- * @param IProject
- * project - The current project.
- * @return UtilityJARMapping
- */
- public UtilityJARMapping addUtilityJARMapping(String uri, IProject aProject) {
-
- UtilityJARMapping map = ((ModulemapPackage) EPackage.Registry.INSTANCE.getEPackage(ModulemapPackage.eNS_URI)).getModulemapFactory().createUtilityJARMapping();
- map.setUri(uri);
- map.setProjectName(aProject.getName());
- getEARProjectMap().getUtilityJARMappings().add(map);
-
- return map;
- }// addUtilityJARMapping
-
- /**
- * Return the root object, application, from the application.xml DD.
- *
- * @return Application
- */
- public Application getApplication() {
- ApplicationResource dd = getApplicationXmiResource();
- return dd == null ? null : dd.getApplication();
- }
-
- /**
- * Gets the application resource.
- *
- * @return ApplicationResource
- */
- public ApplicationResource getApplicationXmiResource() {
- return (ApplicationResource) getResource(J2EEConstants.APPLICATION_DD_URI_OBJ);
- }// getApplicationXmiResource
-
- /**
- * Answer all the projects referenced by the .modulemaps file
- *
- * @return Set
- */
- public Set getModuleMappedProjects() {
- Set aSet = getModuleMappedModuleProjects();
- aSet.addAll(getModuleMappedUtilityJarProjects());
- return aSet;
- }
-
- public Map getModuleMappedProjectsAsMap() {
- Map aMap = getModuleMappedModuleProjectsAsMap();
- aMap.putAll(getModuleMappedUtilityJarProjectsAsMap());
- return aMap;
- }
-
-
- public Set getModuleMappedUtilityJarProjects() {
- Set aSet = new HashSet();
- aSet.addAll(getModuleMappedUtilityJarProjectsAsMap().values());
- return aSet;
- }
-
- public Map getModuleMappedUtilityJarProjectsAsMap() {
- Map aMap = new HashMap();
- IProject aProject = null;
- List utilityJARMappings = getUtilityJARMappings();
- for (int i = 0; i < utilityJARMappings.size(); i++) {
- aProject = null;
- UtilityJARMapping map = (UtilityJARMapping) utilityJARMappings.get(i);
- if (map.getProjectName() != null && map.getProjectName().length() > 0)
- aProject = getProject(map.getProjectName());
- if (aProject != null && map.getUri() != null && map.getUri().length() > 0)
- aMap.put(map.getUri(), aProject);
- }
- return aMap;
- }
-
- public Set getModuleMappedModuleProjects() {
- Set aSet = new HashSet();
- aSet.addAll(getModuleMappedModuleProjectsAsMap().values());
- return aSet;
- }
-
- public Map getModuleMappedModuleProjectsAsMap() {
- Map aMap = new HashMap();
- List moduleMappings = getModuleMappings();
- IProject aProject = null;
- for (int i = 0; i < moduleMappings.size(); i++) {
- aProject = null;
- ModuleMapping map = (ModuleMapping) moduleMappings.get(i);
- if (map.getProjectName() != null && map.getProjectName().length() > 0)
- aProject = getProject(map.getProjectName());
- Module module = map.getModule();
- if (aProject != null && module != null && module.getUri() != null && module.getUri().length() > 0)
- aMap.put(module.getUri(), aProject);
- }
- return aMap;
- }
-
-
- /**
- * Get a project
- *
- * @param String
- * name - The project name.
- * @return IProject
- */
- protected IProject getProject(String name) {
- if (name == null || name.length() == 0)
- return null;
- return ResourcesPlugin.getWorkspace().getRoot().getProject(name);
- }
-
- protected IProject getProject(ModuleMapping mapping) {
- if (mapping != null && mapping.getProjectName() != null && mapping.getProjectName().length() > 0)
- return getProject(mapping.getProjectName());
- return null;
- }
-
- /**
- * Finds an existing UtilityJARMapping for the project and uri, if one exists
- *
- */
- public UtilityJARMapping getUtilityJARMapping(String uri, IProject aProject) {
- if (aProject == null || uri == null)
- return null;
- List maps = getUtilityJARMappings();
- for (int i = 0; i < maps.size(); i++) {
- UtilityJARMapping map = (UtilityJARMapping) maps.get(i);
- if (aProject.getName().equals(map.getProjectName()) && uri.equals(map.getUri()))
- return map;
- }
- return null;
- }
-
- /**
- * Insert the method's description here. Creation date: (4/11/2001 4:14:26 PM)
- *
- * @return EJBNatureRuntime
- */
- public EARNatureRuntime getEARNature() {
- return EARNatureRuntime.getRuntime(getProject());
- }
-
- /**
- * The root object which contains the list of mappings from application modules to workbench
- * projects
- */
- public EARProjectMap getEARProjectMap() {
- return getEARProjectMap(true);
- }
-
- /**
- * The root object which contains the list of mappings from application modules to workbench
- * projects
- */
- protected EARProjectMap getEARProjectMap(boolean createIfEmpty) {
- Resource res = null;
- try {
- res = getOrCreateResource(MODULE_MAP_URI_OBJ);
- } catch (WrappedException e) {
- //Ignore
- }
- if (res == null)
- return null;
- if (res.getContents().isEmpty() && createIfEmpty) {
- boolean dirtyFlag = res.isModified();
- res.getContents().add(ModulemapPackage.eINSTANCE.getModulemapFactory().createEARProjectMap());
- res.setModified(dirtyFlag);
- }// if
- if (res.getContents().isEmpty())
- return null;
- return (EARProjectMap) res.getContents().get(0);
- }// getEARProjectMap
-
- /**
- * Get the module mappings from module
- *
- * @param Module
- * module - The current module.
- * @return ModuleMapping
- */
- public ModuleMapping getModuleMapping(Module module) {
- if (module == null)
- return null;
- List maps = getModuleMappings();
- for (int i = 0; i < maps.size(); i++) {
- ModuleMapping map = (ModuleMapping) maps.get(i);
- Module iModule = map.getModule();
- if (module.equals(iModule))
- return map;
- }// for
- return null;
- }// getModuleMapping
-
- /**
- * Get the utility jar mapping from an uri
- *
- * @param String
- * uri - The current uri
- * @return UtilityJARMapping
- */
- public UtilityJARMapping getUtilityJARMapping(String uri) {
- if (uri == null)
- return null;
- List maps = getUtilityJARMappings();
- for (int i = 0; i < maps.size(); i++) {
- UtilityJARMapping map = (UtilityJARMapping) maps.get(i);
- if (uri.equals(map.getUri()))
- return map;
- }// for
- return null;
- }// getUtilityJARMapping
-
- /**
- * Return a Project for the given <code>uri</code>. This will return a Project for a utility
- * JAR mapping or a module mapping. A project will be returned if the mapping has a project name
- * even if the project does not exist or is not accessible.
- *
- * @param uri
- * @return
- */
- public IProject getMappedProject(String uri) {
- UtilityJARMapping utilMapping = getUtilityJARMapping(uri);
- if (utilMapping != null) {
- return getProject(utilMapping.getProjectName());
- }
- List moduleMappings = getModuleMappings();
- for (int i = 0; i < moduleMappings.size(); i++) {
- ModuleMapping map = (ModuleMapping) moduleMappings.get(i);
- Module mod = map.getModule();
- if (mod != null && uri.equals(mod.getUri()))
- return getProject(map.getProjectName());
- }
- return null;
- }
-
- /**
- * Get the module mapping based on a project.
- *
- * @param IProject
- * project - The current project.
- * @return ModuleMapping
- */
- public ModuleMapping getModuleMapping(IProject aProject) {
- if (aProject == null)
- return null;
- List maps = getModuleMappings();
- for (int i = 0; i < maps.size(); i++) {
- ModuleMapping map = (ModuleMapping) maps.get(i);
- if (aProject.getName().equals(map.getProjectName()))
- return map;
- }// for
- return null;
- }// getModuleMapping
-
- /**
- * Checks if the uri mapping already exists.
- *
- * @param String
- * currentName - The current uri of the module.
- * @return boolean
- */
- public boolean uriExists(String currentName) {
-
- if (currentName != null) {
- return (this.moduleMappingExists(currentName) || this.utilJarMappingExists(currentName));
- } // if
- return false;
- } // uriExists
-
- /**
- * Checks if the current uri conflicts with any of the existing module mappings.
- *
- * @param String
- * currentUri - The uri to check to see if it exists.
- * @return boolean
- */
- public boolean moduleMappingExists(String currentUri) {
- if (currentUri == null)
- return false;
- List maps = getModuleMappings();
- if (maps != null || !maps.isEmpty()) {
- for (int i = 0; i < maps.size(); i++) {
- ModuleMapping map = (ModuleMapping) maps.get(i);
- if (currentUri.equals(map.getModule().getUri())) {
- return true;
- }
- }
- }
- return false;
- }
-
- /**
- * Checks if the current uri conflicts with any of the existing utility jar mappings.
- *
- * @param String
- * currentUri - The uri to check to see if it exists.
- * @return boolean
- */
- public boolean utilJarMappingExists(String currentUri) {
- if (currentUri == null)
- return false;
- List utilMaps = this.getUtilityJARMappings();
- if (utilMaps != null || !utilMaps.isEmpty()) {
- for (int i = 0; i < utilMaps.size(); i++) {
- UtilityJARMapping utilMap = (UtilityJARMapping) utilMaps.get(i);
- if (currentUri.equals(utilMap.getUri())) {
- return true;
- } // if
- } // for
- } // if
- return false;
- } // utilJarMappingExists
-
- /**
- * Gets the utilityJARMapping bases on project.
- *
- * @param IProject
- * project - The current project.
- * @return UtilityJARMapping
- */
- public UtilityJARMapping getUtilityJARMapping(IProject aProject) {
- if (aProject == null)
- return null;
- List maps = getUtilityJARMappings();
- for (int i = 0; i < maps.size(); i++) {
- UtilityJARMapping map = (UtilityJARMapping) maps.get(i);
- if (aProject.getName().equals(map.getProjectName()))
- return map;
- }// for
- return null;
- }// getUtilityJARMapping
-
- /**
- * Get a collection of module mappings.
- *
- * @return List
- */
- public List getModuleMappings() {
- EARProjectMap map = getEARProjectMap();
- if (map == null)
- return java.util.Collections.EMPTY_LIST;
- return map.getMappings();
- }//getModuleMappings
-
- /**
- * Get a collection of utility mappings.
- *
- * @return List
- */
- public List getUtilityJARMappings() {
- EARProjectMap map = getEARProjectMap();
- if (map == null)
- return java.util.Collections.EMPTY_LIST;
- return map.getUtilityJARMappings();
- }// getUtilityJARMappings
-
- /**
- * The resource which contains the mappings from application modules to workbench projects
- *
- * @return Resource
- */
- protected Resource getModuleMapsXmiResource() {
- return getResource(MODULE_MAP_URI_OBJ);
- }// getModuleMapsXmiResource
-
- // TODO Removed to make way for the generic getRootObject()
- // /**
- // * Gets the root object.
- // *
- // * @return Application
- // * @deprecated Please use getApplication() for consistency
- // */
- // public org.eclipse.jst.j2ee.internal.internal.application.Application getRootObject() {
- // return getApplication();
- // }// getRootObject
-
-
- /**
- * discription goes here
- *
- * @return Resource
- */
- public Resource makeDeploymentDescriptorWithRoot() {
- XMLResource res = (XMLResource) makeEarXmiResource();
- Application app = ApplicationPackage.eINSTANCE.getApplicationFactory().createApplication();
- res.getContents().add(app);
- res.setID(app, J2EEConstants.APPL_ID);
- res.setJ2EEVersionID(getEARNature().getJ2EEVersion());
- app.setDisplayName(getProject().getName());
- return res;
- }// Resource
-
- /**
- * discription goes here
- *
- * @return Resource
- */
- public Resource makeEarXmiResource() {
- return createResource(J2EEConstants.APPLICATION_DD_URI_OBJ);
- }// makeEarXmiResource
-
- /**
- * The resource which contains the mappings from application modules to workbench projects
- *
- * @return Resource
- */
- protected Resource makeModuleMapsXmiResource() {
-
- if (isReadOnly())
- return null;
-
- Resource res = createResource(MODULE_MAP_URI_OBJ);
- EARProjectMap root = ModulemapPackage.eINSTANCE.getModulemapFactory().createEARProjectMap();
- res.getContents().add(root);
- res.setModified(false);
- return res;
- }// makeModuleMapsXmiResource
-
- /**
- * makeRoot
- *
- * @param Resource
- * deploymentDescriptor - The current deployment descriptor
- */
- public Resource makeRoot(Resource deploymentDescriptor) {
-
- Application app = ((ApplicationPackage) EPackage.Registry.INSTANCE.getEPackage(ApplicationPackage.eNS_URI)).getApplicationFactory().createApplication();
- app.setDisplayName(getProject().getName());
- ((XMIResource) app.eResource()).setID(app, J2EEConstants.APPL_ID);
- deploymentDescriptor.getContents().add(app);
- return deploymentDescriptor;
- }// makeRoot
-
- //HACK TO BE REMOVED
- protected void notifyListeners(EditModelEvent anEvent) {
- if (!stopListenerNotifications)
- super.notifyListeners(anEvent);
- }
-
- //HACK TO BE REMOVED
- public void resumeNotifications() {
- stopListenerNotifications = false;
- }
-
- //HACK TO BE REMOVED
- public void stopNotifications() {
- stopListenerNotifications = true;
- }
-
- /**
- * primSave
- *
- * @param IProgressMonitor
- * monitor - Current progress monitor.
- * @see EditModel#primSave(IProgressMonitor)
- */
- public void primSave(IProgressMonitor monitor) {
- removeInvalidModuleMaps(true);
- super.primSave(monitor);
- try {
- updateProjectReferences(monitor);
- } catch (CoreException ex) {
- throw new SaveFailedException(EARCreationResourceHandler.getString("PROJ_DESC_UPDATE_ERROR_UI_"), ex); //$NON-NLS-1$
- }// try
- } // primSave
-
- public void removeInvalidModuleMaps(boolean preserveModifiedFlag) {
- if (!this.isReadOnly()) {
- List moduleMaps = this.getExistingModuleMappings();
- if (!moduleMaps.isEmpty()) {
- Resource mmResource = getModuleMapsXmiResource();
- boolean isDirty = mmResource.isModified();
- try {
- Iterator mapIterator = moduleMaps.iterator();
- ModuleMapping mm = null;
- Module m = null;
- while (mapIterator.hasNext()) {
- mm = (ModuleMapping) mapIterator.next();
- m = mm.getModule();
- if (m == null || m.eIsProxy())
- mapIterator.remove();
- }
- } finally {
- if (preserveModifiedFlag)
- mmResource.setModified(isDirty);
- }
- }
- }
- }
-
- /**
- * @return
- */
- private List getExistingModuleMappings() {
- EARProjectMap map = getEARProjectMap(false);
- if (map == null)
- return java.util.Collections.EMPTY_LIST;
- return map.getMappings();
- }
-
-
-
- /**
- * Updates the project references
- *
- * @param IProgressMonitor
- * monitor - Current progress monitor.
- */
- protected void updateProjectReferences(IProgressMonitor monitor) throws CoreException {
- IProjectDescription description = getProject().getDescription();
- Set newProjects = new HashSet();
- newProjects.addAll(getModuleMappedProjects());
- if (!hasProjectReferenceChanges(description, newProjects))
- return;
- IProject[] newArray = (IProject[]) newProjects.toArray(new IProject[newProjects.size()]);
- description.setReferencedProjects(newArray);
- int flags = IResource.FORCE | IResource.KEEP_HISTORY;
- getProject().setDescription(description, flags, monitor);
- }// updateProjectReferences
-
- /**
- * Checks if there are reference changes.
- *
- * @return boolean
- */
- public boolean hasProjectReferenceChanges() {
- IProjectDescription description;
- try {
- description = getProject().getDescription();
- } catch (CoreException ex) {
- return false;
- }// try
-
- Set newProjects = new HashSet();
- newProjects.addAll(getModuleMappedProjects());
- return hasProjectReferenceChanges(description, newProjects);
- }// hasProjectReferenceChanges
-
- /**
- * Checks if any of the project references have changed.
- *
- * @param IProjectDescription
- * description - Current project discription.
- * @param Set
- * newProjects - A set of new projects.
- * @return boolean
- */
- protected boolean hasProjectReferenceChanges(IProjectDescription description, Set newProjects) {
- IProject[] projects = description.getReferencedProjects();
- Set oldProjects = new HashSet();
- oldProjects.addAll(Arrays.asList(projects));
- return !oldProjects.equals(newProjects);
- }// hasProjectReferenceChanges
-
- /**
- * Gets a list of non resource files.
- *
- * @return List
- * @see org.eclipse.wst.common.internal.emfworkbench.validateedit.ResourceStateInputProvider#getNonResourceFiles()
- */
- public List getNonResourceFiles() {
- IFile aFile = getProject().getFile(ProjectUtilities.DOT_PROJECT);
- return Collections.singletonList(aFile);
- }// getNonResourceFiles
-
- /**
- * Get the deployment descripto resource
- *
- * @return XMLResource
- */
- public XMLResource getDeploymentDescriptorResource() {
- return getApplicationXmiResource();
- }// getDeploymentDescriptorResource
-
- /**
- * Answer whether there is either a module mapping or a utility JAR mapping to the project.
- *
- * @param IProject
- * p - The current project.
- * @return boolean
- */
- public boolean hasMappingToProject(IProject p) {
- return getModuleMapping(p) != null || getUtilityJARMapping(p) != null;
- }// hasMappingToProject
-
- /**
- * Returns a project based on a util jar mapping.
- *
- * @param UtilityJARMapping
- * utilJarMapping - The current utilJarMapping
- * @return IProject
- */
- public IProject getProjectFromUtilJarMapping(UtilityJARMapping utilJarMapping) {
- if (utilJarMapping != null) {
- String projectName = utilJarMapping.getProjectName();
- return getProject(projectName);
- } // if
- return null;
- } // getProjectFromUtilJarMapping
-
- public boolean isEjbClientJarMapping(UtilityJARMapping utilJarMapping) {
- IProject aProject = getProjectFromUtilJarMapping(utilJarMapping);
- if (aProject != null)
- return isEjbClientJarProject(aProject);
- return false;
- }
-
- /**
- * @param project
- * @return
- */
- public boolean isEjbClientJarProject(IProject utilProject) {
- if (utilProject != null) {
- List mappings = getModuleMappings();
- ModuleMapping mapping;
- IProject ejbProject;
- for (int i = 0; i < mappings.size(); i++) {
- mapping = (ModuleMapping) mappings.get(i);
- if (mapping.getModule() != null && mapping.getModule().isEjbModule()) {
- ejbProject = getProject(mapping);
- if (utilProject.equals(EarModuleManager.getEJBModuleExtension().getDefinedEJBClientJARProject(ejbProject)))
- return true;
- }
- }
- }
- return false;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.jst.j2ee.internal.internal.workbench.J2EEEditModel#getRootObject()
- */
- public Object getRootObject() {
- return getApplication();
- }
-
- public String getDevelopmentAcivityID() {
- return ENTERPRISE_JAVA;
- }
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/internal/earcreation/EAREditModelFactory.java b/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/internal/earcreation/EAREditModelFactory.java
deleted file mode 100644
index 904c4bd94..000000000
--- a/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/internal/earcreation/EAREditModelFactory.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jst.j2ee.internal.earcreation;
-
-import java.util.Map;
-
-import org.eclipse.wst.common.internal.emfworkbench.EMFWorkbenchContext;
-import org.eclipse.wst.common.internal.emfworkbench.integration.EditModel;
-import org.eclipse.wst.common.internal.emfworkbench.integration.EditModelFactory;
-
-
-
-/**
- * @deprecated
- * Use
- * <p>
- * EARArtifactEdit
- * </p>
- *
- */
-public class EAREditModelFactory extends EditModelFactory {
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.wst.common.internal.emfworkbench.integration.EditModelFactory#createEditModelForRead(java.lang.Object,
- * org.eclipse.wst.common.internal.emfworkbench.EMFWorkbenchContext)
- */
- public EditModel createEditModelForRead(String editModelID, EMFWorkbenchContext context, Map params) {
- return new EAREditModel(editModelID, context, true, isLoadKnownResourcesAsReadOnly());
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.wst.common.internal.emfworkbench.integration.EditModelFactory#createEditModelForWrite(java.lang.Object,
- * org.eclipse.wst.common.internal.emfworkbench.EMFWorkbenchContext)
- */
- public EditModel createEditModelForWrite(String editModelID, EMFWorkbenchContext context, Map params) {
- return new EAREditModel(editModelID, context, false, isLoadKnownResourcesAsReadOnly());
- }
-
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/internal/earcreation/EARNatureRuntime.java b/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/internal/earcreation/EARNatureRuntime.java
deleted file mode 100644
index 96a4c76c5..000000000
--- a/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/internal/earcreation/EARNatureRuntime.java
+++ /dev/null
@@ -1,600 +0,0 @@
-/***************************************************************************************************
- * Copyright (c) 2003, 2004 IBM Corporation and others. All rights reserved. This program and the
- * accompanying materials are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors: IBM Corporation - initial API and implementation
- **************************************************************************************************/
-package org.eclipse.jst.j2ee.internal.earcreation;
-
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import org.eclipse.core.resources.IContainer;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IResourceStatus;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.emf.common.util.URI;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.ecore.resource.Resource;
-import org.eclipse.emf.ecore.resource.ResourceSet;
-import org.eclipse.jst.j2ee.application.Application;
-import org.eclipse.jst.j2ee.application.Module;
-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.ArchiveConstants;
-import org.eclipse.jst.j2ee.internal.J2EEEditModel;
-import org.eclipse.jst.j2ee.internal.J2EEVersionConstants;
-import org.eclipse.jst.j2ee.internal.common.XMLResource;
-import org.eclipse.jst.j2ee.internal.earcreation.modulemap.ModuleMapping;
-import org.eclipse.jst.j2ee.internal.earcreation.modulemap.UtilityJARMapping;
-import org.eclipse.jst.j2ee.internal.plugin.J2EEPlugin;
-import org.eclipse.jst.j2ee.internal.project.J2EENature;
-import org.eclipse.wst.common.internal.emfworkbench.integration.EditModel;
-
-/**
- * @deprecated - This class is deprecated.
- * Use
- * <pre>
- * EARArtifactEdit instead.
- * </pre>
- *
- */
-
-public class EARNatureRuntime extends J2EENature {
-
- private static final String EAR_PROJECT_12_OVERLAY = "1_2_ovr"; //$NON-NLS-1$
- private static final String EAR_PROJECT_13_OVERLAY = "1_3_ovr"; //$NON-NLS-1$
- private static final String EAR_PROJECT_14_OVERLAY = "1_4_ovr"; //$NON-NLS-1$
- protected static final String ALT_ROOT_EDEFAULT = null;
-
- public static Map EMPTY_MAP = new HashMap(0);
-
-
- /**
- * WebNature constructor comment.
- */
- public EARNatureRuntime() {
- super();
- }
-
- /**
- * Return the key for the sourcePath.
- */
- public Archive asArchive() throws OpenFailureException {
- return null;
- }
-
- /**
- * Return the key for the sourcePath.
- */
- public Archive asArchive(boolean shouldExportSource) throws OpenFailureException {
- return null;
- }
-
- /**
- * (non-Javadoc)
- *
- * @see org.eclipse.jst.j2ee.internal.internal.j2eeproject.J2EENature#getJ2EEVersion()
- * @deprecated
- * Use
- * <p>
- * EARArtifactEdit.getJ2EEVersion()
- * </p>
- */
- public int getJ2EEVersion() {
-
- return getModuleVersion();
- }
-
- /**
- * True for all but the EAR Nature
- */
- protected boolean projectIsJavaProject() {
- return false;
- }
-
- protected EditModel createCacheEditModel() {
- return getEarEditModelForRead(this);
- }
-
- /**
- * Create the folders for the project we have just created.
- *
- * @exception com.ibm.itp.core.api.resources.CoreException
- * The exception description.
- */
- protected void createFolders() throws CoreException {
-
- //build for metapath
- createFolder(getMetaPath());
- }
-
- /**
- * Undefined for an ear project
- */
- public Module createNewModule() {
- return null;
- }
-
- /**
- * Return a list of all projects that have an ear nature
- */
- public static List getAllEARProjectsInWorkbench() {
- List allProjects = Arrays.asList(J2EEPlugin.getWorkspace().getRoot().getProjects());
- List earProjects = new ArrayList();
- for (int i = 0; i < allProjects.size(); i++) {
- IProject p = (IProject) allProjects.get(i);
- if (p.exists() && p.isOpen()) {
- if (hasRuntime(p))
- earProjects.add(p);
- }
- }
- return earProjects;
- }
-
- /**
- * @deprecated
- * Use
- * <pre>
- * EARArtifactEdit.getApplication()
- * </pre>
- *
- */
-
- public Application getApplication() {
- return ((EAREditModel) getCacheEditModel()).getApplication();
- }
-
- /**
- * @deprecated
- * Use
- * <pre>
- * EARArtifactEdit.getApplicationXmiResource()
- * </pre>
- * @return
- */
-
- public Resource getApplicationXmiResource() {
- return getResource(URI.createURI(ArchiveConstants.APPLICATION_DD_URI));
- }
-
- /**
- * Return the key for the classpath.
- */
- public java.lang.String getClassPathKey() {
- return null;
- }
-
- /**
- * @see org.eclipse.jst.j2ee.internal.internal.j2eeproject.J2EENature#getEditModelKey()
- */
- public String getEditModelKey() {
- return IEARNatureConstants.EDIT_MODEL_ID;
- }
-
- /**
- * Returns an application xml model that consists of the MOF model and the DOM model.
- * Important!!! Calling this method increments the use count of this model. When you are done
- * accessing the model, call releaseAccess()!
- *
- * @deprecated - use EARArtifactEdit.getArtifactEditForRead(WorkbenchComponent aModule) instead.
- */
- public EAREditModel getEarEditModelForRead(Object accessorKey) {
- return (EAREditModel) getEditModelForRead(IEARNatureConstants.EDIT_MODEL_ID, accessorKey);
- }
-
- /**
- * Returns an application xml model that consists of the MOF model and the DOM model.
- * Important!!! Calling this method increments the use count of this model. When you are done
- * accessing the model, call releaseAccess()!
- *
- * @deprecated - use EARArtifactEdit.getArtifactEditForWrite(WorkbenchComponent aModule) instead.
- *
- */
- public EAREditModel getEarEditModelForWrite(Object accessorKey) {
- return (EAREditModel) getEditModelForWrite(IEARNatureConstants.EDIT_MODEL_ID, accessorKey);
- }
-
- /**
- * @deprecated - Use EJBArtifactEdit.getApplicationXmiResource()
- */
-
- public Resource getEjbXmiResource() {
- return getResource(URI.createURI(ArchiveConstants.EJBJAR_DD_URI));
- }
-
- /**
- * Return the key for the metaPath.
- */
- public java.lang.String getMetaPathKey() {
- return IEARNatureConstants.DEFAULT_META_PATH;
- }
-
- public Module getModule(IProject referencedProject) {
- EAREditModel model = (EAREditModel) getCacheEditModel();
- ModuleMapping map = model.getModuleMapping(referencedProject);
- if (map != null) {
- return map.getModule();
- }
- return null;
- }
-
- /**
- * Return a Project for the given <code>uri</code>. This will return a Project for a utility
- * JAR mapping or a module mapping. A project will be returned if the mapping has a project name
- * even if the project does not exist or is not accessible.
- * @param uri
- * @return
- * @deprecated
- * Use
- * <p>
- * Get the enterprise application module workbench component and call getReferencedComponents()
- * </p>
- */
- public IProject getMappedProject(String uri) {
- EAREditModel model = (EAREditModel) getCacheEditModel();
- return model.getMappedProject(uri);
- }
-
- /**
- * @return J2EENature - the nature for the project that represents
- * @aModule in the ear; null if no such project exists
- * @deprecated
- * Use
- * <p>
- * ModuleCore.findWorkbenchModuleByModuleURI(URI aModuleURI)
- * </p>
- */
- public J2EENature getModuleProject(Module aModule) {
-
- IProject aProject = primGetModuleProject(aModule);
- if (aProject != null)
- return J2EENature.getRegisteredRuntime(aProject);
- return null;
- }
-
- /**
- * @return J2EENature - the nature for the project that represents the module having
- * @moduleURI in the ear; null if the application does not contain a module with
- * @moduleURI or if no such project exists
- * @deprecated
- * Use
- * <p>
- * ModuleCore.findWorkbenchModuleByModuleURI(URI aModuleURI)
- * </p>
- */
- public J2EENature getModuleProject(String moduleURI) {
- Application dd = getApplication();
- //You could have two modules with the same uri - right now we will take the first module it
- // finds
- return dd == null ? null : getModuleProject(dd.getFirstModule(moduleURI));
- }
-
- /**
- * If the project is referenced by the EAR, return the URI of the JAR or module
- */
- public String getJARUri(IProject aProject) {
- EAREditModel model = (EAREditModel) getCacheEditModel();
- ModuleMapping moduleMap = model.getModuleMapping(aProject);
- if (moduleMap != null) {
- Module aModule = moduleMap.getModule();
- return aModule == null ? EARCreationResourceHandler.getString("UNKNOWN_UI_") : aModule.getUri(); //$NON-NLS-1$
- }
- UtilityJARMapping jarMap = model.getUtilityJARMapping(aProject);
- if (jarMap != null)
- return jarMap.getUri();
- return null;
- }
-
- /**
- * Return all the projects which represent the modules in this ear; Note that it is possible by
- * hand editing or otherwise for a module to be declared for which there is no such project. In
- * this case the value in the map for the uri will be null, so clients should check the values
- * for null.
- *
- * @return java.util.Map where the keys are the uris of all the modules (String), and the values
- * are the natures (J2EENature) of the projects represented by the uris.
- */
- public java.util.Map getModuleProjects() {
- Application dd = getApplication();
- if (dd == null)
- return EMPTY_MAP;
- //Open an edit model here so we don't keep loading resources for each nested
- // call to getModuleProject()
-
- List modules = getApplication().getModules();
- Map result = new HashMap();
- for (int i = 0; i < modules.size(); i++) {
- Module m = (Module) modules.get(i);
- J2EENature nature = getModuleProject(m);
- result.put(m.getUri(), nature);
- }
- return result;
-
- }
-
- /**
- * Return all the projects which represent the modules and project utility JARs in this ear;
- *
- * @return java.util.Map where the keys are the uris of all the modules and JARs (String), and
- * the values are the projects represented by the uris.
- * @deprecated -
- * Use
- * <p>
- * WorkbenchComponent.getReferencedComponents()
- * </p>
- */
- public Map getAllMappedProjects() {
- EAREditModel model = (EAREditModel) getCacheEditModel();
- return model.getModuleMappedProjectsAsMap();
-
- }
-
- public IContainer getEMFRoot() {
- return getProject();
- }
-
- /**
- * Return the nature's ID.
- * @deprecated
- * Use
- * <p>
- * ModuleCoreNature.getNatureID()
- * </p>
- */
- public java.lang.String getNatureID() {
- return IEARNatureConstants.NATURE_ID;
- }
-
- /**
- * Return the ID of the plugin that this nature is contained within.
- * @deprecated
- * Use
- * <p>
- * ModuleCoreNature.getPluginID()
- * </p>
- */
- protected java.lang.String getPluginID() {
- return J2EEPlugin.PLUGIN_ID;
- }
-
- /**
- * @deprecated Referenced projects are no longer used to track modules in the ear; if you need
- * the referenced projects, obtain them from the project itself
- */
- public IProject[] getReferencedProjects() {
-
- try {
- return getProject().getReferencedProjects();
- } catch (CoreException ex) {
- return new IProject[]{};
- }
-
- }
-
- /**
- * Get a WebNatureRuntime that corresponds to the supplied project.
- *
- * @return com.ibm.itp.wt.IWebNature
- * @param project
- * com.ibm.itp.core.api.resources.IProject
- * @deprecated
- * Use
- * <p>
- * EARArtifactEdit.getEARArtifactEditForRead(WorkbenchComponent)
- * </p>
- */
- public static EARNatureRuntime getRuntime(IProject project) {
- return (EARNatureRuntime) getRuntime(project, IEARNatureConstants.NATURE_IDS);
- }
-
- /**
- * Return the key for the sourcePath.
- */
- public java.lang.String getSourcePathKey() {
- return null;
- }
-
- /**
- * Return whether or not the project has a runtime created on it.
- *
- * @return boolean
- * @param project
- * com.ibm.itp.core.api.resources.IProject
- * @deprecated
- * Use
- * <p>
- *
- * </p>
- */
- public static boolean hasRuntime(IProject project) {
- return hasRuntime(project, IEARNatureConstants.NATURE_IDS);
- }
-
- /**
- * Update the receiver from the supplied info and then configure it.
- *
- * @param info
- * EARProjctInfo - the info this was created from
- * @exception CoreExeption -
- * thrown if the project cannot be updated
- */
- // public void initializeFromInfo(EARProjectInfo info) throws CoreException {
- // createFolders();
- // J2EESettings j2eeSettings = getJ2EESettings();
- // j2eeSettings.setModuleVersion(info.getModuleVersion());
- // j2eeSettings.write();
- // }
-
- /**
- * @deprecated
- * Use
- * <p>
- * EARArtifactEdit.createModuleRoot
- * </p>
- */
- public Resource makeApplicationXmiResource() {
- return createResource(URI.createURI(ArchiveConstants.APPLICATION_DD_URI));
- }
-
- /**
- * This returns the project, whether it is open or closed, whereas
- * {@link #getModuleProject() returns the nature, which is only validif the project is open.
- *
- * @return IProject - the project that represents
- * @aModule in the ear; null if no such project exists
- */
- public IProject primGetModuleProject(Module aModule) {
-
- try {
- if (aModule == null)
- return null;
- EAREditModel model = (EAREditModel) getCacheEditModel();
-
- ModuleMapping map = model.getModuleMapping(aModule);
- if (map != null && map.getProjectName() != null && map.getProjectName().length() > 0) {
- return J2EEPlugin.getWorkspace().getRoot().getProject(map.getProjectName());
- }
-
- return null;
- } catch (java.lang.IllegalArgumentException ie) {
- return null;
- }
- }
-
- /**
- * Because of team support or moving the workspace, the absolute paths of the module extensions
- * may be out of sync with the actual locations of the files; moreover, modules might contain no
- * mapping or absolute path, or might be mapped to a non-existent project. If there are unsaved
- * changes to the application, then a warning is returned and no other validation is executed.
- *
- * @return IStatus - code WARNING if there are unsaved changes or if a module project is closed,
- * ERROR if there is a problem with one of the modules, OK otherwise
- */
- public IStatus validateModuleProjects() {
- //We're not going to write anything, but by using a write model, we can determine
- // if there are pending changes; also, we'll keep it open for the execution of this method
- // to ensure resources remain cached and reduce the performance hit
- EAREditModel model = getEarEditModelForWrite(this);
- try {
- if (model.isShared() && model.isDirty()) {
- String msg = EARCreationResourceHandler.getString("UNSAVED_CHANGES_WARN_", new Object[]{getProject().getName()}); //$NON-NLS-1$
- return J2EEPlugin.newStatus(IStatus.WARNING, 0, msg, (Throwable) null);
- }
- String message = EARCreationResourceHandler.getString("PROJECT_MAP_PROBLEMS_ERROR_", new Object[]{getProject().getName()}); //$NON-NLS-1$
- Application dd = model.getApplication();
- List modules = dd.getModules();
- boolean closedProject = false;
- for (int i = 0; i < modules.size(); i++) {
- Module m = (Module) modules.get(i);
- IProject p = primGetModuleProject(m);
- if (p == null)
- return new Status(IStatus.ERROR, J2EEPlugin.PLUGIN_ID, IResourceStatus.OPERATION_FAILED, message, (Throwable) null);
- if (!p.isOpen())
- closedProject = true;
- }
- if (closedProject) {
- String msg = EARCreationResourceHandler.getString("MODULE_PROJECTS_CLOSED_WARN_", new Object[]{getProject().getName()}); //$NON-NLS-1$
- return J2EEPlugin.newStatus(IStatus.WARNING, 0, msg, (Throwable) null);
- }
- return J2EEPlugin.newStatus(IStatus.OK, 0, "", (Throwable) null); //$NON-NLS-1$
- } finally {
- model.releaseAccess(this);
- }
- }
-
- public String getOverlayIconName() {
- switch (getJ2EEVersion()) {
- case J2EEVersionConstants.J2EE_1_2_ID :
- return EAR_PROJECT_12_OVERLAY;
- case J2EEVersionConstants.J2EE_1_3_ID :
- return EAR_PROJECT_13_OVERLAY;
- case J2EEVersionConstants.J2EE_1_4_ID :
- default :
- return EAR_PROJECT_14_OVERLAY;
- }
- }
-
- /**
- * @deprecated
- * Use
- * <p>
- * EARArtifactEdit.getDeploymentDescriptorResource()
- * </p>
- */
-
- public int getDeploymentDescriptorType() {
- return XMLResource.APPLICATION_TYPE;
- }
-
- /**
- * @see org.eclipse.jem.internal.java.plugin.AbstractJavaMOFNatureRuntime#addJavaReflectionAdapterFactories(ResourceSet)
- */
- protected void addJavaReflectionAdapterFactories(ResourceSet aContext) {
- //do nothing since this is not a Java project
- }
-
- /**
- * (non-Javadoc)
- *
- * @see org.eclipse.jst.j2ee.internal.internal.j2eeproject.J2EENature#getDeploymentDescriptorRoot()
- * @deprecated
- * Use
- * <a>
- * EARArtifactEdit.getDeploymentDescriptorResource()
- * </a>
- */
- public EObject getDeploymentDescriptorRoot() {
- return getApplication();
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.jst.j2ee.internal.internal.j2eeproject.J2EENature#getVersionFromModuleFile()
- */
- protected int getVersionFromModuleFile() {
- Application ddRoot = getApplication();
- if (ddRoot != null) {
- return ddRoot.getVersionID();
- }
- return J2EEVersionConstants.J2EE_1_4_ID;
- }
-
- /**
- * (non-Javadoc)
- * @see org.eclipse.jst.j2ee.internal.internal.j2eeproject.J2EENature#getJ2EEEditModelForRead(java.lang.Object)
- * @deprecated
- * Use
- * <p>
- * EARArtifactEdit.getEARArtifactEditForRead(WorkbenchComponent)
- * </p>
- */
- public J2EEEditModel getJ2EEEditModelForRead(Object accessorKey) {
- return getEarEditModelForRead(accessorKey);
- }
-
- /**
- * (non-Javadoc)
- * @see org.eclipse.jst.j2ee.internal.internal.j2eeproject.J2EENature#getJ2EEEditModelForWrite(java.lang.Object)
- * @deprecated
- * Use
- * <p>
- * EARArtifactEdit.getEARArtifactEditForWrite(WorkbenchComponent)
- * </p>
- */
- public J2EEEditModel getJ2EEEditModelForWrite(Object accessorKey) {
- return getEarEditModelForWrite(accessorKey);
- }
-
-
-
-} \ No newline at end of file
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 ac334dd4e..000000000
--- a/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/internal/earcreation/EarComponentCreationDataModelProvider.java
+++ /dev/null
@@ -1,208 +0,0 @@
-package org.eclipse.jst.j2ee.internal.earcreation;
-
-import java.util.Collections;
-import java.util.Iterator;
-import java.util.List;
-
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.emf.ecore.EClass;
-import org.eclipse.jem.util.emf.workbench.ProjectUtilities;
-import org.eclipse.jst.j2ee.application.internal.operations.EARComponentCreationOperation;
-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.wst.common.componentcore.ComponentCore;
-import org.eclipse.wst.common.componentcore.internal.util.IModuleConstants;
-import org.eclipse.wst.common.componentcore.resources.ComponentHandle;
-import org.eclipse.wst.common.componentcore.resources.IVirtualComponent;
-import org.eclipse.wst.common.frameworks.datamodel.DataModelPropertyDescriptor;
-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;
-
-public class EarComponentCreationDataModelProvider extends J2EEComponentCreationDataModelProvider implements IEarComponentCreationDataModelProperties {
-
- public IDataModelOperation getDefaultOperation() {
- return new EARComponentCreationOperation(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 String[] getPropertyNames() {
- String[] props = new String[] { J2EE_COMPONENT_LIST, JAVA_PROJECT_LIST };
- return combineProperties(super.getPropertyNames(), props);
- }
-
- public Object getDefaultProperty(String propertyName) {
- if (propertyName.equals(DD_FOLDER)) {
- if(isProjMultiComponents)
- return IPath.SEPARATOR + this.getModuleName() + IPath.SEPARATOR + "META_INF"; //$NON-NLS-1$
- else
- return IPath.SEPARATOR + "META_INF"; //$NON-NLS-1$
- } else if (propertyName.equals(UI_SHOW_EAR_SECTION)) {
- return Boolean.FALSE;
- } else if (propertyName.equals(J2EE_COMPONENT_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.WEB_2_2_ID:
- description = J2EEVersionConstants.VERSION_2_2_TEXT;
- break;
- case J2EEVersionConstants.WEB_2_3_ID:
- description = J2EEVersionConstants.VERSION_2_3_TEXT;
- break;
- case J2EEVersionConstants.WEB_2_4_ID:
- default:
- description = J2EEVersionConstants.VERSION_2_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.getString(EARCreationResourceHandler.SERVER_TARGET_NOT_SUPPORT_EAR);
- return WTPCommonPlugin.createErrorStatus(msg);
- }
- }
- }
- }
- }
- }else if(propertyName.equals(J2EE_COMPONENT_LIST)){
- return validateTargetComponentVersion((List)model.getProperty(J2EE_COMPONENT_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();) {
- ComponentHandle handle = (ComponentHandle)iter.next();
- //IVirtualComponent comp = (IVirtualComponent) iter.next();
- IVirtualComponent comp = ComponentCore.createComponent(handle.getProject(), handle.getName());
- 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;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.jst.j2ee.application.operations.FlexibleJ2EECreationDataModel#getModuleID()
- */
- protected String getComponentID() {
- return IModuleConstants.JST_EAR_MODULE;
- }
-
- public DataModelPropertyDescriptor[] getValidPropertyDescriptors(String propertyName){
- return super.getValidPropertyDescriptors(propertyName);
- }
-
-}
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 57d499166..000000000
--- a/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/internal/earcreation/IDefaultJ2EEComponentCreationDataModelProperties.java
+++ /dev/null
@@ -1,73 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 2004, 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$
-
-}
diff --git a/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/internal/earcreation/IEARNatureConstants.java b/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/internal/earcreation/IEARNatureConstants.java
deleted file mode 100644
index 2705fd9a0..000000000
--- a/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/internal/earcreation/IEARNatureConstants.java
+++ /dev/null
@@ -1,30 +0,0 @@
-/***************************************************************************************************
- * Copyright (c) 2003, 2004 IBM Corporation and others. All rights reserved. This program and the
- * accompanying materials are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors: IBM Corporation - initial API and implementation
- **************************************************************************************************/
-package org.eclipse.jst.j2ee.internal.earcreation;
-
-/**
- * @deprecated
- * Use
- * <p>
-* All nature constants interfaces are also deprecated along with nature runtime classes
-* IModuleConstants need to be used.
-* </p>
-*/
-
-public interface IEARNatureConstants {
-
- String PLUG_IN_ID = "org.eclipse.jst.j2ee"; //$NON-NLS-1$
- String NATURE_ID = PLUG_IN_ID + ".EARNature"; //$NON-NLS-1$
- String NO_NATURE_MESSAGE = EARCreationResourceHandler.getString("Not_an_ear_project_UI_"); //$NON-NLS-1$
- String NOT_OPEN_MESSAGE = EARCreationResourceHandler.getString("EAR_PROJECT_MUST_BE_OPEN_UI_"); //$NON-NLS-1$
-
- String DEFAULT_META_PATH = "META-INF"; //$NON-NLS-1$
- String[] NATURE_IDS = {NATURE_ID};
- String EDIT_MODEL_ID = "org.eclipse.jst.j2ee.application.editModel"; //$NON-NLS-1$
-} \ No newline at end of file
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 c0f3acfa5..000000000
--- a/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/internal/earcreation/ILooseConfigConstants.java
+++ /dev/null
@@ -1,27 +0,0 @@
-/***************************************************************************************************
- * Copyright (c) 2003, 2004 IBM Corporation and others. All rights reserved. This program and the
- * accompanying materials are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors: IBM Corporation - initial API and implementation
- **************************************************************************************************/
-package org.eclipse.jst.j2ee.internal.earcreation;
-
-
-import org.eclipse.jst.j2ee.commonarchivecore.internal.looseconfig.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;
-
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/internal/earcreation/LooseConfigUpdateOperation.java b/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/internal/earcreation/LooseConfigUpdateOperation.java
deleted file mode 100644
index 29f5a5c39..000000000
--- a/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/internal/earcreation/LooseConfigUpdateOperation.java
+++ /dev/null
@@ -1,211 +0,0 @@
-/***************************************************************************************************
- * Copyright (c) 2003, 2004 IBM Corporation and others. All rights reserved. This program and the
- * accompanying materials are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors: IBM Corporation - initial API and implementation
- **************************************************************************************************/
-package org.eclipse.jst.j2ee.internal.earcreation;
-
-
-import java.io.OutputStream;
-import java.lang.reflect.InvocationTargetException;
-import java.util.Collections;
-import java.util.List;
-
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.emf.common.util.URI;
-import org.eclipse.emf.ecore.EPackage;
-import org.eclipse.emf.ecore.resource.Resource;
-import org.eclipse.emf.ecore.resource.ResourceSet;
-import org.eclipse.jdt.core.IJavaModel;
-import org.eclipse.jdt.core.IJavaProject;
-import org.eclipse.jem.workbench.utility.JemProjectUtilities;
-import org.eclipse.jst.j2ee.commonarchivecore.internal.looseconfig.LooseApplication;
-import org.eclipse.jst.j2ee.commonarchivecore.internal.looseconfig.LooseArchive;
-import org.eclipse.jst.j2ee.commonarchivecore.internal.looseconfig.LooseConfiguration;
-import org.eclipse.jst.j2ee.commonarchivecore.internal.looseconfig.LooseLibrary;
-import org.eclipse.jst.j2ee.commonarchivecore.internal.looseconfig.LooseModule;
-import org.eclipse.jst.j2ee.commonarchivecore.internal.looseconfig.LooseconfigFactory;
-import org.eclipse.jst.j2ee.commonarchivecore.internal.looseconfig.LooseconfigPackage;
-import org.eclipse.jst.j2ee.internal.earcreation.modulemap.ModuleMapping;
-import org.eclipse.jst.j2ee.internal.earcreation.modulemap.UtilityJARMapping;
-import org.eclipse.jst.j2ee.internal.project.J2EEModuleNature;
-import org.eclipse.jst.j2ee.internal.project.J2EENature;
-import org.eclipse.wst.common.frameworks.internal.enablement.nonui.WFTWrappedException;
-import org.eclipse.wst.common.frameworks.internal.operations.WTPOperation;
-
-public class LooseConfigUpdateOperation extends WTPOperation implements ILooseConfigConstants {
-
- protected Resource resource;
- protected IProgressMonitor monitor;
- protected LooseConfiguration looseConfig;
- protected String uri;
- protected EAREditModel currentEditModel;
-
- protected static final String UPDATING_MESSAGE = EARCreationResourceHandler.getString("Updating_absolute_paths_UI_"); //$NON-NLS-1$
-
- public LooseConfigUpdateOperation() {
- }
-
- protected LooseconfigFactory looseConfigFactory() {
- return ((LooseconfigPackage) EPackage.Registry.INSTANCE.getEPackage(LooseconfigPackage.eNS_URI)).getLooseconfigFactory();
- }
-
- /*
- * @see HeadlessJ2EEOperation#execute(IProgressMonitor)
- */
- protected void execute(IProgressMonitor progressMonitor) throws CoreException, InvocationTargetException, InterruptedException {
- monitor = progressMonitor;
- monitor.beginTask(UPDATING_MESSAGE, IProgressMonitor.UNKNOWN);
- initialize();
- addLooseApplications();
- save();
- }
-
- protected void initialize() {
- resource = Resource.Factory.Registry.INSTANCE.getFactory(URI.createURI(CONFIG_PATH)).createResource(URI.createURI(CONFIG_PATH));
- resource.getContents().add(createLooseConfig());
- }
-
- protected LooseConfiguration createLooseConfig() {
- looseConfig = looseConfigFactory().createLooseConfiguration();
- return looseConfig;
- }
-
- protected void addLooseApplications() throws CoreException {
- List earProjects = EARNatureRuntime.getAllEARProjectsInWorkbench();
- for (int i = 0; i < earProjects.size(); i++) {
- IProject p = (IProject) earProjects.get(i);
- EARNatureRuntime runtime = EARNatureRuntime.getRuntime(p);
- addLooseApplication(runtime);
- }
- }
-
- protected void addLooseApplication(EARNatureRuntime runtime) throws CoreException {
- monitor.subTask(runtime.getProject().getName());
- currentEditModel = runtime.getEarEditModelForRead(this);
- try {
- LooseApplication looseApp = createLooseApplication(runtime);
- addLooseApplication(looseApp);
- } finally {
- currentEditModel.releaseAccess(this);
- currentEditModel = null;
- }
- }
-
- protected void addLooseApplication(LooseApplication looseApp) throws CoreException {
- addLooseModules(looseApp, currentEditModel.getModuleMappings());
- addLooseUtilityJARs(looseApp, currentEditModel.getUtilityJARMappings());
- looseConfig.getApplications().add(looseApp);
- }
-
- protected LooseApplication createLooseApplication(EARNatureRuntime runtime) {
- LooseApplication looseApp = looseConfigFactory().createLooseApplication();
- String absPath = getAbsolutePath(runtime);
- looseApp.setUri(absPath);
- setPaths(looseApp, absPath);
- return looseApp;
- }
-
- protected void addLooseModules(LooseApplication looseApp, List moduleMaps) {
- List looseModules = looseApp.getLooseArchives();
- for (int i = 0; i < moduleMaps.size(); i++) {
- ModuleMapping map = (ModuleMapping) moduleMaps.get(i);
- LooseModule module = createLooseModule(map);
- looseModules.add(module);
- }
- }
-
- protected LooseModule createLooseModule(ModuleMapping map) {
- LooseModule loose = looseConfigFactory().createLooseModule();
- loose.setUri(map.getModule().getUri());
- setPaths(loose, getAbsolutePath(map));
- return loose;
- }
-
- protected void setPaths(LooseArchive archive, String absPath) {
- if (absPath == null)
- return;
-
- archive.setBinariesPath(absPath);
- archive.setResourcesPath(absPath);
- }
-
- protected void save() throws InvocationTargetException {
- try {
- ResourceSet set = resource.getResourceSet();
- if (set != null) {
- OutputStream out = set.getURIConverter().createOutputStream(resource.getURI());
- resource.save(out, Collections.EMPTY_MAP);
- }
- } catch (Exception ex) {
- throw new WFTWrappedException(ex);
- }
- }
-
- protected String getAbsolutePath(ModuleMapping map) {
- if (map.getProjectName() == null)
- return null;
- IProject p = getProject(map.getProjectName());
- J2EEModuleNature nature = (J2EEModuleNature) J2EENature.getRegisteredRuntime(p);
-
- return getAbsolutePath(nature);
- }
-
- protected String getAbsolutePath(UtilityJARMapping map) throws CoreException {
- if (map.getProjectName() == null)
- return null;
- IProject p = getProject(map.getProjectName());
- //JavaProject javaProj = JavaCore.get
-
- return getAbsolutePath(getJavaProject(p));
- }
-
- protected String getAbsolutePath(IJavaProject javaProj) throws CoreException {
- IPath loc = javaProj.getOutputLocation();
- if (loc == null)
- return null;
-
- return javaProj.getProject().getFile(loc).getLocation().toOSString();
- }
-
- protected IProject getProject(String projectName) {
- return getWorkspace().getRoot().getProject(projectName);
- }
-
- protected IJavaModel getJavaModel() {
- return JemProjectUtilities.getJavaModel();
- }
-
- protected IJavaProject getJavaProject(IProject p) {
- return getJavaModel().getJavaProject(p.getName());
- }
-
- protected String getAbsolutePath(J2EENature nature) {
- if (nature == null)
- return null;
- return nature.getModuleServerRoot().getLocation().toOSString();
- }
-
- protected void addLooseUtilityJARs(LooseApplication looseApp, List utilMaps) throws CoreException {
- List looseArchives = looseApp.getLooseArchives();
- for (int i = 0; i < utilMaps.size(); i++) {
- UtilityJARMapping map = (UtilityJARMapping) utilMaps.get(i);
- LooseLibrary lib = createLooseLibrary(map);
- looseArchives.add(lib);
- }
- }
-
- protected LooseLibrary createLooseLibrary(UtilityJARMapping map) throws CoreException {
- LooseLibrary loose = looseConfigFactory().createLooseLibrary();
- loose.setUri(map.getUri());
- setPaths(loose, getAbsolutePath(map));
- return loose;
- }
-
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/internal/earcreation/ModuleInEARProjectCommand.java b/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/internal/earcreation/ModuleInEARProjectCommand.java
deleted file mode 100644
index 01db0a5db..000000000
--- a/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/internal/earcreation/ModuleInEARProjectCommand.java
+++ /dev/null
@@ -1,311 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jst.j2ee.internal.earcreation;
-
-
-import org.eclipse.core.commands.Command;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.emf.common.command.AbstractCommand;
-import org.eclipse.jst.j2ee.application.Application;
-import org.eclipse.jst.j2ee.application.Module;
-import org.eclipse.jst.j2ee.componentcore.util.EARArtifactEdit;
-
-
-/**
- * Insert the type's description here. Creation date: (03/29/01 4:48:46 PM)
- *
- * @author: Administrator
- */
-public abstract class ModuleInEARProjectCommand extends AbstractCommand {
- protected EARArtifactEdit earArtifactEdit;
- protected IProject earProject;
- protected IProject nestedJ2EEProject;
- protected String moduleUri;
- protected String moduleAltDD;
- protected String moduleContextRoot;
- protected boolean moduleSuccessful;
- protected boolean mapSuccessful;
- protected Module module;
-
- /**
- * AddModuleToEARProjectCommand constructor comment.
- */
- protected ModuleInEARProjectCommand() {
- super();
- }
-
- /**
- * AddModuleToEARProjectCommand constructor comment.
- */
- protected ModuleInEARProjectCommand(EARArtifactEdit earArtifactEdit) {
- super();
- this.earArtifactEdit = earArtifactEdit;
- }
-
- /**
- * AddModuleToEARProjectCommand constructor comment.
- *
- * @param label
- * java.lang.String
- */
- protected ModuleInEARProjectCommand(String label) {
- super(label);
- }
-
- /**
- * AddModuleToEARProjectCommand constructor comment.
- *
- * @param label
- * java.lang.String
- * @param description
- * java.lang.String
- */
- protected ModuleInEARProjectCommand(String label, String description) {
- super(label, description);
- }
-
- public ModuleInEARProjectCommand(IProject aNestedJ2EEProject, IProject anEarProject, String uri, String contextRoot, String altDD) {
- super();
- setNestedJ2EEProject(aNestedJ2EEProject);
- setEarProject(anEarProject);
- setModuleUri(uri);
- setModuleContextRoot(contextRoot);
- setModuleAltDD(altDD);
- }
-
- protected void addModule() {
- Application dd = getApplication();
- if (dd == null) {
- return;
- }
- Module m = dd.getFirstModule(moduleUri);
-// if (m == null) {
-// J2EEModuleNature j2eeNature = (J2EEModuleNature) J2EENature.getRegisteredRuntime(getNestedJ2EEProject());
-// m = j2eeNature.createNewModule();
-//
-// if (m == null)
-// return;
-// m.setUri(moduleUri);
-// m.setAltDD(moduleAltDD);
-// if (m instanceof WebModule) {
-// ((WebModule) m).setContextRoot(moduleContextRoot);
-// }
-// dd.getModules().add(m);
-// }
- setModule(m);
- }
-
- protected void addModuleMapping() {
-// if (module != null) {
-// ModuleMapping map = editModel.addModuleMapping(module, getNestedJ2EEProject());
-// mapSuccessful = (map != null);
-// }
- }
-
- public void dispose() {
- setNestedJ2EEProject(null);
- setEarProject(null);
- }
-
- /**
- * @see Command
- */
- public void execute() {
-// try {
-// setupEditModel();
-// if (editModel != null) {
- primExecute();
-// editModel.saveIfNecessary(this);
-// } else
-// moduleSuccessful = false;
-// } finally {
-// releaseEditModel();
-// }
- }
-
- protected Application getApplication() {
- return earArtifactEdit.getApplication();
- }
-
- /**
- * Insert the method's description here. Creation date: (03/29/01 5:34:26 PM)
- *
- * @return org.eclipse.core.resources.IProject
- */
- public org.eclipse.core.resources.IProject getEarProject() {
- return earProject;
- }
-
- /**
- * Insert the method's description here. Creation date: (3/29/2001 11:44:01 PM)
- *
- * @return org.eclipse.jst.j2ee.internal.internal.application.Module
- */
- public Module getModule() {
- return module;
- }
-
- /**
- * Insert the method's description here. Creation date: (03/29/01 5:34:26 PM)
- *
- * @return java.lang.String
- */
- public java.lang.String getModuleAltDD() {
- return moduleAltDD;
- }
-
- /**
- * Insert the method's description here. Creation date: (03/29/01 5:34:26 PM)
- *
- * @return java.lang.String
- */
- public java.lang.String getModuleContextRoot() {
- return moduleContextRoot;
- }
-
- /**
- * Insert the method's description here. Creation date: (03/29/01 5:34:26 PM)
- *
- * @return java.lang.String
- */
- public java.lang.String getModuleUri() {
- return moduleUri;
- }
-
- protected EARNatureRuntime getNature() {
- return EARNatureRuntime.getRuntime(getEarProject());
- }
-
- /**
- * Insert the method's description here. Creation date: (03/29/01 5:34:26 PM)
- *
- * @return org.eclipse.core.resources.IProject
- */
- public org.eclipse.core.resources.IProject getNestedJ2EEProject() {
- return nestedJ2EEProject;
- }
-
- public boolean isExecuteSuccess() {
- return moduleSuccessful && mapSuccessful;
- }
-
- protected boolean prepare() {
- return true;
- }
-
- protected abstract void primExecute();
-
- protected abstract void primUndo();
-
- /**
- * @see Command
- */
- public void redo() {
- execute();
- }
-
-// protected void releaseEditModel() {
-// if (editModel != null) {
-// editModel.releaseAccess(this);
-// editModel = null;
-// }
-// }
-
- protected void removeModule() {
- getApplication().getModules().remove(getModule());
- }
-
- protected void removeModuleMapping() {
-//
-// org.eclipse.jst.j2ee.internal.earcreation.modulemap.ModuleMapping map = editModel.getModuleMapping(module);
-// if (map != null)
-// editModel.getModuleMappings().remove(map);
-//
- }
-
- /**
- * Insert the method's description here. Creation date: (03/29/01 5:34: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: (3/29/2001 11:44:01 PM)
- *
- * @param newAddedModule
- * org.eclipse.jst.j2ee.internal.internal.application.Module
- */
- public void setModule(Module module) {
- this.module = module;
- }
-
- /**
- * Insert the method's description here. Creation date: (03/29/01 5:34:26 PM)
- *
- * @param newModuleUri
- * java.lang.String
- */
- public void setModuleAltDD(java.lang.String newModuleAltDD) {
- moduleAltDD = newModuleAltDD;
- }
-
- /**
- * Insert the method's description here. Creation date: (03/29/01 5:34:26 PM)
- *
- * @param newModuleUri
- * java.lang.String
- */
- public void setModuleContextRoot(java.lang.String newModuleContextRoot) {
- moduleContextRoot = newModuleContextRoot;
- }
-
- /**
- * Insert the method's description here. Creation date: (03/29/01 5:34:26 PM)
- *
- * @param newModuleUri
- * java.lang.String
- */
- public void setModuleUri(java.lang.String newModuleUri) {
- moduleUri = newModuleUri;
- }
-
- /**
- * Insert the method's description here. Creation date: (03/29/01 5:34:26 PM)
- *
- * @param newNestedJ2EEProject
- * org.eclipse.core.resources.IProject
- */
- public void setNestedJ2EEProject(org.eclipse.core.resources.IProject newNestedJ2EEProject) {
- nestedJ2EEProject = newNestedJ2EEProject;
- }
-
-// protected void setupEditModel() {
-// EARNatureRuntime nature = getNature();
-// if (nature != null)
-// editModel = nature.getEarEditModelForWrite(this);
-// else
-// editModel = null; // arived here with a valid project, but not an EAR nature.
-// }
-
- public void undo() {
-// try {
-// setupEditModel();
- primUndo();
-// editModel.saveIfNecessary(this);
-// } finally {
-// releaseEditModel();
-// }
- }
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/internal/earcreation/ModuleMapHelper.java b/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/internal/earcreation/ModuleMapHelper.java
deleted file mode 100644
index 7af3bbfc8..000000000
--- a/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/internal/earcreation/ModuleMapHelper.java
+++ /dev/null
@@ -1,170 +0,0 @@
-/***************************************************************************************************
- * Copyright (c) 2003, 2004 IBM Corporation and others. All rights reserved. This program and the
- * accompanying materials are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors: IBM Corporation - initial API and implementation
- **************************************************************************************************/
-package org.eclipse.jst.j2ee.internal.earcreation;
-
-
-import java.io.FileNotFoundException;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.emf.ecore.resource.Resource;
-import org.eclipse.jem.util.logger.proxy.Logger;
-import org.eclipse.jst.j2ee.application.Module;
-import org.eclipse.jst.j2ee.commonarchivecore.internal.Archive;
-import org.eclipse.jst.j2ee.commonarchivecore.internal.EARFile;
-import org.eclipse.jst.j2ee.internal.earcreation.modulemap.EARProjectMap;
-import org.eclipse.jst.j2ee.internal.earcreation.modulemap.ModuleMapping;
-import org.eclipse.jst.j2ee.internal.earcreation.modulemap.UtilityJARMapping;
-
-/**
-* @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 .wtpmodules file
-*/
-
-public class ModuleMapHelper {
-
- /**
- * Constructor for ModuleMapHelper.
- */
- protected ModuleMapHelper() {
- super();
- }
-
- public static ModuleMapping getModuleMapping(Module module, EARProjectMap projectMap) {
- if (module == null)
- return null;
- List maps = getModuleMappings(projectMap);
- for (int i = 0; i < maps.size(); i++) {
- ModuleMapping map = (ModuleMapping) maps.get(i);
- if (module.equals(map.getModule()))
- return map;
- }
- return null;
- }
-
- public static List getModuleMappings(EARProjectMap map) {
- if (map == null)
- return java.util.Collections.EMPTY_LIST;
- return map.getMappings();
- }
-
- public static UtilityJARMapping getUtilityJARMapping(String uri, EARProjectMap projectMap) {
- if (uri == null || projectMap == null)
- return null;
- List maps = getUtilityJARMappings(projectMap);
- for (int i = 0; i < maps.size(); i++) {
- UtilityJARMapping map = (UtilityJARMapping) maps.get(i);
- if (uri.equals(map.getUri()))
- return map;
- }
- return null;
- }
-
- public static List getUtilityJARMappings(EARProjectMap map) {
- if (map == null)
- return java.util.Collections.EMPTY_LIST;
- return map.getUtilityJARMappings();
- }
-
- public static EARProjectMap getEARProjectMap(Resource res) {
- if (res == null || res.getContents().isEmpty())
- return null;
- return (EARProjectMap) res.getContents().get(0);
- }
-
- public static List getAllMappedJARs(EARFile ear) {
- if (ear == null)
- return Collections.EMPTY_LIST;
- Resource res = null;
- try {
- res = ear.getMofResource(EAREditModel.MODULE_MAP_URI);
- } catch (Exception ex) {
- Logger.getLogger().logError(ex);
- return Collections.EMPTY_LIST;
- }
- EARProjectMap map = getEARProjectMap(res);
- if (map == null)
- return Collections.EMPTY_LIST;
-
- List result = new ArrayList();
- List moduleMaps = getModuleMappings(map);
- for (int i = 0; i < moduleMaps.size(); i++) {
- ModuleMapping mMap = (ModuleMapping) moduleMaps.get(i);
- Module m = mMap.getModule();
- if (m == null)
- continue;
- addArchiveIfNotNull(result, m.getUri(), ear);
- }
- List utilMaps = getUtilityJARMappings(map);
- for (int i = 0; i < utilMaps.size(); i++) {
- UtilityJARMapping uMap = (UtilityJARMapping) utilMaps.get(i);
- addArchiveIfNotNull(result, uMap.getUri(), ear);
- }
- return result;
- }
-
- protected static void addArchiveIfNotNull(List result, String uri, EARFile ear) {
- Archive anArchive = getArchive(uri, ear);
- if (anArchive != null)
- result.add(anArchive);
- }
-
- protected static Archive getArchive(String uri, EARFile ear) {
- if (uri == null || uri.trim().length() == 0)
- return null;
- try {
- return (Archive) ear.getFile(uri);
- } catch (FileNotFoundException ex) {
- Logger.getLogger().logError(ex);
- } catch (ClassCastException ex2) {
- Logger.getLogger().logError(ex2);
- }
- return null;
- }
-
- public static IProject getProject(String uri, EARFile ear) {
- if (uri == null || uri.length() == 0 || ear == null)
- return null;
- Resource res = null;
- try {
- res = ear.getMofResource(EAREditModel.MODULE_MAP_URI);
- } catch (Exception ex) {
- return null;
- }
- EARProjectMap map = getEARProjectMap(res);
- if (map == null)
- return null;
-
- String projectName = null;
- UtilityJARMapping uMap = getUtilityJARMapping(uri, map);
- if (uMap != null)
- projectName = uMap.getProjectName();
- else {
- Module m = ear.getDeploymentDescriptor().getFirstModule(uri);
- if (m != null) {
- ModuleMapping mMap = getModuleMapping(m, map);
- if (mMap != null)
- projectName = mMap.getProjectName();
- }
- }
- if (projectName != null && projectName.trim().length() > 0)
- return ResourcesPlugin.getWorkspace().getRoot().getProject(projectName.trim());
- return null;
- }
-
-
-
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/internal/earcreation/RemoveModuleFromEARProjectCommand.java b/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/internal/earcreation/RemoveModuleFromEARProjectCommand.java
deleted file mode 100644
index b141501b0..000000000
--- a/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/internal/earcreation/RemoveModuleFromEARProjectCommand.java
+++ /dev/null
@@ -1,100 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jst.j2ee.internal.earcreation;
-
-
-
-import org.eclipse.core.resources.IProject;
-import org.eclipse.emf.ecore.util.EcoreUtil;
-import org.eclipse.jst.j2ee.application.Module;
-import org.eclipse.jst.j2ee.componentcore.util.EARArtifactEdit;
-
-
-/**
- * Insert the type's description here. Creation date: (03/29/01 4:48:46 PM)
- *
- * @author: Administrator
- */
-public class RemoveModuleFromEARProjectCommand extends ModuleInEARProjectCommand {
- public RemoveModuleFromEARProjectCommand(Module module, IProject anEarProject) {
- super();
- setEarProject(anEarProject);
- setModuleUri(module.getUri());
- setModuleAltDD(module.getAltDD());
- setModule(module);
- }
- public RemoveModuleFromEARProjectCommand(EARArtifactEdit earArtifactEdit,
- Module module, IProject anEarProject) {
- super(earArtifactEdit);
- setEarProject(anEarProject);
- setModuleUri(module.getUri());
- setModuleAltDD(module.getAltDD());
- setModule(module);
- }
-
- public boolean canExecute() {
- return super.canExecute();
- }
-
- protected void primExecute() {
- //Required for validate edit support
- refreshModule();
- // Set up nestedJ2EEProject before the map removed
- // It is needed for undo remove
-// if (editModel != null) {
-// ModuleMapping map = editModel.getModuleMapping(module);
-// if (map != null)
-// setNestedJ2EEProject(ResourcesPlugin.getWorkspace().getRoot().getProject(map.getProjectName()));
-// }
-// removeModuleMapping();
-// if (mapSuccessful)
- removeModule();
- }
-
- /*
- * If this was a deferred command, then the module object might be stale because a file was
- * checked out
- */
- protected void refreshModule() {
- if (module == null)
- return;
- Module m = (Module) EcoreUtil.resolve(module, getApplication());
- if (m != null)
- module = m;
- }
-
- protected void primUndo() {
- if (moduleSuccessful) {
- addModule();
- moduleSuccessful = false;
- }
-// if (mapSuccessful) {
-// addModuleMapping();
-// mapSuccessful = false;
-// }
- }
-
- protected void removeModule() {
-
- super.removeModule();
- moduleSuccessful = true;
- }
-
-// protected void removeModuleMapping() {
-// super.removeModuleMapping();
-// mapSuccessful = true;
-// }
-
- // override
- public String getLabel() {
- return label == null ? EARCreationResourceHandler.getString("Remove_Module_Command_Label_UI_") : label;//$NON-NLS-1$
- }
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/internal/earcreation/RemoveUtilityJARMapCommand.java b/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/internal/earcreation/RemoveUtilityJARMapCommand.java
deleted file mode 100644
index 6cf53bd0b..000000000
--- a/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/internal/earcreation/RemoveUtilityJARMapCommand.java
+++ /dev/null
@@ -1,59 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-/*
- * Created on Aug 14, 2003
- *
- */
-package org.eclipse.jst.j2ee.internal.earcreation;
-
-import org.eclipse.core.resources.IProject;
-import org.eclipse.jst.j2ee.internal.earcreation.modulemap.UtilityJARMapping;
-
-
-/**
- * @author schacher
- */
-public class RemoveUtilityJARMapCommand extends UtilityJARInEARProjectCommand {
-
- public static final String LABEL = EARCreationResourceHandler.getString("REM_UTIL_JAR_UI"); //$NON-NLS-1$
-
- public RemoveUtilityJARMapCommand(EAREditModel earEditModel, String aUri, IProject aProject) {
- super(earEditModel, aUri, aProject, LABEL);
- }
-
- public RemoveUtilityJARMapCommand(IProject anEarProject, String aUri, IProject aProject) {
- super(anEarProject, aUri, aProject, LABEL);
- }
-
- public RemoveUtilityJARMapCommand(IProject anEarProject, UtilityJARMapping jarMapping, IProject moduleProject) {
- super(anEarProject, null, moduleProject, LABEL);
- map = jarMapping;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.jst.j2ee.internal.internal.internal.earcreation.UtilityJARInEARProjectCommand#primUndo()
- */
- protected void primUndo() {
- addMapping();
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.jst.j2ee.internal.internal.internal.earcreation.UtilityJARInEARProjectCommand#primExecute()
- */
- protected void primExecute() {
- removeMapping();
- }
-
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/internal/earcreation/RollupRolesCommand.java b/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/internal/earcreation/RollupRolesCommand.java
deleted file mode 100644
index 72ecff9e4..000000000
--- a/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/internal/earcreation/RollupRolesCommand.java
+++ /dev/null
@@ -1,147 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jst.j2ee.internal.earcreation;
-
-
-import java.io.OutputStream;
-import java.util.HashMap;
-
-import org.eclipse.core.resources.IProject;
-import org.eclipse.emf.common.command.AbstractCommand;
-import org.eclipse.emf.ecore.resource.Resource;
-import org.eclipse.emf.ecore.resource.ResourceSet;
-import org.eclipse.jst.j2ee.application.Application;
-import org.eclipse.jst.j2ee.commonarchivecore.internal.EARFile;
-import org.eclipse.jst.j2ee.commonarchivecore.internal.exception.OpenFailureException;
-
-
-/**
- * Insert the type's description here. Creation date: (03/29/01 4:48:46 PM)
- *
- * @author: Administrator
- */
-public class RollupRolesCommand extends AbstractCommand {
- protected IProject earProject;
- protected boolean saveResources;
-
- /**
- * AddModuleToEARProjectCommand constructor comment.
- */
- protected RollupRolesCommand() {
- super();
- }
-
- /**
- * AddModuleToEARProjectCommand constructor comment.
- *
- * @param label
- * java.lang.String
- */
- protected RollupRolesCommand(String label) {
- super(label);
- }
-
- /**
- * AddModuleToEARProjectCommand constructor comment.
- *
- * @param label
- * java.lang.String
- * @param description
- * java.lang.String
- */
- protected RollupRolesCommand(String label, String description) {
- super(label, description);
- }
-
- public RollupRolesCommand(IProject earProject, boolean saveResources) {
- super();
- this.earProject = earProject;
- this.saveResources = saveResources;
- }
-
- public boolean canExecute() {
- return super.canExecute() && org.eclipse.jst.j2ee.internal.earcreation.EARNatureRuntime.getRuntime(getEarProject()) != null;
- }
-
- public void dispose() {
- // TODO Edit Model Rework This line does not make any sense.
- //EARNatureRuntime.getRuntime(getEarProject()).getEarEditModelForWrite().releaseAccess();
- // setEarProject(null);
- }
-
- /**
- * @see Command
- */
- public void execute() {
- try {
- EARFile earFile = (EARFile)EARNatureRuntime.getRuntime(getEarProject()).asArchive();
- earFile.rollUpRoles();
- } catch (OpenFailureException e) {
- org.eclipse.jem.util.logger.proxy.Logger.getLogger().logError(e);
- }
- }
-
- protected Application getApplication() {
-
- EAREditModel earEditModel = null;
- Application application = null;
- try {
- earEditModel = EARNatureRuntime.getRuntime(getEarProject()).getEarEditModelForWrite(this);
- application = earEditModel.getApplication();
- } finally {
- if (earEditModel != null)
- earEditModel.releaseAccess(this);
- }
- return application;
- }
-
- /**
- * Insert the method's description here. Creation date: (03/29/01 5:34:26 PM)
- *
- * @return org.eclipse.core.resources.IProject
- */
- public org.eclipse.core.resources.IProject getEarProject() {
- return earProject;
- }
-
- protected boolean prepare() {
- return true;
- }
-
- /**
- * @see Command
- */
- public void redo() {
- execute();
- }
-
- protected void saveResources() throws Exception {
- Resource resource = getApplication().eResource();
- ResourceSet set = resource.getResourceSet();
- if (set != null) {
- OutputStream out = set.getURIConverter().createOutputStream(resource.getURI());
- resource.save(out, new HashMap());
- }
- }
-
- /**
- * Insert the method's description here. Creation date: (03/29/01 5:34:26 PM)
- *
- * @param newEarProject
- * org.eclipse.core.resources.IProject
- */
- public void setEarProject(org.eclipse.core.resources.IProject newEarProject) {
- earProject = newEarProject;
- }
-
- public void undo() {
- }
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/internal/earcreation/UpdateModuleReferencesInEARProjectCommand.java b/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/internal/earcreation/UpdateModuleReferencesInEARProjectCommand.java
deleted file mode 100644
index 260d1b21a..000000000
--- a/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/internal/earcreation/UpdateModuleReferencesInEARProjectCommand.java
+++ /dev/null
@@ -1,180 +0,0 @@
-/***************************************************************************************************
- * Copyright (c) 2003, 2004 IBM Corporation and others. All rights reserved. This program and the
- * accompanying materials are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors: IBM Corporation - initial API and implementation
- **************************************************************************************************/
-package org.eclipse.jst.j2ee.internal.earcreation;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Iterator;
-import java.util.List;
-
-import org.eclipse.core.resources.IProject;
-import org.eclipse.jst.j2ee.application.Module;
-import org.eclipse.jst.j2ee.applicationclient.internal.creation.AppClientEditModel;
-import org.eclipse.jst.j2ee.applicationclient.internal.creation.ApplicationClientNatureRuntime;
-import org.eclipse.jst.j2ee.client.ApplicationClient;
-import org.eclipse.jst.j2ee.common.EjbRef;
-import org.eclipse.jst.j2ee.internal.J2EEEditModel;
-import org.eclipse.jst.j2ee.internal.common.XMLResource;
-import org.eclipse.jst.j2ee.internal.moduleextension.EarModuleManager;
-import org.eclipse.jst.j2ee.internal.moduleextension.EjbModuleExtension;
-import org.eclipse.jst.j2ee.internal.moduleextension.JcaModuleExtension;
-import org.eclipse.jst.j2ee.internal.moduleextension.WebModuleExtension;
-import org.eclipse.jst.j2ee.internal.project.J2EENature;
-
-
-public class UpdateModuleReferencesInEARProjectCommand extends ModuleInEARProjectCommand {
- protected List ejbRefernces;
- protected String oldModuleUri;
- protected List nestedEditModels;
-
- /**
- * Constructor for UpdateModuleReferencesInEARProjectCommand.
- *
- * @param anEarProject
- * @param uri
- */
- public UpdateModuleReferencesInEARProjectCommand(IProject anEarProject, Module aModule, String newUri) {
- setEarProject(anEarProject);
- setModule(aModule);
- setModuleUri(newUri);
- }
-
- protected void primExecute() {
- oldModuleUri = getModule().getUri();
- try {
- initializeEjbReferencesToModule();
- if (ejbRefernces != null)
- updateEjbReferences();
- } finally {
- saveAndReleaseEditModels();
- }
- }
-
- protected void initializeEjbReferencesToModule() {
- EARNatureRuntime earNature = EARNatureRuntime.getRuntime(getEarProject());
- Collection modNatures = earNature.getModuleProjects().values();
- J2EENature nature;
- Iterator it = modNatures.iterator();
- while (it.hasNext()) {
- nature = (J2EENature) it.next();
- initializeEjbReferencesToModule(nature);
- }
- }
-
- /**
- * Method initializeEjbReferencesToModule.
- *
- * @param nature
- */
- protected void initializeEjbReferencesToModule(J2EENature moduleNature) {
- if (moduleNature == null)
- return;
- switch (moduleNature.getDeploymentDescriptorType()) {
- case XMLResource.EJB_TYPE :
- EjbModuleExtension ejbExt = EarModuleManager.getEJBModuleExtension();
- ejbExt.initializeEjbReferencesToModule(moduleNature, this);
- break;
- case XMLResource.WEB_APP_TYPE :
- WebModuleExtension webExt = EarModuleManager.getWebModuleExtension();
- webExt.initializeEjbReferencesToModule(moduleNature, this);
- break;
- case XMLResource.APP_CLIENT_TYPE :
- initializeEjbReferencesToModule((ApplicationClientNatureRuntime) moduleNature);
- break;
- case XMLResource.RAR_TYPE :
- JcaModuleExtension jcaExt = EarModuleManager.getJCAModuleExtension();
- jcaExt.initializeEjbReferencesToModule(moduleNature, this);
- break;
- }
- }
-
-
-
- public boolean initializeEjbReferencesToModule(List someEjbReferences) {
- if (!someEjbReferences.isEmpty()) {
- EjbRef ref;
- for (int i = 0; i < someEjbReferences.size(); i++) {
- ref = (EjbRef) someEjbReferences.get(i);
- if (hasModuleRefernces(ref.getLink())) {
- addEjbReference(ref);
- return true;
- }
- }
- }
- return false;
- }
-
- public boolean hasModuleRefernces(String aString) {
- return aString != null && aString.indexOf(oldModuleUri) > -1;
- }
-
- private void addEjbReference(EjbRef ref) {
- if (ejbRefernces == null)
- ejbRefernces = new ArrayList();
- ejbRefernces.add(ref);
- }
-
- public void addNestedEditModel(J2EEEditModel anEditModel) {
- if (nestedEditModels == null)
- nestedEditModels = new ArrayList();
- nestedEditModels.add(anEditModel);
- }
-
- protected void initializeEjbReferencesToModule(ApplicationClientNatureRuntime moduleNature) {
- AppClientEditModel anEditModel = moduleNature.getAppClientEditModelForWrite(this);
- boolean foundRef = false;
- try {
- ApplicationClient appclient = anEditModel.getApplicationClient();
- if (appclient != null)
- foundRef = initializeEjbReferencesToModule(appclient.getEjbReferences());
- if (foundRef)
- addNestedEditModel(anEditModel);
- } finally {
- if (!foundRef)
- anEditModel.releaseAccess(this);
- }
- }
-
- protected void updateEjbReferences() {
- if (ejbRefernces != null && !ejbRefernces.isEmpty()) {
- EjbRef ref;
- for (int i = 0; i < ejbRefernces.size(); i++) {
- ref = (EjbRef) ejbRefernces.get(i);
- updateEjbReference(ref);
- }
- }
- }
-
- protected void updateEjbReference(EjbRef ref) {
- String uri = ref.getLink();
- int index = uri.indexOf(oldModuleUri);
- String pre, post;
- pre = uri.substring(0, index);
- post = uri.substring(index + oldModuleUri.length());
- ref.setLink(pre + getModuleUri() + post);
- }
-
- protected void saveAndReleaseEditModels() {
- if (nestedEditModels != null) {
- J2EEEditModel anEditModel;
- for (int i = 0; i < nestedEditModels.size(); i++) {
- anEditModel = (J2EEEditModel) nestedEditModels.get(i);
- try {
- anEditModel.saveIfNecessary(this);
- } finally {
- anEditModel.releaseAccess(this);
- }
- }
- }
- }
-
- protected void primUndo() {
- //not undoable at this time.
- }
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/internal/earcreation/UtilityJARInEARProjectCommand.java b/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/internal/earcreation/UtilityJARInEARProjectCommand.java
deleted file mode 100644
index 66a77249b..000000000
--- a/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/internal/earcreation/UtilityJARInEARProjectCommand.java
+++ /dev/null
@@ -1,177 +0,0 @@
-/***************************************************************************************************
- * Copyright (c) 2003, 2004 IBM Corporation and others. All rights reserved. This program and the
- * accompanying materials are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors: IBM Corporation - initial API and implementation
- **************************************************************************************************/
-package org.eclipse.jst.j2ee.internal.earcreation;
-
-
-import org.eclipse.core.internal.resources.ResourceException;
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.emf.common.command.AbstractCommand;
-import org.eclipse.jem.util.emf.workbench.ProjectUtilities;
-import org.eclipse.jem.util.logger.proxy.Logger;
-import org.eclipse.jst.j2ee.internal.earcreation.modulemap.UtilityJARMapping;
-import org.eclipse.jst.j2ee.internal.plugin.LibCopyBuilder;
-import org.eclipse.jst.j2ee.internal.project.J2EEProjectUtilities;
-
-public abstract class UtilityJARInEARProjectCommand extends AbstractCommand {
- protected EAREditModel editModel;
- protected IProject earProject;
- protected String uri;
- protected IProject project;
- protected UtilityJARMapping map;
-
- /**
- * AddModuleMapCommand constructor comment.
- */
- protected UtilityJARInEARProjectCommand() {
- super();
- }
-
- /**
- * AddModuleMapCommand constructor comment.
- */
- public UtilityJARInEARProjectCommand(EAREditModel earEditModel, String aUri, IProject aProject, String label) {
- super(label);
- editModel = earEditModel;
- if (earEditModel != null)
- earProject = earEditModel.getProject();
- project = aProject;
- uri = aUri;
- }
-
- public UtilityJARInEARProjectCommand(IProject anEarProject, String aUri, IProject aProject, String label) {
- super(label);
- earProject = anEarProject;
- project = aProject;
- uri = aUri;
- }
-
- /**
- * @return
- */
- protected IFile[] getAffectedFiles() {
- return new IFile[]{earProject.getFile(EAREditModel.MODULE_MAP_URI), earProject.getFile(".project") //$NON-NLS-1$
- };
- }
-
- public boolean canUndo() {
- return map != null;
- }
-
- /**
- * This will perform the command activity required for the effect. The effect of calling execute
- * when canExecute returns false, or when canExecute hasn't been called, is undefined.
- */
- public void execute() {
- boolean createdEditModel = editModel == null;
- setupEditModel();
- try {
- primExecute();
- if (createdEditModel)
- editModel.saveIfNecessary(this);
- } finally {
- if (createdEditModel) {
- editModel.releaseAccess(this);
- editModel = null;
- }
- }
- }
-
- /**
- * This will perform the command activity required for the effect. The effect of calling execute
- * when canExecute returns false, or when canExecute hasn't been called, is undefined.
- */
- public void undo() {
- boolean createdEditModel = editModel == null;
- setupEditModel();
- try {
- primUndo();
- if (createdEditModel)
- editModel.saveIfNecessary(this);
- } finally {
- if (createdEditModel) {
- editModel.releaseAccess(this);
- editModel = null;
- }
- }
- }
-
- protected abstract void primUndo();
-
- protected abstract void primExecute();
-
- protected void setupEditModel() {
- ResourcesPlugin.getWorkspace().validateEdit(getAffectedFiles(), null);
- if (editModel == null && earProject != null) {
- EARNatureRuntime nature = EARNatureRuntime.getRuntime(earProject);
- if (nature != null)
- editModel = nature.getEarEditModelForWrite(this);
- }
- }
-
- protected boolean prepare() {
- return true;
- }
-
- /**
- * This will again perform the command activity required to redo the effect after undoing the
- * effect. The effect, if any, of calling redo before undo is called is undefined. Note that if
- * you implement redo to call execute then any derived class will be restricted to by that
- * decision also.
- */
- public void redo() {
- execute();
- }
-
- protected void addLibCopyBuilder(IProject aProject) {
- try {
- ProjectUtilities.addToBuildSpec(LibCopyBuilder.BUILDER_ID, aProject);
- } catch (CoreException e) {
- Logger.getLogger().logError(e);
- }
- }
-
- protected void removeLibCopyBuilder(IProject aProject) {
- //If this project is in other EARs, then leave the builder there
- if (J2EEProjectUtilities.getFirstReferencingEARProject(aProject) != null)
- return;
-
- try {
- ProjectUtilities.removeFromBuildSpec(LibCopyBuilder.BUILDER_ID, aProject);
- } catch (ResourceException e) {
- //this is on a delete...do nothing if already deleted
- } catch (CoreException e) {
- Logger.getLogger().logError(e);
- }
- }
-
- public void addMapping() {
- setExistingMap();
- if (map == null)
- map = editModel.addUtilityJARMapping(uri, project);
- else
- editModel.getUtilityJARMappings().add(map);
- addLibCopyBuilder(project);
- }
-
- protected void removeMapping() {
- setExistingMap();
- if (map != null)
- editModel.getUtilityJARMappings().remove(map);
- removeLibCopyBuilder(project);
- }
-
- protected void setExistingMap() {
- if (map == null)
- map = editModel.getUtilityJARMapping(uri, project);
- }
-
-} \ No newline at end of file
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 30a249aab..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, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jst.j2ee.internal.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 .wtpmodules 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 02aea5dec..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, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jst.j2ee.internal.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 .wtpmodules 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 1dce176e3..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, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jst.j2ee.internal.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 .wtpmodules 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 9f8c6b9f9..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, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jst.j2ee.internal.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 .wtpmodules 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 4a1a18fac..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, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jst.j2ee.internal.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 .wtpmodules 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 92eaa8e8b..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, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jst.j2ee.internal.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 .wtpmodules 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 1bb612785..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, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jst.j2ee.internal.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 .wtpmodules 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 5b65b6782..000000000
--- a/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/internal/earcreation/modulemap/ModulemapInit.java
+++ /dev/null
@@ -1,52 +0,0 @@
-/***************************************************************************************************
- * Copyright (c) 2003, 2004 IBM Corporation and others. All rights reserved. This program and the
- * accompanying materials are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors: IBM Corporation - initial API and implementation
- **************************************************************************************************/
-package org.eclipse.jst.j2ee.internal.earcreation.modulemap;
-
-
-import org.eclipse.emf.ecore.EPackage;
-import org.eclipse.jst.j2ee.internal.J2EEConstants;
-import org.eclipse.jst.j2ee.internal.earcreation.EAREditModel;
-import org.eclipse.wst.common.internal.emf.utilities.ExtendedEcoreUtil;
-import org.eclipse.wst.common.internal.emf.utilities.ResourceDependencyRegister;
-/**
-* @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 .wtpmodules 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;
- }
- });
- }
- 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);
- }
-} \ No newline at end of file
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 5d78b9733..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, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jst.j2ee.internal.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 .wtpmodules 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 8cd6ad2e3..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, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jst.j2ee.internal.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.impl.JavaRefPackageImpl;
-import org.eclipse.jst.j2ee.internal.application.ApplicationPackage;
-import org.eclipse.jst.j2ee.internal.application.impl.ApplicationPackageImpl;
-import org.eclipse.jst.j2ee.internal.common.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 .wtpmodules 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 de6864bb3..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, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jst.j2ee.internal.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 .wtpmodules 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 2ed2e6da9..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, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jst.j2ee.internal.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 .wtpmodules 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 6df46a16f..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, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jst.j2ee.internal.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 .wtpmodules 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/EARArtifactEditOperation.java b/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/internal/modulecore/util/EARArtifactEditOperation.java
deleted file mode 100644
index 18cd25687..000000000
--- a/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/internal/modulecore/util/EARArtifactEditOperation.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 2004, 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.jst.j2ee.componentcore.util.EARArtifactEdit;
-import org.eclipse.wst.common.componentcore.ArtifactEdit;
-import org.eclipse.wst.common.componentcore.internal.StructureEdit;
-import org.eclipse.wst.common.componentcore.internal.WorkbenchComponent;
-import org.eclipse.wst.common.componentcore.internal.operation.ArtifactEditOperation;
-import org.eclipse.wst.common.componentcore.resources.ComponentHandle;
-
-public class EARArtifactEditOperation extends ArtifactEditOperation {
-
- public EARArtifactEditOperation(EARArtifactEditOperationDataModel operationDataModel) {
- super(operationDataModel);
- }
-
- protected ArtifactEdit getArtifactEditForModule(WorkbenchComponent module) {
- ComponentHandle handle = ComponentHandle.create(StructureEdit.getContainingProject(module),module.getName());
- return EARArtifactEdit.getEARArtifactEditForWrite(handle);
- }
-
- protected EARArtifactEdit getEJBArtifactEdit() {
- return (EARArtifactEdit)getArtifactEdit();
- }
-}
diff --git a/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/internal/modulecore/util/EARArtifactEditOperationDataModel.java b/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/internal/modulecore/util/EARArtifactEditOperationDataModel.java
deleted file mode 100644
index f16e96699..000000000
--- a/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/internal/modulecore/util/EARArtifactEditOperationDataModel.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 2004, 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.jst.j2ee.componentcore.util.EARArtifactEdit;
-import org.eclipse.wst.common.componentcore.internal.operation.ArtifactEditOperationDataModel;
-import org.eclipse.wst.common.frameworks.internal.operations.WTPOperation;
-
-//TODO delete
-/**
- * @deprecated
- *
- */
-public class EARArtifactEditOperationDataModel extends ArtifactEditOperationDataModel {
-
- public WTPOperation getDefaultOperation() {
- return new EARArtifactEditOperation(this);
- }
-
- public EARArtifactEdit getEARArtifactEditForRead() {
- return EARArtifactEdit.getEARArtifactEditForRead(getComponent());
- }
-
-}
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 d27f95b2b..000000000
--- a/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/internal/modulecore/util/EarEditAdapterFactory.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/***************************************************************************************************
- * Copyright (c) 2003, 2004 IBM Corporation and others. All rights reserved. This program and the
- * accompanying materials are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors: IBM Corporation - initial API and implementation
- **************************************************************************************************/
-package org.eclipse.jst.j2ee.internal.modulecore.util;
-
-import org.eclipse.core.runtime.IAdapterFactory;
-import org.eclipse.jst.j2ee.componentcore.util.EARArtifactEdit;
-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 (editModel.getModuleType().equals(EARArtifactEdit.TYPE_ID))
- 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};
- }
-} \ No newline at end of file
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 53768a7a5..000000000
--- a/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/internal/moduleextension/EarModuleExtension.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-/*
- * Created on 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.application.internal.operations.J2EEComponentCreationOperation;
-import org.eclipse.jst.j2ee.internal.archive.operations.ImportOption;
-import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
-
-
-
-/**
- * @author cbridgha
- *
- * To change the template for this generated type comment go to Window>Preferences>Java>Code
- * Generation>Code and Comments
- */
-public interface EarModuleExtension {
- String getNatureID();
-
- /**
- * Return a default instance of the J2EEModuleCreationDataModel.
- *
- * @return
- */
- IDataModel createProjectDataModel();
-
- IDataModel createImportDataModel();
-
- J2EEComponentCreationOperation createProjectCreationOperation(IDataModel dataModel);
-
- J2EEComponentCreationOperation createProjectCreationOperation(ImportOption option);
-} \ No newline at end of file
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 66bc6fd49..000000000
--- a/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/internal/moduleextension/EarModuleExtensionImpl.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/***************************************************************************************************
- * Copyright (c) 2003, 2004 IBM Corporation and others. All rights reserved. This program and the
- * accompanying materials are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors: IBM Corporation - initial API and implementation
- **************************************************************************************************/
-/*
- * Created on 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.core.internal.resources.Project;
-import org.eclipse.jst.j2ee.application.internal.operations.J2EEComponentCreationOperation;
-import org.eclipse.jst.j2ee.internal.archive.operations.ImportOption;
-import org.eclipse.jst.j2ee.internal.project.J2EENature;
-
-
-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#getNature(org.eclipse.core.internal.resources.Project)
- */
- public J2EENature getNature(Project proj) {
- // TODO Auto-generated method stub
- return null;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.jst.j2ee.internal.internal.moduleextension.EarModuleExtension#getNatureID()
- */
- public abstract String getNatureID();
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.jst.j2ee.internal.internal.moduleextension.EarModuleExtension#createProjectCreationOperation(com.ibm.etools.archive.ear.operations.ImportOption)
- */
- public J2EEComponentCreationOperation createProjectCreationOperation(ImportOption option) {
- if (option.getArchiveType() == ImportOption.MODULE)
- return createProjectCreationOperation(option.getModel());
- return null;
- }
-
-} \ No newline at end of file
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 8ef204c62..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, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-/*
- * Created on 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);
- }
-
-} \ No newline at end of file
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 0e380f826..000000000
--- a/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/internal/moduleextension/EarModuleManager.java
+++ /dev/null
@@ -1,89 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-/*
- * Created on 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.IConnectorNatureConstants;
-import org.eclipse.jst.j2ee.internal.project.IEJBNatureConstants;
-import org.eclipse.jst.j2ee.internal.project.IWebNatureConstants;
-
-
-/**
- * @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(IEJBNatureConstants.NATURE_ID);
- }
-
- /**
- * @return
- */
- public static JcaModuleExtension getJCAModuleExtension() {
- return (JcaModuleExtension) getModuleExtension(IConnectorNatureConstants.NATURE_ID);
- }
-
- /**
- * @return
- */
- public static WebModuleExtension getWebModuleExtension() {
- return (WebModuleExtension) getModuleExtension(IWebNatureConstants.J2EE_NATURE_ID);
- }
-
- public static boolean hasEJBModuleExtension() {
- return (EjbModuleExtension) getModuleExtension(IEJBNatureConstants.NATURE_ID) != null;
- }
-
- public static boolean hasJCAModuleExtension() {
- return (JcaModuleExtension) getModuleExtension(IConnectorNatureConstants.NATURE_ID) != null;
- }
-
- public static boolean hasWebModuleExtension() {
- return (WebModuleExtension) getModuleExtension(IWebNatureConstants.J2EE_NATURE_ID) != null;
- }
-
- public static void registerModuleExtension(EarModuleExtension ext) {
- moduleExtensions.put(ext.getNatureID(), ext);
- }
-
- public static void removeModuleExtension(String key) {
- moduleExtensions.remove(key);
- }
-} \ No newline at end of file
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 a740590b9..000000000
--- a/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/internal/moduleextension/EjbModuleExtension.java
+++ /dev/null
@@ -1,49 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-/*
- * Created on 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.application.internal.operations.JavaUtilityComponentCreationOperation;
-import org.eclipse.jst.j2ee.ejb.EJBJar;
-import org.eclipse.jst.j2ee.internal.earcreation.UpdateModuleReferencesInEARProjectCommand;
-import org.eclipse.jst.j2ee.internal.project.J2EENature;
-import org.eclipse.wst.common.frameworks.internal.operations.IHeadlessRunnableWithProgress;
-
-
-/**
- * @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);
-
- IHeadlessRunnableWithProgress createEJBPostImportOperation(IProject aProj);
-
- EJBJar getEJBJar(IProject aProject);
-
- IProject getDefinedEJBClientJARProject(IProject anEJBProject);
-
- JavaUtilityComponentCreationOperation createEJBClientJARProject(IProject anEJBProject);
-
-} \ No newline at end of file
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 b0a09a23c..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, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-/*
- * Created on 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);
-} \ No newline at end of file
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 8c8caddee..000000000
--- a/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/internal/moduleextension/WebModuleExtension.java
+++ /dev/null
@@ -1,61 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-/*
- * Created on 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.commonarchivecore.internal.Archive;
-import org.eclipse.jst.j2ee.internal.earcreation.UpdateModuleReferencesInEARProjectCommand;
-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);
-
- J2EEJavaProjectInfo createWebProjectInfo(Archive anArchive);
-
- 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);
-
-} \ No newline at end of file

Back to the top