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/j2eecreation/org/eclipse/jst')
-rw-r--r--plugins/org.eclipse.jst.j2ee/j2eecreation/org/eclipse/jst/j2ee/componentcore/EnterpriseArtifactEdit.java225
-rw-r--r--plugins/org.eclipse.jst.j2ee/j2eecreation/org/eclipse/jst/j2ee/internal/delete/ClasspathDeleteInfo.java76
-rw-r--r--plugins/org.eclipse.jst.j2ee/j2eecreation/org/eclipse/jst/j2ee/internal/delete/DeleteModuleDependencyOperation.java242
-rw-r--r--plugins/org.eclipse.jst.j2ee/j2eecreation/org/eclipse/jst/j2ee/internal/delete/DeleteModuleOperation.java269
-rw-r--r--plugins/org.eclipse.jst.j2ee/j2eecreation/org/eclipse/jst/j2ee/internal/delete/DeleteOptions.java126
-rw-r--r--plugins/org.eclipse.jst.j2ee/j2eecreation/org/eclipse/jst/j2ee/internal/delete/J2EEDeleteResourceListener.java103
-rw-r--r--plugins/org.eclipse.jst.j2ee/j2eecreation/org/eclipse/jst/j2ee/internal/project/IConnectorNatureConstants.java50
-rw-r--r--plugins/org.eclipse.jst.j2ee/j2eecreation/org/eclipse/jst/j2ee/internal/project/IEJBNatureConstants.java43
-rw-r--r--plugins/org.eclipse.jst.j2ee/j2eecreation/org/eclipse/jst/j2ee/internal/project/IJ2EEProjectTypes.java23
-rw-r--r--plugins/org.eclipse.jst.j2ee/j2eecreation/org/eclipse/jst/j2ee/internal/project/IWebNatureConstants.java100
-rw-r--r--plugins/org.eclipse.jst.j2ee/j2eecreation/org/eclipse/jst/j2ee/internal/project/J2EEComponentUtilities.java49
-rw-r--r--plugins/org.eclipse.jst.j2ee/j2eecreation/org/eclipse/jst/j2ee/internal/project/J2EECreationResourceHandler.java63
-rw-r--r--plugins/org.eclipse.jst.j2ee/j2eecreation/org/eclipse/jst/j2ee/internal/project/J2EEJavaProjectInfo.java481
-rw-r--r--plugins/org.eclipse.jst.j2ee/j2eecreation/org/eclipse/jst/j2ee/internal/project/J2EEModuleNature.java306
-rw-r--r--plugins/org.eclipse.jst.j2ee/j2eecreation/org/eclipse/jst/j2ee/internal/project/J2EEModuleWorkbenchURIConverterImpl.java301
-rw-r--r--plugins/org.eclipse.jst.j2ee/j2eecreation/org/eclipse/jst/j2ee/internal/project/J2EENature.java490
-rw-r--r--plugins/org.eclipse.jst.j2ee/j2eecreation/org/eclipse/jst/j2ee/internal/project/J2EEProjectUtilities.java542
-rw-r--r--plugins/org.eclipse.jst.j2ee/j2eecreation/org/eclipse/jst/j2ee/internal/project/J2EEResourceDependencyRegister.java56
-rw-r--r--plugins/org.eclipse.jst.j2ee/j2eecreation/org/eclipse/jst/j2ee/internal/project/J2EESettings.java397
-rw-r--r--plugins/org.eclipse.jst.j2ee/j2eecreation/org/eclipse/jst/j2ee/internal/project/J2EEWorkbenchURIConverterImpl.java187
-rw-r--r--plugins/org.eclipse.jst.j2ee/j2eecreation/org/eclipse/jst/j2ee/internal/project/ManifestFileCreationAction.java41
-rw-r--r--plugins/org.eclipse.jst.j2ee/j2eecreation/org/eclipse/jst/j2ee/internal/project/ProjectSupportResourceHandler.java65
-rw-r--r--plugins/org.eclipse.jst.j2ee/j2eecreation/org/eclipse/jst/j2ee/internal/project/WTPJETEmitter.java563
-rw-r--r--plugins/org.eclipse.jst.j2ee/j2eecreation/org/eclipse/jst/j2ee/internal/project/ZipFileEntryInputStream.java45
-rw-r--r--plugins/org.eclipse.jst.j2ee/j2eecreation/org/eclipse/jst/j2ee/internal/project/test.jpage0
-rw-r--r--plugins/org.eclipse.jst.j2ee/j2eecreation/org/eclipse/jst/j2ee/internal/reference/EJBReferenceCreationOperation.java316
-rw-r--r--plugins/org.eclipse.jst.j2ee/j2eecreation/org/eclipse/jst/j2ee/internal/reference/EJBReferenceDataModel.java617
-rw-r--r--plugins/org.eclipse.jst.j2ee/j2eecreation/org/eclipse/jst/j2ee/internal/reference/MessageDestReferenceCreationOperation.java144
-rw-r--r--plugins/org.eclipse.jst.j2ee/j2eecreation/org/eclipse/jst/j2ee/internal/reference/MessageDestReferenceDataModel.java267
-rw-r--r--plugins/org.eclipse.jst.j2ee/j2eecreation/org/eclipse/jst/j2ee/internal/reference/PortComponentReferenceCreationOperation.java65
-rw-r--r--plugins/org.eclipse.jst.j2ee/j2eecreation/org/eclipse/jst/j2ee/internal/reference/PortComponentReferenceDataModel.java84
-rw-r--r--plugins/org.eclipse.jst.j2ee/j2eecreation/org/eclipse/jst/j2ee/internal/reference/ReferenceDataModel.java425
-rw-r--r--plugins/org.eclipse.jst.j2ee/j2eecreation/org/eclipse/jst/j2ee/internal/reference/ResourceEnvironmentReferenceCreationOperation.java78
-rw-r--r--plugins/org.eclipse.jst.j2ee/j2eecreation/org/eclipse/jst/j2ee/internal/reference/ResourceEnvironmentReferenceDataModel.java62
-rw-r--r--plugins/org.eclipse.jst.j2ee/j2eecreation/org/eclipse/jst/j2ee/internal/reference/ResourceReferenceCreationOperation.java88
-rw-r--r--plugins/org.eclipse.jst.j2ee/j2eecreation/org/eclipse/jst/j2ee/internal/reference/ResourceReferenceDataModel.java77
-rw-r--r--plugins/org.eclipse.jst.j2ee/j2eecreation/org/eclipse/jst/j2ee/internal/reference/ServiceReferenceCreationOperation.java252
-rw-r--r--plugins/org.eclipse.jst.j2ee/j2eecreation/org/eclipse/jst/j2ee/internal/reference/ServiceReferenceDataModel.java322
-rw-r--r--plugins/org.eclipse.jst.j2ee/j2eecreation/org/eclipse/jst/j2ee/internal/rename/ClasspathRenameInfo.java76
-rw-r--r--plugins/org.eclipse.jst.j2ee/j2eecreation/org/eclipse/jst/j2ee/internal/rename/RenameModuleDependencyOperation.java267
-rw-r--r--plugins/org.eclipse.jst.j2ee/j2eecreation/org/eclipse/jst/j2ee/internal/rename/RenameModuleOperation.java273
-rw-r--r--plugins/org.eclipse.jst.j2ee/j2eecreation/org/eclipse/jst/j2ee/internal/rename/RenameOptions.java165
-rw-r--r--plugins/org.eclipse.jst.j2ee/j2eecreation/org/eclipse/jst/j2ee/internal/rename/RenameUtilityJarMetadataOperation.java86
-rw-r--r--plugins/org.eclipse.jst.j2ee/j2eecreation/org/eclipse/jst/j2ee/internal/rename/UpdateWebContextRootMetadataOperation.java89
-rw-r--r--plugins/org.eclipse.jst.j2ee/j2eecreation/org/eclipse/jst/j2ee/internal/servertarget/IServerTargetConstants.java41
-rw-r--r--plugins/org.eclipse.jst.j2ee/j2eecreation/org/eclipse/jst/j2ee/internal/servertarget/ITargetRuntimeExtensionHandler.java29
-rw-r--r--plugins/org.eclipse.jst.j2ee/j2eecreation/org/eclipse/jst/j2ee/internal/servertarget/J2EEProjectServerTargetDataModel.java199
-rw-r--r--plugins/org.eclipse.jst.j2ee/j2eecreation/org/eclipse/jst/j2ee/internal/servertarget/J2EEProjectServerTargetDataModelProvider.java282
-rw-r--r--plugins/org.eclipse.jst.j2ee/j2eecreation/org/eclipse/jst/j2ee/internal/servertarget/J2EEProjectServerTargetOp.java61
-rw-r--r--plugins/org.eclipse.jst.j2ee/j2eecreation/org/eclipse/jst/j2ee/internal/servertarget/J2EEProjectServerTargetOperation.java46
-rw-r--r--plugins/org.eclipse.jst.j2ee/j2eecreation/org/eclipse/jst/j2ee/internal/servertarget/ServerTargetDataModel.java328
-rw-r--r--plugins/org.eclipse.jst.j2ee/j2eecreation/org/eclipse/jst/j2ee/internal/servertarget/ServerTargetHelper.java486
-rw-r--r--plugins/org.eclipse.jst.j2ee/j2eecreation/org/eclipse/jst/j2ee/internal/servertarget/ServerTargetOperation.java53
-rw-r--r--plugins/org.eclipse.jst.j2ee/j2eecreation/org/eclipse/jst/j2ee/internal/servertarget/SyncEARServerTargetDataModel.java39
-rw-r--r--plugins/org.eclipse.jst.j2ee/j2eecreation/org/eclipse/jst/j2ee/internal/servertarget/SyncEARServerTargetOperation.java53
-rw-r--r--plugins/org.eclipse.jst.j2ee/j2eecreation/org/eclipse/jst/j2ee/internal/servertarget/TargetRuntimeExtension.java62
-rw-r--r--plugins/org.eclipse.jst.j2ee/j2eecreation/org/eclipse/jst/j2ee/internal/servertarget/TargetRuntimeExtensionHandlerReader.java143
-rw-r--r--plugins/org.eclipse.jst.j2ee/j2eecreation/org/eclipse/jst/j2ee/project/datamodel/properties/IFlexibleJavaProjectCreationDataModelProperties.java51
-rw-r--r--plugins/org.eclipse.jst.j2ee/j2eecreation/org/eclipse/jst/j2ee/project/datamodel/properties/IJ2EEProjectServerTargetDataModelProperties.java40
59 files changed, 0 insertions, 10509 deletions
diff --git a/plugins/org.eclipse.jst.j2ee/j2eecreation/org/eclipse/jst/j2ee/componentcore/EnterpriseArtifactEdit.java b/plugins/org.eclipse.jst.j2ee/j2eecreation/org/eclipse/jst/j2ee/componentcore/EnterpriseArtifactEdit.java
deleted file mode 100644
index f9f3e6580..000000000
--- a/plugins/org.eclipse.jst.j2ee/j2eecreation/org/eclipse/jst/j2ee/componentcore/EnterpriseArtifactEdit.java
+++ /dev/null
@@ -1,225 +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;
-
-import org.eclipse.emf.common.util.URI;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.ecore.resource.Resource;
-import org.eclipse.jdt.core.ICompilationUnit;
-import org.eclipse.jst.common.jdt.internal.integration.JavaArtifactEditModel;
-import org.eclipse.jst.common.jdt.internal.integration.WorkingCopyManager;
-import org.eclipse.jst.common.jdt.internal.integration.WorkingCopyProvider;
-import org.eclipse.jst.j2ee.commonarchivecore.internal.Archive;
-import org.eclipse.jst.j2ee.commonarchivecore.internal.exception.OpenFailureException;
-import org.eclipse.wst.common.componentcore.ArtifactEdit;
-import org.eclipse.wst.common.componentcore.ModuleCoreNature;
-import org.eclipse.wst.common.componentcore.internal.ArtifactEditModel;
-import org.eclipse.wst.common.componentcore.internal.impl.ModuleURIUtil;
-import org.eclipse.wst.common.componentcore.resources.ComponentHandle;
-import org.eclipse.wst.common.componentcore.resources.IVirtualComponent;
-
-/**
- * <p>
- * EnterpriseArtifactEdit obtains a type-specific J2EE metamodel from the managed
- * {@see org.eclipse.wst.common.modulecore.ArtifactEditModel}. The underlying EditModel maintains
- * {@see org.eclipse.emf.ecore.resource.Resource}s, such as the J2EE deployment descriptor
- * resource. The defined methods extract data or manipulate the contents of the underlying resource.
- * </p>
- *
- * <p>
- * This class is an abstract class, and clients are intended to subclass and own their
- * implementation.
- * </p>
- */
-public abstract class EnterpriseArtifactEdit extends ArtifactEdit implements WorkingCopyProvider {
-
- /**
- *
- */
- protected EnterpriseArtifactEdit() {
- super();
- // TODO Auto-generated constructor stub
- }
-
- /**
- * @param aHandle
- * @param toAccessAsReadOnly
- * @throws IllegalArgumentException
- */
- public EnterpriseArtifactEdit(ComponentHandle aHandle, boolean toAccessAsReadOnly) throws IllegalArgumentException {
- super(aHandle, toAccessAsReadOnly);
- // TODO Auto-generated constructor stub
- }
-
- /**
- * <p>
- * Creates an instance facade for the given {@see ArtifactEditModel}.
- * </p>
- * <p>
- * Clients that use this constructor are required to release their access of the EditModel when
- * finished. Calling {@see ArtifactEdit#dispose()}will not touch the supplied EditModel.
- * </p>
- *
- * @param anArtifactEditModel
- * A valid, properly-accessed EditModel
- */
- public EnterpriseArtifactEdit(ArtifactEditModel model) {
- super(model);
- }
-
- /**
- * <p>
- * Creates an instance facade for the given {@see WorkbenchComponent}.
- * </p>
- * <p>
- * Instances of EnterpriseArtifactEdit that are returned through this method must be
- * {@see #dispose()}ed of when no longer in use.
- * </p>
- * <p>
- * Note: This method is for internal use only. Clients should not call this method.
- * </p>
- *
- * @param aNature
- * A non-null {@see ModuleCoreNature}&nbsp;for an accessible project
- * @param aModule
- * A non-null {@see WorkbenchComponent}&nbsp;pointing to a module from the given
- * {@see ModuleCoreNature}
- */
-
- public EnterpriseArtifactEdit(ModuleCoreNature aNature, IVirtualComponent aModule, boolean toAccessAsReadOnly) {
- super(aNature, aModule, toAccessAsReadOnly);
- }
-
- /**
- * <p>
- * Retrieves J2EE version information from deployment descriptor resource.
- * </p>
- *
- * @return An the J2EE Specification version of the underlying {@see WorkbenchComponent}
- *
- */
- public abstract int getJ2EEVersion();
-
- /**
- * <p>
- * Retrieves a deployment descriptor resource from {@see ArtifactEditModel}using a defined URI.
- * </p>
- *
- * @return The correct deployment descriptor resource for the underlying
- * {@see WorkbenchComponent}
- *
- */
- public abstract Resource getDeploymentDescriptorResource();
-
- /**
- * <p>
- * Obtains the root object from a deployment descriptor resource, the root object contains all
- * other resource defined objects. Examples of a deployment descriptor root include:
- * {@see org.eclipse.jst.j2ee.webapplication.WebApp},
- * {@see org.eclipse.jst.j2ee.application.Application}, and
- * {@see org.eclipse.jst.j2ee.ejb.EJBJar}
- * </p>
- * <p>
- * Subclasses may extend this method to perform their own deployment descriptor creataion/
- * retrieval.
- * </p>
- *
- * @return An EMF metamodel object representing the J2EE deployment descriptor
- *
- */
-
- public EObject getDeploymentDescriptorRoot() {
- Resource res = getDeploymentDescriptorResource();
- return (EObject) res.getContents().get(0);
- }
-
- /**
- * Returns a working copy managet
- *
- * @return
- */
-
- public WorkingCopyManager getWorkingCopyManager() {
-
- return ((JavaArtifactEditModel)getArtifactEditModel()).getWorkingCopyManager();
- }
-
- /**
- * Returns the working copy remembered for the compilation unit.
- *
- * @param input
- * ICompilationUnit
- * @return the working copy of the compilation unit, or <code>null</code> if there is no
- * remembered working copy for this compilation unit
- */
- public ICompilationUnit getWorkingCopy(ICompilationUnit cu, boolean forNewCU) throws org.eclipse.core.runtime.CoreException {
- if (isReadOnly())
- return null;
- return getWorkingCopyManager().getWorkingCopy(cu, forNewCU);
- }
-
- /**
- * Returns the working copy remembered for the compilation unit encoded in the given editor
- * input. Does not connect the edit model to the working copy.
- *
- * @param input
- * ICompilationUnit
- * @return the working copy of the compilation unit, or <code>null</code> if the input does
- * not encode an editor input, or if there is no remembered working copy for this
- * compilation unit
- */
- public ICompilationUnit getExistingWorkingCopy(ICompilationUnit cu) throws org.eclipse.core.runtime.CoreException {
- return getWorkingCopyManager().getExistingWorkingCopy(cu);
- }
-
- public URI getModuleLocation(String moduleName) {
- if (getComponentHandle()!=null)
- return ModuleURIUtil.fullyQualifyURI(getComponentHandle());
- return null;
- }
-
- /**
- * This will delete
- *
- * @cu from the workbench and fix the internal references for this working copy manager.
- */
- public void delete(org.eclipse.jdt.core.ICompilationUnit cu, org.eclipse.core.runtime.IProgressMonitor monitor) {
- getWorkingCopyManager().delete(cu, monitor);
- }
-
- /**
- * <p>
- * Create an deployment descriptor resource if one does not get and return it. Subclasses should
- * overwrite this method to create their own type of deployment descriptor
- * </p>
- *
- * @return an EObject
- */
-
- public abstract EObject createModelRoot();
-
- /**
- * <p>
- * Create an deployment descriptor resource if one does not get and return it. Subclasses should
- * overwrite this method to create their own type of deployment descriptor
- * </p>
- *
- * @param int
- * version of the component
- * @return an EObject
- */
-
- public abstract EObject createModelRoot(int version);
-
-
- public Archive asArchive(boolean includeSource) throws OpenFailureException{
- return null;
- }
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.jst.j2ee/j2eecreation/org/eclipse/jst/j2ee/internal/delete/ClasspathDeleteInfo.java b/plugins/org.eclipse.jst.j2ee/j2eecreation/org/eclipse/jst/j2ee/internal/delete/ClasspathDeleteInfo.java
deleted file mode 100644
index fbb8341f7..000000000
--- a/plugins/org.eclipse.jst.j2ee/j2eecreation/org/eclipse/jst/j2ee/internal/delete/ClasspathDeleteInfo.java
+++ /dev/null
@@ -1,76 +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.delete;
-
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.core.resources.IProject;
-
-/**
- * A simple structure that remembers for a given project, the manifest entries to be deleted and the
- * build path entries to be deleted
- */
-public class ClasspathDeleteInfo {
- /**
- * The project from which the dependencies will be removed
- */
- protected IProject targetProject;
- /**
- * The literal manifest entries to be removed; String
- */
- protected List manifestEntries;
- /**
- * The project references to be removed from the build path; IProject
- */
- protected List referencedProjects;
-
- public ClasspathDeleteInfo(IProject project) {
- super();
- targetProject = project;
- }
-
- /**
- * Gets the manifestEntries.
- *
- * @return Returns a List
- */
- public List getManifestEntries() {
- if (manifestEntries == null)
- manifestEntries = new ArrayList();
- return manifestEntries;
- }
-
-
- /**
- * Gets the referencedProjects.
- *
- * @return Returns a List
- */
- public List getReferencedProjects() {
- if (referencedProjects == null)
- referencedProjects = new ArrayList();
- return referencedProjects;
- }
-
-
- /**
- * Gets the targetProject.
- *
- * @return Returns a IProject
- */
- public IProject getTargetProject() {
- return targetProject;
- }
-
-
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.jst.j2ee/j2eecreation/org/eclipse/jst/j2ee/internal/delete/DeleteModuleDependencyOperation.java b/plugins/org.eclipse.jst.j2ee/j2eecreation/org/eclipse/jst/j2ee/internal/delete/DeleteModuleDependencyOperation.java
deleted file mode 100644
index 75ad8ef7a..000000000
--- a/plugins/org.eclipse.jst.j2ee/j2eecreation/org/eclipse/jst/j2ee/internal/delete/DeleteModuleDependencyOperation.java
+++ /dev/null
@@ -1,242 +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.delete;
-
-
-import java.io.IOException;
-import java.lang.reflect.InvocationTargetException;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.HashMap;
-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.ResourcesPlugin;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.SubProgressMonitor;
-import org.eclipse.jdt.core.IClasspathEntry;
-import org.eclipse.jdt.core.IJavaProject;
-import org.eclipse.jdt.core.JavaModelException;
-import org.eclipse.jem.util.emf.workbench.ProjectUtilities;
-import org.eclipse.jem.workbench.utility.JemProjectUtilities;
-import org.eclipse.jst.j2ee.commonarchivecore.internal.helpers.ArchiveManifest;
-import org.eclipse.jst.j2ee.commonarchivecore.internal.util.ArchiveUtil;
-import org.eclipse.jst.j2ee.internal.earcreation.EARNatureRuntime;
-import org.eclipse.jst.j2ee.internal.plugin.J2EEPlugin;
-import org.eclipse.jst.j2ee.internal.project.J2EECreationResourceHandler;
-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;
-
-public class DeleteModuleDependencyOperation extends WTPOperation {
-
- protected List earNatures;
- protected Set projects;
- protected Map deleteInfos;
- protected IProgressMonitor monitor;
- protected static String MOD_DEP_DELETE_ERRORS = J2EECreationResourceHandler.getString("Errors_occurred_deleting_module_dependencies_UI_"); //$NON-NLS-1$
- protected List affectedFiles = null;
-
- public DeleteModuleDependencyOperation(List earNatures, Set projects) {
- this.earNatures = earNatures;
- this.projects = projects;
- }
-
- protected Map getDeleteInfos() {
- if (deleteInfos == null)
- deleteInfos = new HashMap();
- return deleteInfos;
- }
-
- protected ClasspathDeleteInfo getDeleteInfo(IProject referencingProject) {
- ClasspathDeleteInfo info = (ClasspathDeleteInfo) getDeleteInfos().get(referencingProject);
- if (info != null)
- return info;
- info = new ClasspathDeleteInfo(referencingProject);
- deleteInfos.put(referencingProject, info);
- return info;
- }
-
- /**
- * @see HeadlessJ2EEOperation#execute(IProgressMonitor)
- */
- protected void execute(IProgressMonitor aMonitor) throws CoreException, InvocationTargetException, InterruptedException {
- this.monitor = aMonitor;
- gatherDeleteInfoIfNecessary();
- executeDeleteInfo();
- }
-
- /*
- * Iterate the edit models; for each edit model, iterate the projects; for each project... find
- * the module for the project find all the modules that reference the module for each of those,
- * resolve back to a project and cache the runtime classpath entry and project name going away
- */
- protected void gatherDeleteInfoIfNecessary() {
- if (deleteInfos == null || deleteInfos.isEmpty()) {
- for (int i = 0; i < earNatures.size(); i++) {
- EARNatureRuntime nature = (EARNatureRuntime) earNatures.get(i);
- gatherDeleteInfo(nature);
- }
- }
- }
-
- protected void gatherDeleteInfo(EARNatureRuntime runtime) {
- Map urisToProjects = runtime.getAllMappedProjects();
- for (Iterator iterator = projects.iterator(); iterator.hasNext();) {
- IProject project = (IProject) iterator.next();
- gatherDeleteInfo(runtime, urisToProjects, project);
- }
- }
-
- /*
- * If this project is referenced by the EAR iterate all the other projects referenced by the EAR
- * for each project p if the p references the referenced project, add the reference to the
- * delete info
- */
- protected void gatherDeleteInfo(EARNatureRuntime runtime, Map urisToProjects, IProject referencedProject) {
- String referencedProjectURI = runtime.getJARUri(referencedProject);
- if (referencedProjectURI == null)
- return;
- Iterator it = urisToProjects.entrySet().iterator();
- while (it.hasNext()) {
- Map.Entry entry = (Map.Entry) it.next();
- String uri = (String) entry.getKey();
- IProject project = (IProject) entry.getValue();
- if (referencedProject.equals(project) || projects.contains(project))
- continue;
- gatherDeleteInfo(uri, project, referencedProject, referencedProjectURI);
- }
- }
-
- protected void gatherDeleteInfo(String testUri, IProject testProject, IProject referencedProject, String moduleUri) {
- ArchiveManifest mf = J2EEProjectUtilities.readManifest(testProject);
- if (mf == null)
- return;
- String[] classpath = mf.getClassPathTokenized();
- for (int i = 0; i < classpath.length; i++) {
- String resolved = ArchiveUtil.deriveEARRelativeURI(classpath[i], testUri);
- if (!moduleUri.equals(resolved))
- continue;
- ClasspathDeleteInfo info = getDeleteInfo(testProject);
- info.getManifestEntries().add(classpath[i]);
- info.getReferencedProjects().add(referencedProject);
- }
- }
-
- protected void executeDeleteInfo() throws InvocationTargetException {
- if (deleteInfos == null)
- return;
- Iterator it = deleteInfos.values().iterator();
- while (it.hasNext()) {
- ClasspathDeleteInfo info = (ClasspathDeleteInfo) it.next();
- IProject p = info.getTargetProject();
- if (JemProjectUtilities.isBinaryProject(p)) {
- String message = J2EECreationResourceHandler.getString("Can_not_remove_module_dependency_from_project_UI_", new Object[]{p.getName()}); //$NON-NLS-1$
- addErrorStatus(message);
- continue;
- }
- try {
- replaceManifest(p, info);
- replaceBuildPath(p, info);
- } catch (Exception ex) {
- throw new WFTWrappedException(ex);
- }
- }
- }
-
- protected void replaceManifest(IProject project, ClasspathDeleteInfo info) throws IOException {
- ArchiveManifest mf = J2EEProjectUtilities.readManifest(project);
- if (mf == null)
- return;
- String[] entries = mf.getClassPathTokenized();
- StringBuffer sb = new StringBuffer();
- boolean empty = true;
- for (int i = 0; i < entries.length; i++) {
- String entry = entries[i];
- if (info.getManifestEntries().contains(entry))
- continue;
- if (!empty)
- sb.append(" "); //$NON-NLS-1$
- empty = false;
- sb.append(entries[i]);
- }
- mf.setClassPath(sb.toString());
- J2EEProjectUtilities.writeManifest(project, mf);
- }
-
- protected void replaceBuildPath(IProject project, ClasspathDeleteInfo info) throws JavaModelException {
- IJavaProject javaP = JemProjectUtilities.getJavaProject(project);
- if (javaP == null)
- return;
- List result = new ArrayList();
- IClasspathEntry[] entries = javaP.getRawClasspath();
- for (int i = 0; i < entries.length; i++) {
- IClasspathEntry entry = entries[i];
- if (shouldKeepEntry(entry, info))
- result.add(entry);
- }
- IClasspathEntry[] toArray = (IClasspathEntry[]) result.toArray(new IClasspathEntry[result.size()]);
- javaP.setRawClasspath(toArray, new SubProgressMonitor(monitor, 1));
- }
-
- protected boolean shouldKeepEntry(IClasspathEntry entry, ClasspathDeleteInfo info) {
- if (entry.getEntryKind() != IClasspathEntry.CPE_PROJECT)
- return true;
-
- IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(entry.getPath().toString());
- return !info.getReferencedProjects().contains(project);
- }
-
- /**
- * Return a list of all the files that will get modified as a result of running this operation;
- * used for validateEdit
- */
- protected List getAffectedFiles() {
- if (affectedFiles == null)
- affectedFiles = gatherAffectedFiles();
- return affectedFiles;
- }
-
- protected List gatherAffectedFiles() {
- gatherDeleteInfoIfNecessary();
- if (deleteInfos == null || deleteInfos.isEmpty())
- return Collections.EMPTY_LIST;
- List result = new ArrayList();
- Iterator it = deleteInfos.values().iterator();
- while (it.hasNext()) {
- ClasspathDeleteInfo info = (ClasspathDeleteInfo) it.next();
- IProject p = info.getTargetProject();
- IFile aFile = J2EEProjectUtilities.getManifestFile(p);
- if (aFile != null && aFile.exists()) {
- result.add(aFile);
- result.addAll(ProjectUtilities.getFilesAffectedByClasspathChange(p));
- }
- }
- return result;
- }
-
- protected void addErrorStatus(String message) {
- IStatus newStatus = J2EEPlugin.newErrorStatus(message, null);
- addStatus(newStatus);
- // if (status.isOK())
- // status = newStatus;
- // else if (status.isMultiStatus())
- // ((MultiStatus)status).add(newStatus);
- // else {
- // IStatus[] children = new IStatus[] {status, newStatus};
- // status = new MultiStatus(J2EEPlugin.PLUGIN_ID, 0, children, MOD_DEP_DELETE_ERRORS, null);
- // }
- }
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.jst.j2ee/j2eecreation/org/eclipse/jst/j2ee/internal/delete/DeleteModuleOperation.java b/plugins/org.eclipse.jst.j2ee/j2eecreation/org/eclipse/jst/j2ee/internal/delete/DeleteModuleOperation.java
deleted file mode 100644
index a582c21f0..000000000
--- a/plugins/org.eclipse.jst.j2ee/j2eecreation/org/eclipse/jst/j2ee/internal/delete/DeleteModuleOperation.java
+++ /dev/null
@@ -1,269 +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.delete;
-
-
-import java.lang.reflect.InvocationTargetException;
-import java.util.ArrayList;
-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 org.eclipse.core.resources.IProject;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.emf.common.command.Command;
-import org.eclipse.jst.j2ee.application.Module;
-import org.eclipse.jst.j2ee.internal.J2EEEditModel;
-import org.eclipse.jst.j2ee.internal.earcreation.EAREditModel;
-import org.eclipse.jst.j2ee.internal.earcreation.EARNatureRuntime;
-import org.eclipse.jst.j2ee.internal.earcreation.RemoveModuleFromEARProjectCommand;
-import org.eclipse.jst.j2ee.internal.earcreation.RemoveUtilityJARMapCommand;
-import org.eclipse.jst.j2ee.internal.project.J2EECreationResourceHandler;
-import org.eclipse.wst.common.frameworks.internal.operations.WTPOperation;
-import org.eclipse.wst.common.internal.emfworkbench.EMFWorkbenchContext;
-import org.eclipse.wst.common.internal.emfworkbench.WorkbenchResourceHelper;
-import org.eclipse.wst.common.internal.emfworkbench.integration.ComposedEditModel;
-import org.eclipse.wst.common.internal.emfworkbench.integration.EditModel;
-import org.eclipse.wst.common.internal.emfworkbench.integration.LooseComposedEditModel;
-
-
-public class DeleteModuleOperation extends WTPOperation {
-
- protected DeleteOptions options;
- /*
- * key is an EAREditModel and the value is a list of delete commands. We cache the commands and
- * execute later because the modules still need to exist when we go to remove module dependency
- * references.
- */
- protected Map deferredCommands;
- protected IProgressMonitor monitor;
- protected DeleteModuleDependencyOperation deleteModuleDependencyOperation;
- protected LooseComposedEditModel deleteEditModel;
- protected List dirtyEarModels;
-
- protected static String EDIT_MODEL_KEY = "DELETE_MODULES"; //$NON-NLS-1$
-
- public DeleteModuleOperation(DeleteOptions options) {
- this.options = options;
- }
-
- /**
- * @see HeadlessJ2EEOperation#execute(IProgressMonitor)
- */
- protected void execute(IProgressMonitor aMonitor) throws CoreException, InvocationTargetException, InterruptedException {
- this.monitor = aMonitor;
- try {
- buildDeleteCommandsIfNecessary();
- if (options.shouldDeleteModuleDependencies()) {
- deleteModuleDependencies();
- }
- checkIfEarsAreDirty();
- executeDeferredCommands();
- saveModelsIfNecessary();
- } finally {
- releaseModels();
- }
-
- }
-
- protected void checkIfEarsAreDirty() {
- dirtyEarModels = new ArrayList();
- if (deferredCommands == null)
- return;
- Iterator models = deferredCommands.keySet().iterator();
- while (models.hasNext()) {
- EAREditModel model = (EAREditModel) models.next();
- if (model.isDirty() && !dirtyEarModels.contains(model)) {
- dirtyEarModels.add(model);
- }
- }
- }
-
- protected void buildDeleteCommandsIfNecessary() {
- if (deferredCommands != null && !deferredCommands.isEmpty())
- return;
- deferredCommands = new HashMap();
- List earProjects = EARNatureRuntime.getAllEARProjectsInWorkbench();
- for (int i = 0; i < earProjects.size(); i++) {
- IProject p = (IProject) earProjects.get(i);
- if (options.getSelectedProjects().contains(p))
- return;
- EARNatureRuntime runtime = EARNatureRuntime.getRuntime(p);
- if (runtime != null)
- buildDeleteCommands(runtime);
- }
- }
-
- protected void buildDeleteCommands(EARNatureRuntime runtime) {
- List commands = new ArrayList();
- EAREditModel model = runtime.getEarEditModelForWrite(this);
- List projects = options.getModuleAndUtilityProjects();
- try {
- if (options.shouldDeleteModules()) {
- for (int i = 0; i < projects.size(); i++) {
- IProject project = (IProject) projects.get(i);
- Module m = runtime.getModule(project);
- if (m != null)
- commands.add(new RemoveModuleFromEARProjectCommand(m, runtime.getProject()));
- else {
- String uri = runtime.getJARUri(project);
- if (uri != null)
- commands.add(new RemoveUtilityJARMapCommand(runtime.getProject(), uri, project));
- }
- }
- }
- if (!commands.isEmpty())
- deferredCommands.put(model, commands);
- else
- model.releaseAccess(this);
- } catch (RuntimeException e) {
- model.releaseAccess(this);
- throw e;
- } catch (Error err) {
- model.releaseAccess(this);
- throw err;
- }
- }
-
- /**
- * Do this for unhandled exceptions
- */
- protected void releaseModels() {
- if (deleteEditModel != null) {
- //TODO - RLS, 2/19/2004 we need to revisit the whole notion of the loose composed edit
- //model beccause this does not release the nested models as expected, also it looks
- // like
- // the delete edit model is never created which means validate edit is not happening
- //TODO - JAS when you look at this class to clean up the above, also look at
- // RenameModuleOperation
- //because it has the same kind of mess
- deleteEditModel.releaseAccess(this);
- deleteEditModel = null;
- }
- if (deferredCommands != null) {
- Iterator iter = deferredCommands.keySet().iterator();
- while (iter.hasNext()) {
- EditModel editModel = (EditModel) iter.next();
- editModel.releaseAccess(this);
- iter.remove();
- }
- }
- }
-
- public void release() {
- releaseModels();
- }
-
- /**
- * After a normal execution flow, save the models if necessary
- */
- protected void saveModelsIfNecessary() {
- if (deferredCommands == null)
- return;
- Iterator models = deferredCommands.keySet().iterator();
- while (models.hasNext()) {
- EAREditModel model = (EAREditModel) models.next();
- if (model.isDirty()) {
- if (dirtyEarModels.contains(model)) {
- model.saveIfNecessary(this);
- } else {
- model.save(this);
- }
- }
- }
- }
-
- protected void deleteModuleDependencies() throws InvocationTargetException, InterruptedException {
- getDeleteModuleDependencyOperation().run(monitor);
- }
-
- protected DeleteModuleDependencyOperation getDeleteModuleDependencyOperation() {
- if (deleteModuleDependencyOperation == null) {
- List earEditModels = new ArrayList();
- Iterator iter = deferredCommands.keySet().iterator();
- while (iter.hasNext())
- earEditModels.add(((EAREditModel) iter.next()).getEARNature());
- deleteModuleDependencyOperation = new DeleteModuleDependencyOperation(earEditModels, new HashSet(options.getModuleAndUtilityProjects()));
- }
- return deleteModuleDependencyOperation;
- }
-
- protected void executeDeferredCommands() {
- Iterator it = deferredCommands.entrySet().iterator();
- while (it.hasNext()) {
- Map.Entry entry = (Map.Entry) it.next();
- List commands = (List) entry.getValue();
- executeCommands(commands);
-
- }
- }
-
- protected void executeCommands(List commands) {
- for (int i = 0; i < commands.size(); i++) {
- Command cmd = (Command) commands.get(i);
- cmd.execute();
- }
- }
-
- /**
- * Return a list of all the non-resource files that will get modified as a result of running
- * this operation; used for validate edit.
- */
- protected List getAffectedNonResourceFiles() {
- if (options.shouldDeleteModuleDependencies())
- return getDeleteModuleDependencyOperation().getAffectedFiles();
- return Collections.EMPTY_LIST;
- }
-
- /**
- * Use this only for validate edits
- */
- public ComposedEditModel getDeleteEditModel() {
- if (deleteEditModel == null)
- initializeDeleteEditModel();
- return deleteEditModel;
- }
-
- protected void initializeDeleteEditModel() {
- if (options.getAllProjectsToDelete().size() == 0) {
- throw new RuntimeException(J2EECreationResourceHandler.getString("DeleteModuleOperation_UI_0")); //$NON-NLS-1$
- }
-
- buildDeleteCommandsIfNecessary();
- IProject project = null;
- project = (IProject) options.getAllProjectsToDelete().get(0);
-
- deleteEditModel = new LooseComposedEditModel(EDIT_MODEL_KEY, (EMFWorkbenchContext) WorkbenchResourceHelper.getEMFContext(project)) {
-
- /**
- * @see org.eclipse.jst.j2ee.internal.internal.workbench.EditModel#getNonResourceFiles()
- */
- public List getNonResourceFiles() {
- List result = super.getNonResourceFiles();
- result.addAll(getAffectedNonResourceFiles());
- return result;
- }
- };
-
- Iterator it = deferredCommands.keySet().iterator();
- while (it.hasNext()) {
- deleteEditModel.addChild((J2EEEditModel) it.next());
- }
- }
-
- public IStatus getStatus() {
- return deleteModuleDependencyOperation.getStatus();
- }
-
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.jst.j2ee/j2eecreation/org/eclipse/jst/j2ee/internal/delete/DeleteOptions.java b/plugins/org.eclipse.jst.j2ee/j2eecreation/org/eclipse/jst/j2ee/internal/delete/DeleteOptions.java
deleted file mode 100644
index a921577e5..000000000
--- a/plugins/org.eclipse.jst.j2ee/j2eecreation/org/eclipse/jst/j2ee/internal/delete/DeleteOptions.java
+++ /dev/null
@@ -1,126 +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.delete;
-
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-
-public class DeleteOptions {
-
- protected boolean isEARDelete;
- protected boolean deleteProjects;
- protected boolean deleteModules;
- protected boolean deleteModuleDependencies;
- protected List selectedProjects;
- /** Applicable for EAR delete */
- protected List selectedReferencedProjects;
-
- /**
- * Constructor for DeleteOptions.
- */
- public DeleteOptions() {
- super();
- }
-
-
- public boolean shouldDeleteModules() {
- return deleteModules;
- }
-
-
- public void setDeleteModules(boolean deleteModulesFromAllEARs) {
- this.deleteModules = deleteModulesFromAllEARs;
- }
-
-
- public boolean shouldDeleteProjects() {
- return deleteProjects;
- }
-
-
- public void setDeleteProjects(boolean deleteProjects) {
- this.deleteProjects = deleteProjects;
- }
-
-
- public boolean shouldDeleteModuleDependencies() {
- return deleteModuleDependencies;
- }
-
-
- public void setDeleteModuleDependencies(boolean deleteReferencesFromModuleDependencies) {
- this.deleteModuleDependencies = deleteReferencesFromModuleDependencies;
- }
-
- public List getModuleAndUtilityProjects() {
- if (isEARDelete)
- return getSelectedReferencedProjects();
- return getSelectedProjects();
- }
-
- public List getAllProjectsToDelete() {
- List result = new ArrayList();
- result.addAll(getSelectedProjects());
- result.addAll(getSelectedReferencedProjects());
- return result;
- }
-
- /**
- * Gets the selectedProjects.
- *
- * @return Returns a List
- */
- public List getSelectedProjects() {
- if (selectedProjects == null)
- return Collections.EMPTY_LIST;
- return selectedProjects;
- }
-
- /**
- * Sets the selectedProjects.
- *
- * @param selectedProjects
- * The selectedProjects to set
- */
- public void setSelectedProjects(List selectedProjects) {
- this.selectedProjects = selectedProjects;
- }
-
- /**
- * Gets the selectedReferencedProjects.
- *
- * @return Returns a List
- */
- public List getSelectedReferencedProjects() {
- if (selectedReferencedProjects == null)
- return Collections.EMPTY_LIST;
- return selectedReferencedProjects;
- }
-
- /**
- * Sets the selectedReferencedProjects.
- *
- * @param selectedReferencedProjects
- * The selectedReferencedProjects to set
- */
- public void setSelectedReferencedProjects(List selectedReferencedProjects) {
- this.selectedReferencedProjects = selectedReferencedProjects;
- }
-
- public boolean isEARDelete() {
- return isEARDelete;
- }
-
- public void setIsEARDelete(boolean isEARDelete) {
- this.isEARDelete = isEARDelete;
- }
-
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.jst.j2ee/j2eecreation/org/eclipse/jst/j2ee/internal/delete/J2EEDeleteResourceListener.java b/plugins/org.eclipse.jst.j2ee/j2eecreation/org/eclipse/jst/j2ee/internal/delete/J2EEDeleteResourceListener.java
deleted file mode 100644
index 916c9a74c..000000000
--- a/plugins/org.eclipse.jst.j2ee/j2eecreation/org/eclipse/jst/j2ee/internal/delete/J2EEDeleteResourceListener.java
+++ /dev/null
@@ -1,103 +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.delete;
-
-
-import java.util.Vector;
-
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.resources.IResourceChangeEvent;
-import org.eclipse.core.resources.IResourceChangeListener;
-import org.eclipse.jst.j2ee.applicationclient.internal.creation.ApplicationClientNatureRuntime;
-import org.eclipse.jst.j2ee.internal.project.IEJBNatureConstants;
-import org.eclipse.jst.j2ee.internal.project.IWebNatureConstants;
-import org.eclipse.jst.j2ee.internal.project.J2EENature;
-
-
-public class J2EEDeleteResourceListener implements IResourceChangeListener {
- // the following are projects that are already being deleted, so ignore them.
- static protected Vector WARProjects = new Vector();
- static protected Vector EJBProjects = new Vector();
- static protected Vector AppClientProjects = new Vector();
-
- public J2EEDeleteResourceListener() {
- super();
- }
-
- /**
- * @see IResourceChangeListener#resourceChanged(IResourceChangeEvent)
- */
- public void resourceChanged(IResourceChangeEvent event) {
- System.err.println("Hello, world!"); //$NON-NLS-1$
- IResource resource = event.getResource();
- if (resource instanceof IProject) {
- IProject project = (IProject) resource;
- try {
- if (J2EENature.hasRuntime(project, IEJBNatureConstants.NATURE_ID)) {
- if (!EJBProjects.contains(project)) {
- System.err.println("Hello, world!- EJB"); //$NON-NLS-1$
- showEJBOptions(project);
- }
- } else if (project.hasNature(IWebNatureConstants.J2EE_NATURE_ID)) {
- if (!WARProjects.contains(project)) {
- System.err.println("Hello, world!- WAR"); //$NON-NLS-1$
- showWAROptions(project);
- }
- } else if (ApplicationClientNatureRuntime.hasRuntime(project)) {
- if (!AppClientProjects.contains(project)) {
- System.err.println("Hello, world!- AppClient"); //$NON-NLS-1$
- showAppClientOptions(project);
- }
- }
- } catch (Throwable t) {
- }
- }
- }
-
- protected void showEJBOptions(IProject project) {
- showOptions(project);
- }
-
- protected void showWAROptions(IProject project) {
- showOptions(project);
- }
-
- protected void showAppClientOptions(IProject project) {
- showOptions(project);
- }
-
- protected void showOptions(IProject project) {
- System.err.println("Showing options for " + project.toString()); //$NON-NLS-1$
- }
-
- static public synchronized void addProject(IProject project) {
- try {
- if (J2EENature.hasRuntime(project, IEJBNatureConstants.NATURE_ID)) {
- EJBProjects.add(project);
- } else if (project.hasNature(IWebNatureConstants.J2EE_NATURE_ID)) {
- WARProjects.add(project);
- System.err.println("There are " + WARProjects.size() + " projects now."); //$NON-NLS-1$ //$NON-NLS-2$
- } else if (ApplicationClientNatureRuntime.hasRuntime(project)) {
- AppClientProjects.add(project);
- }
- } catch (Throwable t) {
- }
- }
-
- static public synchronized void removeProject(IProject project) {
- // we can't count on the nature any more, since it has been deleted
- try {
- EJBProjects.remove(project);
- WARProjects.remove(project);
- AppClientProjects.remove(project);
- } catch (Throwable t) {
- }
- }
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.jst.j2ee/j2eecreation/org/eclipse/jst/j2ee/internal/project/IConnectorNatureConstants.java b/plugins/org.eclipse.jst.j2ee/j2eecreation/org/eclipse/jst/j2ee/internal/project/IConnectorNatureConstants.java
deleted file mode 100644
index cc63dd687..000000000
--- a/plugins/org.eclipse.jst.j2ee/j2eecreation/org/eclipse/jst/j2ee/internal/project/IConnectorNatureConstants.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.project;
-
-import org.eclipse.jst.j2ee.internal.plugin.J2EEPluginResourceHandler;
-
-
-/**
- * Defines constants used with the ConnectorNatureRuntime class
- * @deprecated
- * Use
- * <p>
- * All nature constants interfaces are also deprecated along with nature runtime classes
- * IModuleConstants need to be used.
- * </p>
- */
-public interface IConnectorNatureConstants {
-
- //General
- public static final String CONNECTOR_XML_TEMPLATE_10 = "rartp10.xml"; //$NON-NLS-1$
- public static final String CONNECTOR_XML_TEMPLATE_15 = "rartp15.xml"; //$NON-NLS-1$
- public static final String ENC_NATURE_ID = "META-INF/ra.xml.enc"; //$NON-NLS-1$
- public static final String PLUG_IN_ID = "org.eclipse.jst.j2ee.jca"; //$NON-NLS-1$
- public static final String NATURE_ID = PLUG_IN_ID + ".ConnectorNature"; //$NON-NLS-1$
-
- public static final String DEFAULT_SOURCE_PATH = "connectorModule"; //$NON-NLS-1$
- public static final String CONNECTOR_NATURE_ID = NATURE_ID; //$NON-NLS-1$
- public static final String EDIT_MODEL_ID = "org.eclipse.jst.j2ee.jca.editModel"; //$NON-NLS-1$
- public static final String CONNECTOR_CLASSPATH_ENTRY_1 = "/lib/j2ee.jar"; //$NON-NLS-1$
- public static final String CONNECTOR_CLASSPATH_ENTRY_2 = "/lib/ivjejb35.jar"; //$NON-NLS-1$
- public static final String CONNECTOR_DEFAULT_URI = ".rar"; //$NON-NLS-1$
- public static final String CONNECTOR_FILE_UI_ = J2EEPluginResourceHandler.getString("RAR_File"); //$NON-NLS-1$
-
-
- //Errors
- public static final String ARCHIVE_OPERATION_OPENINGARCHIVE = J2EEPluginResourceHandler.getString("Error_opening_archive_for_export_2"); //$NON-NLS-1$
- public static final String PROJECT_NATURE = J2EEPluginResourceHandler.getString("Error_getting_project_nature_runtime_3"); //$NON-NLS-1$
- public static final String ERROR_OCCURED_GETTING_CONN_ERROR_ = J2EEPluginResourceHandler.getString("Error_occurred_loading_ra.xml__4"); //$NON-NLS-1$
- public static final String CREATING_CONN_UI_ = J2EEPluginResourceHandler.getString("Creating_Connector_Project_5"); //$NON-NLS-1$
- public static final String ARCHIVE_OPERATION_PROJECTNATURE = J2EEPluginResourceHandler.getString("Error_getting_project_nature_runtime_6"); //$NON-NLS-1$
- public static final String ARCHIVE_OPERATION_SAVEMANIFEST = J2EEPluginResourceHandler.getString("Error_occurred_saving_the_manifest_7"); //$NON-NLS-1$
-}// IConnectorNatureConstants
diff --git a/plugins/org.eclipse.jst.j2ee/j2eecreation/org/eclipse/jst/j2ee/internal/project/IEJBNatureConstants.java b/plugins/org.eclipse.jst.j2ee/j2eecreation/org/eclipse/jst/j2ee/internal/project/IEJBNatureConstants.java
deleted file mode 100644
index 956353421..000000000
--- a/plugins/org.eclipse.jst.j2ee/j2eecreation/org/eclipse/jst/j2ee/internal/project/IEJBNatureConstants.java
+++ /dev/null
@@ -1,43 +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.project;
-
-import org.eclipse.jst.j2ee.commonarchivecore.internal.helpers.ArchiveConstants;
-
-/**
- * @deprecated
- * Use
- * <p>
- * All nature constants interfaces are also deprecated along with nature runtime classes
- * IModuleConstants need to be used.
- * </p>
- *
- */
-
-public interface IEJBNatureConstants {
- String NATURE_ID = "org.eclipse.jst.j2ee.ejb.EJBNature"; //$NON-NLS-1$
-
- String DEFAULT_EJB_MODULE_PATH = "ejbModule"; //$NON-NLS-1$
- String META_PATH = ArchiveConstants.META_INF;
- String J2EE_PLUGIN_ID = "org.eclipse.jst.j2ee"; //$NON-NLS-1$
-
- /**
- * @deprecated - Please use
- * {@link com.ibm.etools.archive.ArchiveConstants#com.ibm.etools.archive.ArchiveConstants.EJBJAR_DD_URI
- */
- String MODEL_RESOURCE_URI = META_PATH + "/ejb-jar.xml"; //$NON-NLS-1$
-
-
- /** The possible nature ids available for an EJB project */
- String[] EJB_NATURE_IDS = {NATURE_ID};
-
- String EDIT_MODEL_ID = "org.eclipse.jst.ejb.editModel"; //$NON-NLS-1$
- String WEB_SERVICE_EDIT_MODEL_ID = "org.eclipse.jst.j2ee.webservice.ejb.editModel"; //$NON-NLS-1$
-
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.jst.j2ee/j2eecreation/org/eclipse/jst/j2ee/internal/project/IJ2EEProjectTypes.java b/plugins/org.eclipse.jst.j2ee/j2eecreation/org/eclipse/jst/j2ee/internal/project/IJ2EEProjectTypes.java
deleted file mode 100644
index 684f12120..000000000
--- a/plugins/org.eclipse.jst.j2ee/j2eecreation/org/eclipse/jst/j2ee/internal/project/IJ2EEProjectTypes.java
+++ /dev/null
@@ -1,23 +0,0 @@
-/***************************************************************************************************
- * Copyright (c) 2003, 2004 IBM Corporation and others. All rights reserved. This program and the
- * accompanying materials are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors: IBM Corporation - initial API and implementation
- **************************************************************************************************/
-package org.eclipse.jst.j2ee.internal.project;
-
-
-public interface IJ2EEProjectTypes {
- int SOURCE = 1;
- int BINARY = 2;
- int DEFAULT = 3;
- int UTIL = 4;
- int EJB_CLIENT = 5;
- int MODULE = 6;
- int EJB_MODULE = 7;
- int WEB_MODULE = 8;
- int JCA_MODULE = 9;
- int APPCLIENT_MODULE = 10;
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.jst.j2ee/j2eecreation/org/eclipse/jst/j2ee/internal/project/IWebNatureConstants.java b/plugins/org.eclipse.jst.j2ee/j2eecreation/org/eclipse/jst/j2ee/internal/project/IWebNatureConstants.java
deleted file mode 100644
index 0aadc097e..000000000
--- a/plugins/org.eclipse.jst.j2ee/j2eecreation/org/eclipse/jst/j2ee/internal/project/IWebNatureConstants.java
+++ /dev/null
@@ -1,100 +0,0 @@
-package org.eclipse.jst.j2ee.internal.project;
-
-/*
- * Licensed Material - Property of IBM (C) Copyright IBM Corp. 2002 - All Rights Reserved. US
- * Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP
- * Schedule Contract with IBM Corp.
- */
-
-/*
- * Licensed Material - Property of IBM (C) Copyright IBM Corp. 2001 - All Rights Reserved. US
- * Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP
- * Schedule Contract with IBM Corp.
- */
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.Path;
-
-
-/**
- * The Web Nature constants are the constants for the web nature interface to the plugins
- * @deprecated
- * Use
- * <p>
- * All nature constants interfaces are also deprecated along with nature runtime classes
- * IModuleConstants need to be used.
- * </p>
- */
-
-public interface IWebNatureConstants {
-
- public static final String WEB_XML_TEMPLATE_SERVLET_2_2 = "web22.xml"; //$NON-NLS-1$
- public static final String WEB_XML_TEMPLATE_SERVLET_2_3 = "web23.xml"; //$NON-NLS-1$
- public static final String JAVA_SOURCE = "JavaSource"; //$NON-NLS-1$
-
- String J2EE_NATURE_ID = "org.eclipse.jst.j2ee.web.WebNature"; //$NON-NLS-1$
- String PORTLET_NATURE_ID = "com.ibm.etools.portal.tools.PortletProjectNature"; //$NON-NLS-1$
- String STRUTS_NATURE_ID = "com.ibm.etools.struts.StrutsNature";//$NON-NLS-1$
- String JSF_NATURE_ID = "com.ibm.etools.jsf.JSFNature";//$NON-NLS-1$
- public static final String EDIT_MODEL_ID = "org.eclipse.jst.web.editModel"; //$NON-NLS-1$
- String WEB_SERVICE_EDIT_MODEL_ID = "org.eclipse.jst.webservice.web.editModel"; //$NON-NLS-1$
- String DEFAULT_AUTO_INVOKER_PATH = "servlet"; //$NON-NLS-1$
- String DEFAULT_FILE_PATH = ""; //$NON-NLS-1$
-
- String EXCEPTION_CLASS_NAME = "java.lang.Exception"; //$NON-NLS-1$
-
- String FILE_ENABLER_NAME = "File"; //$NON-NLS-1$
- String FILE_ENABLER_DISPLAY_NAME = ProjectSupportResourceHandler.getString("File_Serving_Enabler_7"); //$NON-NLS-1$
- String FILE_ENABLER_CLASS_NAME = "com.ibm.servlet.engine.webapp.SimpleFileServlet"; //$NON-NLS-1$
- String FILE_ENABLER_DESCRIPTION = ProjectSupportResourceHandler.getString("Auto_Generated_-_File_Enabler_9"); //$NON-NLS-1$
- String FILE_ENABLER_MAPPING = "/"; //$NON-NLS-1$
-
- String DEPLOYMENT_DESCRIPTOR_FILE_NAME = "web.xml"; //$NON-NLS-1$
- String BINDINGS_FILE_NAME = "ibm-web-bnd.xmi"; //$NON-NLS-1$
- String EXTENSIONS_FILE_NAME = "ibm-web-ext.xmi"; //$NON-NLS-1$
- //String WEBSETTINGS_FILE_NAME = ".websettings"; //$NON-NLS-1$
- String WEBSETTINGS_FILE_NAME = ".j2ee"; //$NON-NLS-1$
- String WEBSETTINGS_MIGRATION_FILE_NAME = ".websettings"; //$NON-NLS-1$
- String INFO_DIRECTORY = "WEB-INF"; //$NON-NLS-1$
- String META_INFO_DIRECTORY = "META-INF"; //$NON-NLS-1$
- String CLASSES_DIRECTORY = "classes"; //$NON-NLS-1$
- String LIBRARY_DIRECTORY = "lib"; //$NON-NLS-1$
- String IMPORTED_CLASSES_SUFFIX = "_classes.jar"; //$NON-NLS-1$
- String DATABASES_DIRECTORY = "databases"; //$NON-NLS-1$
-
- String CSS_DIRECTORY = "theme"; //$NON-NLS-1$
- public static final String DEFAULT_CSS_FILE_NAME = "Master.css"; //$NON-NLS-1$
-
- // These values must be accessed through IBaseWebNature or IJ2EEWebNature
- String WEB_MODULE_DIRECTORY_V4 = "webApplication";//$NON-NLS-1$
- String WEB_MODULE_DIRECTORY_ = "WebContent";//$NON-NLS-1$
- IPath WEB_MODULE_PATH_V4 = new Path(WEB_MODULE_DIRECTORY_V4);
- IPath WEB_MODULE_PATH_ = new Path(WEB_MODULE_DIRECTORY_);
- IPath WEBINF_PATH_V4 = WEB_MODULE_PATH_V4.append(INFO_DIRECTORY);
- IPath WEBINF_PATH_ = WEB_MODULE_PATH_.append(INFO_DIRECTORY);
-
- String DEFAULT_DOCUMENT_ROOT = ""; //$NON-NLS-1$
-
- String GENERATED_WEB_APP_DESCRIPTION = ProjectSupportResourceHandler.getString("Generated_by_Web_Tooling_23"); //$NON-NLS-1$
-
- // keys for the persistent store
- String SOURCE_FOLDER_KEY = "java-source-folder"; //$NON-NLS-1$
- String CLASS_FOLDER_KEY = "class-folder"; //$NON-NLS-1$
- String META_PATH_KEY = "meta-path"; //$NON-NLS-1$
-
- String SERVLET_JAR = "servlet.jar"; //$NON-NLS-1$
- String WEBAS_JAR = "ibmwebas.jar"; //$NON-NLS-1$
-
- //Messages used by the web nature classes
- String NO_NATURE_MESSAGE = ProjectSupportResourceHandler.getString("Not_a_web_project_29"); //$NON-NLS-1$
- String NOT_OPEN_MESSAGE = ProjectSupportResourceHandler.getString("A_web_project_must_be_open_and_must_exist_for_properties_to_be_edited_30"); //$NON-NLS-1$
-
- String WEBTOOLS_PLUGINDIR_VARIABLE = "WEBTOOLS_PLUGINDIR"; //$NON-NLS-1$
-
- int J2EE_WEB_PROJECT = 1;
- int PORTLET_WEB_PROJECT = 2;
-
- java.lang.String STATIC_CONTEXT_ROOT = "/"; //$NON-NLS-1$
- String STATIC_NATURE_ID = "org.eclipse.jst.j2ee.web" + ".StaticWebNature"; //$NON-NLS-1$ //$NON-NLS-2$
- int STATIC_WEB_PROJECT = 0;
-
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.jst.j2ee/j2eecreation/org/eclipse/jst/j2ee/internal/project/J2EEComponentUtilities.java b/plugins/org.eclipse.jst.j2ee/j2eecreation/org/eclipse/jst/j2ee/internal/project/J2EEComponentUtilities.java
deleted file mode 100644
index 781691845..000000000
--- a/plugins/org.eclipse.jst.j2ee/j2eecreation/org/eclipse/jst/j2ee/internal/project/J2EEComponentUtilities.java
+++ /dev/null
@@ -1,49 +0,0 @@
-package org.eclipse.jst.j2ee.internal.project;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.jst.common.componentcore.util.ComponentUtilities;
-import org.eclipse.jst.j2ee.commonarchivecore.internal.Archive;
-import org.eclipse.jst.j2ee.commonarchivecore.internal.exception.OpenFailureException;
-import org.eclipse.jst.j2ee.commonarchivecore.internal.impl.CommonarchiveFactoryImpl;
-import org.eclipse.jst.j2ee.internal.archive.operations.JavaComponentLoadStrategyImpl;
-import org.eclipse.wst.common.componentcore.internal.util.IModuleConstants;
-import org.eclipse.wst.common.componentcore.resources.IVirtualComponent;
-
-public class J2EEComponentUtilities extends ComponentUtilities {
-
- public J2EEComponentUtilities() {
- super();
- }
-
- public static IVirtualComponent[] getReferencingEARComponents(IVirtualComponent component) {
- List result = new ArrayList();
- IVirtualComponent[] refComponents = component.getReferencingComponents();
- for (int i=0; i<refComponents.length; i++) {
- if (refComponents[i].getComponentTypeId().equals(IModuleConstants.JST_EAR_MODULE))
- result.add(refComponents[i]);
- }
- return (IVirtualComponent[]) result.toArray(new IVirtualComponent[result.size()]);
- }
-
- public static boolean isStandaloneComponent(IVirtualComponent component) {
- if (getReferencingEARComponents(component).length>0)
- return false;
- return true;
- }
-
- public static Archive asArchive(String jarUri, IVirtualComponent component, boolean exportSource) throws OpenFailureException {
- JavaComponentLoadStrategyImpl strat = new JavaComponentLoadStrategyImpl(component);
- strat.setExportSource(exportSource);
- return CommonarchiveFactoryImpl.getActiveFactory().primOpenArchive(strat, jarUri);
- }
-
- public static boolean isWebComponent(IVirtualComponent component) {
- return component.getComponentTypeId().equals(IModuleConstants.JST_WEB_MODULE);
- }
-
- public static boolean isStandaloneWebComponent(IVirtualComponent component) {
- return (component.getComponentTypeId().equals(IModuleConstants.JST_WEB_MODULE) && isStandaloneComponent(component));
- }
-}
diff --git a/plugins/org.eclipse.jst.j2ee/j2eecreation/org/eclipse/jst/j2ee/internal/project/J2EECreationResourceHandler.java b/plugins/org.eclipse.jst.j2ee/j2eecreation/org/eclipse/jst/j2ee/internal/project/J2EECreationResourceHandler.java
deleted file mode 100644
index c072ce848..000000000
--- a/plugins/org.eclipse.jst.j2ee/j2eecreation/org/eclipse/jst/j2ee/internal/project/J2EECreationResourceHandler.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
- **************************************************************************************************/
-package org.eclipse.jst.j2ee.internal.project;
-
-
-import java.text.MessageFormat;
-import java.util.MissingResourceException;
-import java.util.ResourceBundle;
-
-public class J2EECreationResourceHandler {
-
- private static ResourceBundle fgResourceBundle;
-
- /**
- * Returns the resource bundle used by all classes in this Project
- */
- public static ResourceBundle getResourceBundle() {
- try {
- return ResourceBundle.getBundle("j2eecreation");//$NON-NLS-1$
- } catch (MissingResourceException e) {
- // does nothing - this method will return null and
- // getString(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 String getString(String key, Object[] args, int x) {
-
- return getString(key);
- }
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.jst.j2ee/j2eecreation/org/eclipse/jst/j2ee/internal/project/J2EEJavaProjectInfo.java b/plugins/org.eclipse.jst.j2ee/j2eecreation/org/eclipse/jst/j2ee/internal/project/J2EEJavaProjectInfo.java
deleted file mode 100644
index 4b163f8f7..000000000
--- a/plugins/org.eclipse.jst.j2ee/j2eecreation/org/eclipse/jst/j2ee/internal/project/J2EEJavaProjectInfo.java
+++ /dev/null
@@ -1,481 +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.project;
-
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IWorkspace;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.Path;
-import org.eclipse.jdt.core.IClasspathEntry;
-import org.eclipse.jdt.core.IJavaProject;
-import org.eclipse.jdt.core.JavaCore;
-import org.eclipse.jdt.core.JavaModelException;
-import org.eclipse.jem.internal.plugin.JavaProjectInfo;
-import org.eclipse.wst.server.core.IRuntime;
-
-/**
- * This class stores the info required for creating a new J2EE project; not all info will apply to
- * all kinds of projects
- */
-public class J2EEJavaProjectInfo extends JavaProjectInfo {
- protected static final String SRCROOT_VAR = "JRE_SRCROOT"; //$NON-NLS-1$
- protected IProject project;
- protected String jdkRTJarPath;
- protected String projectName;
- protected IPath projectLocation;
- protected String javaOutputPath;
- protected IClasspathEntry[] classpathEntries;
- protected boolean shouldInitializeDefaultClasspath = true;
- protected String natureId;
- protected IRuntime serverTarget;
- protected int moduleVersion;
-
- /**
- * EJBProjectInfo constructor comment.
- */
- public J2EEJavaProjectInfo() {
- super();
- }
-
- /**
- * EJBProjectInfo constructor comment.
- */
- public J2EEJavaProjectInfo(IProject project) {
- super();
- setProject(project);
- }
-
- public IClasspathEntry[] calculateServerClasspathEntries() throws JavaModelException {
- IJavaProject javaProject = getJavaProject();
- if (javaProject == null)
- return null;
- if (getProject().exists()) {
- //We don't need to remove a server target anyomre as it need to be there
- //ServerTargetManager.removeServerTarget(getProject(),null);
- IClasspathEntry[] ces = javaProject.getRawClasspath();
- if (ces.length > 0)
- addToClasspathEntries(ces);
- }
- addServerJdkRuntimeToClasspathEntries();
- addServerJarsToClasspathEntries();
- return classpathEntries;
- }
-
- /**
- * Sets up the default classpath for this project
- */
- protected void addDefaultToClasspathEntries() {
- addToClasspathEntries(computeDefaultJavaClasspath());
- }
-
- /**
- * Set the corresponding jsp and servlet levels. Creation date: (11/09/00 10:05:24 AM)
- */
- public void setJ2EEVersion(int newVersion) {
- }
-
-
- /**
- * add the source folder to classpath dir (IClasspathEntry.CPE_SOURCE)
- */
- public void addJavaSourceToClasspathEntries() {
- IPath sourceClassPath = new Path(getFullSourcePath());
- addToClasspathEntries(new IClasspathEntry[]{JavaCore.newSourceEntry(sourceClassPath)});
- }
-
- public boolean addJdkJarToClasspathEntries(String jdkJarFullPathName) {
-
- IJavaProject javaProject = getJavaProject();
- if (javaProject == null)
- return false;
-
- IClasspathEntry[] entry = new IClasspathEntry[1];
- Path path = new Path(jdkJarFullPathName);
- if (!path.toFile().exists()) {
- org.eclipse.jem.util.logger.proxy.Logger.getLogger().logError(J2EECreationResourceHandler.getString("JdkJarFileDoesNotExist_UI", new Object[]{jdkJarFullPathName})); //$NON-NLS-1$
- return false;
- }
-
- entry[0] = JavaCore.newLibraryEntry(path, null, null);
- addToClasspathEntries(entry);
-
- return true;
- }
-
- /**
- * add rt.jar form the server.jdk plugin
- */
- public void addServerJdkRuntimeToClasspathEntries() {
- addToClasspathEntries(getServerJDKClasspathEntries());
- }
-
- public IClasspathEntry[] getServerJDKClasspathEntries() {
- List list = new ArrayList(4);
- //TODO This class should be deleted.
- // if (isJ2EE13()
- // || !org.eclipse.jst.j2ee.internal.internal.plugin.J2EEPlugin.hasDevelopmentRole()) {
- // list.add(JavaCore.newVariableEntry(new
- // Path(IEJBNatureConstants.SERVERJDK_50_PLUGINDIR_VARIABLE + "/jre/lib/rt.jar"),
- // //$NON-NLS-1$
- // new Path(IEJBNatureConstants.SERVERJDK_50_PLUGINDIR_VARIABLE + "/src.jar"), //$NON-NLS-1$
- // new Path(IEJBNatureConstants.SERVERJDK_SRCROOT_VARIABLE))); //$NON-NLS-1$
- // } else {
- // list.add(JavaCore.newVariableEntry(new
- // Path(IEJBNatureConstants.SERVERJDK_PLUGINDIR_VARIABLE + "/jre/lib/rt.jar"), //$NON-NLS-1$
- // new Path(IEJBNatureConstants.SERVERJDK_PLUGINDIR_VARIABLE + "/src.jar"), //$NON-NLS-1$
- // new Path(IEJBNatureConstants.SERVERJDK_SRCROOT_VARIABLE))); //$NON-NLS-1$
- // }
- return (IClasspathEntry[]) list.toArray(new IClasspathEntry[list.size()]);
- }
-
- /**
- * Adds entries to the class path for this project
- */
- public void addToClasspathEntries(IClasspathEntry[] entries) {
-
- java.util.List list = new ArrayList(10);
- // add the existing ones if any
- if (classpathEntries != null)
- list.addAll(Arrays.asList(classpathEntries));
-
- // add the new ones
- list.addAll(Arrays.asList(entries));
-
- // convert
- classpathEntries = new IClasspathEntry[list.size()];
- classpathEntries = (IClasspathEntry[]) list.toArray(classpathEntries);
-
- }
-
- public boolean addVariableJarToClasspathEntries(String fullPath) {
-
- IJavaProject javaProject = getJavaProject();
- if (javaProject == null)
- return false;
-
- IClasspathEntry[] entry = new IClasspathEntry[1];
- entry[0] = JavaCore.newVariableEntry(new Path(fullPath), null, null);
- addToClasspathEntries(entry);
- return true;
- }
-
- public boolean addVariableJarToClasspathEntriesWithAttachments(String fullPath, String srcPath, String srcRoot) {
-
- IJavaProject javaProject = getJavaProject();
- if (javaProject == null)
- return false;
-
- IClasspathEntry[] entry = new IClasspathEntry[1];
- entry[0] = JavaCore.newVariableEntry(new Path(fullPath), new Path(srcPath), new Path(srcRoot));
- addToClasspathEntries(entry);
- return true;
- }
-
- /**
- * Return the default classpath for projects of this kind; subclasses should override for
- * setting up new projects
- */
- protected IClasspathEntry[] computeDefaultJavaClasspath() {
- IJavaProject javaProject = getJavaProject();
- if (javaProject == null)
- return null;
- addJavaSourceToClasspathEntries();
- if (serverTarget == null) {
- addServerJdkRuntimeToClasspathEntries();
- addServerJarsToClasspathEntries();
- }
- return classpathEntries;
- }
-
- /**
- * Sublcasses have to overide this method to set the server jars
- */
- public void addServerJarsToClasspathEntries() {
-
- }
-
- /**
- * Creates a project handle with a specified path. The project resource should <b>not </b> be
- * created concretely here;
- */
- public IProject createProjectHandle(IPath projectPath) {
- return getWorkspace().getRoot().getProject(projectPath.segment(0));
- }
-
- public IClasspathEntry[] getClasspathEntries() {
- if (classpathEntries == null)
- initializeClasspathEntries();
- return classpathEntries;
- }
-
- /**
- * Insert the method's description here. Creation date: (11/09/00 10:05:24 AM)
- *
- * @return java.lang.String
- */
- public java.lang.String getDefaultContextRoot() {
- return null;
- }
-
- /**
- * Subclasses should override as necessary
- */
- protected String getDefaultJavaOutputPath() {
- return DEFAULT_JAVA_OUTPUT_PATH;
- }
-
- /**
- * Insert the method's description here. Creation date: (11/09/00 10:05:24 AM)
- *
- * @return java.lang.String
- */
- public java.lang.String getDefaultUri() {
- return projectName.replace(' ', '_') + ".jar"; //$NON-NLS-1$
- }
-
- /**
- * Get the java output folder for the receiver, in the form of /project/ <output folder>
- *
- * @return java.lang.String
- */
- public String getFullJavaOutputPath() {
- return Path.ROOT.append(getProjectPath()).append(getJavaOutputPath()).toString();
- }
-
- /**
- * Get the module path folder for the receiver in the form of /project/modulepath
- *
- * @return java.lang.String
- */
- protected String getFullSourcePath() {
- return Path.ROOT.append(getProjectPath()).append(getSourcePath()).toString();
- }
-
- /**
- * Returns the project relative path of the java build destination
- */
- public java.lang.String getJavaOutputPath() {
- if (javaOutputPath == null)
- javaOutputPath = getDefaultJavaOutputPath();
- return javaOutputPath;
- }
-
- /**
- * @param i
- */
- public void setModuleVersion(int version) {
- moduleVersion = version;
- }
-
- public IJavaProject getJavaProject() {
- // needed to get an IJavaProject to create classpaths from.
- IProject aProject = getProject();
- if (aProject == null)
- aProject = getWorkspace().getRoot().getProject(getProjectName());
-
- return JavaCore.create(aProject);
- }
-
- /**
- * Return the absolute path of the default jdk rt.jar to use for this project
- */
- public java.lang.String getJdkRTJarPath() {
- return jdkRTJarPath;
- }
-
- /**
- * Return the project being created; checks the workspace for an existing project
- */
- public IProject getProject() {
- if (project == null) {
- IProject aProject = getWorkspace().getRoot().getProject(getProjectName());
- if (aProject.exists())
- project = aProject;
- }
- return project;
- }
-
- /**
- * Return the location of the project in the file system.
- *
- * @return org.eclipse.core.runtime.IPath
- */
- public IPath getProjectLocation() {
- return projectLocation;
- }
-
- /**
- * Insert the method's description here. Creation date: (11/09/00 10:05:24 AM)
- *
- * @return java.lang.String
- */
- public java.lang.String getProjectName() {
- if (projectName == null && project != null)
- projectName = project.getName();
- return projectName;
- }
-
- public IPath getProjectPath() {
- return new Path(getProjectName());
- }
-
- public IWorkspace getWorkspace() {
- return org.eclipse.jst.j2ee.internal.plugin.J2EEPlugin.getWorkspace();
- }
-
- /**
- * Lazy initialization - useGetClasspathEntries
- */
- protected void initializeClasspathEntries() {
- if (shouldInitializeDefaultClasspath())
- computeDefaultJavaClasspath();
- else
- classpathEntries = new IClasspathEntry[0];
- }
-
- /**
- * Answer false by default
- *
- * @deprecated - Use getModuleVersion() with J2EEVersionConstants
- */
- protected boolean isJ2EE13() {
- return false;
- }
-
- public IProject primGetProject() {
- return project;
- }
-
- public void removeClasspathEntry(IClasspathEntry entry) {
- if (entry == null)
- return;
-
- List list = new ArrayList(Arrays.asList(getClasspathEntries()));
- list.remove(entry);
- classpathEntries = (IClasspathEntry[]) list.toArray(new IClasspathEntry[list.size()]);
- }
-
- /**
- * Insert the method's description here. Creation date: (11/10/00 10:09:58 AM)
- *
- * @param newClassPathEntries
- * org.eclipse.jdt.core.api.IClasspathEntry
- */
- public void setClasspathEntries(IClasspathEntry[] newClasspathEntries) {
- classpathEntries = newClasspathEntries;
- }
-
- public void setJavaOutputPath(String path) {
- javaOutputPath = path;
- }
-
- public void setJdkRTJarPath(String path) {
- jdkRTJarPath = path;
- }
-
- public void setProject(IProject aProject) {
- project = aProject;
- }
-
- /**
- * Set the location in the file system that the project is to be created.
- *
- * @param newProjectLocation
- * IPath
- */
- public void setProjectLocation(IPath newProjectLocation) {
- projectLocation = newProjectLocation;
- }
-
- /**
- * Insert the method's description here. Creation date: (11/09/00 10:05:24 AM)
- *
- * @param newProjectName
- * java.lang.String
- */
- public void setProjectName(java.lang.String newProjectName) {
- if (projectName != newProjectName)
- setClasspathEntries(null);
- projectName = newProjectName;
- }
-
- public void setShouldInitializeDefaultClasspath(boolean value) {
- shouldInitializeDefaultClasspath = value;
- }
-
- public boolean shouldInitializeDefaultClasspath() {
- return shouldInitializeDefaultClasspath;
- }
-
- /**
- * Gets the natureId.
- *
- * @return Returns a String
- */
- public String getNatureId() {
- if (natureId == null)
- return getDefaultNatureId();
- return natureId;
- }
-
- /**
- * returns the correct nature id string based on the J2EE spec level being used
- */
- public String getDefaultNatureId() {
- return null;
- }
-
- /**
- * Sets the natureId.
- *
- * @param natureId
- * The natureId to set
- */
- public void setNatureId(String natureId) {
- this.natureId = natureId;
- }
-
- /**
- * Get the correct WAS classpath variable based on the J2EE version.
- */
- protected String getWASPluginVariable() {
- //TODO This class needs to be deleted.
- // if (isJ2EE13()
- // || !org.eclipse.jst.j2ee.internal.internal.plugin.J2EEPlugin.hasDevelopmentRole())
- // return IEJBNatureConstants.WAS_50_PLUGINDIR_VARIABLE;
- // else
- // return IEJBNatureConstants.WAS_PLUGINDIR_VARIABLE;
- return ""; //$NON-NLS-1$
- }
-
- public int getModuleVersion() {
- return moduleVersion;
- }
-
- /**
- * @return
- */
- public IRuntime getServerTarget() {
- return serverTarget;
- }
-
- /**
- * @param target
- */
- public void setServerTarget(IRuntime target) {
- serverTarget = target;
- }
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.jst.j2ee/j2eecreation/org/eclipse/jst/j2ee/internal/project/J2EEModuleNature.java b/plugins/org.eclipse.jst.j2ee/j2eecreation/org/eclipse/jst/j2ee/internal/project/J2EEModuleNature.java
deleted file mode 100644
index a8ee5c886..000000000
--- a/plugins/org.eclipse.jst.j2ee/j2eecreation/org/eclipse/jst/j2ee/internal/project/J2EEModuleNature.java
+++ /dev/null
@@ -1,306 +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 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.internal.project;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.core.resources.IContainer;
-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.emf.common.notify.AdapterFactory;
-import org.eclipse.emf.ecore.resource.ResourceSet;
-import org.eclipse.emf.ecore.util.EcoreUtil;
-import org.eclipse.jdt.core.ICompilationUnit;
-import org.eclipse.jdt.core.IJavaElementDelta;
-import org.eclipse.jem.internal.adapters.jdom.JavaJDOMAdapterFactory;
-import org.eclipse.jem.internal.adapters.jdom.JavaReflectionSynchronizer;
-import org.eclipse.jem.internal.java.adapters.ReadAdaptor;
-import org.eclipse.jem.internal.plugin.IJavaProjectInfo;
-import org.eclipse.jem.util.emf.workbench.ProjectResourceSet;
-import org.eclipse.jem.util.emf.workbench.ProjectUtilities;
-import org.eclipse.jem.util.emf.workbench.WorkbenchURIConverter;
-import org.eclipse.jem.workbench.utility.JemProjectUtilities;
-import org.eclipse.jst.j2ee.application.Module;
-import org.eclipse.jst.j2ee.commonarchivecore.internal.CommonarchiveFactory;
-import org.eclipse.jst.j2ee.internal.earcreation.EARNatureRuntime;
-import org.eclipse.jst.j2ee.internal.plugin.J2EEPlugin;
-
-/**
- * @deprecated
- * Use
- * <p>
- * ArtifactEdit
- * </p>
- *
- */
-public abstract class J2EEModuleNature extends J2EENature {
-
-
- /**
- *
- */
- public J2EEModuleNature() {
- super();
- }
-
- /**
- * Method used for adding a j2ee project to an ear project; subclasses must override to create a
- * new instance of the correct kind of Module
- */
- public abstract Module createNewModule();
-
- /**
- * If this project is a binary project, returns the JAR used as the input for loading the
- * descriptor resources
- */
- public IResource getBinaryProjectInputJARResource() {
- J2EEModuleWorkbenchURIConverterImpl conv = (J2EEModuleWorkbenchURIConverterImpl) getJ2EEWorkbenchURIConverter();
- IPath aPath = null;
- if (conv != null)
- aPath = conv.getInputJARProjectRelativePath();
- if (aPath != null)
- return getProject().getFile(aPath);
-
- return null;
- }
-
- /**
- * Only some of the J2EE project types can be run from the JAR file; others must be expanded
- *
- * @return false by default; subclasses should override
- */
- public boolean canBeBinary() {
- return false;
- }
-
- /**
- * 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 classpath
- IPath sourcePath = JemProjectUtilities.getSourcePathOrFirst(getProject(), null);
- //might be null for binary projects
- if (sourcePath != null) {
- createFolder(sourcePath.toString());
- IContainer container = JemProjectUtilities.getJavaProjectOutputContainer(getProject());
- if (container != null && container.getType() == IResource.FOLDER)
- createFolder(container.getProjectRelativePath().toString());
- }
- }
-
- /**
- * Answer the absolute path of the module root
- *
- * @see #getModuleRoot
- */
- public String computeModuleAbsolutePath() {
- return computeModuleAbsoluteLocation().toOSString();
- }
-
- public IPath computeModuleAbsoluteLocation() {
- IPath location = null;
- J2EEModuleWorkbenchURIConverterImpl conv = (J2EEModuleWorkbenchURIConverterImpl) getJ2EEWorkbenchURIConverter();
- if (conv != null)
- location = conv.getInputJARLocation();
-
- if (location != null)
- return location;
- return getModuleServerRoot().getLocation();
- }
-
- public void recomputeBinaryProject() {
- J2EEModuleWorkbenchURIConverterImpl conv = (J2EEModuleWorkbenchURIConverterImpl) getJ2EEWorkbenchURIConverter();
- if (conv != null)
- conv.recomputeInputJARLocation();
- }
-
- public static String getModuleAbsolutePath(IProject aJ2EEProject) {
- J2EEModuleNature aNature = (J2EEModuleNature) getRegisteredRuntime(aJ2EEProject);
- return aNature == null ? null : aNature.computeModuleAbsolutePath();
- }
-
- /**
- * Return the root location for loading mof resources; defaults to the source folder, subclasses
- * may override
- */
- public IContainer getEMFRoot() {
- return J2EEProjectUtilities.getSourceFolderOrFirst(project, null);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.jst.j2ee.internal.internal.j2eeproject.J2EENature#primConfigure()
- */
- protected void primConfigure() throws CoreException {
- super.primConfigure();
- ProjectUtilities.addToBuildSpec(J2EEPlugin.LIBCOPY_BUILDER_ID, project);
- }
-
- public CommonarchiveFactory getCommonArchiveFactory() {
- return CommonarchiveFactory.eINSTANCE;
- }
-
- /*
- * @see IJ2EENature#isBinaryProject()
- */
- public boolean isBinaryProject() {
- J2EEModuleWorkbenchURIConverterImpl conv = (J2EEModuleWorkbenchURIConverterImpl) getJ2EEWorkbenchURIConverter();
- if (conv == null)
- return false;
-
- return conv.isBinary();
- }
-
- protected J2EEWorkbenchURIConverterImpl getJ2EEWorkbenchURIConverter() {
- WorkbenchURIConverter conv = getWorkbenchURIConverter();
- if (conv instanceof J2EEModuleWorkbenchURIConverterImpl)
- return (J2EEModuleWorkbenchURIConverterImpl) conv;
- return null;
- }
-
- public void initializeFromInfo(IJavaProjectInfo info) throws CoreException {
- //super.initializeFromInfo(info);
- J2EEJavaProjectInfo j2eeInfo = (J2EEJavaProjectInfo) info;
-
-// To do : Needs rework for flexibile project ModuleCore.getFirstArtifactEditForRead
-// J2EESettings settings = getJ2EESettings();
-// settings.setModuleVersion(j2eeInfo.getModuleVersion());
-// settings.write();
-
- JemProjectUtilities.updateClasspath(j2eeInfo.getJavaProject()); //lsr - no monitor, do not
- // update resources
- }
-
- /**
- * Return all the ear projects in which this project is a nested module; Applicable to project
- * (nature) types that can be modules in an ear file
- */
- public EARNatureRuntime[] getReferencingEARProjects() {
- List earProjects = EARNatureRuntime.getAllEARProjectsInWorkbench();
- List result = new ArrayList();
- for (int i = 0; i < earProjects.size(); i++) {
- IProject earProject = (IProject) earProjects.get(i);
- EARNatureRuntime earNature = EARNatureRuntime.getRuntime(earProject);
- if (earNature.getModule(getProject()) != null) {
- result.add(earNature);
- }
- }
- return (EARNatureRuntime[]) result.toArray(new EARNatureRuntime[result.size()]);
- }
-
- public String getModuleUriInFirstEAR() {
- EARNatureRuntime[] earNatures = getReferencingEARProjects();
- EARNatureRuntime earNature;
- Module mod;
- for (int i = 0; i < earNatures.length; i++) {
- earNature = earNatures[i];
- mod = earNature.getModule(getProject());
- if (mod != null && mod.getUri() != null && mod.getUri().length() > 0)
- return mod.getUri();
- }
- return null;
- }
-
- /**
- * Returns the default source folder for this J2EE project, or null if it can't be determined.
- *
- * If the output location is also a source folder, then returns the output location, otherwise,
- * looks for the source folder that has the deployment descriptor, otherwise, returns the first
- * source folder on the java build path.
- *
- * Currently the project as the source is not supported.
- *
- * @see org.eclipse.jem.internal.java.plugin.IJavaMOFNature#getSourceFolder()
- */
- public IFolder getSourceFolder() {
- IContainer output = JemProjectUtilities.getJavaProjectOutputContainer(getProject());
- List sources = JemProjectUtilities.getSourceContainers(getProject());
- //TODO: We need to be able to support the project as the source, but this would be a
- // breaking change
- if (sources == null || sources.isEmpty() || ((IContainer) sources.get(0)).getType() != IResource.FOLDER)
- return null;
- if (output != null && sources.contains(output))
- return (IFolder) output;
-
- for (int i = 0; i < sources.size(); i++) {
- IFolder source = (IFolder) sources.get(i);
- if (source.getFile(getDeploymentDescriptorURI()).isAccessible())
- return source;
- }
- return (IFolder) sources.get(0);
- }
-
-
- protected J2EEWorkbenchURIConverterImpl initializeWorbenchURIConverter(ProjectResourceSet set) {
- return new J2EEModuleWorkbenchURIConverterImpl(this, set.getSynchronizer());
- }
-
- /**
- * Add Adaptor factories to aContext which is now being used for this nature.
- */
- protected void addAdapterFactories(ResourceSet aSet) {
- addJavaReflectionAdapterFactories(aSet);
- }
-
- protected void addJavaReflectionAdapterFactories(ResourceSet aSet) {
- List factories = aSet.getAdapterFactories();
- // The context may already have a JavaReflection adaptor factory, so remove it
- if (!factories.isEmpty()) {
- AdapterFactory factory = EcoreUtil.getAdapterFactory(factories, ReadAdaptor.TYPE_KEY);
- if (factory != null)
- factories.remove(factory);
- }
-
- // Override JavaJDOMFactory so we can notify on add of compilation unit for ejb annotation
- // support
- JavaJDOMAdapterFactory jdomFactory = new JavaJDOMAdapterFactory(JemProjectUtilities.getJavaProject(project)) {
- protected void initializeSynchronizer() {
- synchronizer = new JavaReflectionSynchronizer(this) {
- // TODO push this up into JavaReflectionSynchronizer
- protected void processJavaElementChanged(ICompilationUnit element, IJavaElementDelta delta) {
- switch (delta.getKind()) {
- case IJavaElementDelta.CHANGED : {
- // A file save had occurred. It doesn't matter if currently working
- // copy or not.
- // It means something has changed to the file on disk, but don't
- // know what.
- if ((delta.getFlags() & IJavaElementDelta.F_PRIMARY_RESOURCE) != 0) {
- flush(element); // Flush everything, including inner classes.
- }
- break;
- }
- case IJavaElementDelta.REMOVED :
- case IJavaElementDelta.ADDED :
- disAssociateSourcePlusInner(getFullNameFromElement(element));
- break;
- }
- }
- };
- }
- };
- factories.add(jdomFactory);
- }
-
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.jst.j2ee/j2eecreation/org/eclipse/jst/j2ee/internal/project/J2EEModuleWorkbenchURIConverterImpl.java b/plugins/org.eclipse.jst.j2ee/j2eecreation/org/eclipse/jst/j2ee/internal/project/J2EEModuleWorkbenchURIConverterImpl.java
deleted file mode 100644
index bfc817de2..000000000
--- a/plugins/org.eclipse.jst.j2ee/j2eecreation/org/eclipse/jst/j2ee/internal/project/J2EEModuleWorkbenchURIConverterImpl.java
+++ /dev/null
@@ -1,301 +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 28, 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.project;
-
-import java.io.FileNotFoundException;
-import java.io.IOException;
-import java.io.InputStream;
-import java.util.List;
-import java.util.zip.ZipEntry;
-import java.util.zip.ZipFile;
-
-import org.eclipse.core.resources.IContainer;
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.resources.IResourceDelta;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.Path;
-import org.eclipse.emf.common.util.URI;
-import org.eclipse.emf.ecore.resource.ResourceSet;
-import org.eclipse.emf.ecore.resource.impl.URIConverterImpl;
-import org.eclipse.jem.util.emf.workbench.ProjectResourceSet;
-import org.eclipse.jem.util.emf.workbench.ProjectUtilities;
-import org.eclipse.jem.util.emf.workbench.ResourceSetWorkbenchSynchronizer;
-import org.eclipse.jem.workbench.utility.JemProjectUtilities;
-import org.eclipse.jst.j2ee.applicationclient.internal.creation.ApplicationClientNatureRuntime;
-import org.eclipse.jst.j2ee.commonarchivecore.internal.CommonarchiveFactory;
-import org.eclipse.jst.j2ee.commonarchivecore.internal.exception.OpenFailureException;
-import org.eclipse.jst.j2ee.commonarchivecore.internal.helpers.ArchiveTypeDiscriminator;
-import org.eclipse.jst.j2ee.commonarchivecore.internal.strategy.AppClient12ImportStrategyImpl;
-import org.eclipse.jst.j2ee.commonarchivecore.internal.strategy.EjbJar11ImportStrategyImpl;
-import org.eclipse.jst.j2ee.internal.common.impl.J2EEResouceFactorySaxRegistry;
-import org.eclipse.jst.j2ee.internal.common.impl.J2EEResourceFactoryRegistry;
-
-/**
- * @author jlanuti
- *
- * To change the template for this generated type comment go to Window>Preferences>Java>Code
- * Generation>Code and Comments
- */
-public class J2EEModuleWorkbenchURIConverterImpl extends J2EEWorkbenchURIConverterImpl {
-
- /** For binary projects, this is the file system absolute location of the input JAR */
- protected IPath inputJARLocation;
- /** For binary projects, this is the project relative location of the input JAR */
- protected IPath inputJARProjectRelativePath;
-
-
- /**
- * @param aNature
- * @param aSynchronizer
- */
- public J2EEModuleWorkbenchURIConverterImpl(J2EEModuleNature aNature, ResourceSetWorkbenchSynchronizer aSynchronizer) {
- super(aNature, aSynchronizer);
- }
-
- protected void initialize() {
- recomputeInputsIfNecessary();
- super.initialize();
- }
-
- protected ArchiveTypeDiscriminator getArchiveDiscriminator() {
- if (nature.getNatureID().equals(IEJBNatureConstants.NATURE_ID))
- return EjbJar11ImportStrategyImpl.getDiscriminator();
- else if (nature instanceof ApplicationClientNatureRuntime)
- return AppClient12ImportStrategyImpl.getDiscriminator();
- return null;
- }
-
- protected boolean isJ2EEArchive(IResource resource) {
- String uri = resource.getLocation().toOSString();
- ArchiveTypeDiscriminator disc = getArchiveDiscriminator();
- if (disc == null)
- return false;
- org.eclipse.jst.j2ee.commonarchivecore.internal.Archive anArchive = null;
- try {
- anArchive = getArchiveFactory().primOpenArchive(uri);
- return disc.canImport(anArchive);
- } catch (OpenFailureException ex) {
- return false;
- } finally {
- if (anArchive != null)
- anArchive.close();
- }
- }
-
- protected CommonarchiveFactory getArchiveFactory() {
- return CommonarchiveFactory.eINSTANCE;
- }
-
- public boolean recomputeInputsIfNecessary() {
- boolean containersChanged = recomputeContainersIfNecessary();
- boolean inputJARChanged = recomputeInputJARLocation();
- return containersChanged || inputJARChanged;
- }
-
- /**
- * recomputes the input containers and the binary JAR location
- *
- * @return boolean if a change was detected
- */
- public boolean recomputeContainersIfNecessary() {
- IContainer input = getInputContainer();
- IContainer newInput = nature.getEMFRoot();
- boolean changed = !objectsEqual(input, newInput);
- if (changed && (getNature() != null && getNature().getProject() != null && getNature().getProject().isAccessible())) {
- List resources = getNature().getResourceSet().getResources();
- deNormalize(resources);
- getInputContainers().clear();
- setOutputContainer(null);
- resetNormalizedResourceCache();
- if (newInput != null)
- addInputContainer(newInput);
- normalize(resources);
- }
- return changed;
- }
-
- private void resetNormalizedResourceCache() {
- J2EENature aNature = getNature();
- if (aNature != null) {
- ResourceSet set = aNature.getResourceSet();
- if (set instanceof ProjectResourceSet)
- ((ProjectResourceSet) set).resetNormalizedURICache();
- }
- }
-
- /**
- * Applies only if the nature is a "binary" project
- *
- * @return boolean if the input JAR location changed
- */
- public boolean recomputeInputJARLocation() {
- if (!((J2EEModuleNature) nature).canBeBinary())
- return false;
- IPath existing = inputJARLocation;
- IPath newLoc = null;
- boolean changed = false;
- IResource resource = null;
- if (JemProjectUtilities.isBinaryProject(nature.getProject())) {
- resource = getInputJARResource();
- newLoc = resource == null ? null : resource.getLocation();
- }
- if (!objectsEqual(existing, newLoc)) {
- changed = true;
- inputJARLocation = newLoc;
- inputJARProjectRelativePath = resource == null ? null : resource.getProjectRelativePath();
- nature.getResourceSet().setResourceFactoryRegistry((null == inputJARLocation) ? J2EEResourceFactoryRegistry.INSTANCE : J2EEResouceFactorySaxRegistry.INSTANCE);
- }
- return changed;
- }
-
- protected IResource getInputJARResource() {
- IProject project = nature.getProject();
- if (project == null)
- return null;
- List jarPaths = JemProjectUtilities.getLocalJARPathsFromClasspath(project);
- for (int i = 0; i < jarPaths.size(); i++) {
- IPath path = (IPath) jarPaths.get(i);
- IResource resource = project.findMember(path);
- if (resource != null && resource.exists() && (resource instanceof IFile) && isJ2EEArchive(resource))
- return resource;
- }
- return null;
- }
-
- /**
- * @see org.eclipse.emf.ecore.resource.impl.URIConverterImpl#createInputStream(URI)
- */
- public InputStream createInputStream(URI uri) throws IOException {
- if (isBinary())
- return createBinaryInputStream(uri);
- return super.createInputStream(uri);
- }
-
- protected InputStream createBinaryInputStream(URI uri) throws IOException {
- //if it's a primitives doc then let the super implementation handle it
- if (!(((URIConverterImpl.URIMap) getURIMap()).getURI(uri).equals(uri)))
- return super.createInputStream(uri);
- ZipFile zip = null;
- boolean forceClose = true;
- try {
- zip = new ZipFile(inputJARLocation.toOSString());
- InputStream result = searchZipFile(zip, uri.toString());
- if (result == null) {
- throw new FileNotFoundException(uri.toString());
- }
- ZipFileEntryInputStream inputStream = new ZipFileEntryInputStream(result, zip);
- forceClose = false;
- return inputStream;
- } finally {
- //We don't want to close it here, or the IS can't be
- //read; the ZipFileEntryInputStream will do the close
- // when it is closed
- //if (zip != null)
- // zip.close();
-
- //Only close the zip file here if we fail to return an inputstream
- if (forceClose && zip != null) {
- zip.close();
- }
- }
- }
-
- /**
- * For binary projects, this is the file system absolute location of the input JAR
- */
- public IPath getInputJARLocation() {
- return inputJARLocation;
- }
-
- /**
- * For binary projects, this is the project relative location of the input JAR
- */
- public IPath getInputJARProjectRelativePath() {
- return inputJARProjectRelativePath;
- }
-
- protected boolean isBroken() {
- return super.isBroken() && getInputJARLocation() == null;
- }
-
- protected boolean isBinary() {
- return inputJARLocation != null;
- }
-
- /**
- * @see org.eclipse.wst.common.internal.emfworkbench.WorkbenchURIConverterImpl#canGetUnderlyingResource(String)
- */
- public boolean canGetUnderlyingResource(String aFileName) {
- if (isBinary())
- return hasZipEntry(aFileName);
- return super.canGetUnderlyingResource(aFileName);
- }
-
- protected boolean isClasspathChanged(IResourceDelta delta) {
- IResourceDelta child = delta.findMember(new Path(ProjectUtilities.DOT_CLASSPATH));
- return (child != null) && (child.getFlags() != IResourceDelta.MARKERS);
- }
-
- private boolean hasZipEntry(String aFileName) {
- //URI converted = URI.createURI(applyURIMapping(aFileName.toString()));
- //dcb - if normalize is required it should be done prior to this method
- //being called.
- ZipFile zip = null;
- try {
- zip = new ZipFile(inputJARLocation.toOSString());
- return zip.getEntry(aFileName) != null;
- } catch (IOException e) {
- } finally {
- if (zip != null)
- try {
- zip.close();
- } catch (IOException e) {
- }
- }
- return false;
- }
-
- /**
- * This method determines whether there is a ZipEntry whose name is filename in the given
- * ZipFile. If not, it returns null; otherwise, it returns an input source to read from the
- * ZipEntry.
- *
- * @param zip
- * java.util.zip.ZipFile
- * @return java.io.InputSource
- */
- protected InputStream searchZipFile(ZipFile zip, String filename) throws IOException {
- ZipEntry entry = zip.getEntry(filename);
-
- if (entry == null)
- return null;
-
- return zip.getInputStream(entry);
- }
-
- protected boolean shouldNotifyChangedListeners(IResourceDelta delta) {
- if (isClasspathChanged(delta) || super.shouldNotifyChangedListeners(delta)) {
- if (recomputeInputsIfNecessary())
- return true;
- }
- return false;
- }
-
-
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.jst.j2ee/j2eecreation/org/eclipse/jst/j2ee/internal/project/J2EENature.java b/plugins/org.eclipse.jst.j2ee/j2eecreation/org/eclipse/jst/j2ee/internal/project/J2EENature.java
deleted file mode 100644
index bdd9fa551..000000000
--- a/plugins/org.eclipse.jst.j2ee/j2eecreation/org/eclipse/jst/j2ee/internal/project/J2EENature.java
+++ /dev/null
@@ -1,490 +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.project;
-
-
-
-import org.eclipse.core.resources.IContainer;
-import org.eclipse.core.resources.IFolder;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IResourceDelta;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.ecore.resource.ResourceSet;
-import org.eclipse.jem.util.emf.workbench.EMFWorkbenchContextBase;
-import org.eclipse.jem.util.emf.workbench.ISynchronizerExtender;
-import org.eclipse.jem.util.emf.workbench.ProjectResourceSet;
-import org.eclipse.jem.util.emf.workbench.ProjectUtilities;
-import org.eclipse.jem.util.emf.workbench.ResourceSetWorkbenchSynchronizer;
-import org.eclipse.jem.util.emf.workbench.WorkbenchURIConverter;
-import org.eclipse.jst.j2ee.applicationclient.internal.creation.IApplicationClientNatureConstants;
-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.common.impl.J2EEResourceFactoryRegistry;
-import org.eclipse.jst.j2ee.internal.earcreation.IEARNatureConstants;
-import org.eclipse.jst.j2ee.internal.plugin.J2EEPlugin;
-import org.eclipse.wst.common.internal.emfworkbench.integration.EditModel;
-import org.eclipse.wst.common.internal.emfworkbench.integration.EditModelNature;
-import org.eclipse.wst.server.core.IModule;
-
-/**
- * @deprecated
- * Use
- * <p>
- * ArtifactEdit
- * </p>
- *
- */
-public abstract class J2EENature extends EditModelNature implements ISynchronizerExtender {
-
- /** Used to keep documents loaded */
- private EditModel cacheEditModel;
-
- protected IModule module;
- protected int moduleVersion;
-// protected J2EESettings j2eeSettings;
-
- private static final String[] J2EE_NATURE_IDS = {IEJBNatureConstants.NATURE_ID, IEARNatureConstants.NATURE_ID, IWebNatureConstants.J2EE_NATURE_ID, IApplicationClientNatureConstants.NATURE_ID, IConnectorNatureConstants.NATURE_ID};
-
- /**
- * J2EENature constructor comment.
- */
- public J2EENature() {
- }
-
- public abstract String getOverlayIconName();
-
- /**
- * Create the folders for the project we have just created.
- *
- * @exception com.ibm.itp.core.api.resources.CoreException
- * The exception description.
- */
- protected abstract void createFolders() throws CoreException;
-
- protected J2EEWorkbenchURIConverterImpl getJ2EEWorkbenchURIConverter() {
- WorkbenchURIConverter conv = getWorkbenchURIConverter();
- if (conv instanceof J2EEWorkbenchURIConverterImpl)
- return (J2EEWorkbenchURIConverterImpl) conv;
- return null;
- }
-
- /**
- * Return the folder where the meta data documents are stored
- */
- public IFolder getMetaFolder() {
- if (getMetaPath() != null)
- return getProject().getFolder(getMetaPath());
- return null;
- }
-
- /**
- * Return the path to the folder in which meta-data is stored; subclasses should override
- * getMofRoot() and getMetaPathKey()
- */
- protected IPath getMetaPath() {
- IContainer mofRoot = getEMFRoot();
- if (mofRoot == null)
- return null;
- return mofRoot.getProjectRelativePath().append(getMetaPathKey());
- }
-
- protected String getMetaPathKey() {
- return ArchiveConstants.META_INF;
- }
-
- public static J2EENature getRuntime(IProject project, String natureId) {
- if (project == null)
- return null;
- try {
- return (J2EENature) project.getNature(natureId);
- } catch (CoreException e) {
- return null;
- }
- }
-
- public static J2EENature getRuntime(IProject project, String[] possibleNatureIds) {
- if (project != null && project.isAccessible()) {
- for (int i = 0; i < possibleNatureIds.length; i++) {
- J2EENature nature = getRuntime(project, possibleNatureIds[i]);
- if (nature != null)
- return nature;
- }
- }
- return null;
- }
-
-
- /**
- * Answer the root container for the j2ee module, under which the relative path of all resources
- * are equivalent to the uris within a j2ee module JAR file; used for the server to run from
- *
- * The default is to return the IProject itself
- */
- public IContainer getModuleServerRoot() {
- return getProject();
- }
-
-// protected J2EESettings getJ2EESettings() {
-// if (j2eeSettings == null) {
-// j2eeSettings = new J2EESettings(getProject());
-// }
-// return j2eeSettings;
-// }
-
- protected J2EEWorkbenchURIConverterImpl initializeWorbenchURIConverter(ProjectResourceSet set) {
- return new J2EEWorkbenchURIConverterImpl(this, set.getSynchronizer());
- }
-
- /*
- * @deprecated - Use getJ2EEVersion() with J2EEVersionConstants
- * @see IJ2EENature#isJ2EEVersionN() Subclasses should override when they have a nature that can
- * support this specification level.
- */
- public boolean isJ2EE1_3() {
- return getJ2EEVersion() >= J2EEVersionConstants.J2EE_1_3_ID;
- }
-
- /**
- * Primary Contribute to nature
- */
- public void primaryContributeToContext(EMFWorkbenchContextBase aNature) {
- if (emfContext == aNature)
- return;
- emfContext = aNature;
- getEmfContext().setDefaultToMOF5Compatibility(true);
- //Overriding superclass to use our own URI converter, which knows about binary projects
- ProjectResourceSet set = aNature.getResourceSet();
- set.setResourceFactoryRegistry(new J2EEResourceFactoryRegistry());
- WorkbenchURIConverter conv = initializeWorbenchURIConverter(set);
- set.setURIConverter(conv);
- initializeCacheEditModel();
- addAdapterFactories(set);
- set.getSynchronizer().addExtender(this); //added so we can be informed of closes to the
- // project.
- new J2EEResourceDependencyRegister(set); //This must be done after the URIConverter is
- // created.
- }
-
- /**
- * Secondary Contribute to nature
- */
- public void secondaryContributeToContext(EMFWorkbenchContextBase aNature) {
- primaryContributeToContext(aNature);
- }
-
- /**
- * Add Adaptor factories to aContext which is now being used for this nature.
- */
- protected void addAdapterFactories(ResourceSet aSet) {
- // module natures will override
- }
-
- /**
- * Gets the module.
- *
- * @return Returns an IModule
- */
- public IModule getModule() {
- return module;
- }
-
- /**
- * Sets the module.
- *
- * @param module
- * The module to set
- */
- public void setModule(IModule module) {
- this.module = module;
- }
-
- /**
- * This method is used by migration to set the properties of this nature on the on
- * <code>anotherNature</code>. TODO - See if this can be deleted
- */
- public void replaceWith(J2EENature anotherNature) {
- if (anotherNature != null && anotherNature.getDeploymentDescriptorType() == getDeploymentDescriptorType()) {
- //Move EMFNature
- if (emfContext != null) {
- anotherNature.emfContext = emfContext;
- ResourceSetWorkbenchSynchronizer synchronizer = emfContext.getResourceSet().getSynchronizer();
- if (synchronizer != null) {
- synchronizer.removeExtender(this);
- synchronizer.addExtender(anotherNature);
- }
-
- }
- anotherNature.setCacheEditModel(cacheEditModel);
- }
- }
-
- public int getJ2EEVersion() {
- return J2EEVersionConstants.J2EE_1_4_ID;
- }
-
- public String getJ2EEVersionText() {
- switch (getJ2EEVersion()) {
- case J2EEVersionConstants.J2EE_1_2_ID :
- return J2EEVersionConstants.VERSION_1_2_TEXT;
- case J2EEVersionConstants.J2EE_1_3_ID :
- return J2EEVersionConstants.VERSION_1_3_TEXT;
- case J2EEVersionConstants.J2EE_1_4_ID :
- default :
- return J2EEVersionConstants.VERSION_1_4_TEXT;
- }
- }
-
-
- /**
- * @see org.eclipse.jem.internal.java.plugin.AbstractJavaMOFNatureRuntime#primConfigure()
- */
- protected void primConfigure() throws CoreException {
- super.primConfigure();
- // The two builders below are common to all J2EE project types
- // add Validation Builder to Web Projects' builder list
- ProjectUtilities.addToBuildSpec(J2EEPlugin.VALIDATION_BUILDER_ID, project);
- // add LibCopy Builder to Projects' builder list
- // Note: since this is the last nature added, we are assuming it will
- // be after the Java builder. May need to be more explicit about this.
-
- }
-
- /**
- * @return The uri of the dd resource for the J2EE project
- */
- public String getDeploymentDescriptorURI() {
- switch (getDeploymentDescriptorType()) {
- case XMLResource.APPLICATION_TYPE :
- return ArchiveConstants.APPLICATION_DD_URI;
- case XMLResource.APP_CLIENT_TYPE :
- return ArchiveConstants.APP_CLIENT_DD_URI;
- case XMLResource.EJB_TYPE :
- return ArchiveConstants.EJBJAR_DD_URI;
- case XMLResource.RAR_TYPE :
- return ArchiveConstants.RAR_DD_URI;
- case XMLResource.WEB_APP_TYPE :
- return ArchiveConstants.WEBAPP_DD_URI;
- default :
- return null;
- }
- }
-
- /**
- * Return a EMFNature based on the natures that have been configured.
- *
- * @return EMFNature
- * @param project
- * com.ibm.itp.core.api.resources.IProject
- */
- public static J2EENature getRegisteredRuntime(IProject project) {
- return getRuntime(project, J2EE_NATURE_IDS);
- }
-
- /**
- * Return a EMFFNatureID based on the natures that have been configured.
- *
- * @return String
- * @param project
- * com.ibm.itp.core.api.resources.IProject
- */
- public static String getRegisteredRuntimeID(IProject project) {
- String natureID = null;
- J2EENature nature = getRegisteredRuntime(project);
- if (nature != null)
- natureID = nature.getNatureID();
- return natureID;
- }
-
- /**
- * Return a "virtual" archive on this nature's project; used for export
- */
- public abstract Archive asArchive() throws OpenFailureException;
-
- /**
- * Return a "virtual" archive on this nature's project; used for export
- */
- public abstract Archive asArchive(boolean shouldExportSource) throws OpenFailureException;
-
- /**
- * This will be the type of the deployment descriptor docuemnt. Subclasses should override if
- * they have a deployment descriptor.
- *
- * @see XMLResource#APP_CLIENT_TYPE
- * @see XMLResource#APPLICATION_TYPE
- * @see XMLResource#EJB_TYPE
- * @see XMLResource#WEB_APP_TYPE
- * @see XMLResource#RAR_TYPE
- */
- public abstract int getDeploymentDescriptorType();
-
- public abstract EObject getDeploymentDescriptorRoot();
-
- /**
- * @param i
- */
- public void setModuleVersion(int aModuleVersion) throws CoreException {
- if (aModuleVersion == moduleVersion)
- return;
-// To do : Needs rework for flexibile project ModuleCore.getFirstArtifactEditForRead
-// J2EESettings settings = getJ2EESettings();
-// settings.setModuleVersion(aModuleVersion);
-// settings.write();
- moduleVersion = aModuleVersion;
- }
-
- /**
- * Compare with J2EEVersionConstants
- */
- public int getModuleVersion() {
-// To do : Needs rework for flexibile project ModuleCore.getFirstArtifactEditForRead
-
-// if (moduleVersion == 0) {
-// if (getJ2EESettings().getModuleVersion() == 0)
-// try {
-// setModuleVersion(getVersionFromModuleFile());
-// } catch (CoreException e) {
-// Logger.getLogger().logError(e);
-// }
-// }
-// moduleVersion = getJ2EESettings().getModuleVersion();
- moduleVersion =22;
- return moduleVersion;
- }
-
- /**
- * Compare with J2EEVersionConstants
- */
- public String getModuleVersionText() {
- switch (getModuleVersion()) {
- case J2EEVersionConstants.VERSION_1_0 :
- return J2EEVersionConstants.VERSION_1_0_TEXT;
- case J2EEVersionConstants.VERSION_1_1 :
- return J2EEVersionConstants.VERSION_1_1_TEXT;
- case J2EEVersionConstants.VERSION_1_2 :
- return J2EEVersionConstants.VERSION_1_2_TEXT;
- case J2EEVersionConstants.VERSION_1_3 :
- return J2EEVersionConstants.VERSION_1_3_TEXT;
- case J2EEVersionConstants.VERSION_1_4 :
- return J2EEVersionConstants.VERSION_1_4_TEXT;
- case J2EEVersionConstants.VERSION_1_5 :
- return J2EEVersionConstants.VERSION_1_5_TEXT;
- case J2EEVersionConstants.VERSION_2_0 :
- return J2EEVersionConstants.VERSION_2_0_TEXT;
- case J2EEVersionConstants.VERSION_2_1 :
- return J2EEVersionConstants.VERSION_2_1_TEXT;
- case J2EEVersionConstants.VERSION_2_2 :
- return J2EEVersionConstants.VERSION_2_2_TEXT;
- case J2EEVersionConstants.VERSION_2_3 :
- return J2EEVersionConstants.VERSION_2_3_TEXT;
- case J2EEVersionConstants.VERSION_2_4 :
- return J2EEVersionConstants.VERSION_2_4_TEXT;
- case J2EEVersionConstants.VERSION_2_5 :
- return J2EEVersionConstants.VERSION_2_5_TEXT;
- default :
- return "0.0"; //$NON-NLS-1$
- }
- }
-
- /**
- * @return the version from he archive
- */
- protected abstract int getVersionFromModuleFile();
-
- protected void initializeCacheEditModel() {
- setCacheEditModel(createCacheEditModel());
- }
-
- /**
- * Factory method to create a subtype specific edit model; subclasses that wish to keep
- * resources from being removed except when rolling back changes should override this method.
- */
- protected abstract EditModel createCacheEditModel();
-
- /**
- * Insert the method's description here. Creation date: (9/18/2001 11:54:45 AM)
- *
- * @param newCacheEditModel
- * org.eclipse.jst.j2ee.internal.internal.workbench.J2EEEditModel
- */
- protected void setCacheEditModel(EditModel newCacheEditModel) {
- cacheEditModel = newCacheEditModel;
- }
-
- /**
- * Insert the method's description here. Creation date: (9/18/2001 11:54:45 AM)
- *
- * @param newCacheEditModel
- * org.eclipse.jst.j2ee.internal.internal.workbench.J2EEEditModel
- */
- protected EditModel getCacheEditModel() {
- if (emfContext == null)
- // Lazy initialize of the EMF context that will force the cache edit model
- getEmfContext();
- return cacheEditModel;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.wst.common.internal.emfworkbench.ISynchronizerExtender#projectChanged(org.eclipse.core.resources.IResourceDelta)
- */
- public void projectChanged(IResourceDelta delta) {
-
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.wst.common.internal.emfworkbench.ISynchronizerExtender#projectClosed()
- */
- public void projectClosed() {
- this.emfContext = null;
- }
-
- /**
- * Returns a default edit model for the nature
- *
- * @param accessorKey
- * @return
- */
- public abstract J2EEEditModel getJ2EEEditModelForRead(Object accessorKey);
-
- /**
- * Returns a default edit model for the nature
- *
- * @param accessorKey
- * @return
- */
- public abstract J2EEEditModel getJ2EEEditModelForWrite(Object accessorKey);
-
- /**
- * Return the default EditModel id for the specific J2EENature.
- *
- * @return
- */
- public abstract String getEditModelKey();
-
-
- public static J2EEEditModel getEditModelForProject(IProject project, Object accessorKey) {
- if (project == null || !project.isAccessible())
- return null;
- J2EEEditModel editModel = null;
- J2EENature nature = J2EENature.getRegisteredRuntime(project);
- if (nature != null) {
- editModel = nature.getJ2EEEditModelForRead(accessorKey);
- }
- return editModel;
- }
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.jst.j2ee/j2eecreation/org/eclipse/jst/j2ee/internal/project/J2EEProjectUtilities.java b/plugins/org.eclipse.jst.j2ee/j2eecreation/org/eclipse/jst/j2ee/internal/project/J2EEProjectUtilities.java
deleted file mode 100644
index 9664b1f68..000000000
--- a/plugins/org.eclipse.jst.j2ee/j2eecreation/org/eclipse/jst/j2ee/internal/project/J2EEProjectUtilities.java
+++ /dev/null
@@ -1,542 +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.project;
-
-
-import java.io.FileNotFoundException;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import org.eclipse.core.resources.IContainer;
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IFolder;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IProjectDescription;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.NullProgressMonitor;
-import org.eclipse.core.runtime.Path;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.jdt.core.IClasspathEntry;
-import org.eclipse.jdt.core.ICompilationUnit;
-import org.eclipse.jdt.core.IJavaProject;
-import org.eclipse.jdt.core.JavaCore;
-import org.eclipse.jdt.core.JavaModelException;
-import org.eclipse.jem.java.JavaClass;
-import org.eclipse.jem.java.JavaRefFactory;
-import org.eclipse.jem.util.emf.workbench.ProjectUtilities;
-import org.eclipse.jem.util.emf.workbench.WorkbenchByteArrayOutputStream;
-import org.eclipse.jem.util.logger.proxy.Logger;
-import org.eclipse.jem.util.plugin.JEMUtilPlugin;
-import org.eclipse.jem.workbench.utility.JemProjectUtilities;
-import org.eclipse.jst.common.componentcore.util.ComponentUtilities;
-import org.eclipse.jst.j2ee.applicationclient.internal.creation.IApplicationClientNatureConstants;
-import org.eclipse.jst.j2ee.commonarchivecore.internal.Archive;
-import org.eclipse.jst.j2ee.commonarchivecore.internal.EARFile;
-import org.eclipse.jst.j2ee.commonarchivecore.internal.EJBJarFile;
-import org.eclipse.jst.j2ee.commonarchivecore.internal.File;
-import org.eclipse.jst.j2ee.commonarchivecore.internal.exception.OpenFailureException;
-import org.eclipse.jst.j2ee.commonarchivecore.internal.helpers.ArchiveConstants;
-import org.eclipse.jst.j2ee.commonarchivecore.internal.helpers.ArchiveManifest;
-import org.eclipse.jst.j2ee.commonarchivecore.internal.helpers.ArchiveManifestImpl;
-import org.eclipse.jst.j2ee.commonarchivecore.internal.impl.CommonarchiveFactoryImpl;
-import org.eclipse.jst.j2ee.commonarchivecore.internal.util.ArchiveUtil;
-import org.eclipse.jst.j2ee.ejb.EJBJar;
-import org.eclipse.jst.j2ee.ejb.EnterpriseBean;
-import org.eclipse.jst.j2ee.internal.J2EEConstants;
-import org.eclipse.jst.j2ee.internal.earcreation.EAREditModel;
-import org.eclipse.jst.j2ee.internal.earcreation.EARNatureRuntime;
-import org.eclipse.jst.j2ee.internal.earcreation.modulemap.ModuleMapping;
-import org.eclipse.jst.j2ee.internal.earcreation.modulemap.UtilityJARMapping;
-import org.eclipse.jst.j2ee.internal.moduleextension.EarModuleManager;
-import org.eclipse.wst.common.componentcore.ComponentCore;
-import org.eclipse.wst.common.componentcore.resources.IFlexibleProject;
-import org.eclipse.wst.common.componentcore.resources.IVirtualComponent;
-
-public class J2EEProjectUtilities extends ProjectUtilities {
-
- /**
- * @deprecated use {@link ProjectUtilities#isBinaryProject(IProject)}
- */
- public static boolean isBinaryProject(String jarUri, IProject aProject) {
- return JemProjectUtilities.isBinaryProject(aProject);
- }
-
- /**
- * Return the absolute path of a loose archive in a J2EE application or WAR file
- */
- public static IPath getRuntimeLocation(IProject aProject) {
- if (JemProjectUtilities.isBinaryProject(aProject))
- return getBinaryProjectJARLocation(aProject);
- return JemProjectUtilities.getJavaProjectOutputAbsoluteLocation(aProject);
- }
-
- public static IPath getBinaryProjectJARLocation(IProject aProject) {
- List sources = JemProjectUtilities.getLocalJARPathsFromClasspath(aProject);
- if (!sources.isEmpty()) {
- IPath path = (IPath) sources.get(0);
- return aProject.getFile(path).getLocation();
- }
- return null;
- }
-
- public static Archive getClientJAR(EJBJarFile file, EARFile earFile) {
- EJBJar jar = file.getDeploymentDescriptor();
- if (jar == null)
- return null;
- String clientJAR = jar.getEjbClientJar();
- if (clientJAR == null || clientJAR.length() == 0)
- return null;
- String normalized = ArchiveUtil.deriveEARRelativeURI(clientJAR, file.getURI());
- if (normalized != null) {
- try {
- File aFile = earFile.getFile(normalized);
- if (aFile.isArchive() && !aFile.isModuleFile())
- return (Archive) aFile;
- } catch (FileNotFoundException nothingThere) {
- }
- }
- return null;
- // TODO - release the DD here to free up space
- }
-
- /**
- * Append one IClasspathEntry to the build path of the passed project. If a classpath entry
- * having the same path as the parameter already exists, then does nothing.
- */
- public static void appendJavaClassPath(IProject p, IClasspathEntry newEntry) throws JavaModelException {
- IJavaProject javaProject = JemProjectUtilities.getJavaProject(p);
- if (javaProject == null)
- return;
- IClasspathEntry[] classpath = javaProject.getRawClasspath();
- List newPathList = new ArrayList(classpath.length);
- for (int i = 0; i < classpath.length; i++) {
- IClasspathEntry entry = classpath[i];
- // fix dup class path entry for .JETEmitter project
- // Skip the entry to be added if it already exists
- if (Platform.getOS().equals(Platform.OS_WIN32)) {
- if (!entry.getPath().toString().equalsIgnoreCase(newEntry.getPath().toString()))
- newPathList.add(entry);
- else
- return;
- } else {
- if (!entry.getPath().equals(newEntry.getPath()))
- newPathList.add(entry);
- else
- return;
- }
- }
- newPathList.add(newEntry);
- IClasspathEntry[] newClasspath = (IClasspathEntry[]) newPathList.toArray(new IClasspathEntry[newPathList.size()]);
- javaProject.setRawClasspath(newClasspath, new NullProgressMonitor());
- }
-
-
- public static Archive asArchiveFromBinary(String jarUri, IProject aProject) throws OpenFailureException {
- IPath path = getBinaryProjectJARLocation(aProject);
- if (path != null) {
- String location = path.toOSString();
- Archive anArchive = CommonarchiveFactoryImpl.getActiveFactory().primOpenArchive(location);
- anArchive.setURI(jarUri);
- return anArchive;
- }
- return null;
- }
-
- public static EARNatureRuntime[] getReferencingEARProjects(IProject aProject) {
-
- List earProjects = EARNatureRuntime.getAllEARProjectsInWorkbench();
- List result = new ArrayList();
- EAREditModel editModel = null;
- for (int i = 0; i < earProjects.size(); i++) {
- IProject earProject = (IProject) earProjects.get(i);
- EARNatureRuntime earNature = EARNatureRuntime.getRuntime(earProject);
- Object accessorKey = new Object();
- try {
-
- editModel = earNature.getEarEditModelForRead(accessorKey);
- UtilityJARMapping map = editModel.getUtilityJARMapping(aProject);
- if (map != null)
- result.add(earNature);
- else {
- ModuleMapping modMap = editModel.getModuleMapping(aProject);
- if (modMap != null)
- result.add(earNature);
- }
- } finally {
- if (editModel != null)
- editModel.releaseAccess(accessorKey);
- }
- }
- return (EARNatureRuntime[]) result.toArray(new EARNatureRuntime[result.size()]);
- }
-
- public static EARNatureRuntime getFirstReferencingEARProject(IProject aProject) {
- EARNatureRuntime[] natures = getReferencingEARProjects(aProject);
- if (natures.length != 0)
- return natures[0];
- return null;
- }
-
- /**
- * If the project is referenced by the EAR, return the URI of the JAR or module
- *
- * @deprecated use {@link EARNatureRuntime#getJARUri(IProject)}
- */
- public static String getJARUri(EARNatureRuntime runtime, IProject project) {
- return runtime.getJARUri(project);
- }
-
- public static ArchiveManifest readManifest(IFile aFile) {
-
- InputStream in = null;
- try {
-
- if (aFile == null || !aFile.exists())
- return null;
- in = aFile.getContents();
- return new ArchiveManifestImpl(in);
- } catch (Exception ex) {
- org.eclipse.jem.util.logger.proxy.Logger.getLogger().logError(ex);
- return null;
- } finally {
- if (in != null) {
- try {
- in.close();
- } catch (IOException weTried) {
- }
- }
- }
- }
-
-
- public static ArchiveManifest readManifest(IProject p) {
-
- InputStream in = null;
- try {
- IFile aFile = getManifestFile(p);
- if (aFile == null || !aFile.exists())
- return null;
- in = aFile.getContents();
- return new ArchiveManifestImpl(in);
- } catch (Exception ex) {
- org.eclipse.jem.util.logger.proxy.Logger.getLogger().logError(ex);
- return null;
- } finally {
- if (in != null) {
- try {
- in.close();
- } catch (IOException weTried) {
- }
- }
- }
- }
-
- public static IFile getManifestFile(IProject p) {
- IFlexibleProject core = ComponentCore.createFlexibleProject(p);
- IVirtualComponent component = core.getComponents()[0];
- try {
- return ComponentUtilities.findFile(component, new Path(ArchiveConstants.MANIFEST_SHORT_NAME));
- } catch (CoreException ce) {
- Logger.getLogger().log(ce);
- }
- return null;
- }
-
- public static void writeManifest(IProject p, ArchiveManifest manifest) throws java.io.IOException {
-
- IFile aFile = getManifestFile(p);
- if (aFile != null) {
- OutputStream out = new WorkbenchByteArrayOutputStream(aFile);
- manifest.writeSplittingClasspath(out);
- out.close();
- }
- }
-
- public static void writeManifest(IFile aFile, ArchiveManifest manifest) throws java.io.IOException {
- if (aFile != null) {
- OutputStream out = new WorkbenchByteArrayOutputStream(aFile);
- manifest.writeSplittingClasspath(out);
- out.close();
- }
- }
-
-
- public static String getUtilityJARUriInFirstEAR(IProject project) {
- EARNatureRuntime[] earNatures = getReferencingEARProjects(project);
- String uri;
- for (int i = 0; i < earNatures.length; i++) {
- uri = getJARUri(earNatures[i], project);
- if (uri != null && uri.length() > 0)
- return uri;
- }
- return null;
- }
-
- /**
- * Keys are the EJB JAR files and the values are the respective client JARs; includes only key
- * value pairs for which EJB Client JARs are defined and exist.
- *
- * @author schacher
- */
- public static Map collectEJBClientJARs(EARFile earFile) {
- if (earFile == null)
- return Collections.EMPTY_MAP;
- Map ejbClientJARs = null;
- List ejbJARFiles = earFile.getEJBJarFiles();
- Archive clientJAR = null;
- for (int i = 0; i < ejbJARFiles.size(); i++) {
- EJBJarFile ejbJarFile = (EJBJarFile) ejbJARFiles.get(i);
- clientJAR = getClientJAR(ejbJarFile, earFile);
- if (clientJAR != null) {
- if (ejbClientJARs == null)
- ejbClientJARs = new HashMap();
- ejbClientJARs.put(ejbJarFile, clientJAR);
- }
- }
- return ejbClientJARs == null ? Collections.EMPTY_MAP : ejbClientJARs;
- }
-
- public static void makeJ2EENatureFirst(IProject proj) {
- String natureID = J2EENature.getRegisteredRuntimeID(proj);
- if (natureID != null) {
- try {
- IProjectDescription description = proj.getDescription();
- String[] prevNatures = description.getNatureIds();
- String[] newNatures = new String[prevNatures.length];
- newNatures[0] = natureID;
- int next = 1;
- for (int i = 0; i < prevNatures.length; i++) {
- if (!prevNatures[i].equals(natureID))
- newNatures[next++] = prevNatures[i];
- }
- description.setNatureIds(newNatures);
- proj.setDescription(description, null);
- } catch (CoreException e) {
- Logger.getLogger().logError(e);
- }
- }
- }
-
- /**
- * If the project is referenced by the EAR, return the URI of the JAR or module
- */
- public static boolean hasProjectMapping(EARNatureRuntime runtime, IProject project) {
- if (runtime != null) {
- EAREditModel model = null;
- Object key = new Object();
- try {
- model = runtime.getEarEditModelForRead(key);
- ModuleMapping moduleMap = model.getModuleMapping(project);
- if (moduleMap != null) {
- return true;
- }
- UtilityJARMapping jarMap = model.getUtilityJARMapping(project);
- if (jarMap != null)
- return true;
-
- } finally {
- if (model != null)
- model.releaseAccess(key);
- }
- }
- return false;
- }
-
- public static String computeRelativeText(String referencingURI, String referencedURI, EnterpriseBean bean) {
- if (bean == null)
- return null;
-
- String beanName = bean.getName();
- if (beanName == null)
- return null;
-
- String relativeUri = computeRelativeText(referencingURI, referencedURI);
- if (relativeUri == null)
- return beanName;
- return relativeUri + "#" + beanName; //$NON-NLS-1$
- }
-
- public static String computeRelativeText(String referencingURI, String referencedURI) {
- if (referencingURI == null || referencedURI == null)
- return null;
- IPath pPre = new Path(referencingURI);
- IPath pDep = new Path(referencedURI);
- if (pPre.getDevice() != null || pDep.getDevice() != null)
- return null;
- pPre = pPre.makeRelative();
- pDep = pDep.makeRelative(); // referenced Archive path URI
-
- while (pPre.segmentCount() > 1 && pDep.segmentCount() > 1 && pPre.segment(0).equals(pDep.segment(0))) {
- pPre = pPre.removeFirstSegments(1);
- pDep = pDep.removeFirstSegments(1);
- }
-
- IPath result = null; //$NON-NLS-1$
- StringBuffer buf = new StringBuffer();
- String segment = null;
- do {
- segment = pDep.lastSegment();
- pPre = pPre.removeLastSegments(1);
- pDep = pDep.removeLastSegments(1);
- if (segment != null) {
- if (result == null)
- result = new Path(segment);
- else
- result = new Path(segment).append(result);
- }
- if (!pPre.equals(pDep) && !pPre.isEmpty())
- buf.append("../"); //$NON-NLS-1$
- } while (!pPre.equals(pDep));
-
- if (result != null)
- buf.append(result.makeRelative().toString());
-
- return buf.toString();
- }
-
- public static IProject getEJBProjectFromEJBClientProject(IProject ejbClientProject) {
- try {
- if (null != ejbClientProject && ejbClientProject.hasNature(JavaCore.NATURE_ID)) {
- IProject[] allProjects = getAllProjects();
- for (int i = 0; i < allProjects.length; i++) {
- if (null != EarModuleManager.getEJBModuleExtension().getEJBJar(allProjects[i])) {
- if (ejbClientProject == EarModuleManager.getEJBModuleExtension().getDefinedEJBClientJARProject(allProjects[i])) {
- return allProjects[i];
- }
- }
- }
- }
- } catch (CoreException e) {
- }
- return null;
- }
-
-
- public static EnterpriseBean getEnterpriseBean(ICompilationUnit cu) {
- IProject proj = cu.getJavaProject().getProject();
- EJBJar jar = EarModuleManager.getEJBModuleExtension().getEJBJar(proj);
- if (null == jar) {
- jar = EarModuleManager.getEJBModuleExtension().getEJBJar(getEJBProjectFromEJBClientProject(proj));
- }
- if (jar != null) {
- int index = cu.getElementName().indexOf('.');
- String className = cu.getElementName();
- if (index > 0)
- className = className.substring(0, index);
- JavaClass javaClass = (JavaClass) JavaRefFactory.eINSTANCE.reflectType(cu.getParent().getElementName(), className, jar.eResource().getResourceSet());
- return jar.getEnterpriseBeanWithReference(javaClass);
- }
- return null;
- }
-
- public static IContainer getSourceFolderOrFirst(IProject p, String defaultSourceName) {
- try {
- IPath sourcePath = getSourcePathOrFirst(p, defaultSourceName);
- if (sourcePath == null)
- return null;
- else if (sourcePath.isEmpty())
- return p;
- else
- return p.getFolder(sourcePath);
- } catch (IllegalArgumentException ex) {
- return null;
- }
- }
-
- public static IPath getSourcePathOrFirst(IProject p, String defaultSourceName) {
- IJavaProject javaProj = JemProjectUtilities.getJavaProject(p);
- if (javaProj == null)
- return null;
- IClasspathEntry[] cp = null;
- try {
- cp = javaProj.getRawClasspath();
- } catch (JavaModelException ex) {
- JEMUtilPlugin.getLogger().logError(ex);
- return null;
- }
- IClasspathEntry firstSource = null;
- IPath defaultSourcePath = null;
- if (defaultSourceName != null)
- defaultSourcePath = createPath(p, defaultSourceName);
- boolean found = false;
- for (int i = 0; i < cp.length; i++) {
- if (cp[i].getEntryKind() == IClasspathEntry.CPE_SOURCE) {
- // check if it contains /META-INF/MANIFEST.MF
- IPath sourceFolderPath = cp[i].getPath().removeFirstSegments(1);
- IFolder sourceFolder = p.getFolder(sourceFolderPath);
- if (isSourceFolderAnInputContainer(sourceFolder)) {
- found = true;
- if (firstSource == null) {
- firstSource = cp[i];
- if (defaultSourcePath == null)
- break;
- }
- if (cp[i].getPath().equals(defaultSourcePath))
- return defaultSourcePath.removeFirstSegments(1);
- }
- }
- }
- if (!found) {
- for (int i = 0; i < cp.length; i++) {
- if (cp[i].getEntryKind() == IClasspathEntry.CPE_SOURCE) {
- if (firstSource == null) {
- firstSource = cp[i];
- if (defaultSourcePath == null)
- break;
- }
- if (cp[i].getPath().equals(defaultSourcePath))
- return defaultSourcePath.removeFirstSegments(1);
- }
- }
- }
- if (firstSource == null)
- return null;
- if (firstSource.getPath().segment(0).equals(p.getName()))
- return firstSource.getPath().removeFirstSegments(1);
- return null;
- }
-
- public static boolean isSourceFolderAnInputContainer(IFolder sourceFolder) {
- IContainer parent = sourceFolder;
- while (true) {
- parent = parent.getParent();
- if (parent == null)
- return false;
- if (parent instanceof IProject)
- break;
- }
- IProject project = (IProject) parent;
- try {
- if (!project.isAccessible())
- return false;
-
- IProjectDescription desc = project.getDescription();
- if (desc.hasNature(IEJBNatureConstants.NATURE_ID)) {
- return sourceFolder.findMember(J2EEConstants.EJBJAR_DD_URI) != null;
- } else if (desc.hasNature(IApplicationClientNatureConstants.NATURE_ID)) {
- return sourceFolder.findMember(J2EEConstants.APP_CLIENT_DD_URI) != null;
- } else if (desc.hasNature(IWebNatureConstants.J2EE_NATURE_ID)) {
- return sourceFolder.findMember(J2EEConstants.WEBAPP_DD_URI) != null;
- } else if (desc.hasNature(IConnectorNatureConstants.NATURE_ID)) {
- return sourceFolder.findMember(J2EEConstants.RAR_DD_URI) != null;
- }
- } catch (CoreException e) {
- e.printStackTrace();
- }
- return false;
- }
-
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.jst.j2ee/j2eecreation/org/eclipse/jst/j2ee/internal/project/J2EEResourceDependencyRegister.java b/plugins/org.eclipse.jst.j2ee/j2eecreation/org/eclipse/jst/j2ee/internal/project/J2EEResourceDependencyRegister.java
deleted file mode 100644
index 61221e1d6..000000000
--- a/plugins/org.eclipse.jst.j2ee/j2eecreation/org/eclipse/jst/j2ee/internal/project/J2EEResourceDependencyRegister.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
- *******************************************************************************/
-/*
- * Created on Jun 28, 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.project;
-
-import org.eclipse.emf.ecore.resource.ResourceSet;
-import org.eclipse.jem.util.emf.workbench.ProjectResourceSet;
-import org.eclipse.wst.common.internal.emf.utilities.ResourceDependencyRegister;
-
-/**
- * @author daberg
- *
- * To change the template for this generated type comment go to Window>Preferences>Java>Code
- * Generation>Code and Comments
- */
-public class J2EEResourceDependencyRegister extends ResourceDependencyRegister implements J2EEWorkbenchURIConverterImpl.InputChangedListener {
- /**
- * @param aResourceSet
- */
- public J2EEResourceDependencyRegister(ProjectResourceSet aResourceSet) {
- super(aResourceSet);
- initializeConverter(aResourceSet);
- }
-
- private void initializeConverter(ResourceSet aResourceSet) {
- if (aResourceSet.getURIConverter() instanceof J2EEWorkbenchURIConverterImpl) {
- J2EEWorkbenchURIConverterImpl converter = (J2EEWorkbenchURIConverterImpl) aResourceSet.getURIConverter();
- converter.addListener(this);
- }
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.jst.j2ee.internal.internal.j2eeproject.J2EEWorkbenchURIConverterImpl.InputChangedListener#inputsChanged(org.eclipse.jst.j2ee.internal.internal.j2eeproject.J2EEWorkbenchURIConverterImpl)
- */
- public void inputsChanged(J2EEWorkbenchURIConverterImpl aConverter) {
- localDependencies.clear();
- initializeLocalDependencies(aConverter);
- }
-
-
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.jst.j2ee/j2eecreation/org/eclipse/jst/j2ee/internal/project/J2EESettings.java b/plugins/org.eclipse.jst.j2ee/j2eecreation/org/eclipse/jst/j2ee/internal/project/J2EESettings.java
deleted file mode 100644
index de63eb6bb..000000000
--- a/plugins/org.eclipse.jst.j2ee/j2eecreation/org/eclipse/jst/j2ee/internal/project/J2EESettings.java
+++ /dev/null
@@ -1,397 +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 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.project;
-
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.InputStreamReader;
-import java.io.StringWriter;
-
-import javax.xml.parsers.DocumentBuilder;
-import javax.xml.parsers.DocumentBuilderFactory;
-import javax.xml.parsers.ParserConfigurationException;
-import javax.xml.transform.OutputKeys;
-import javax.xml.transform.Transformer;
-import javax.xml.transform.TransformerConfigurationException;
-import javax.xml.transform.TransformerException;
-import javax.xml.transform.TransformerFactory;
-import javax.xml.transform.TransformerFactoryConfigurationError;
-import javax.xml.transform.dom.DOMSource;
-import javax.xml.transform.stream.StreamResult;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.jdt.core.JavaModelException;
-import org.eclipse.jdt.internal.core.util.Messages;
-import org.eclipse.jem.util.logger.proxy.Logger;
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-import org.w3c.dom.Node;
-import org.w3c.dom.NodeList;
-import org.w3c.dom.Text;
-import org.xml.sax.InputSource;
-import org.xml.sax.SAXException;
-
-public class J2EESettings {
-
- protected IFile fSettingsFile;
- protected IProject fProject;
- protected Document fDomDocument;
- protected J2EENature nature = null;
- // Version number may not change with every release,
- // only when changes necessitate a new version number
- public static String CURRENT_VERSION = "600"; //$NON-NLS-1$
- public static String VERSION_V4 = "400"; //$NON-NLS-1$
- public static final String ELEMENT_WORKSPACE_VERSION = "version"; //$NON-NLS-1$
-
- public static String J2EE_SETTINGS_FILE_NAME = ".j2ee"; //$NON-NLS-1$
-
- static final String ELEMENT_J2EESETTINGS = "j2eesettings"; //$NON-NLS-1$
- static final String ELEMENT_J2EE_MODULE_VERSION = "moduleversion"; //$NON-NLS-1$
-
- public J2EESettings(IProject project, J2EENature nature) {
- fProject = project;
- this.nature = nature;
- if (getDOMDocument() == null) {
- try {
- createNewDocument();
- } catch (CoreException e) {
- } catch (IOException e) {
- }
- }
- }
-
- public J2EESettings(IProject project, J2EENature nature, IFile webSettings) {
- fProject = project;
- this.nature = nature;
- }
-
- protected void createNewDocument() throws CoreException, IOException {
- StringWriter writer = new StringWriter();
- writer.write("<?xml version=\"1.0\" encoding=\"UTF-8\"?>"); //$NON-NLS-1$
- writer.write("\n"); //$NON-NLS-1$
- writer.write("<j2eesettings version=\""); //$NON-NLS-1$
- writer.write(getCurrentVersion());
- writer.write("\">");//$NON-NLS-1$
- writer.write("\n"); //$NON-NLS-1$
- writer.write("</j2eesettings>"); //$NON-NLS-1$
- writer.write("\n"); //$NON-NLS-1$
-
- InputStream sourceStream = new ByteArrayInputStream(writer.toString().getBytes("UTF8")); //$NON-NLS-1$
- IFile settingsFile = getSettingsFile();
- if (settingsFile.exists())
- settingsFile.setContents(sourceStream, true, true, null);
- else
- settingsFile.create(sourceStream, true, null);
- read();
- }
-
- public J2EESettings(IProject project) {
- fProject = project;
- if (getDOMDocument() == null) {
- try {
- createNewDocument();
- } catch (CoreException e) {
- } catch (IOException e) {
- }
- }
- }
-
- protected Document getDOMDocument() {
- if (fDomDocument == null) {
- try {
- read();
- } catch (IOException e) {
- }
- }
- return fDomDocument;
- }
-
- // Version of getDomDocument for use by import
- protected Document getDOMDocument(IFile webSettings) {
- if (fDomDocument == null) {
- try {
- read(webSettings);
- } catch (IOException e) {
- }
- }
- return fDomDocument;
- }
-
- public String getCurrentVersion() {
- // The following change is needed when the websettings file is
- // deleted from a version 4 workspace Checking for webapplication
- // folder - Otherwise, new projects will not work.
- return CURRENT_VERSION;
- }
-
- protected IFile getSettingsFile() {
- if (fSettingsFile == null) {
- fSettingsFile = fProject.getFile(J2EE_SETTINGS_FILE_NAME);
- }
- return fSettingsFile;
- }
-
- protected void read() throws IOException {
- // This following was changed for Defect 212723 The Util StringReader
- // was changed to the InputStreamReader MAY
- IFile settingsFile = getSettingsFile();
- InputStream inputStream = null;
- InputStreamReader fileStream = null;
- if (settingsFile.exists()) {
- try {
- ClassLoader prevClassLoader = Thread.currentThread().getContextClassLoader();
- try {
- Thread.currentThread().setContextClassLoader(getClass().getClassLoader());
-
- // JZ: fix to defect 240171
- inputStream = settingsFile.getContents(true);
- fileStream = new InputStreamReader(inputStream, "utf-8"); //$NON-NLS-1$
-
- DocumentBuilder parser = DocumentBuilderFactory.newInstance().newDocumentBuilder();
- fDomDocument = parser.parse(new InputSource(fileStream));
- } finally {
- Thread.currentThread().setContextClassLoader(prevClassLoader);
- }
- } catch (JavaModelException e) {
- throw new IOException(Messages.file_badFormat); //$NON-NLS-1$
- } catch (CoreException e) {
- throw new IOException(Messages.file_badFormat); //$NON-NLS-1$
- } catch (SAXException e) {
- throw new IOException(Messages.file_badFormat); //$NON-NLS-1$
- } catch (ParserConfigurationException e) {
- throw new IOException(Messages.file_badFormat); //$NON-NLS-1$
- } finally {
- if (fileStream != null)
- fileStream.close();
- }
- }
- }
-
-
- // Version of read for use by import
- protected void read(IFile settings) throws IOException {
- // This following was changed for Defect 212723 The Util StringReader
- // was changed to the InputStreamReader MAY
- IFile settingsFile = settings;
-
- InputStream inputStream = null;
- InputStreamReader fileStream = null;
- if (settingsFile != null) {
- try {
- ClassLoader prevClassLoader = Thread.currentThread().getContextClassLoader();
- try {
- Thread.currentThread().setContextClassLoader(getClass().getClassLoader());
- inputStream = settingsFile.getContents();
- fileStream = new InputStreamReader(inputStream, "utf-8"); //$NON-NLS-1$
-
- DocumentBuilder parser = DocumentBuilderFactory.newInstance().newDocumentBuilder();
- fDomDocument = parser.parse(new InputSource(fileStream));
- } finally {
- Thread.currentThread().setContextClassLoader(prevClassLoader);
- }
-
- } catch (SAXException e) {
- throw new IOException(Messages.file_badFormat); //$NON-NLS-1$
- } catch (ParserConfigurationException e) {
- throw new IOException(Messages.file_badFormat); //$NON-NLS-1$
- } catch (CoreException ce) {
- ce.printStackTrace();
- } finally {
- if (fileStream != null)
- fileStream.close();
- }
- }
- }
-
- public void write() throws CoreException {
- if (fDomDocument == null)
- return;
-
- ByteArrayOutputStream outStream = new ByteArrayOutputStream();
-
- try {
- TransformerFactory factory = TransformerFactory.newInstance();
- Transformer transformer = factory.newTransformer();
- transformer.setOutputProperty(OutputKeys.INDENT, "yes"); //$NON-NLS-1$
- transformer.transform(new DOMSource(fDomDocument.getDocumentElement()), new StreamResult(outStream));
- } catch (TransformerConfigurationException e) {
- Logger.getLogger().logError(e);
- } catch (TransformerFactoryConfigurationError e) {
- Logger.getLogger().logError(e);
- } catch (TransformerException e) {
- Logger.getLogger().logError(e);
- }
-
- InputStream sourceStream = new ByteArrayInputStream(outStream.toByteArray());
-
- IFile settingsFile = getSettingsFile();
- if (settingsFile.exists())
- settingsFile.setContents(sourceStream, true, true, null);
- else
- settingsFile.create(sourceStream, true, null);
- }
-
- public String getVersion() {
- Document doc = getDOMDocument();
- if (doc == null)
- return null;
-
- Element root = doc.getDocumentElement();
- if (root == null)
- return null;
- if (!root.getNodeName().equalsIgnoreCase(getRootNodeName()))
- return null;
-
- return root.getAttribute(ELEMENT_WORKSPACE_VERSION); //$NON-NLS-1$
- }
-
-
- public void setVersion(String version) {
- Document doc = getDOMDocument();
- if (doc == null)
- return;
-
- Element root = doc.getDocumentElement();
- if (root == null)
- return;
-
- if (!root.getNodeName().equalsIgnoreCase(getRootNodeName()))
- return;
-
- root.setAttribute(ELEMENT_WORKSPACE_VERSION, version); //$NON-NLS-1$
- }
-
- protected void setValue(Element root, String nodeName, String value) {
- Node node = findOrCreateChildNode(root, nodeName);
-
- NodeList childNodes = node.getChildNodes();
-
- if (childNodes.getLength() == 0) {
- Text newText = getDOMDocument().createTextNode(value);
- node.appendChild(newText);
- root.appendChild(node);
- } else {
- for (int i = 0; i < childNodes.getLength(); i++) {
- Node curNode = childNodes.item(i);
- if (curNode.getNodeType() == Node.TEXT_NODE)
- curNode.setNodeValue(value);
- }
- }
- }
-
- protected Node findOrCreateChildNode(Element root, String nodeName) {
- Node node = findChildNode(root, nodeName);
- if (node == null) {
- // If the element does not exist yet, create one.
- node = getDOMDocument().createElement(nodeName);
- root.appendChild(node);
- }
- return node;
- }
-
- protected Element findChildNode(Element parent, String nodeName) {
- NodeList list = parent.getChildNodes();
- int length = list.getLength();
- for (int i = 0; i < length; ++i) {
- Node curNode = list.item(i);
- if (curNode.getNodeType() == Node.ELEMENT_NODE) {
- Element curElement = (Element) curNode;
- if (curElement.getNodeName().equalsIgnoreCase(nodeName))
- return curElement;
- }
- }
- return null;
- }
-
- protected Document getOrCreateDocument() {
- Document doc = getDOMDocument();
- if (doc == null) {
- try {
- createNewDocument();
- doc = getDOMDocument();
- } catch (CoreException e) {
- } catch (IOException e) {
- }
- }
- return doc;
- }
-
- protected Element getRootElement() {
- Document doc = getDOMDocument();
- if (doc == null)
- return null;
-
- Element root = doc.getDocumentElement();
- if (root == null)
- return null;
- if (!root.getNodeName().equalsIgnoreCase(getRootNodeName()))
- return null;
- return root;
- }
-
- protected String getValue(String settingName) {
- Element root = getRootElement();
- if (root == null)
- return null;
- return getNodeValue(root, settingName);
- }
-
- protected String getNodeValue(Element parent, String nodeName) {
- if (parent != null) {
- Element node = findChildNode(parent, nodeName);
- if (node != null)
- return getChildText(node);
- }
- return null;
- }
-
- protected String getChildText(Element node) {
- NodeList list = node.getChildNodes();
- int length = list.getLength();
- for (int i = 0; i < length; ++i) {
- Node curNode = list.item(i);
- if (curNode.getNodeType() == Node.TEXT_NODE) {
- return curNode.getNodeValue();
- }
- }
- return null;
- }
-
- protected void setValue(String nodeName, String value) {
- Document doc = getOrCreateDocument();
- setValue(doc.getDocumentElement(), nodeName, value);
- }
-
- public int getModuleVersion() {
- int version = 0;
- String moduleVer = getValue(ELEMENT_J2EE_MODULE_VERSION);
- if (moduleVer != null)
- version = Integer.valueOf(moduleVer).intValue();
- return version;
- }
-
- public void setModuleVersion(int moduleVersion) {
- Integer holder = new Integer(moduleVersion);
- setValue(ELEMENT_J2EE_MODULE_VERSION, holder.toString());
- }
-
- public String getRootNodeName() {
- return ELEMENT_J2EESETTINGS;
- }
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.jst.j2ee/j2eecreation/org/eclipse/jst/j2ee/internal/project/J2EEWorkbenchURIConverterImpl.java b/plugins/org.eclipse.jst.j2ee/j2eecreation/org/eclipse/jst/j2ee/internal/project/J2EEWorkbenchURIConverterImpl.java
deleted file mode 100644
index ee881ee9b..000000000
--- a/plugins/org.eclipse.jst.j2ee/j2eecreation/org/eclipse/jst/j2ee/internal/project/J2EEWorkbenchURIConverterImpl.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
- **************************************************************************************************/
-package org.eclipse.jst.j2ee.internal.project;
-
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.core.resources.IContainer;
-import org.eclipse.core.resources.IFolder;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.resources.IResourceDelta;
-import org.eclipse.core.resources.IResourceDeltaVisitor;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.emf.ecore.resource.Resource;
-import org.eclipse.jem.util.emf.workbench.ISynchronizerExtender;
-import org.eclipse.jem.util.emf.workbench.ResourceSetWorkbenchSynchronizer;
-import org.eclipse.jem.util.logger.proxy.Logger;
-import org.eclipse.wst.common.internal.emfworkbench.CompatibilityWorkbenchURIConverterImpl;
-
-public class J2EEWorkbenchURIConverterImpl extends CompatibilityWorkbenchURIConverterImpl implements ISynchronizerExtender {
-
- protected J2EENature nature;
- protected List inputChangedListeners;
-
- public interface InputChangedListener {
- void inputsChanged(J2EEWorkbenchURIConverterImpl aConverter);
- }
-
- /**
- * Constructor for J2EEWorkbenchURIConverterImpl.
- */
- public J2EEWorkbenchURIConverterImpl(J2EENature aNature, ResourceSetWorkbenchSynchronizer aSynchronizer) {
- super(aNature.getProject(), aSynchronizer);
- nature = aNature;
- initialize();
- }
-
- protected void initialize() {
- if (resourceSetSynchronizer != null)
- resourceSetSynchronizer.addExtender(this);
- }
-
-
- protected void deNormalize(List resources) {
- for (int i = 0; i < resources.size(); i++) {
- Resource aResource = (Resource) resources.get(i);
- aResource.setURI(deNormalize(aResource.getURI()));
- }
- }
-
- protected void normalize(List resources) {
- for (int i = 0; i < resources.size(); i++) {
- Resource aResource = (Resource) resources.get(i);
- aResource.setURI(normalize(aResource.getURI()));
- }
- }
-
- protected boolean isBroken() {
- return getInputContainer() == null;
- }
-
- /**
- * Gets the nature.
- *
- * @return Returns a IJ2EENature
- */
- public J2EENature getNature() {
- return nature;
- }
-
- /**
- * Sets the nature.
- *
- * @param nature
- * The nature to set
- */
- public void setNature(J2EENature nature) {
- this.nature = nature;
- }
-
- /**
- * @see org.eclipse.wst.common.internal.emfworkbench.ISynchronizerExtender#projectChanged(IResourceDelta)
- */
- public void projectChanged(IResourceDelta delta) {
- if (shouldNotifyChangedListeners(delta))
- notifyInputChangedListeners();
- }
-
- protected boolean shouldNotifyChangedListeners(IResourceDelta delta) {
- if (isInputContainerChanged(delta) || (isBroken() && isFolderAdded(delta)))
- return true;
- return false;
- }
-
- public void addListener(InputChangedListener aListener) {
- if (inputChangedListeners == null)
- inputChangedListeners = new ArrayList();
- inputChangedListeners.add(aListener);
- }
-
- /**
- *
- */
- private void notifyInputChangedListeners() {
- if (inputChangedListeners != null && !inputChangedListeners.isEmpty()) {
- InputChangedListener listener;
- for (int i = 0; i < inputChangedListeners.size(); i++) {
- listener = (InputChangedListener) inputChangedListeners.get(i);
- listener.inputsChanged(this);
- }
- }
- }
-
- protected boolean isFolderAdded(IResourceDelta delta) {
- final boolean[] result = new boolean[1];
- result[0] = false;
- IResourceDeltaVisitor visitor = new IResourceDeltaVisitor() {
- public boolean visit(IResourceDelta aDelta) throws CoreException {
- if (result[0] || (aDelta.getResource() == null))
- return false;
- switch (aDelta.getResource().getType()) {
- case IResource.FOLDER :
- if (aDelta.getKind() == IResourceDelta.ADDED) {
- result[0] = true;
- return false;
- }
- return true;
- default :
- return true;
- }
- }
- };
- try {
- visitor.visit(delta);
- } catch (CoreException core) {
- Logger.getLogger().logError(core);
- }
- return result[0];
- }
-
- protected boolean isInputContainerChanged(IResourceDelta delta) {
- IContainer input = getInputContainer();
- if (input == null)
- return false;
- IResourceDelta child = delta.findMember(input.getProjectRelativePath());
- return (child != null) && (child.getKind() == IResourceDelta.REMOVED || child.getKind() == IResourceDelta.CHANGED);
- }
-
- protected boolean objectsEqual(Object o1, Object o2) {
- if (o1 == null)
- return o2 == null;
- return o1.equals(o2);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.wst.common.internal.emfworkbench.ISynchronizerExtender#projectClosed()
- */
- public void projectClosed() {
- }
-
- public IContainer getInputContainer() {
- List list = getInputContainers();
- if (!list.isEmpty()) {
- for (int i = 0; i < list.size(); i++) {
- IContainer container = (IContainer) list.get(i);
- if (container instanceof IFolder) {
- IFolder sourceFolder = (IFolder) container;
- if (J2EEProjectUtilities.isSourceFolderAnInputContainer(sourceFolder)) {
- return sourceFolder;
- }
- }
- }
- return (IContainer) list.get(0);
- }
- return null;
- }
-
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.jst.j2ee/j2eecreation/org/eclipse/jst/j2ee/internal/project/ManifestFileCreationAction.java b/plugins/org.eclipse.jst.j2ee/j2eecreation/org/eclipse/jst/j2ee/internal/project/ManifestFileCreationAction.java
deleted file mode 100644
index c7d7a2eaa..000000000
--- a/plugins/org.eclipse.jst.j2ee/j2eecreation/org/eclipse/jst/j2ee/internal/project/ManifestFileCreationAction.java
+++ /dev/null
@@ -1,41 +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.project;
-
-import java.io.IOException;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.jem.util.emf.workbench.WorkbenchByteArrayOutputStream;
-
-public class ManifestFileCreationAction {
-
- public static final String MANIFEST_HEADER = "Manifest-Version: 1.0\r\nClass-Path: \r\n\r\n"; //$NON-NLS-1$
-
- /**
- * Constructor for ManifestFileCreationAction.
- */
- public ManifestFileCreationAction() {
- super();
- }
-
- public static void createManifestFile(IFile file, IProject aJ2EEProject) throws CoreException, IOException {
- try {
- WorkbenchByteArrayOutputStream out = new WorkbenchByteArrayOutputStream(file);
- out.write(MANIFEST_HEADER.getBytes());
- out.close();
-
- } catch (IOException ioe) {
- throw ioe;
- }
- }
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.jst.j2ee/j2eecreation/org/eclipse/jst/j2ee/internal/project/ProjectSupportResourceHandler.java b/plugins/org.eclipse.jst.j2ee/j2eecreation/org/eclipse/jst/j2ee/internal/project/ProjectSupportResourceHandler.java
deleted file mode 100644
index 3975d47a0..000000000
--- a/plugins/org.eclipse.jst.j2ee/j2eecreation/org/eclipse/jst/j2ee/internal/project/ProjectSupportResourceHandler.java
+++ /dev/null
@@ -1,65 +0,0 @@
-package org.eclipse.jst.j2ee.internal.project;
-
-/*
- * Licensed Material - Property of IBM (C) Copyright IBM Corp. 2002 - All Rights Reserved. US
- * Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP
- * Schedule Contract with IBM Corp.
- */
-
-/*
- * Licensed Material - Property of IBM (C) Copyright IBM Corp. 2001 - All Rights Reserved. US
- * Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP
- * Schedule Contract with IBM Corp.
- */
-import java.text.MessageFormat;
-import java.util.MissingResourceException;
-import java.util.ResourceBundle;
-
-public class ProjectSupportResourceHandler {
-
- private static ResourceBundle fgResourceBundle;
-
- /**
- * Returns the resource bundle used by all classes in this Project
- */
- public static ResourceBundle getResourceBundle() {
- try {
- return ResourceBundle.getBundle("projectsupport");//$NON-NLS-1$
- } catch (MissingResourceException e) {
- // does nothing - this method will return null and
- // getString(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 String getString(String key, Object[] args, int x) {
-
- return getString(key);
- }
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.jst.j2ee/j2eecreation/org/eclipse/jst/j2ee/internal/project/WTPJETEmitter.java b/plugins/org.eclipse.jst.j2ee/j2eecreation/org/eclipse/jst/j2ee/internal/project/WTPJETEmitter.java
deleted file mode 100644
index 5e23d284f..000000000
--- a/plugins/org.eclipse.jst.j2ee/j2eecreation/org/eclipse/jst/j2ee/internal/project/WTPJETEmitter.java
+++ /dev/null
@@ -1,563 +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 Mar 17, 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.internal.project;
-
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
-import java.io.File;
-import java.io.IOException;
-import java.io.InputStream;
-import java.lang.reflect.Method;
-import java.net.MalformedURLException;
-import java.net.URL;
-import java.net.URLClassLoader;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.StringTokenizer;
-
-import org.eclipse.core.internal.runtime.Assert;
-import org.eclipse.core.resources.IContainer;
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IFolder;
-import org.eclipse.core.resources.IMarker;
-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.IncrementalProjectBuilder;
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.Path;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.core.runtime.SubProgressMonitor;
-import org.eclipse.emf.codegen.CodeGenPlugin;
-import org.eclipse.emf.codegen.jet.JETCompiler;
-import org.eclipse.emf.codegen.jet.JETEmitter;
-import org.eclipse.emf.codegen.jet.JETException;
-import org.eclipse.jdt.core.IClasspathEntry;
-import org.eclipse.jdt.core.IJavaModel;
-import org.eclipse.jdt.core.IJavaProject;
-import org.eclipse.jdt.core.IPackageFragmentRoot;
-import org.eclipse.jdt.core.JavaCore;
-import org.eclipse.jdt.core.JavaModelException;
-import org.eclipse.jdt.internal.core.ClasspathEntry;
-import org.eclipse.jdt.launching.JavaRuntime;
-import org.eclipse.jem.util.logger.proxy.Logger;
-import org.eclipse.jst.j2ee.internal.plugin.J2EEPluginResourceHandler;
-import org.eclipse.osgi.util.ManifestElement;
-import org.osgi.framework.Bundle;
-import org.osgi.framework.Constants;
-
-/**
- * @author schacher, mdelder
- *
- * 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 WTPJETEmitter extends JETEmitter {
-
- private Map variables;
-
- private boolean intelligentLinkingEnabled = false;
-
- private JETCompiler jetCompiler;
-
- /**
- * @param templateURI
- */
- public WTPJETEmitter(String templateURI) {
- super(templateURI);
- }
-
- /**
- * @param templateURIPath
- * @param relativeTemplateURI
- */
- public WTPJETEmitter(String[] templateURIPath, String relativeTemplateURI) {
- super(templateURIPath, relativeTemplateURI);
- }
-
- /**
- * @param templateURI
- * @param classLoader
- */
- public WTPJETEmitter(String templateURI, ClassLoader classLoader) {
- super(templateURI, classLoader);
- }
-
- /**
- * @param templateURIPath
- * @param relativeTemplateURI
- * @param classLoader
- */
- public WTPJETEmitter(String[] templateURIPath, String relativeTemplateURI, ClassLoader classLoader) {
- super(templateURIPath, relativeTemplateURI, classLoader);
- }
-
- /**
- * @param templateURIPath
- * @param relativeTemplateURI
- * @param classLoader
- * @param encoding
- */
- public WTPJETEmitter(String[] templateURIPath, String relativeTemplateURI, ClassLoader classLoader, String encoding) {
- super(templateURIPath, relativeTemplateURI, classLoader, encoding);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.emf.codegen.jet.JETEmitter#initialize(org.eclipse.core.runtime.IProgressMonitor)
- */
- public void initialize(IProgressMonitor progressMonitor) throws JETException {
-
- progressMonitor.beginTask("", 10); //$NON-NLS-1$
- progressMonitor.subTask(CodeGenPlugin.getPlugin().getString("_UI_GeneratingJETEmitterFor_message", new Object[]{templateURI})); //$NON-NLS-1$
-
- try {
- // This ensures that the JRE variables are initialized.
- try {
- JavaRuntime.getDefaultVMInstall();
- } catch (Throwable throwable) {
- // This is kind of nasty to come here.
- URL jreURL = Platform.find(Platform.getBundle("org.eclipse.emf.codegen"),new Path("plugin.xml")); //$NON-NLS-1$ //$NON-NLS-2$
- IPath jrePath = new Path(Platform.asLocalURL(jreURL).getFile());
- jrePath = jrePath.removeLastSegments(1).append(new Path("../../jre/lib/rt.jar")); //$NON-NLS-1$
- if (!jrePath.equals(JavaCore.getClasspathVariable(JavaRuntime.JRELIB_VARIABLE))) {
- JavaCore.setClasspathVariable(JavaRuntime.JRELIB_VARIABLE, jrePath, null);
- }
- }
-
- /*
- * final JETCompiler jetCompiler = templateURIPath == null ? new
- * MyJETCompiler(templateURI, encoding) :
- */
-
- getJetCompiler();
-
- progressMonitor.subTask(CodeGenPlugin.getPlugin().getString("_UI_JETParsing_message", new Object[]{jetCompiler.getResolvedTemplateURI()})); //$NON-NLS-1$
- jetCompiler.parse();
- progressMonitor.worked(1);
-
- ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
- jetCompiler.generate(outputStream);
- final InputStream contents = new ByteArrayInputStream(outputStream.toByteArray());
-
- final IWorkspace workspace = ResourcesPlugin.getWorkspace();
- IJavaModel javaModel = JavaCore.create(ResourcesPlugin.getWorkspace().getRoot());
- if (!javaModel.isOpen()) {
- javaModel.open(new SubProgressMonitor(progressMonitor, 1));
- } else {
- progressMonitor.worked(1);
- }
-
- final IProject project = workspace.getRoot().getProject(getProjectName());
- progressMonitor.subTask(CodeGenPlugin.getPlugin().getString("_UI_JETPreparingProject_message", new Object[]{project.getName()})); //$NON-NLS-1$
-
- IJavaProject javaProject;
- if (!project.exists()) {
- javaProject = createJavaProject(progressMonitor, workspace, project);
-
- initializeJavaProject(progressMonitor, project, javaProject);
-
- javaProject.close();
- } else {
- project.open(new SubProgressMonitor(progressMonitor, 5));
- javaProject = JavaCore.create(project);
- }
-
- IPackageFragmentRoot sourcePackageFragmentRoot = openJavaProjectIfNecessary(progressMonitor, project, javaProject);
-
- String packageName = jetCompiler.getSkeleton().getPackageName();
- StringTokenizer stringTokenizer = new StringTokenizer(packageName, "."); //$NON-NLS-1$
- IProgressMonitor subProgressMonitor = new SubProgressMonitor(progressMonitor, 1);
- subProgressMonitor.beginTask("", stringTokenizer.countTokens() + 4); //$NON-NLS-1$
- subProgressMonitor.subTask(CodeGenPlugin.getPlugin().getString("_UI_CreateTargetFile_message")); //$NON-NLS-1$
- IContainer sourceContainer = (IContainer) sourcePackageFragmentRoot.getCorrespondingResource();
- while (stringTokenizer.hasMoreElements()) {
- String folderName = stringTokenizer.nextToken();
- sourceContainer = sourceContainer.getFolder(new Path(folderName));
- if (!sourceContainer.exists()) {
- ((IFolder) sourceContainer).create(false, true, new SubProgressMonitor(subProgressMonitor, 1));
- }
- }
- IFile targetFile = sourceContainer.getFile(new Path(jetCompiler.getSkeleton().getClassName() + ".java")); //$NON-NLS-1$
- if (!targetFile.exists()) {
- subProgressMonitor.subTask(CodeGenPlugin.getPlugin().getString("_UI_JETCreating_message", new Object[]{targetFile.getFullPath()})); //$NON-NLS-1$
- targetFile.create(contents, true, new SubProgressMonitor(subProgressMonitor, 1));
- } else {
- subProgressMonitor.subTask(CodeGenPlugin.getPlugin().getString("_UI_JETUpdating_message", new Object[]{targetFile.getFullPath()})); //$NON-NLS-1$
- targetFile.setContents(contents, true, true, new SubProgressMonitor(subProgressMonitor, 1));
- }
-
- boolean errors = performBuild(project, subProgressMonitor, targetFile);
-
- if (!errors) {
- loadClass(workspace, project, javaProject, packageName, subProgressMonitor);
- }
-
- subProgressMonitor.done();
- } catch (CoreException exception) {
- throw new JETException(exception);
- } catch (Exception exception) {
- throw new JETException(exception);
- } finally {
- progressMonitor.done();
- }
-
- }
-
- /**
- * @param progressMonitor
- * @param project
- * @param javaProject
- * @return
- * @throws JavaModelException
- */
- protected IPackageFragmentRoot openJavaProjectIfNecessary(IProgressMonitor progressMonitor, final IProject project, IJavaProject javaProject) throws JavaModelException {
- progressMonitor.subTask(CodeGenPlugin.getPlugin().getString("_UI_JETOpeningJavaProject_message", new Object[]{project.getName()})); //$NON-NLS-1$
- javaProject.open(new SubProgressMonitor(progressMonitor, 1));
-
- IPackageFragmentRoot[] packageFragmentRoots = javaProject.getPackageFragmentRoots();
- IPackageFragmentRoot sourcePackageFragmentRoot = null;
- for (int j = 0; j < packageFragmentRoots.length; ++j) {
- IPackageFragmentRoot packageFragmentRoot = packageFragmentRoots[j];
- if (packageFragmentRoot.getKind() == IPackageFragmentRoot.K_SOURCE) {
- sourcePackageFragmentRoot = packageFragmentRoot;
- break;
- }
- }
- return sourcePackageFragmentRoot;
- }
-
- /**
- * @param progressMonitor
- * @param project
- * @param javaProject
- * @throws CoreException
- * @throws JavaModelException
- */
- protected void initializeJavaProject(IProgressMonitor progressMonitor, final IProject project, IJavaProject javaProject) throws CoreException, JavaModelException {
- progressMonitor.subTask(CodeGenPlugin.getPlugin().getString("_UI_JETInitializingProject_message", new Object[]{project.getName()})); //$NON-NLS-1$
- IClasspathEntry classpathEntry = JavaCore.newSourceEntry(new Path("/" + project.getName() + "/src")); //$NON-NLS-1$ //$NON-NLS-2$
-
- IClasspathEntry jreClasspathEntry = JavaCore.newVariableEntry(new Path(JavaRuntime.JRELIB_VARIABLE), new Path(JavaRuntime.JRESRC_VARIABLE), new Path(JavaRuntime.JRESRCROOT_VARIABLE));
-
- List classpath = new ArrayList();
- classpath.add(classpathEntry);
- classpath.add(jreClasspathEntry);
- classpath.addAll(classpathEntries);
-
- IFolder sourceFolder = project.getFolder(new Path("src")); //$NON-NLS-1$
- if (!sourceFolder.exists()) {
- sourceFolder.create(false, true, new SubProgressMonitor(progressMonitor, 1));
- }
- IFolder runtimeFolder = project.getFolder(new Path("runtime")); //$NON-NLS-1$
- if (!runtimeFolder.exists()) {
- runtimeFolder.create(false, true, new SubProgressMonitor(progressMonitor, 1));
- }
-
- IClasspathEntry[] classpathEntryArray = (IClasspathEntry[]) classpath.toArray(new IClasspathEntry[classpath.size()]);
-
- javaProject.setRawClasspath(classpathEntryArray, new SubProgressMonitor(progressMonitor, 1));
-
- javaProject.setOutputLocation(new Path("/" + project.getName() + "/runtime"), new SubProgressMonitor(progressMonitor, 1)); //$NON-NLS-1$ //$NON-NLS-2$
-
- // appended from previous implementation
- createClasspathEntries(project);
- }
-
- /**
- * @param progressMonitor
- * @param workspace
- * @param project
- * @return
- * @throws CoreException
- */
- private IJavaProject createJavaProject(IProgressMonitor progressMonitor, final IWorkspace workspace, final IProject project) throws CoreException {
- IJavaProject javaProject;
- progressMonitor.subTask("JET creating project " + project.getName()); //$NON-NLS-1$
- project.create(new SubProgressMonitor(progressMonitor, 1));
- progressMonitor.subTask(CodeGenPlugin.getPlugin().getString("_UI_JETCreatingProject_message", new Object[]{project.getName()})); //$NON-NLS-1$
- IProjectDescription description = workspace.newProjectDescription(project.getName());
- description.setNatureIds(new String[]{JavaCore.NATURE_ID});
- description.setLocation(null);
- project.open(new SubProgressMonitor(progressMonitor, 1));
- project.setDescription(description, new SubProgressMonitor(progressMonitor, 1));
-
- javaProject = JavaCore.create(project);
- return javaProject;
- }
-
- /**
- * @param workspace
- * @param project
- * @param javaProject
- * @param packageName
- * @param subProgressMonitor
- * @throws JavaModelException
- * @throws MalformedURLException
- * @throws ClassNotFoundException
- * @throws SecurityException
- */
- protected void loadClass(final IWorkspace workspace, final IProject project, IJavaProject javaProject, String packageName, IProgressMonitor subProgressMonitor) throws JavaModelException, MalformedURLException, ClassNotFoundException, SecurityException {
- //IContainer targetContainer =
- // workspace.getRoot().getFolder(javaProject.getOutputLocation());
-
- subProgressMonitor.subTask(CodeGenPlugin.getPlugin().getString("_UI_JETLoadingClass_message", new Object[]{jetCompiler.getSkeleton().getClassName() + ".class"})); //$NON-NLS-1$ //$NON-NLS-2$
-
- // Construct a proper URL for relative lookup.
- //
- URL url = new File(project.getLocation() + "/" + javaProject.getOutputLocation().removeFirstSegments(1) + "/").toURL(); //$NON-NLS-1$ //$NON-NLS-2$
- URLClassLoader theClassLoader = new URLClassLoader(new URL[]{url}, classLoader);
- Class theClass = theClassLoader.loadClass((packageName.length() == 0 ? "" : packageName + ".") + jetCompiler.getSkeleton().getClassName()); //$NON-NLS-1$ //$NON-NLS-2$
- String methodName = jetCompiler.getSkeleton().getMethodName();
- Method[] methods = theClass.getDeclaredMethods();
- for (int i = 0; i < methods.length; ++i) {
- if (methods[i].getName().equals(methodName)) {
- setMethod(methods[i]);
- break;
- }
- }
- }
-
- /**
- * @param project
- * @param subProgressMonitor
- * @param targetFile
- * @return
- * @throws CoreException
- */
- protected boolean performBuild(final IProject project, IProgressMonitor subProgressMonitor, IFile targetFile) throws CoreException {
- subProgressMonitor.subTask(CodeGenPlugin.getPlugin().getString("_UI_JETBuilding_message", new Object[]{project.getName()})); //$NON-NLS-1$
- project.build(IncrementalProjectBuilder.INCREMENTAL_BUILD, new SubProgressMonitor(subProgressMonitor, 1));
-
- IMarker[] markers = targetFile.findMarkers(IMarker.PROBLEM, true, IResource.DEPTH_INFINITE);
- boolean errors = false;
- for (int i = 0; i < markers.length; ++i) {
- IMarker marker = markers[i];
- if (marker.getAttribute(IMarker.SEVERITY, IMarker.SEVERITY_INFO) == IMarker.SEVERITY_ERROR) {
- errors = true;
- subProgressMonitor.subTask(marker.getAttribute(IMarker.MESSAGE) + " : " + (CodeGenPlugin.getPlugin().getString("jet.mark.file.line", new Object[]{targetFile.getLocation(), marker.getAttribute(IMarker.LINE_NUMBER)}))); //$NON-NLS-1$ //$NON-NLS-2$
- }
- }
- return errors;
- }
-
- /**
- * Create the correct classpath entries for the given project
- *
- * @param project
- */
- protected void createClasspathEntries(IProject project) {
- Assert.isNotNull(project, "A valid project is required in order to append to a classpath"); //$NON-NLS-1$
- String variableName = null;
- String pluginId = null;
- for (Iterator variablesKeyIterator = getVariables().keySet().iterator(); variablesKeyIterator.hasNext();) {
- variableName = (String) variablesKeyIterator.next();
- pluginId = (String) getVariables().get(variableName);
- if (hasOutputDirectory(pluginId))
- addLinkedFolderAsLibrary(project, variableName, pluginId);
- else
- addRuntimeJarsAsLibrary(project, pluginId);
- }
- }
-
- /**
- * @param pluginId
- * @return
- */
- protected boolean hasOutputDirectory(String pluginId) {
- Bundle bundle = Platform.getBundle(pluginId);
- URL outputDirectory = Platform.find(bundle,new Path("bin")); //$NON-NLS-1$
- if (outputDirectory == null)
- return false;
- URL installLocation = null;
- try {
- installLocation = Platform.asLocalURL(outputDirectory);
- } catch (IOException e) {
- Logger.getLogger().logWarning(J2EEPluginResourceHandler.getString("Install_Location_Error_", new Object[]{installLocation}) + e); //$NON-NLS-1$
- }
- File outputDirectoryFile = new File(installLocation.getPath());// new File(location);
- return outputDirectoryFile.canRead() && outputDirectoryFile.isDirectory() && outputDirectoryFile.listFiles().length > 0;
- }
-
- /**
- * @param project
- * @param variableName
- * @param pluginId
- */
- protected void addRuntimeJarsAsLibrary(IProject project, String pluginId) {
- ManifestElement[] elements = null;
- Bundle bundle = Platform.getBundle(pluginId);
- try {
- String requires = (String) bundle.getHeaders().get(Constants.BUNDLE_CLASSPATH);
- elements = ManifestElement.parseHeader(Constants.BUNDLE_CLASSPATH, requires);
- } catch (Exception e) {
- Logger.getLogger().logError(e);
- elements = new ManifestElement[0];
- }
- IClasspathEntry entry = null;
- IPath runtimeLibFullPath = null;
- URL fullurl = null;
- for (int i = 0; i < elements.length; i++) {
- String value = elements[i].getValue();
- if (".".equals(value)) //$NON-NLS-1$
- value = "/"; //$NON-NLS-1$
- fullurl = Platform.getBundle(pluginId).getEntry(value);
-
- // fix the problem with leading slash that caused dup classpath entries
- if (fullurl==null) continue;
- try {
- runtimeLibFullPath = new Path(Platform.asLocalURL(fullurl).getPath());
- } catch (Exception e) {
- Logger.getLogger().logError(e);
- }
- //TODO handle jar'ed plugins, this is a hack for now, need to find proper bundle API
- if (bundle.getLocation().endsWith(".jar")) {
- String jarPluginPath = bundle.getLocation().substring(7);
- String installPath = Platform.getInstallLocation().getURL().getPath();
- runtimeLibFullPath = new Path(installPath+"/"+jarPluginPath);
- }
- if (!"jar".equals(runtimeLibFullPath.getFileExtension()) && !"zip".equals(runtimeLibFullPath.getFileExtension()))
- continue;
- entry = new ClasspathEntry(IPackageFragmentRoot.K_BINARY, IClasspathEntry.CPE_LIBRARY, runtimeLibFullPath, ClasspathEntry.INCLUDE_ALL, ClasspathEntry.EXCLUDE_NONE, null,
- null, /* Source attachment root */
- null, /* specific output folder */
- false,
- null,false,ClasspathEntry.NO_EXTRA_ATTRIBUTES); /* is exported ? *///JavaCore.newLibraryEntry(runtimeLibFullPath, null, null);
- try {
- J2EEProjectUtilities.appendJavaClassPath(project, entry);
- } catch (JavaModelException e) {
- Logger.getLogger().logError("Problem appending \"" + entry.getPath() + "\" to classpath of Project \"" + project.getName() + "\"."); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- Logger.getLogger().logError(e);
- }
- }
- }
-
- /**
- * @param progressMonitor
- */
- protected void updateProgress(IProgressMonitor progressMonitor, String key) {
- progressMonitor.subTask(getMessage(key));
- }
-
- /**
- * @param progressMonitor
- */
- protected void updateProgress(IProgressMonitor progressMonitor, String key, Object[] args) {
- progressMonitor.subTask(getMessage(key, args));
- }
-
- protected String getMessage(String key) {
- return CodeGenPlugin.getPlugin().getString(key);
- }
-
- protected String getMessage(String key, Object[] args) {
- return CodeGenPlugin.getPlugin().getString(key, args);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.emf.codegen.jet.JETEmitter#addVariable(java.lang.String, java.lang.String)
- */
- public void addVariable(String variableName, String pluginID) throws JETException {
- if (!isIntelligentLinkingEnabled())
- super.addVariable(variableName, pluginID);
- else {
- getVariables().put(variableName, pluginID);
- IWorkspace workspace = ResourcesPlugin.getWorkspace();
- IProject project = workspace.getRoot().getProject(getProjectName());
- if (project != null && project.exists())
- createClasspathEntries(project);
- }
-
- }
-
- /**
- * @return
- */
- private boolean isIntelligentLinkingEnabled() {
- return intelligentLinkingEnabled;
- }
-
- /**
- * @return
- */
- private Map getVariables() {
- if (variables == null)
- variables = new HashMap();
- return variables;
- }
-
- protected void addLinkedFolderAsLibrary(IProject project, String variableName, String pluginID) {
- try {
- URL outputDirectory = Platform.find(Platform.getBundle(pluginID),new Path("bin")); //$NON-NLS-1$
-// IPluginDescriptor pluginDescriptor = Platform.getPlugin(pluginID).getDescriptor();
-// URL outputDirectory = pluginDescriptor.find(new Path("bin")); //$NON-NLS-1$
- String pathString = Platform.asLocalURL(outputDirectory).getPath();
- if (pathString.endsWith("/")) //$NON-NLS-1$
- pathString = pathString.substring(0, pathString.length() - 1);
- if (pathString.startsWith("/")) //$NON-NLS-1$
- pathString = pathString.substring(1, pathString.length());
- IPath path = new Path(pathString).makeAbsolute();
-
- String binDirectoryVariable = variableName + "_BIN"; //$NON-NLS-1$
- IFolder linkedDirectory = project.getFolder(binDirectoryVariable);
- if (!linkedDirectory.exists()) {
- linkedDirectory.createLink(path, IResource.ALLOW_MISSING_LOCAL, null);
- linkedDirectory.setDerived(true);
- project.refreshLocal(IResource.DEPTH_INFINITE, null);
- }
- IClasspathEntry entry = new ClasspathEntry(IPackageFragmentRoot.K_BINARY, IClasspathEntry.CPE_LIBRARY, linkedDirectory.getFullPath(), ClasspathEntry.INCLUDE_ALL, ClasspathEntry.EXCLUDE_NONE, null, // source
- // attachment
- null, // source attachment root
- null, // custom output location
- false,null,false,ClasspathEntry.NO_EXTRA_ATTRIBUTES);
-
- J2EEProjectUtilities.appendJavaClassPath(project, entry);
-
- } catch (Exception e) {
- Logger.getLogger().logError(e);
- }
- }
-
- /**
- * @param intelligentLinkingEnabled
- * The intelligentLinkingEnabled to set.
- */
- public void setIntelligentLinkingEnabled(boolean intelligentLinkingEnabled) {
- this.intelligentLinkingEnabled = intelligentLinkingEnabled;
- }
-
- protected JETCompiler getJetCompiler() {
- try {
- if (jetCompiler == null) {
- jetCompiler = templateURIPath == null ? new MyJETCompiler(templateURI, encoding) : new MyJETCompiler(templateURIPath, templateURI, encoding);
- }
- } catch (JETException e) {
- Logger.getLogger().logError(e);
- }
- return jetCompiler;
- }
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.jst.j2ee/j2eecreation/org/eclipse/jst/j2ee/internal/project/ZipFileEntryInputStream.java b/plugins/org.eclipse.jst.j2ee/j2eecreation/org/eclipse/jst/j2ee/internal/project/ZipFileEntryInputStream.java
deleted file mode 100644
index 194d7ac6a..000000000
--- a/plugins/org.eclipse.jst.j2ee/j2eecreation/org/eclipse/jst/j2ee/internal/project/ZipFileEntryInputStream.java
+++ /dev/null
@@ -1,45 +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.project;
-
-
-import java.io.FilterInputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.util.zip.ZipFile;
-
-/**
- * This is a special wrapper class that cleans up after itself and closes the zip file when it is
- * closed
- */
-public class ZipFileEntryInputStream extends FilterInputStream {
- protected ZipFile owner;
-
- /**
- * Constructor for ZipFileEntryInputStream.
- *
- * @param in
- */
- public ZipFileEntryInputStream(InputStream in, ZipFile owningZipFile) {
- super(in);
- owner = owningZipFile;
- }
-
-
- /*
- * @see InputStream#close()
- */
- public void close() throws IOException {
- super.close();
- owner.close();
- }
-
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.jst.j2ee/j2eecreation/org/eclipse/jst/j2ee/internal/project/test.jpage b/plugins/org.eclipse.jst.j2ee/j2eecreation/org/eclipse/jst/j2ee/internal/project/test.jpage
deleted file mode 100644
index e69de29bb..000000000
--- a/plugins/org.eclipse.jst.j2ee/j2eecreation/org/eclipse/jst/j2ee/internal/project/test.jpage
+++ /dev/null
diff --git a/plugins/org.eclipse.jst.j2ee/j2eecreation/org/eclipse/jst/j2ee/internal/reference/EJBReferenceCreationOperation.java b/plugins/org.eclipse.jst.j2ee/j2eecreation/org/eclipse/jst/j2ee/internal/reference/EJBReferenceCreationOperation.java
deleted file mode 100644
index 918f8e8dd..000000000
--- a/plugins/org.eclipse.jst.j2ee/j2eecreation/org/eclipse/jst/j2ee/internal/reference/EJBReferenceCreationOperation.java
+++ /dev/null
@@ -1,316 +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 Jan 27, 2004
- *
- * To change the template for this generated file go to
- * Window - Preferences - Java - Code Generation - Code and Comments
- */
-package org.eclipse.jst.j2ee.internal.reference;
-
-import java.lang.reflect.InvocationTargetException;
-
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.NullProgressMonitor;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.jem.util.emf.workbench.ProjectUtilities;
-import org.eclipse.jem.util.logger.proxy.Logger;
-import org.eclipse.jst.j2ee.application.internal.operations.AddUtilityProjectToEARDataModel;
-import org.eclipse.jst.j2ee.application.internal.operations.JavaUtilityComponentCreationOperation;
-import org.eclipse.jst.j2ee.common.CommonFactory;
-import org.eclipse.jst.j2ee.common.Description;
-import org.eclipse.jst.j2ee.common.EJBLocalRef;
-import org.eclipse.jst.j2ee.common.EjbRef;
-import org.eclipse.jst.j2ee.common.EjbRefType;
-import org.eclipse.jst.j2ee.ejb.EJBJar;
-import org.eclipse.jst.j2ee.internal.J2EEVersionConstants;
-import org.eclipse.jst.j2ee.internal.client.impl.ClientFactoryImpl;
-import org.eclipse.jst.j2ee.internal.common.CommonPackage;
-import org.eclipse.jst.j2ee.internal.common.XMLResource;
-import org.eclipse.jst.j2ee.internal.common.operations.JARDependencyDataModel;
-import org.eclipse.jst.j2ee.internal.common.operations.JARDependencyOperation;
-import org.eclipse.jst.j2ee.internal.earcreation.AddUtilityJARMapCommand;
-import org.eclipse.jst.j2ee.internal.earcreation.EARNatureRuntime;
-import org.eclipse.jst.j2ee.internal.moduleextension.EarModuleManager;
-import org.eclipse.jst.j2ee.internal.moduleextension.EjbModuleExtension;
-import org.eclipse.jst.j2ee.internal.project.J2EEModuleNature;
-import org.eclipse.jst.j2ee.internal.project.J2EENature;
-import org.eclipse.jst.j2ee.internal.project.J2EEProjectUtilities;
-import org.eclipse.wst.common.componentcore.internal.operation.ModelModifierOperation;
-import org.eclipse.wst.common.internal.emfworkbench.integration.ModifierHelper;
-
-/**
- * @author dfholttp
- *
- * To change the template for this generated type comment go to Window - Preferences - Java - Code
- * Generation - Code and Comments
- */
-public class EJBReferenceCreationOperation extends ModelModifierOperation {
- protected IProject ownerProject;
- protected IProject targetProject; //referencing project
- protected AddUtilityJARMapCommand addUtilityJarMapCommand = null;
- protected JARDependencyOperation jarDependencyOperation = null;
- protected String refName = null;
- protected String refType = null;
- protected String refHome = null;
- protected String refRemote = null;
- protected String des = null;
- protected String refLink = null;
- protected IProject newClientProject;
-
-
- /**
- * @param dataModel
- */
- public EJBReferenceCreationOperation(EJBReferenceDataModel dataModel) {
- super(dataModel);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.wst.common.internal.emfworkbench.operation.ModelModifierOperation#doInitialize(org.eclipse.core.runtime.IProgressMonitor)
- */
- protected void doInitialize(IProgressMonitor monitor) {
- super.doInitialize(monitor);
- setUpDataForCommand();
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.wst.common.internal.emfworkbench.operation.ModelModifierOperation#postExecuteCommands()
- */
- protected void postExecuteCommands(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
- super.postExecuteCommands(monitor);
- if (jarDependencyOperation != null)
- jarDependencyOperation.run(monitor);
- }
-
- protected void addHelpers() throws CoreException {
- ModifierHelper baseHelper = null;
- if (!operationDataModel.getBooleanProperty(EJBReferenceDataModel.IS_LOCAL))
- baseHelper = createEjbRefHelper();
- else
- baseHelper = createEJBLocalRefHelper();
-
- modifier.addHelper(baseHelper);
-
- if (((EJBReferenceDataModel) operationDataModel).shouldCreateClientJar())
- copyClientJarToEAR(ownerProject);
- updateJARDependencyIfNecessary();
- }
-
- protected ModifierHelper createEJBLocalRefHelper() {
- ModifierHelper helper = new ModifierHelper();
- EJBLocalRef ref = CommonPackage.eINSTANCE.getCommonFactory().createEJBLocalRef();
- ref.setName(refName);
- ref.setType(EjbRefType.get(refType));
- ref.setLocal(refRemote);
- ref.setLocalHome(refHome);
- ref.setLink(refLink);
- Integer version = (Integer) operationDataModel.getProperty(EJBReferenceDataModel.J2EE_VERSION);
- if (version != null && version.intValue() <= J2EEVersionConstants.J2EE_1_3_ID) {
- ref.setDescription(des);
- } else {
- Description descriptionObj = CommonFactory.eINSTANCE.createDescription();
- descriptionObj.setValue(des);
- ref.getDescriptions().add(descriptionObj);
- }
- helper.setOwner((EObject) operationDataModel.getProperty(EJBReferenceDataModel.OWNER));
- helper.setFeature(CommonPackage.eINSTANCE.getJNDIEnvRefsGroup_EjbLocalRefs());
- //TODO:implement in was ext
- //modifier.addHelper(createEJBRefBindingHelper(ref, owner,
- // getEJBModel().getSelectedEnterpriseBean()));
- helper.setValue(ref);
- return helper;
- }
-
- protected ModifierHelper createEjbRefHelper() {
- ModifierHelper helper = new ModifierHelper();
- EjbRef ref = CommonPackage.eINSTANCE.getCommonFactory().createEjbRef();
- ref.setName(refName);
- ref.setType(EjbRefType.get(refType));
- ref.setHome(refHome);
- ref.setRemote(refRemote);
- ref.setLink(refLink);
- helper.setOwner((EObject) operationDataModel.getProperty(EJBReferenceDataModel.OWNER));
-
- Integer version = (Integer) operationDataModel.getProperty(EJBReferenceDataModel.J2EE_VERSION);
- if (version != null && version.intValue() <= J2EEVersionConstants.J2EE_1_3_ID) {
- ref.setDescription(des);
- } else {
- Description descriptionObj = CommonFactory.eINSTANCE.createDescription();
- descriptionObj.setValue(des);
- ref.getDescriptions().add(descriptionObj);
- }
-
- switch (((EJBReferenceDataModel) operationDataModel).getDeploymentDescriptorType()) {
- case XMLResource.APP_CLIENT_TYPE :
- helper.setFeature(ClientFactoryImpl.getPackage().getApplicationClient_EjbReferences());
- break;
- case XMLResource.EJB_TYPE :
- helper.setFeature(CommonPackage.eINSTANCE.getJNDIEnvRefsGroup_EjbRefs());
- break;
- case XMLResource.WEB_APP_TYPE :
- helper.setFeature(CommonPackage.eINSTANCE.getJNDIEnvRefsGroup_EjbRefs());
- break;
- }
- helper.setValue(ref);
- return helper;
- }
-
- private void copyClientJarToEAR(IProject ownerProj) throws CoreException {
- IProject clientProj = newClientProject;
- if (clientProj == null) {
- EjbModuleExtension ejbExt = EarModuleManager.getEJBModuleExtension();
- if (ejbExt == null)
- return;
- clientProj = ejbExt.getDefinedEJBClientJARProject(targetProject);
- if (clientProj == null) {
- JavaUtilityComponentCreationOperation clientOp = ejbExt.createEJBClientJARProject(targetProject);
- clientOp.execute(new NullProgressMonitor(), null);
- clientProj = ejbExt.getDefinedEJBClientJARProject(targetProject);
- }
- setNewClientProject(clientProj);
- }
- if (clientProj != null) {
- J2EENature ownerNature = J2EENature.getRegisteredRuntime(ownerProj);
- if (ownerNature != null && ownerNature instanceof J2EEModuleNature) {
- EARNatureRuntime[] natures = ((J2EEModuleNature) ownerNature).getReferencingEARProjects();
- for (int i = 0; i < natures.length; i++) {
- addUtilityJarIfNecessary(clientProj, natures[i]);
- }
- }
- }
- }
-
- private void addUtilityJarIfNecessary(IProject clientProj, EARNatureRuntime nature) {
- if (!J2EEProjectUtilities.hasProjectMapping(nature, clientProj)) {
- IProject earProject = nature.getProject();
- String clientUri = J2EEProjectUtilities.getUtilityJARUriInFirstEAR(clientProj);
- AddUtilityProjectToEARDataModel uDataModel = AddUtilityProjectToEARDataModel.createAddToEARDataModel(earProject.getName(), clientProj);
- uDataModel.setProperty(AddUtilityProjectToEARDataModel.ARCHIVE_URI, clientUri);
- try {
- runNestedDefaultOperation(uDataModel, new NullProgressMonitor());
- // addUtilityJarMapCommand = new AddUtilityJARMapCommand(earProject, clientUri,
- // clientProj);
- // modifier.addAdditionalCommand(addUtilityJarMapCommand);
- } catch (InvocationTargetException e) {
- Logger.getLogger().logError(e);
- } catch (InterruptedException e) {
- Logger.getLogger().logError(e);
- }
- }
- }
-
- public void updateJARDependencyIfNecessary() {
- if (ownerProject != null && J2EEProjectUtilities.getReferencingEARProjects(ownerProject) != null) {
- //TODO: handle multiple ears
- EARNatureRuntime earNature = J2EEProjectUtilities.getFirstReferencingEARProject(ownerProject);
- if (earNature == null)
- return;
- IProject earProject = earNature.getProject();
- JARDependencyDataModel dataModel = new JARDependencyDataModel();
- dataModel.setProperty(JARDependencyDataModel.PROJECT_NAME, ownerProject.getName());
- dataModel.setIntProperty(JARDependencyDataModel.JAR_MANIPULATION_TYPE, JARDependencyDataModel.JAR_MANIPULATION_ADD);
- dataModel.setProperty(JARDependencyDataModel.EAR_PROJECT_NAME, earProject.getName());
- EjbModuleExtension ejbExt = EarModuleManager.getEJBModuleExtension();
- String clientProjectName = null;
- if (ejbExt != null) {
- EJBJar ejbJar = ejbExt.getEJBJar(targetProject);
- if (ejbJar != null) {
- IProject referencedProject = J2EEProjectUtilities.getProject(ejbJar);
- clientProjectName = ejbJar.getEjbClientJar();
- if (clientProjectName != null && !clientProjectName.equals("")) { //$NON-NLS-1$
- if (newClientProject != null) {
- referencedProject = newClientProject;
- clientProjectName = referencedProject.getName();
- } else {
- clientProjectName = referencedProject.getName();
- }
- } else {
- clientProjectName = referencedProject.getName();
- }
- }
- dataModel.setProperty(JARDependencyDataModel.REFERENCED_PROJECT_NAME, clientProjectName);
- } else {
- dataModel.setProperty(JARDependencyDataModel.REFERENCED_PROJECT_NAME, targetProject.getName());
- }
- jarDependencyOperation = new JARDependencyOperation(dataModel);
- }
- }
-
- private void setUpDataForCommand() {
- ownerProject = ProjectUtilities.getProject((EObject) operationDataModel.getProperty(EJBReferenceDataModel.OWNER));
- targetProject = ProjectUtilities.getProject((EObject) operationDataModel.getProperty(EJBReferenceDataModel.TARGET));
-
- refName = operationDataModel.getStringProperty(EJBReferenceDataModel.REF_NAME);
- refType = operationDataModel.getStringProperty(EJBReferenceDataModel.REF_TYPE);
- if (!operationDataModel.getBooleanProperty(EJBReferenceDataModel.TARGET_IN_DIFFERENT_EAR))
- refLink = operationDataModel.getStringProperty(EJBReferenceDataModel.LINK);
- refHome = operationDataModel.getStringProperty(EJBReferenceDataModel.HOME_INTERFACE);
- refRemote = operationDataModel.getStringProperty(EJBReferenceDataModel.REMOTE_INTERACE);
- des = operationDataModel.getStringProperty(EJBReferenceDataModel.DESCRIPTION);
- }
-
- /**
- * @param project
- */
- public void setNewClientProject(IProject project) {
- newClientProject = project;
- }
-
- //TODO: reimplement in was.ext
- // protected ModifierHelper createEJBRefBindingHelper(EjbRef aRef, EObject owner, EnterpriseBean
- // linkedEjb) {
- // boolean isEJBOwner = owner instanceof EnterpriseBean;
- // boolean isWebOwner = owner instanceof WebApp;
- // IProject linkedProject;
- // boolean hasEJBClientJar, isInDiffEar;
- // if (isEJBOwner || isWebOwner) {
- // linkedProject = ProjectUtilities.getProject(linkedEjb);
- // hasEJBClientJar = EJBNatureRuntime.getRuntime(linkedProject).hasEJBClientJARProject();
- // isInDiffEar = getEJBModel().isInDifferentEAR();
- // }
- //
- // if (aRef == null || owner == null || linkedEjb == null)
- // return null;
- // String jndiName = getJndiName(linkedEjb);
- // if (jndiName == null) {
- // return null;
- // }
- //
- // ModifierHelper modifier = new ModifierHelper();
- // if (isEJBOwner)
- // modifier.setFeature(EjbbndFactoryImpl.getPackage().getEnterpriseBeanBinding_EjbRefBindings());
- // else if (isWebOwner)
- // modifier.setFeature(WebappbndPackage.eINSTANCE.getWebAppBinding_EjbRefBindings());
- // else
- // modifier.setFeature(ClientbndFactoryImpl.getPackage().getApplicationClientBinding_EjbRefs());
- // CommonbndPackage pack = CommonbndFactoryImpl.getPackage();
- // modifier.addAttribute(pack.getEjbRefBinding_BindingEjbRef(), aRef);
- // modifier.addAttribute(pack.getEjbRefBinding_JndiName(), jndiName);
- // if (isEJBOwner) {
- // EnterpriseBeanBinding ejbBinding = EJBBindingsHelper.getEjbBinding((EnterpriseBean) owner);
- // modifier.setOwner(ejbBinding);
- // new JNDINameValueHolder(aRef, jndiName, ejbBinding);
- // } else if (isWebOwner) {
- // WebAppBinding webBinding = WebAppBindingsHelper.getWebAppBinding((WebApp) owner);
- // modifier.setOwner(webBinding);
- // } else
- // modifier.setOwner(ApplicationClientBindingsHelper.getApplicationClientBinding((ApplicationClient)
- // owner));
- // return modifier;
- // }
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.jst.j2ee/j2eecreation/org/eclipse/jst/j2ee/internal/reference/EJBReferenceDataModel.java b/plugins/org.eclipse.jst.j2ee/j2eecreation/org/eclipse/jst/j2ee/internal/reference/EJBReferenceDataModel.java
deleted file mode 100644
index b8c27d42d..000000000
--- a/plugins/org.eclipse.jst.j2ee/j2eecreation/org/eclipse/jst/j2ee/internal/reference/EJBReferenceDataModel.java
+++ /dev/null
@@ -1,617 +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.reference;
-
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.jem.util.emf.workbench.ProjectUtilities;
-import org.eclipse.jst.j2ee.application.Module;
-import org.eclipse.jst.j2ee.applicationclient.internal.creation.IApplicationClientNatureConstants;
-import org.eclipse.jst.j2ee.client.ApplicationClient;
-import org.eclipse.jst.j2ee.ejb.EnterpriseBean;
-import org.eclipse.jst.j2ee.internal.J2EEVersionConstants;
-import org.eclipse.jst.j2ee.internal.application.impl.ApplicationImpl;
-import org.eclipse.jst.j2ee.internal.earcreation.EARNatureRuntime;
-import org.eclipse.jst.j2ee.internal.project.IEJBNatureConstants;
-import org.eclipse.jst.j2ee.internal.project.IWebNatureConstants;
-import org.eclipse.jst.j2ee.internal.project.J2EECreationResourceHandler;
-import org.eclipse.jst.j2ee.internal.project.J2EEModuleNature;
-import org.eclipse.jst.j2ee.internal.project.J2EENature;
-import org.eclipse.jst.j2ee.internal.project.J2EEProjectUtilities;
-import org.eclipse.jst.j2ee.webapplication.WebApp;
-import org.eclipse.wst.common.frameworks.internal.operations.WTPOperation;
-import org.eclipse.wst.common.frameworks.internal.plugin.WTPCommonPlugin;
-
-
-public class EJBReferenceDataModel extends ReferenceDataModel {
- /**
- * Required, type EnterpriseBean
- */
- public static final String TARGET = "EJBReferenceDataModel.TARGET"; //$NON-NLS-1$
- /**
- * Required, type String
- */
- public static final String LOCAL_REMOTE_TYPE = "EJBReferenceDataModel.LOCAL_REMOTE_TYPE"; //$NON-NLS-1$
- /**
- * Required, type Boolean
- */
- public static final String IS_LOCAL = "EJBReferenceDataModel.IS_LOCAL"; //$NON-NLS-1$
- /**
- * Optional, type Boolean
- */
- public static final String TARGET_IN_DIFFERENT_EAR = "EJBReferenceDataModel.TARGET_IN_DIFFERENT_EAR"; //$NON-NLS-1$
-
- /**
- * Required, type String
- */
- public static final String LINK = "EJBReferenceDataModel.LINK"; //$NON-NLS-1$
- /**
- * Required, type String
- */
- public static final String REF_TYPE = "EJBReferenceDataModel.REF_TYPE"; //$NON-NLS-1$
- /**
- * Required, type String
- */
- public static final String HOME_INTERFACE = "EJBReferenceDataModel.HOME_INTERFACE"; //$NON-NLS-1$
- /**
- * Required, type String
- */
- public static final String REMOTE_INTERACE = "EJBReferenceDataModel.REMOTE_INTERACE"; //$NON-NLS-1$
- /**
- * Optional, type String
- */
- public static final String CREATE_VALID_DEFAULT_NAME = "EJBReferenceDataModel.CREATE_VALID_DEFAULT_NAME"; //$NON-NLS-1$
-
- /**
- * Optional, type Boolean
- */
- public static final String IS_DEFAULT_LOCAL_OR_REMOTE = "EJBReferenceDataModel.IS_DEFAULT_LOCAL_OR_REMOTE"; //$NON-NLS-1$
-
- /**
- * Required, type Boolean
- */
- public static final String IN_WORKSPACE = "EJBReferenceDataModel.IN_WORKSPACE"; //$NON-NLS-1$
-
- /**
- * Required, type EAR
- */
- public static final String TARGET_EAR = "EJBReferenceDataModel.TARGET_EAR"; //$NON-NLS-1$
-
- /**
- * Required, type boolean
- */
- public static final String TARGET_ALSO_EXIST_IN_SAME_EAR = "EJBReferenceDataModel.ALSO_EXIST_IN_SAME_EAR"; //$NON-NLS-1$
-
- /**
- * Required, type boolean
- */
- public static final String TARGET_IN_SAME_PROJECT = "EJBReferenceDataModel.TARGET_IN_SAME_PROJECT"; //$NON-NLS-1$
-
- /**
- * Required, type project
- */
- public static final String TARGET_ALSO_IN_EAR = "EJBReferenceDataModel.TARGET_ALSO_IN_EAR"; //$NON-NLS-1$
-
-
-
- public static final String TARGET_AND_SOURCE_HAVE_SAME_EARS = "EJBReferenceDataModel.TARGET_AND_SOURCE_HAVE_SAME_EARS"; //$NON-NLS-1$
-
-
- public static final String EMPTY_STRING = ""; //$NON-NLS-1$
- private static final String LOCAL_STRING = "Local"; //$NON-NLS-1$
- private static final String REMOTE_STRING = "Remote"; //$NON-NLS-1$
-
- protected void init() {
- super.init();
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.wst.common.internal.emfworkbench.operation.EditModelOperationDataModel#initValidBaseProperties()
- */
- protected void initValidBaseProperties() {
- addValidBaseProperty(TARGET);
- addValidBaseProperty(LOCAL_REMOTE_TYPE);
- addValidBaseProperty(IS_LOCAL);
- addValidBaseProperty(TARGET_IN_DIFFERENT_EAR);
- addValidBaseProperty(LINK);
- addValidBaseProperty(REF_TYPE);
- addValidBaseProperty(HOME_INTERFACE);
- addValidBaseProperty(REMOTE_INTERACE);
- addValidBaseProperty(CREATE_VALID_DEFAULT_NAME);
- addValidBaseProperty(IN_WORKSPACE);
- addValidBaseProperty(IS_DEFAULT_LOCAL_OR_REMOTE);
- addValidBaseProperty(TARGET_EAR);
- addValidBaseProperty(TARGET_ALSO_EXIST_IN_SAME_EAR);
- addValidBaseProperty(TARGET_IN_SAME_PROJECT);
- addValidBaseProperty(TARGET_ALSO_IN_EAR);
- addValidBaseProperty(TARGET_AND_SOURCE_HAVE_SAME_EARS);
- super.initValidBaseProperties();
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.jst.j2ee.internal.internal.reference.ReferenceDataModel#doSetProperty(java.lang.String,
- * java.lang.Object)
- */
- protected boolean doSetProperty(String propertyName, Object propertyValue) {
- boolean status = super.doSetProperty(propertyName, propertyValue);
- if (propertyName.equals(OWNER) || propertyName.equals(TARGET)) {
- computeTargetInEAR();
- }
- if (propertyName.equals(TARGET)) {
- if (getBooleanProperty(CREATE_VALID_DEFAULT_NAME)) {
- setProperty(REF_NAME, calculateDefaultName());
- setBooleanProperty(CREATE_VALID_DEFAULT_NAME, true);
- }
- this.setProperty(REF_TYPE, this.calculateRefType());
- notifyDefaultChange(REF_TYPE);
- this.setProperty(LINK, this.calculateLink());
- notifyDefaultChange(LINK);
- // set the default property of interface type if the
- // target is not null
- setProperty(LOCAL_REMOTE_TYPE, getDefaultLocalRemote());
- notifyDefaultChange(LOCAL_REMOTE_TYPE);
- notifyEnablementChange(LOCAL_REMOTE_TYPE);
-
- this.setProperty(HOME_INTERFACE, calculateHomeInterface());
- notifyDefaultChange(HOME_INTERFACE);
- this.setProperty(REMOTE_INTERACE, calculateRemoteInterface());
- notifyDefaultChange(REMOTE_INTERACE);
- } else if (propertyName.equals(REF_NAME)) {
- String val = (propertyValue != null) ? ((String) propertyValue).trim() : EMPTY_STRING;
- if (EMPTY_STRING.equals(val)) {
- setBooleanProperty(CREATE_VALID_DEFAULT_NAME, true);
- } else {
- setBooleanProperty(CREATE_VALID_DEFAULT_NAME, false);
- }
- } else if (propertyName.equals(LOCAL_REMOTE_TYPE)) {
- this.setProperty(IS_LOCAL, this.calculateLocalValue());
- notifyDefaultChange(IS_LOCAL);
- this.setProperty(HOME_INTERFACE, calculateHomeInterface());
- notifyDefaultChange(HOME_INTERFACE);
- this.setProperty(REMOTE_INTERACE, calculateRemoteInterface());
- notifyDefaultChange(REMOTE_INTERACE);
- } else if (propertyName.equals(TARGET_IN_DIFFERENT_EAR)) {
- this.setProperty(LINK, this.calculateLink());
- notifyDefaultChange(LINK);
- } else if (propertyName.equals(IN_WORKSPACE)) {
- if (!getBooleanProperty(IN_WORKSPACE))
- setBooleanProperty(TARGET_IN_DIFFERENT_EAR, true);
- notifyEnablementChange(LOCAL_REMOTE_TYPE);
- /*
- * String defaultLocalRemote = getDefaultLocalRemote(); if
- * (!defaultLocalRemote.equals(this.getStringProperty(LOCAL_REMOTE_TYPE))){
- * setProperty(LOCAL_REMOTE_TYPE,defaultLocalRemote); }
- */
- } else if (propertyName.equals(TARGET_EAR)) {
- setProperty(TARGET, null);
- }
- return status;
- }
-
- /**
- * @return
- */
- private void computeTargetInEAR() {
- if (isSet(OWNER) && isSet(TARGET)) {
- setBooleanProperty(TARGET_ALSO_EXIST_IN_SAME_EAR, false);
- setBooleanProperty(TARGET_IN_SAME_PROJECT, false);
- setProperty(TARGET_ALSO_IN_EAR, null);
- setBooleanProperty(TARGET_AND_SOURCE_HAVE_SAME_EARS, false);
- EnterpriseBean target = (EnterpriseBean) getProperty(TARGET);
- IProject sourceProject = getTargetProject();
- IProject targetProject = J2EEProjectUtilities.getProject(target);
- boolean foundEAR = false;
- if (targetProject.equals(sourceProject)) {
- setBooleanProperty(TARGET_IN_SAME_PROJECT, true);
- setBooleanProperty(TARGET_AND_SOURCE_HAVE_SAME_EARS, true);
- foundEAR = true;
- } else {
- EARNatureRuntime[] sourceEARs = J2EEProjectUtilities.getReferencingEARProjects(sourceProject);
- EARNatureRuntime[] targetEARs = J2EEProjectUtilities.getReferencingEARProjects(targetProject);
- ApplicationImpl app = (ApplicationImpl) getProperty(TARGET_EAR);
- IProject earProject = app != null ? J2EEProjectUtilities.getProject(app) : null;
-
- // this code is for smart creation of client jar
- // if the source and target belongs to all the ears to which
- // either one of them belongs then dont generate the client jar.
- boolean bSameEARsForSourceAndTarget = true;
- if (sourceEARs.length == targetEARs.length) {
- for (int i = 0; bSameEARsForSourceAndTarget && i < sourceEARs.length; i++) {
- boolean bFind = false;
- for (int j = 0; !bFind && j < targetEARs.length; ++j) {
- if (sourceEARs[i] == targetEARs[j])
- bFind = true;
- }
- bSameEARsForSourceAndTarget = bFind;
- }
- } else {
- bSameEARsForSourceAndTarget = false;
- }
-
- if (bSameEARsForSourceAndTarget) {
- foundEAR = true;
- setBooleanProperty(TARGET_AND_SOURCE_HAVE_SAME_EARS, true);
- } else {
- setBooleanProperty(TARGET_AND_SOURCE_HAVE_SAME_EARS, false);
- for (int i = 0; !foundEAR && i < sourceEARs.length; i++) {
- for (int j = 0; !foundEAR && j < targetEARs.length; j++) {
- if (sourceEARs[i] == targetEARs[j]) {
- if (earProject != null) {
- // this is for the Reference UI where the TARGET EAR is set
- // the user is given the warning in this case
- if (sourceEARs[i].getProject() != null && sourceEARs[i].getProject() == earProject)
- foundEAR = true;
- else {
- setBooleanProperty(TARGET_ALSO_EXIST_IN_SAME_EAR, true);
- setProperty(TARGET_ALSO_IN_EAR, sourceEARs[i].getProject());
- }
- } else {
- // for non UI datamodel if only the projects are known we will
- // go by
- // the best case scenario.
- foundEAR = true;
- }
- }
- }
- }
- }
- }
- setBooleanProperty(TARGET_IN_DIFFERENT_EAR, !foundEAR);
- }
- }
-
- protected Object getDefaultProperty(String propertyName) {
- if (propertyName.equals(IS_LOCAL)) {
- return calculateLocalValue();
- }
- if (propertyName.equals(REF_NAME)) {
- return calculateDefaultName();
- }
- if (propertyName.equals(REF_TYPE)) {
- return calculateRefType();
- }
-
- if (propertyName.equals(LOCAL_REMOTE_TYPE)) {
- return getDefaultLocalRemote();
- }
-
- if (propertyName.equals(LINK)) {
- return calculateLink();
- }
- if (propertyName.equals(HOME_INTERFACE)) {
- return calculateHomeInterface();
- }
- if (propertyName.equals(REMOTE_INTERACE)) {
- return calculateRemoteInterface();
- }
- if (propertyName.equals(TARGET_IN_DIFFERENT_EAR)) {
- return Boolean.FALSE;
- }
- if (propertyName.equals(CREATE_VALID_DEFAULT_NAME)) {
- return Boolean.TRUE;
- }
- if (propertyName.equals(IN_WORKSPACE)) {
- return Boolean.TRUE;
- }
-
- if (propertyName.equals(TARGET_ALSO_EXIST_IN_SAME_EAR)) {
- return Boolean.FALSE;
- }
-
- if (propertyName.equals(TARGET_IN_SAME_PROJECT)) {
- return Boolean.FALSE;
- }
-
- if (propertyName.equals(TARGET_ALSO_IN_EAR)) {
- return null;
- }
- return super.getDefaultProperty(propertyName);
- }
-
- /**
- * @return
- */
- private String calculateRemoteInterface() {
- EnterpriseBean targetBean = (EnterpriseBean) getProperty(TARGET);
- if (targetBean != null) {
- if (getBooleanProperty(IS_LOCAL))
- return targetBean.getLocalInterfaceName();
- return targetBean.getRemoteInterfaceName();
- }
- return EMPTY_STRING;
- }
-
- /**
- * @return
- */
- private Object calculateHomeInterface() {
- EnterpriseBean targetBean = (EnterpriseBean) getProperty(TARGET);
- if (targetBean != null) {
- if (getBooleanProperty(IS_LOCAL))
- return targetBean.getLocalHomeInterfaceName();
- return targetBean.getHomeInterfaceName();
- }
- return EMPTY_STRING;
- }
-
- /**
- * @return
- */
- private Object calculateLink() {
- EnterpriseBean targetBean = (EnterpriseBean) getProperty(TARGET);
- if (getBooleanProperty(TARGET_IN_DIFFERENT_EAR))
- return EMPTY_STRING; //$NON-NLS-1$
- if (targetBean != null)
- return computeLink();
- return EMPTY_STRING;
- }
-
- /**
- * @return
- */
- private String calculateRefType() {
- EnterpriseBean targetBean = (EnterpriseBean) getProperty(TARGET);
- return (targetBean != null && targetBean.isEntity()) ? "Entity" : "Session"; //$NON-NLS-1$ //$NON-NLS-2$);
-
- }
-
- /**
- * @return
- */
- private Boolean calculateLocalValue() {
- String type = getStringProperty(LOCAL_REMOTE_TYPE);
- if (type == null)
- return Boolean.TRUE;
- if (type.equals(LOCAL_STRING)) //$NON-NLS-1$
- return Boolean.TRUE;
- return Boolean.FALSE;
- }
-
- protected boolean isTargetJ2EEVersion12() {
- EObject target = (EObject) getProperty(TARGET);
- if (target != null && target instanceof EnterpriseBean) {
- return (((EnterpriseBean) getProperty(TARGET)).getVersionID() <= J2EEVersionConstants.EJB_1_1_ID);
- }
- return false;
- }
-
- private boolean isOwnerJ2EEVersion12() {
- if ((ownerType == EJB_TYPE && ((EnterpriseBean) getProperty(OWNER)).getVersionID() <= J2EEVersionConstants.EJB_1_1_ID) || (ownerType == APP_CLIENT_TYPE && ((ApplicationClient) getProperty(OWNER)).getVersionID() <= J2EEVersionConstants.J2EE_1_2_ID) || (ownerType == WEB_TYPE && ((WebApp) getProperty(OWNER)).getVersionID() <= J2EEVersionConstants.WEB_2_2_ID)) {
- return true;
- }
- return false;
- }
-
- /**
- *
- */
- private String getDefaultLocalRemote() {
- EnterpriseBean target = (EnterpriseBean) getProperty(TARGET);
- String type = REMOTE_STRING; //$NON-NLS-1$
- if (ownerType == APP_CLIENT_TYPE) {
- type = REMOTE_STRING;
- } else if (getBooleanProperty(IN_WORKSPACE)) {
- if (target != null) {
- if (isOwnerJ2EEVersion12()) {
- type = REMOTE_STRING;
- } else if (!getBooleanProperty(TARGET_IN_DIFFERENT_EAR)) {
- if (target.hasLocalClient())
- type = LOCAL_STRING; //$NON-NLS-1$
- else
- type = REMOTE_STRING;
- } else {
- if (target.hasRemoteClient())
- type = REMOTE_STRING; //$NON-NLS-1$
- else
- type = LOCAL_STRING;
- }
- }
- } else
- type = REMOTE_STRING; //$NON-NLS-1$
- return type;
- }
-
-
- /**
- * @return
- */
- private Object calculateDefaultName() {
- EnterpriseBean targetBean = (EnterpriseBean) getProperty(TARGET);
- if (targetBean != null) {
- if (getBooleanProperty(CREATE_VALID_DEFAULT_NAME))
- return calculateUniqueDefaultName(targetBean.getName());
- return "ejb/" + targetBean.getName(); //$NON-NLS-1$
- }
- return null;
- }
-
- /**
- * @return
- */
- private Object calculateUniqueDefaultName(String beanName) {
- String refName = "ejb/" + beanName; //$NON-NLS-1$
- if (validateReferenceDoesNotExist(refName)) {
- return refName;
- }
- for (int i = 1; i < 20; i++) {
- refName = "ejb/" + beanName + "_" + i; //$NON-NLS-1$ //$NON-NLS-2$
- if (validateReferenceDoesNotExist(refName))
- return refName;
- }
- return refName;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.jst.j2ee.internal.internal.reference.ReferenceDataModel#doValidateProperty(java.lang.String)
- */
- protected IStatus doValidateProperty(String propertyName) {
- IStatus status = super.doValidateProperty(propertyName);
- if (status.isOK()) {
- if (propertyName.equals(TARGET) && getBooleanProperty(IN_WORKSPACE)) {
- Object target = getProperty(TARGET);
- if (target == null || !(target instanceof EnterpriseBean))
- return WTPCommonPlugin.createErrorStatus(J2EECreationResourceHandler.getString("EJBReferenceDataModel_UI_12")); //$NON-NLS-1$
- else if (!getBooleanProperty(TARGET_IN_SAME_PROJECT) && getBooleanProperty(TARGET_IN_DIFFERENT_EAR) && getBooleanProperty(TARGET_ALSO_EXIST_IN_SAME_EAR)) {
- IProject ownerProject = getOwnerProject();
- IProject project = (IProject) getProperty(TARGET_ALSO_IN_EAR);
- if (project != null && ownerProject != null) {
- EARNatureRuntime earRuntime = EARNatureRuntime.getRuntime(project);
- return WTPCommonPlugin.createWarningStatus(J2EECreationResourceHandler.getString("TARGET_ALSO_EXIST_IN_SAME_EAR", new String[]{earRuntime.getApplication().getDisplayName(), ownerProject.getName()})); //$NON-NLS-1$
- }
-
- }
- } else if (propertyName.equals(LOCAL_REMOTE_TYPE)) {
- if (ownerType == APP_CLIENT_TYPE && getBooleanProperty(IS_LOCAL)) {
- return WTPCommonPlugin.createErrorStatus(J2EECreationResourceHandler.getString("APP_CLIENT_ONLY_HAVE_REMOTE")); //$NON-NLS-1$
- } else if (isOwnerJ2EEVersion12() && getBooleanProperty(IS_LOCAL)) {
- return WTPCommonPlugin.createErrorStatus(J2EECreationResourceHandler.getString("J2EE_1_2_ONLY_HAVE_REMOTE")); //$NON-NLS-1$
- } else if (getBooleanProperty(IS_LOCAL) && (!getBooleanProperty(IN_WORKSPACE) || getBooleanProperty(TARGET_IN_DIFFERENT_EAR))) {
- return WTPCommonPlugin.createWarningStatus(J2EECreationResourceHandler.getString("USE_REMOTE_FOR_DIFFERENT_EAR")); //$NON-NLS-1$
- } else if (!getBooleanProperty(IS_LOCAL) && getBooleanProperty(IN_WORKSPACE) && !getBooleanProperty(TARGET_IN_DIFFERENT_EAR) && ownerType != APP_CLIENT_TYPE && !this.isOwnerJ2EEVersion12() && !this.isTargetJ2EEVersion12()) {
- EnterpriseBean target = (EnterpriseBean) getProperty(TARGET);
- if (target.getVersionID() > J2EEVersionConstants.EJB_1_1_ID)
- return WTPCommonPlugin.createWarningStatus(J2EECreationResourceHandler.getString("USE_LOCAL_FOR_DIFFERENT_EAR")); //$NON-NLS-1$
- }
- } else if ((propertyName.equals(HOME_INTERFACE) && (getProperty(HOME_INTERFACE) == null || getStringProperty(HOME_INTERFACE).length() == 0)) || (propertyName.equals(REMOTE_INTERACE) && (getProperty(REMOTE_INTERACE) == null || getStringProperty(REMOTE_INTERACE).length() == 0))) {
- if (getBooleanProperty(IN_WORKSPACE)) {
- if (getBooleanProperty(IS_LOCAL)) {
- return WTPCommonPlugin.createErrorStatus(J2EECreationResourceHandler.getString("EJBReferenceDataModel_UI_10")); //$NON-NLS-1$
- }
- return WTPCommonPlugin.createErrorStatus(J2EECreationResourceHandler.getString("EJBReferenceDataModel_UI_11")); //$NON-NLS-1$
- }
- if (getBooleanProperty(IS_LOCAL)) {
- if (propertyName.equals(HOME_INTERFACE))
- return WTPCommonPlugin.createErrorStatus(J2EECreationResourceHandler.getString("Local_home_cannot_be_empty_UI_")); //$NON-NLS-1$
- return WTPCommonPlugin.createErrorStatus(J2EECreationResourceHandler.getString("Local_cannot_be_empty_UI_")); //$NON-NLS-1$
- }
- if (propertyName.equals(HOME_INTERFACE))
- return WTPCommonPlugin.createErrorStatus(J2EECreationResourceHandler.getString("Home_cannot_be_empty_UI_")); //$NON-NLS-1$
- return WTPCommonPlugin.createErrorStatus(J2EECreationResourceHandler.getString("Remote_cannot_be_empty_UI_")); //$NON-NLS-1$
-
- }
- }
- return status;
- }
-
- public String computeLink() {
- EnterpriseBean targetBean = (EnterpriseBean) getProperty(TARGET);
- if (targetBean == null)
- return EMPTY_STRING; //$NON-NLS-1$
- IProject targetModuleProject = ProjectUtilities.getProject(targetBean.getEjbJar());
- if (targetModuleProject == null)
- return EMPTY_STRING; //$NON-NLS-1$
-
- IProject ownerProject = getOwnerProject();
- if (targetModuleProject.equals(ownerProject)) {
- return targetBean.getName();
- }
- if ((ownerType == EJB_TYPE && ((EnterpriseBean) getProperty(OWNER)).getVersionID() <= J2EEVersionConstants.EJB_1_1_ID) || (ownerType == APP_CLIENT_TYPE && ((ApplicationClient) getProperty(OWNER)).getVersionID() == J2EEVersionConstants.J2EE_1_2_ID)) {
- return targetBean.getName();
- }
- return calculateLinkForEARRelativeBean(targetBean, ownerProject, targetModuleProject);
- }
-
- /**
- * @return
- */
- public IProject getOwnerProject() {
- IProject ownerProject = null;
- if (ownerType == EJB_TYPE) {
- EnterpriseBean ownerBean = (EnterpriseBean) getProperty(OWNER);
- ownerProject = ProjectUtilities.getProject(ownerBean.getEjbJar());
- } else if (ownerType == APP_CLIENT_TYPE || ownerType == WEB_TYPE) {
- ownerProject = ProjectUtilities.getProject(getProperty(OWNER));
- }
- return ownerProject;
- }
-
- private String calculateLinkForEARRelativeBean(EnterpriseBean bean, IProject ownerProject, IProject targetModuleProject) {
- J2EEModuleNature targetNature = (J2EEModuleNature) J2EENature.getRuntime(targetModuleProject, IEJBNatureConstants.NATURE_ID);
- if (targetNature == null)
- return EMPTY_STRING; //$NON-NLS-1$
- EARNatureRuntime[] runtimes = targetNature.getReferencingEARProjects();
- if (runtimes.length < 1)
- return EMPTY_STRING; //$NON-NLS-1$
- Module targetModule = runtimes[0].getModule(targetModuleProject);
-
- J2EEModuleNature ownerNature = null;
- Module ownerModule = null;
- if (ownerType == EJB_TYPE) {
- ownerNature = (J2EEModuleNature) J2EEModuleNature.getRuntime(ownerProject, IEJBNatureConstants.NATURE_ID);
- } else if (ownerType == APP_CLIENT_TYPE) {
- ownerNature = (J2EEModuleNature) J2EEModuleNature.getRuntime(ownerProject, IApplicationClientNatureConstants.NATURE_ID);
- } else if (ownerType == WEB_TYPE) {
- ownerNature = (J2EEModuleNature) J2EEModuleNature.getRuntime(ownerProject, IWebNatureConstants.J2EE_NATURE_ID);
- }
- if (ownerNature == null)
- return EMPTY_STRING; //$NON-NLS-1$
- runtimes = ownerNature.getReferencingEARProjects();
- if (runtimes.length < 1)
- return EMPTY_STRING; //$NON-NLS-1$
- ownerModule = runtimes[0].getModule(ownerProject);
-
- if (ownerModule == null || targetModule == null)
- return EMPTY_STRING; //$NON-NLS-1$
- return J2EEProjectUtilities.computeRelativeText(ownerModule.getUri(), targetModule.getUri(), bean);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.wst.common.frameworks.internal.operation.WTPOperationDataModel#getDefaultOperation()
- */
- public WTPOperation getDefaultOperation() {
- return new EJBReferenceCreationOperation(this);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.wst.common.frameworks.internal.operation.WTPOperationDataModel#basicIsEnabled(java.lang.String)
- */
- protected Boolean basicIsEnabled(String propertyName) {
- if (propertyName.equals(LOCAL_REMOTE_TYPE)) {
- if (this.getBooleanProperty(IN_WORKSPACE)) {
- if (getProperty(TARGET) == null)
- return Boolean.FALSE;
- else if (ownerType == APP_CLIENT_TYPE || isOwnerJ2EEVersion12() || isTargetJ2EEVersion12())
- return Boolean.FALSE;
- else
- return Boolean.TRUE;
- }
- if (ownerType == APP_CLIENT_TYPE || isOwnerJ2EEVersion12())
- return Boolean.FALSE;
- return Boolean.TRUE;
- }
- return super.basicIsEnabled(propertyName);
- }
-
- public boolean shouldCreateClientJar() {
- boolean isInWorkspace = getBooleanProperty(IN_WORKSPACE);
- boolean isInSameProject = getBooleanProperty(TARGET_IN_SAME_PROJECT);
- boolean isTargetAndSourceHaveSameEars = getBooleanProperty(TARGET_AND_SOURCE_HAVE_SAME_EARS);
- if (isInWorkspace) {
- if (isInSameProject)
- return false;
- else if (isTargetAndSourceHaveSameEars)
- return false;
- else
- return true;
- }
- return false;
- }
-
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.jst.j2ee/j2eecreation/org/eclipse/jst/j2ee/internal/reference/MessageDestReferenceCreationOperation.java b/plugins/org.eclipse.jst.j2ee/j2eecreation/org/eclipse/jst/j2ee/internal/reference/MessageDestReferenceCreationOperation.java
deleted file mode 100644
index 5ef5fdc3c..000000000
--- a/plugins/org.eclipse.jst.j2ee/j2eecreation/org/eclipse/jst/j2ee/internal/reference/MessageDestReferenceCreationOperation.java
+++ /dev/null
@@ -1,144 +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 Mar 24, 2004
- *
- * To change the template for this generated file go to Window - Preferences - Java - Code
- * Generation - Code and Comments
- */
-package org.eclipse.jst.j2ee.internal.reference;
-
-import org.eclipse.emf.ecore.EAttribute;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.jst.j2ee.common.CommonFactory;
-import org.eclipse.jst.j2ee.common.Description;
-import org.eclipse.jst.j2ee.common.MessageDestination;
-import org.eclipse.jst.j2ee.common.MessageDestinationRef;
-import org.eclipse.jst.j2ee.common.MessageDestinationUsageType;
-import org.eclipse.jst.j2ee.ejb.AssemblyDescriptor;
-import org.eclipse.jst.j2ee.ejb.EjbFactory;
-import org.eclipse.jst.j2ee.ejb.EnterpriseBean;
-import org.eclipse.jst.j2ee.ejb.MessageDriven;
-import org.eclipse.jst.j2ee.internal.client.impl.ClientFactoryImpl;
-import org.eclipse.jst.j2ee.internal.common.CommonPackage;
-import org.eclipse.jst.j2ee.internal.common.XMLResource;
-import org.eclipse.jst.j2ee.internal.ejb.EjbPackage;
-import org.eclipse.jst.j2ee.internal.webapplication.WebapplicationPackage;
-import org.eclipse.wst.common.componentcore.internal.operation.ModelModifierOperation;
-import org.eclipse.wst.common.internal.emfworkbench.integration.ModifierHelper;
-
-
-public class MessageDestReferenceCreationOperation extends ModelModifierOperation {
- MessageDestReferenceDataModel dataModel = null;
-
- /**
- * @param dataModel
- */
- public MessageDestReferenceCreationOperation(MessageDestReferenceDataModel dataModel) {
- super(dataModel);
- this.dataModel = dataModel;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.wst.common.internal.emfworkbench.operation.ModelModifierOperation#addHelpers()
- */
- protected void addHelpers() {
- if (dataModel != null) {
- ModifierHelper baseHelper = createHelpers();
- modifier.addHelper(baseHelper);
- if (!dataModel.getBooleanProperty(MessageDestReferenceDataModel.HAS_LINK)) {
- modifier.addHelper(createMessageDestination());
- modifier.addHelper(createMDBLinkHelper());
- }
- }
- }
-
- /*
- * @see SimpleCommandWizardPage#createCommandHelper()
- */
- public ModifierHelper createHelpers() {
- ModifierHelper helper = null;
- helper = new ModifierHelper();
- MessageDestinationRef ref = CommonFactory.eINSTANCE.createMessageDestinationRef();
- helper.setOwner((EObject) dataModel.getProperty(MessageDestReferenceDataModel.OWNER));
- ref.setName(dataModel.getStringProperty(MessageDestReferenceDataModel.REF_NAME).trim());
- ref.setType(dataModel.getStringProperty(MessageDestReferenceDataModel.TYPE).trim());
- ref.setUsage(MessageDestinationUsageType.get(dataModel.getStringProperty(MessageDestReferenceDataModel.USAGE).trim()));
- ref.setLink(dataModel.getStringProperty(MessageDestReferenceDataModel.LINK));
- Description descriptionObj = CommonFactory.eINSTANCE.createDescription();
- descriptionObj.setValue(dataModel.getStringProperty(MessageDestReferenceDataModel.DESCRIPTION));
- ref.getDescriptions().add(descriptionObj);
-
- switch (dataModel.getDeploymentDescriptorType()) {
- case XMLResource.APP_CLIENT_TYPE :
- helper.setFeature(ClientFactoryImpl.getPackage().getApplicationClient_MessageDestinationRefs());
- break;
- case XMLResource.EJB_TYPE :
- helper.setFeature(CommonPackage.eINSTANCE.getJNDIEnvRefsGroup_MessageDestinationRefs());
- break;
- case XMLResource.WEB_APP_TYPE :
- helper.setFeature(CommonPackage.eINSTANCE.getJNDIEnvRefsGroup_MessageDestinationRefs());
- break;
- }
- helper.setValue(ref);
-
- return helper;
- }
-
- /**
- * @return
- */
- private ModifierHelper createMDBLinkHelper() {
- ModifierHelper helper = new ModifierHelper();
- MessageDriven mdb = (MessageDriven) dataModel.getProperty(MessageDestReferenceDataModel.TARGET);
- helper.setOwner(mdb);
- EAttribute link = EjbPackage.eINSTANCE.getMessageDriven_Link();
- helper.setFeature(link);
- helper.setValue(dataModel.getStringProperty(MessageDestReferenceDataModel.LINK));
- return helper;
- }
-
- /**
- * @return
- */
- private ModifierHelper createMessageDestination() {
- ModifierHelper helper = new ModifierHelper();
- MessageDestination dest = CommonFactory.eINSTANCE.createMessageDestination();
- dest.setName(dataModel.getStringProperty(MessageDestReferenceDataModel.LINK));
- switch (dataModel.getDeploymentDescriptorType()) {
- case XMLResource.APP_CLIENT_TYPE :
- helper.setFeature(ClientFactoryImpl.getPackage().getApplicationClient_MessageDestinations());
- helper.setOwner((EObject) dataModel.getProperty(MessageDestReferenceDataModel.OWNER));
- break;
- case XMLResource.EJB_TYPE :
- //whats if no assemply descriptor....fluff one up
- helper.setFeature(EjbPackage.eINSTANCE.getAssemblyDescriptor_MessageDestinations());
- AssemblyDescriptor desc = ((EnterpriseBean) dataModel.getProperty(MessageDestReferenceDataModel.OWNER)).getEjbJar().getAssemblyDescriptor();
- if (desc == null) {
- ModifierHelper descHelper = new ModifierHelper();
- desc = EjbFactory.eINSTANCE.createAssemblyDescriptor();
- desc.setEjbJar(((EnterpriseBean) dataModel.getProperty(MessageDestReferenceDataModel.OWNER)).getEjbJar());
- descHelper.setFeature(EjbPackage.eINSTANCE.getEJBJar_AssemblyDescriptor());
- descHelper.setValue(desc);
- helper.setOwnerHelper(descHelper);
- } else {
- helper.setOwner(desc);
- }
- break;
- case XMLResource.WEB_APP_TYPE :
- helper.setFeature(WebapplicationPackage.eINSTANCE.getWebApp_MessageDestinations());
- helper.setOwner((EObject) dataModel.getProperty(MessageDestReferenceDataModel.OWNER));
- break;
- }
- helper.setValue(dest);
- return helper;
- }
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.jst.j2ee/j2eecreation/org/eclipse/jst/j2ee/internal/reference/MessageDestReferenceDataModel.java b/plugins/org.eclipse.jst.j2ee/j2eecreation/org/eclipse/jst/j2ee/internal/reference/MessageDestReferenceDataModel.java
deleted file mode 100644
index af3b1b154..000000000
--- a/plugins/org.eclipse.jst.j2ee/j2eecreation/org/eclipse/jst/j2ee/internal/reference/MessageDestReferenceDataModel.java
+++ /dev/null
@@ -1,267 +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 Mar 24, 2004
- *
- * To change the template for this generated file go to Window - Preferences - Java - Code
- * Generation - Code and Comments
- */
-package org.eclipse.jst.j2ee.internal.reference;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.jem.util.logger.proxy.Logger;
-import org.eclipse.jst.j2ee.applicationclient.internal.creation.ApplicationClientNatureRuntime;
-import org.eclipse.jst.j2ee.client.ApplicationClient;
-import org.eclipse.jst.j2ee.common.MessageDestination;
-import org.eclipse.jst.j2ee.ejb.AssemblyDescriptor;
-import org.eclipse.jst.j2ee.ejb.EJBJar;
-import org.eclipse.jst.j2ee.ejb.EnterpriseBean;
-import org.eclipse.jst.j2ee.internal.common.XMLResource;
-import org.eclipse.jst.j2ee.internal.earcreation.EARNatureRuntime;
-import org.eclipse.jst.j2ee.internal.moduleextension.EarModuleManager;
-import org.eclipse.jst.j2ee.internal.project.IEJBNatureConstants;
-import org.eclipse.jst.j2ee.internal.project.IWebNatureConstants;
-import org.eclipse.jst.j2ee.internal.project.J2EECreationResourceHandler;
-import org.eclipse.jst.j2ee.internal.project.J2EENature;
-import org.eclipse.jst.j2ee.internal.project.J2EEProjectUtilities;
-import org.eclipse.jst.j2ee.webapplication.WebApp;
-import org.eclipse.wst.common.frameworks.internal.operations.WTPOperation;
-import org.eclipse.wst.common.frameworks.internal.plugin.WTPCommonPlugin;
-
-public class MessageDestReferenceDataModel extends ReferenceDataModel {
- /**
- * Required, type String
- */
- public static final String TARGET = "MessageDestReferenceDataModel.TARGET"; //$NON-NLS-1$
- /**
- * Required, type String
- */
- public static final String TYPE = "MessageDestReferenceDataModel.TYPE"; //$NON-NLS-1$
- /**
- * Required, type String
- */
- public static final String LINK = "MessageDestReferenceDataModel.LINK"; //$NON-NLS-1$
- /**
- * Required, type String
- */
- public static final String USAGE = "MessageDestReferenceDataModel.USAGE"; //$NON-NLS-1$
- /**
- * Required, type String
- */
- public static final String HAS_LINK = "MessageDestReferenceDataModel.HAS_LINK"; //$NON-NLS-1$
- /**
- * Required, type String
- */
- public static final String TARGET_IN_DIFFERENT_EAR = "MessageDestReferenceDataModel.TARGET_IN_DIFFERENT_EAR"; //$NON-NLS-1$
-
-
- private List messageDestinationNames;
-
- protected void init() {
- super.init();
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.wst.common.internal.emfworkbench.operation.EditModelOperationDataModel#initValidBaseProperties()
- */
- protected void initValidBaseProperties() {
- addValidBaseProperty(TARGET);
- addValidBaseProperty(TYPE);
- addValidBaseProperty(LINK);
- addValidBaseProperty(USAGE);
- addValidBaseProperty(HAS_LINK);
- addValidBaseProperty(TARGET_IN_DIFFERENT_EAR);
- super.initValidBaseProperties();
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.wst.common.frameworks.internal.operation.WTPOperationDataModel#getDefaultProperty(java.lang.String)
- */
- protected Object getDefaultProperty(String propertyName) {
- return super.getDefaultProperty(propertyName);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.jst.j2ee.internal.internal.reference.ReferenceDataModel#doValidateProperty(java.lang.String)
- */
- protected IStatus doValidateProperty(String propertyName) {
- IStatus status = super.doValidateProperty(propertyName);
- if (TYPE.equals(propertyName) || USAGE.equals(propertyName)) {
- String temp = getStringProperty(propertyName);
- if (temp == null || temp.trim().equals("")) { //$NON-NLS-1$
- if (TYPE.equals(propertyName)) {
- return WTPCommonPlugin.createErrorStatus(J2EECreationResourceHandler.getString("MessageDestReferenceDataModel.7")); //$NON-NLS-1$
- } else if (USAGE.equals(propertyName)) {
- return WTPCommonPlugin.createErrorStatus(J2EECreationResourceHandler.getString("MessageDestReferenceDataModel.8")); //$NON-NLS-1$
- }
- }
- } else if (LINK.equals(propertyName) && !getBooleanProperty(HAS_LINK)) {
- if (!verifyLinkUnique(getStringProperty(LINK)))
- return WTPCommonPlugin.createErrorStatus(J2EECreationResourceHandler.getString("MessageDestReferenceDataModel.9")); //$NON-NLS-1$
- } else if (propertyName.equals(TARGET)) {
- Object target = getProperty(TARGET);
- if (getBooleanProperty(HAS_LINK) && (target == null || !(target instanceof MessageDestination)))
- return WTPCommonPlugin.createErrorStatus(J2EECreationResourceHandler.getString("EJBReferenceDataModel_UI_12")); //$NON-NLS-1$
- }
- return status;
- }
-
- /**
- * @param string
- */
- private boolean verifyLinkUnique(String link) {
- if (messageDestinationNames == null) {
- EObject owner = (EObject) getProperty(OWNER);
- IProject containingProject = J2EEProjectUtilities.getProject(owner);
- EARNatureRuntime[] ears = J2EEProjectUtilities.getReferencingEARProjects(containingProject);
- if (ears == null) {
- messageDestinationNames = getModuleMessageDestinationNames(owner);
- } else {
- messageDestinationNames = new ArrayList();
- for (int j = 0; j < ears.length; j++) {
- try {
- IProject[] refProj = ears[j].getProject().getReferencedProjects();
- if (refProj != null) {
- for (int k = 0; k < refProj.length; k++) {
- messageDestinationNames.addAll(getModuleMessageDestinationNames(refProj[k]));
- }
- }
- } catch (CoreException e) {
- Logger.getLogger().log(e.getMessage());
- }
- }
- }
- }
- if (messageDestinationNames == null || messageDestinationNames.isEmpty())
- return true;
- String name;
- for (int i = 0; i < messageDestinationNames.size(); i++) {
- name = ((MessageDestination) messageDestinationNames.get(i)).getName();
- if (name != null && name.equals(link))
- return false;
- }
- return true;
- }
-
- /**
- * @param project
- * @return
- */
- private List getModuleMessageDestinationNames(IProject project) throws CoreException {
- if (project.hasNature(ApplicationClientNatureRuntime.NATURE_ID)) {
- J2EENature runtime = (J2EENature) project.getNature(ApplicationClientNatureRuntime.NATURE_ID);
- ApplicationClient appClient = (ApplicationClient) runtime.getDeploymentDescriptorRoot();
- if (appClient != null)
- return appClient.getMessageDestinations();
- } else if (project.hasNature(IWebNatureConstants.J2EE_NATURE_ID)) {
- J2EENature runtime = (J2EENature) project.getNature(IWebNatureConstants.J2EE_NATURE_ID);
- WebApp webApp = (WebApp) runtime.getDeploymentDescriptorRoot();
- if (webApp != null)
- return webApp.getMessageDestinations();
- return (List) (runtime.getDeploymentDescriptorRoot());
- } else if (project.hasNature(IEJBNatureConstants.NATURE_ID)) {
- EJBJar ejbJar = EarModuleManager.getEJBModuleExtension().getEJBJar(project);
- AssemblyDescriptor assDesc = ejbJar.getAssemblyDescriptor();
- if (assDesc != null)
- return assDesc.getMessageDestinations();
- }
- return new ArrayList();
- }
-
- /**
- * @return
- */
- private List getModuleMessageDestinationNames(EObject owner) {
- List temp = new ArrayList();
- if (owner == null)
- return temp;
- switch (getDeploymentDescriptorType()) {
- case XMLResource.APP_CLIENT_TYPE :
- ApplicationClient client = (ApplicationClient) owner;
- temp = client.getMessageDestinations();
- break;
- case XMLResource.EJB_TYPE :
- EnterpriseBean ejb = (EnterpriseBean) owner;
- AssemblyDescriptor assDesc = ejb.getEjbJar().getAssemblyDescriptor();
- if (assDesc != null)
- temp = assDesc.getMessageDestinations();
- break;
- case XMLResource.WEB_APP_TYPE :
- WebApp app = (WebApp) owner;
- temp = app.getMessageDestinations();
- break;
- }
- return temp;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.jst.j2ee.internal.internal.reference.ReferenceDataModel#doSetProperty(java.lang.String,
- * java.lang.Object)
- */
- protected boolean doSetProperty(String propertyName, Object propertyValue) {
- if (TARGET.equals(propertyName)) {
- MessageDestination target = (MessageDestination) propertyValue;
- //setup Link
- if (target == null)
- return super.doSetProperty(propertyName, propertyValue);
- if (target != null) {
- setProperty(HAS_LINK, Boolean.TRUE);
- setProperty(LINK, target.getName());
- } else {
- setProperty(HAS_LINK, Boolean.FALSE);
- setProperty(LINK, target.getName());
- }
- //setup type
- //setProperty(TYPE, target.getMess);
-
- //setup name
- setProperty(REF_NAME, target.getName());
- notifyEnablementChange(LINK);
- }
- return super.doSetProperty(propertyName, propertyValue);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.wst.common.frameworks.internal.operation.WTPOperationDataModel#basicIsEnabled(java.lang.String)
- */
- protected Boolean basicIsEnabled(String propertyName) {
- if (propertyName.equals(LINK)) {
- if (getBooleanProperty(HAS_LINK))
- return Boolean.FALSE;
- return Boolean.TRUE;
- }
- return super.basicIsEnabled(propertyName);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.wst.common.frameworks.internal.operation.WTPOperationDataModel#getDefaultOperation()
- */
- public WTPOperation getDefaultOperation() {
- return new MessageDestReferenceCreationOperation(this);
- }
-
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.jst.j2ee/j2eecreation/org/eclipse/jst/j2ee/internal/reference/PortComponentReferenceCreationOperation.java b/plugins/org.eclipse.jst.j2ee/j2eecreation/org/eclipse/jst/j2ee/internal/reference/PortComponentReferenceCreationOperation.java
deleted file mode 100644
index bd6a26ae5..000000000
--- a/plugins/org.eclipse.jst.j2ee/j2eecreation/org/eclipse/jst/j2ee/internal/reference/PortComponentReferenceCreationOperation.java
+++ /dev/null
@@ -1,65 +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 Feb 12, 2004
- *
- * To change the template for this generated file go to Window - Preferences - Java - Code
- * Generation - Code and Comments
- */
-package org.eclipse.jst.j2ee.internal.reference;
-
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.ecore.EPackage;
-import org.eclipse.jem.java.JavaClass;
-import org.eclipse.jem.java.JavaRefFactory;
-import org.eclipse.jst.j2ee.webservice.internal.wsclient.Webservice_clientPackage;
-import org.eclipse.jst.j2ee.webservice.wsclient.PortComponentRef;
-import org.eclipse.wst.common.componentcore.internal.operation.ModelModifierOperation;
-import org.eclipse.wst.common.internal.emfworkbench.integration.ModifierHelper;
-
-
-public class PortComponentReferenceCreationOperation extends ModelModifierOperation {
- PortComponentReferenceDataModel dataModel;
-
- /**
- * @param dataModel
- */
- public PortComponentReferenceCreationOperation(PortComponentReferenceDataModel dataModel) {
- super(dataModel);
- this.dataModel = dataModel;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.wst.common.internal.emfworkbench.operation.ModelModifierOperation#addHelpers()
- */
- protected void addHelpers() {
- modifier.addHelper(createHelpers());
- }
-
- /*
- * @see SimpleCommandWizardPage#createCommandHelper()
- */
- public ModifierHelper createHelpers() {
- ModifierHelper helper = null;
- if (dataModel != null) {
- helper = new ModifierHelper();
- PortComponentRef ref = ((Webservice_clientPackage) EPackage.Registry.INSTANCE.getEPackage(Webservice_clientPackage.eNS_URI)).getWebservice_clientFactory().createPortComponentRef();
- helper.setOwner((EObject) dataModel.getProperty(PortComponentReferenceDataModel.OWNER));
- ref.setPortComponentLink(dataModel.getStringProperty(PortComponentReferenceDataModel.LINK));
- String serviceEndpointInterface = dataModel.getStringProperty(PortComponentReferenceDataModel.SERVICE_ENDPOINT_INTERFACE);
- ref.setServiceEndpointInterface((JavaClass) JavaRefFactory.eINSTANCE.reflectType(serviceEndpointInterface, (EObject) dataModel.getProperty(PortComponentReferenceDataModel.OWNER)));
- helper.setFeature(Webservice_clientPackage.eINSTANCE.getServiceRef_PortComponentRefs());
- helper.setValue(ref);
- }
- return helper;
- }
-
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.jst.j2ee/j2eecreation/org/eclipse/jst/j2ee/internal/reference/PortComponentReferenceDataModel.java b/plugins/org.eclipse.jst.j2ee/j2eecreation/org/eclipse/jst/j2ee/internal/reference/PortComponentReferenceDataModel.java
deleted file mode 100644
index c7eec1171..000000000
--- a/plugins/org.eclipse.jst.j2ee/j2eecreation/org/eclipse/jst/j2ee/internal/reference/PortComponentReferenceDataModel.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
- *******************************************************************************/
-/*
- * Created on Feb 12, 2004
- *
- * To change the template for this generated file go to
- * Window - Preferences - Java - Code Generation - Code and Comments
- */
-package org.eclipse.jst.j2ee.internal.reference;
-
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.jst.j2ee.internal.common.operations.J2EEModelModifierOperationDataModel;
-import org.eclipse.jst.j2ee.internal.project.J2EECreationResourceHandler;
-import org.eclipse.wst.common.frameworks.internal.operations.WTPOperation;
-import org.eclipse.wst.common.frameworks.internal.plugin.WTPCommonPlugin;
-
-
-/**
- * @author dfholttp
- *
- * To change the template for this generated type comment go to Window - Preferences - Java - Code
- * Generation - Code and Comments
- */
-public class PortComponentReferenceDataModel extends J2EEModelModifierOperationDataModel {
- /**
- * Required, type String
- */
- public static final String OWNER = "PortComponentReferenceDataModel.OWNER"; //$NON-NLS-1$
- /**
- * Required, type String
- */
- public static final String SERVICE_ENDPOINT_INTERFACE = "PortComponentReferenceDataModel.SERVICE_ENDPOINT_INTERFACE"; //$NON-NLS-1$
- /**
- * Required, type String
- */
- public static final String LINK = "PortComponentReferenceDataModel.LINK"; //$NON-NLS-1$
-
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.wst.common.internal.emfworkbench.operation.EditModelOperationDataModel#initValidBaseProperties()
- */
- protected void initValidBaseProperties() {
- addValidBaseProperty(OWNER);
- addValidBaseProperty(SERVICE_ENDPOINT_INTERFACE);
- addValidBaseProperty(LINK);
- super.initValidBaseProperties();
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.wst.common.frameworks.internal.operation.WTPOperationDataModel#doValidateProperty(java.lang.String)
- */
- protected IStatus doValidateProperty(String propertyName) {
- IStatus status = super.doValidateProperty(propertyName);
- if (SERVICE_ENDPOINT_INTERFACE.equals(propertyName)) {
- String temp = getStringProperty(propertyName);
- if (temp == null || temp.trim().equals("")) { //$NON-NLS-1$
- return WTPCommonPlugin.createErrorStatus(J2EECreationResourceHandler.getString("PortComponentReferenceDataModel_ERROR_4")); //$NON-NLS-1$
- }
- }
- return status;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.wst.common.frameworks.internal.operation.WTPOperationDataModel#getDefaultOperation()
- */
- public WTPOperation getDefaultOperation() {
- return new PortComponentReferenceCreationOperation(this);
- }
-
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.jst.j2ee/j2eecreation/org/eclipse/jst/j2ee/internal/reference/ReferenceDataModel.java b/plugins/org.eclipse.jst.j2ee/j2eecreation/org/eclipse/jst/j2ee/internal/reference/ReferenceDataModel.java
deleted file mode 100644
index 66f606698..000000000
--- a/plugins/org.eclipse.jst.j2ee/j2eecreation/org/eclipse/jst/j2ee/internal/reference/ReferenceDataModel.java
+++ /dev/null
@@ -1,425 +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.reference;
-
-import java.util.Collection;
-import java.util.List;
-
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.emf.common.util.EList;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.jem.util.emf.workbench.ProjectUtilities;
-import org.eclipse.jst.j2ee.client.ApplicationClient;
-import org.eclipse.jst.j2ee.common.EJBLocalRef;
-import org.eclipse.jst.j2ee.common.EjbRef;
-import org.eclipse.jst.j2ee.common.MessageDestinationRef;
-import org.eclipse.jst.j2ee.common.ResourceEnvRef;
-import org.eclipse.jst.j2ee.common.ResourceRef;
-import org.eclipse.jst.j2ee.common.SecurityRoleRef;
-import org.eclipse.jst.j2ee.ejb.EnterpriseBean;
-import org.eclipse.jst.j2ee.internal.J2EEConstants;
-import org.eclipse.jst.j2ee.internal.J2EEVersionConstants;
-import org.eclipse.jst.j2ee.internal.common.operations.J2EEModelModifierOperationDataModel;
-import org.eclipse.jst.j2ee.internal.project.J2EECreationResourceHandler;
-import org.eclipse.jst.j2ee.internal.webservices.WSDLServiceExtManager;
-import org.eclipse.jst.j2ee.internal.webservices.WSDLServiceHelper;
-import org.eclipse.jst.j2ee.webapplication.WebApp;
-import org.eclipse.jst.j2ee.webservice.wsclient.ServiceRef;
-import org.eclipse.wst.common.frameworks.internal.plugin.WTPCommonPlugin;
-
-public abstract class ReferenceDataModel extends J2EEModelModifierOperationDataModel {
- /**
- * Required, type ApplicationClient, WebApp, EJBJar
- */
- public static final String OWNER = "ReferenceDataModel.OWNER"; //$NON-NLS-1$
- /**
- * Required, type String
- */
- public static final String REF_NAME = "ReferenceDataModel.REF_NAME"; //$NON-NLS-1$
-
- /**
- * Optional, type String
- */
- public static final String DESCRIPTION = "ReferenceDataModel.DESCRIPTION"; //$NON-NLS-1$
- /**
- * set by model String, j2ee version via J2eeConstants
- */
- public static final String MODULE_TYPE = "ReferenceDataModel.MODULE_TYPE"; //$NON-NLS-1$
-
- /**
- * set by model INTEGER, j2ee version
- */
- public static final String J2EE_VERSION = "ReferenceDataModel.J2EE_VERSION"; //$NON-NLS-1$
-
- //ejb = 0, appclient = 1, web = 2
- public static final int EJB_TYPE = 0;
- public static final int APP_CLIENT_TYPE = 1;
- public static final int WEB_TYPE = 2;
-
- protected int ownerType;
-
- protected void init() {
- super.init();
- }
-
- protected void initializeOwnerNature() {
- EObject owner = (EObject) getProperty(OWNER);
- if (owner != null) {
- IProject ownerProject = ProjectUtilities.getProject(owner);
- if (ownerProject != null) {
- if (owner instanceof EnterpriseBean) {
- ownerType = EJB_TYPE;
- } else if (owner instanceof ApplicationClient) {
- ownerType = APP_CLIENT_TYPE;
- } else if (owner instanceof WebApp) {
- ownerType = WEB_TYPE;
- }
- }
- }
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.wst.common.internal.emfworkbench.operation.EditModelOperationDataModel#initValidBaseProperties()
- */
- protected void initValidBaseProperties() {
- addValidBaseProperty(OWNER);
- addValidBaseProperty(REF_NAME);
- addValidBaseProperty(DESCRIPTION);
- addValidBaseProperty(J2EE_VERSION);
- addValidBaseProperty(MODULE_TYPE);
- super.initValidBaseProperties();
- }
-
- protected boolean doSetProperty(String propertyName, Object propertyValue) {
- boolean doSet = super.doSetProperty(propertyName, propertyValue);
- if (OWNER.equals(propertyName)) {
- try {
- initializeOwnerNature();
- notifyDefaultChange(MODULE_TYPE);
- notifyDefaultChange(J2EE_VERSION);
-// IProject proj = ProjectUtilities.getProject((EObject) propertyValue);
-// if (proj != null)
-// setProperty(EditModelOperationDataModel.PROJECT_NAME, proj.getName());
- } catch (Exception e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- }
- return doSet;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.wst.common.frameworks.internal.operation.WTPOperationDataModel#getDefaultProperty(java.lang.String)
- */
- protected Object getDefaultProperty(String propertyName) {
- if (propertyName.equals(MODULE_TYPE)) {
- return calculateOwnerModuleType();
- }
- if (propertyName.equals(J2EE_VERSION)) {
- int version = calculateJ2EEVersionForOwnerModule();
- return new Integer(version);
- }
- return super.getDefaultProperty(propertyName);
- }
-
- /**
- * @return
- */
- private Object calculateOwnerModuleType() {
- EObject owner = (EObject) getProperty(OWNER);
- if (owner != null) {
- IProject ownerProject = ProjectUtilities.getProject(owner);
- if (ownerProject != null) {
- if (owner instanceof EnterpriseBean) {
- return J2EEConstants.EJBJAR_ID;
- } else if (owner instanceof ApplicationClient) {
- return J2EEConstants.APP_CLIENT_ID;
- } else if (owner instanceof WebApp) {
- return J2EEConstants.WEBAPP_ID;
- }
- }
- }
- return null;
- }
-
- /**
- * @return
- */
- private int calculateJ2EEVersionForOwnerModule() {
- String moduleType = getStringProperty(MODULE_TYPE);
- if (moduleType == null)
- return -1;
- if (moduleType.equals(J2EEConstants.EJBJAR_ID)) {
- switch (((EnterpriseBean) getProperty(OWNER)).getVersionID()) {
- case J2EEVersionConstants.EJB_1_0_ID :
- return J2EEVersionConstants.J2EE_1_2_ID;
- case J2EEVersionConstants.EJB_1_1_ID :
- return J2EEVersionConstants.J2EE_1_2_ID;
- case J2EEVersionConstants.EJB_2_0_ID :
- return J2EEVersionConstants.J2EE_1_3_ID;
- case J2EEVersionConstants.EJB_2_1_ID :
- return J2EEVersionConstants.J2EE_1_4_ID;
- default :
- return J2EEVersionConstants.J2EE_1_4_ID;
- }
- } else if (moduleType.equals(J2EEConstants.WEBAPP_ID)) {
- switch (((WebApp) getProperty(OWNER)).getVersionID()) {
- case J2EEVersionConstants.WEB_2_2_ID :
- return J2EEVersionConstants.J2EE_1_2_ID;
- case J2EEVersionConstants.WEB_2_3_ID :
- return J2EEVersionConstants.J2EE_1_3_ID;
- case J2EEVersionConstants.WEB_2_4_ID :
- return J2EEVersionConstants.J2EE_1_4_ID;
- default :
- return J2EEVersionConstants.J2EE_1_4_ID;
- }
- } else if (moduleType.equals(J2EEConstants.APP_CLIENT_ID)) {
- return ((ApplicationClient) getProperty(OWNER)).getVersionID();
- }
- return -1;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.wst.common.frameworks.internal.operation.WTPOperationDataModel#doValidateProperty(java.lang.String)
- */
- protected IStatus doValidateProperty(String propertyName) {
- if (OWNER.equals(propertyName)) {
- if (getProperty(OWNER) == null)
- return WTPCommonPlugin.createErrorStatus(J2EECreationResourceHandler.getString("ReferenceDataModel_UI_3")); //$NON-NLS-1$
- }
- if (REF_NAME.equals(propertyName)) {
- String nameValue = getStringProperty(propertyName);
- //TODO:find solution to empty string
- if (nameValue == null || nameValue.trim().equals("")) { //$NON-NLS-1$
- return WTPCommonPlugin.createErrorStatus(J2EECreationResourceHandler.getString("ReferenceDataModel_UI_5")); //$NON-NLS-1$
- }
- if (!validateReferenceDoesNotExist(nameValue.trim())) {
- return WTPCommonPlugin.createErrorStatus(J2EECreationResourceHandler.getString("ReferenceDataModel_UI_6")); //$NON-NLS-1$
- }
- }
- return super.doValidateProperty(propertyName);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.jst.j2ee.internal.internal.reference.ReferenceDataModel#validateReferenceDoesNotExist(java.lang.String)
- */
- public boolean validateReferenceDoesNotExist(String nameValue) {
- if (ownerType == EJB_TYPE) {
- EnterpriseBean bean = (EnterpriseBean) getProperty(ReferenceDataModel.OWNER);
- if (checkResourceRefExists(bean.getResourceRefs(), nameValue))
- return false;
- if (checkResourceEnvRefExists(bean.getResourceEnvRefs(), nameValue))
- return false;
- if (checkEJBLocalRefExists(bean.getEjbLocalRefs(), nameValue))
- return false;
- if (checkEJBRefExists(bean.getEjbRefs(), nameValue))
- return false;
- if (checkSecurityRoleRefExists(bean.getSecurityRoleRefs(), nameValue))
- return false;
- if (bean.getVersionID() >= J2EEVersionConstants.EJB_2_1_ID) {
- if (checkServiceRefExists(bean.getServiceRefs(), nameValue))
- return false;
- if (checkMessageDestRefExists(bean.getMessageDestinationRefs(), nameValue))
- return false;
- }
- else {
- WSDLServiceHelper serviceHelper = WSDLServiceExtManager.getServiceHelper();
- Collection temp = serviceHelper.get13ServiceRefs(bean);
- if (temp != null && !temp.isEmpty() && checkServiceRefExists((List) temp, nameValue))
- return false;
- }
- } else if (ownerType == APP_CLIENT_TYPE) {
- ApplicationClient appClient = (ApplicationClient) getProperty(ReferenceDataModel.OWNER);
- if (checkResourceRefExists(appClient.getResourceRefs(), nameValue))
- return false;
- if (checkResourceEnvRefExists(appClient.getResourceEnvRefs(), nameValue))
- return false;
- if (checkEJBRefExists(appClient.getEjbReferences(), nameValue))
- return false;
- if (appClient.getVersionID() >= J2EEVersionConstants.J2EE_1_4_ID) {
- if (checkServiceRefExists(appClient.getServiceRefs(), nameValue))
- return false;
- if (checkMessageDestRefExists(appClient.getMessageDestinationRefs(), nameValue))
- return false;
- }
- else {
- WSDLServiceHelper serviceHelper = WSDLServiceExtManager.getServiceHelper();
- Collection temp = serviceHelper.get13ServiceRefs(appClient);
- if (temp != null && !temp.isEmpty() && checkServiceRefExists((List) temp, nameValue))
- return false;
- }
- } else if (ownerType == WEB_TYPE) {
- WebApp webApp = (WebApp) getProperty(ReferenceDataModel.OWNER);
- if (checkResourceRefExists(webApp.getResourceRefs(), nameValue))
- return false;
- if (checkResourceEnvRefExists(webApp.getResourceEnvRefs(), nameValue))
- return false;
- if (checkEJBLocalRefExists(webApp.getEjbLocalRefs(), nameValue))
- return false;
- if (checkEJBRefExists(webApp.getEjbRefs(), nameValue))
- return false;
- if (webApp.getVersionID() >= J2EEVersionConstants.WEB_2_4_ID) {
- if (checkServiceRefExists(webApp.getServiceRefs(), nameValue))
- return false;
- if (checkMessageDestRefExists(webApp.getMessageDestinationRefs(), nameValue))
- return false;
- }
- else {
- WSDLServiceHelper serviceHelper = WSDLServiceExtManager.getServiceHelper();
- Collection temp = serviceHelper.get13ServiceRefs(webApp);
- if (temp != null && !temp.isEmpty() && checkServiceRefExists((List) temp, nameValue))
- return false;
- }
- }
- return true;
- }
-
- // private boolean checkSecurityRoleRefExists(EList list) {
- // return checkSecurityRoleRefExists(list, getStringProperty(REF_NAME));
- // }
-
- /**
- * @param list
- * @return
- */
- private boolean checkSecurityRoleRefExists(EList list, String refName) {
- if (list != null) {
- for (int i = 0; i < list.size(); i++) {
- SecurityRoleRef ref = (SecurityRoleRef) list.get(i);
- if (ref.getName() != null && ref.getName().equals(refName)) {
- return true;
- }
- }
- }
- return false;
- }
-
- // private boolean checkEJBRefExists(EList list) {
- // return checkEJBRefExists(list, getStringProperty(REF_NAME));
- // }
-
- /**
- * @param list
- */
- private boolean checkEJBRefExists(EList list, String refName) {
- if (list != null) {
- for (int i = 0; i < list.size(); i++) {
- EjbRef ref = (EjbRef) list.get(i);
- if (ref.getName() != null && ref.getName().equals(refName)) {
- return true;
- }
- }
- }
- return false;
- }
-
- // private boolean checkEJBLocalRefExists(EList list) {
- // return checkEJBLocalRefExists(list, getStringProperty(REF_NAME));
- // }
-
- /**
- * @param list
- */
- private boolean checkEJBLocalRefExists(EList list, String refName) {
- if (list != null) {
- for (int i = 0; i < list.size(); i++) {
- EJBLocalRef ref = (EJBLocalRef) list.get(i);
- if (ref.getName() != null && ref.getName().equals(refName)) {
- return true;
- }
- }
- }
- return false;
- }
-
- // private boolean checkServiceRefExists(EList list) {
- // return checkServiceRefExists(list, getStringProperty(REF_NAME));
- // }
-
- /**
- * @param list
- */
- private boolean checkServiceRefExists(List list, String refName) {
- if (list != null) {
- for (int i = 0; i < list.size(); i++) {
- ServiceRef ref = (ServiceRef) list.get(i);
- if (ref.getServiceRefName() != null && ref.getServiceRefName().equals(refName)) {
- return true;
- }
- }
- }
- return false;
- }
-
- // private boolean checkResourceEnvRefExists(EList list) {
- // return checkResourceEnvRefExists(list, getStringProperty(REF_NAME));
- // }
-
- /**
- * @param list
- */
- private boolean checkResourceEnvRefExists(EList list, String refName) {
- if (list != null) {
- for (int i = 0; i < list.size(); i++) {
- ResourceEnvRef ref = (ResourceEnvRef) list.get(i);
- if (ref.getName() != null && ref.getName().equals(refName)) {
- return true;
- }
- }
- }
- return false;
- }
-
- // private boolean checkResourceRefExists(EList list) {
- // return checkResourceRefExists(list, getStringProperty(REF_NAME));
- // }
-
- /**
- * @param list
- */
- private boolean checkResourceRefExists(EList list, String refName) {
- if (list != null) {
- for (int i = 0; i < list.size(); i++) {
- ResourceRef ref = (ResourceRef) list.get(i);
- if (ref.getName() != null && ref.getName().equals(refName)) {
- return true;
- }
- }
- }
- return false;
- }
-
- // private boolean checkMessageDestRefExists(EList list) {
- // return checkMessageDestRefExists(list, getStringProperty(REF_NAME));
- // }
-
- /**
- * @param list
- */
- private boolean checkMessageDestRefExists(EList list, String refName) {
- if (list != null) {
- for (int i = 0; i < list.size(); i++) {
- MessageDestinationRef ref = (MessageDestinationRef) list.get(i);
- if (ref.getName() != null && ref.getName().equals(refName)) {
- return true;
- }
- }
- }
- return false;
- }
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.jst.j2ee/j2eecreation/org/eclipse/jst/j2ee/internal/reference/ResourceEnvironmentReferenceCreationOperation.java b/plugins/org.eclipse.jst.j2ee/j2eecreation/org/eclipse/jst/j2ee/internal/reference/ResourceEnvironmentReferenceCreationOperation.java
deleted file mode 100644
index 30ea2b44c..000000000
--- a/plugins/org.eclipse.jst.j2ee/j2eecreation/org/eclipse/jst/j2ee/internal/reference/ResourceEnvironmentReferenceCreationOperation.java
+++ /dev/null
@@ -1,78 +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.reference;
-
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.ecore.EPackage;
-import org.eclipse.jst.j2ee.common.CommonFactory;
-import org.eclipse.jst.j2ee.common.Description;
-import org.eclipse.jst.j2ee.common.ResourceEnvRef;
-import org.eclipse.jst.j2ee.internal.J2EEVersionConstants;
-import org.eclipse.jst.j2ee.internal.client.impl.ClientFactoryImpl;
-import org.eclipse.jst.j2ee.internal.common.CommonPackage;
-import org.eclipse.jst.j2ee.internal.common.XMLResource;
-import org.eclipse.wst.common.componentcore.internal.operation.ModelModifierOperation;
-import org.eclipse.wst.common.internal.emfworkbench.integration.ModifierHelper;
-
-
-
-public class ResourceEnvironmentReferenceCreationOperation extends ModelModifierOperation {
- ResourceEnvironmentReferenceDataModel dataModel = null;
-
- /**
- * @param dataModel
- */
- public ResourceEnvironmentReferenceCreationOperation(ResourceEnvironmentReferenceDataModel dataModel) {
- super(dataModel);
- this.dataModel = dataModel;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.wst.common.internal.emfworkbench.operation.ModelModifierOperation#addHelpers()
- */
- protected void addHelpers() {
- ModifierHelper baseHelper = createHelper();
- modifier.addHelper(baseHelper);
- }
-
-
- public ModifierHelper createHelper() {
- ModifierHelper helper = new ModifierHelper();
- ResourceEnvRef ref = ((CommonPackage) EPackage.Registry.INSTANCE.getEPackage(CommonPackage.eNS_URI)).getCommonFactory().createResourceEnvRef();
- helper.setOwner((EObject) dataModel.getProperty(ResourceEnvironmentReferenceDataModel.OWNER));
- ref.setName(dataModel.getStringProperty(ResourceEnvironmentReferenceDataModel.REF_NAME).trim());
- ref.setTypeName(dataModel.getStringProperty(ResourceEnvironmentReferenceDataModel.TYPE).trim());
-
- switch (dataModel.getDeploymentDescriptorType()) {
- case XMLResource.APP_CLIENT_TYPE :
- helper.setFeature(ClientFactoryImpl.getPackage().getApplicationClient_ResourceEnvRefs());
- break;
- case XMLResource.EJB_TYPE :
- helper.setFeature(CommonPackage.eINSTANCE.getJNDIEnvRefsGroup_ResourceEnvRefs());
- break;
- case XMLResource.WEB_APP_TYPE :
- helper.setFeature(CommonPackage.eINSTANCE.getJNDIEnvRefsGroup_ResourceEnvRefs());
- break;
- }
- Integer version = (Integer) dataModel.getProperty(ResourceEnvironmentReferenceDataModel.J2EE_VERSION);
- if (version != null && version.intValue() <= J2EEVersionConstants.J2EE_1_3_ID) {
- ref.setDescription(dataModel.getStringProperty(ResourceEnvironmentReferenceDataModel.DESCRIPTION).trim());
- } else {
- Description descriptionObj = CommonFactory.eINSTANCE.createDescription();
- descriptionObj.setValue(dataModel.getStringProperty(ResourceEnvironmentReferenceDataModel.DESCRIPTION).trim());
- ref.getDescriptions().add(descriptionObj);
- }
-
- helper.setValue(ref);
- return helper;
- }
-
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.jst.j2ee/j2eecreation/org/eclipse/jst/j2ee/internal/reference/ResourceEnvironmentReferenceDataModel.java b/plugins/org.eclipse.jst.j2ee/j2eecreation/org/eclipse/jst/j2ee/internal/reference/ResourceEnvironmentReferenceDataModel.java
deleted file mode 100644
index ba2811895..000000000
--- a/plugins/org.eclipse.jst.j2ee/j2eecreation/org/eclipse/jst/j2ee/internal/reference/ResourceEnvironmentReferenceDataModel.java
+++ /dev/null
@@ -1,62 +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.reference;
-
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.jst.j2ee.internal.project.J2EECreationResourceHandler;
-import org.eclipse.wst.common.frameworks.internal.operations.WTPOperation;
-import org.eclipse.wst.common.frameworks.internal.plugin.WTPCommonPlugin;
-
-
-public class ResourceEnvironmentReferenceDataModel extends ReferenceDataModel {
- /**
- * Required, type String
- */
- public static final String TYPE = "ResourceEnvironmentReferenceDataModel.TYPE"; //$NON-NLS-1$
-
- protected void init() {
- super.init();
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.wst.common.internal.emfworkbench.operation.EditModelOperationDataModel#initValidBaseProperties()
- */
- protected void initValidBaseProperties() {
- addValidBaseProperty(TYPE);
- super.initValidBaseProperties();
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.jst.j2ee.internal.internal.reference.ReferenceDataModel#doValidateProperty(java.lang.String)
- */
- protected IStatus doValidateProperty(String propertyName) {
- IStatus status = super.doValidateProperty(propertyName);
- if (TYPE.equals(propertyName)) {
- String temp = getStringProperty(TYPE);
- if (temp == null || temp.trim().equals("")) { //$NON-NLS-1$
- if (TYPE.equals(propertyName))
- return WTPCommonPlugin.createErrorStatus(J2EECreationResourceHandler.getString("ResourceEnvironmentReferenceDataModel.2")); //$NON-NLS-1$
- }
- }
- return status;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.wst.common.frameworks.internal.operation.WTPOperationDataModel#getDefaultOperation()
- */
- public WTPOperation getDefaultOperation() {
- return new ResourceEnvironmentReferenceCreationOperation(this);
- }
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.jst.j2ee/j2eecreation/org/eclipse/jst/j2ee/internal/reference/ResourceReferenceCreationOperation.java b/plugins/org.eclipse.jst.j2ee/j2eecreation/org/eclipse/jst/j2ee/internal/reference/ResourceReferenceCreationOperation.java
deleted file mode 100644
index 1420e2e6d..000000000
--- a/plugins/org.eclipse.jst.j2ee/j2eecreation/org/eclipse/jst/j2ee/internal/reference/ResourceReferenceCreationOperation.java
+++ /dev/null
@@ -1,88 +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.reference;
-
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.ecore.EPackage;
-import org.eclipse.jst.j2ee.common.CommonFactory;
-import org.eclipse.jst.j2ee.common.Description;
-import org.eclipse.jst.j2ee.common.ResAuthTypeBase;
-import org.eclipse.jst.j2ee.common.ResSharingScopeType;
-import org.eclipse.jst.j2ee.common.ResourceRef;
-import org.eclipse.jst.j2ee.internal.J2EEVersionConstants;
-import org.eclipse.jst.j2ee.internal.client.impl.ClientFactoryImpl;
-import org.eclipse.jst.j2ee.internal.common.CommonPackage;
-import org.eclipse.jst.j2ee.internal.common.XMLResource;
-import org.eclipse.wst.common.componentcore.internal.operation.ModelModifierOperation;
-import org.eclipse.wst.common.internal.emfworkbench.integration.ModifierHelper;
-
-
-
-public class ResourceReferenceCreationOperation extends ModelModifierOperation {
- ResourceReferenceDataModel dataModel = null;
-
- /**
- * @param dataModel
- */
- public ResourceReferenceCreationOperation(ResourceReferenceDataModel dataModel) {
- super(dataModel);
- this.dataModel = dataModel;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.wst.common.internal.emfworkbench.operation.ModelModifierOperation#addHelpers()
- */
- protected void addHelpers() {
- ModifierHelper baseHelper = createHelpers();
- modifier.addHelper(baseHelper);
- }
-
- /*
- * @see SimpleCommandWizardPage#createCommandHelper()
- */
- public ModifierHelper createHelpers() {
- ModifierHelper helper = null;
- if (dataModel != null) {
- helper = new ModifierHelper();
- ResourceRef ref = ((CommonPackage) EPackage.Registry.INSTANCE.getEPackage(CommonPackage.eNS_URI)).getCommonFactory().createResourceRef();
- helper.setOwner((EObject) dataModel.getProperty(ResourceReferenceDataModel.OWNER));
- ref.setName(dataModel.getStringProperty(ResourceReferenceDataModel.REF_NAME).trim());
- ref.setType(dataModel.getStringProperty(ResourceReferenceDataModel.TYPE).trim());
- ref.setAuth(ResAuthTypeBase.get(dataModel.getStringProperty(ResourceReferenceDataModel.AUTHENTICATION).trim()));
- String resSharingScope = dataModel.getStringProperty(ResourceReferenceDataModel.SHARING_SCOPE).trim();
- if (resSharingScope != null && !resSharingScope.equals("")) //$NON-NLS-1$
- ref.setResSharingScope(ResSharingScopeType.get(resSharingScope));
-
- Integer version = (Integer) dataModel.getProperty(ResourceReferenceDataModel.J2EE_VERSION);
- if (version != null && version.intValue() <= J2EEVersionConstants.J2EE_1_3_ID) {
- ref.setDescription(dataModel.getStringProperty(ResourceReferenceDataModel.DESCRIPTION).trim());
- } else {
- Description descriptionObj = CommonFactory.eINSTANCE.createDescription();
- descriptionObj.setValue(dataModel.getStringProperty(ResourceReferenceDataModel.DESCRIPTION).trim());
- ref.getDescriptions().add(descriptionObj);
- }
-
- switch (dataModel.getDeploymentDescriptorType()) {
- case XMLResource.APP_CLIENT_TYPE :
- helper.setFeature(ClientFactoryImpl.getPackage().getApplicationClient_ResourceRefs());
- break;
- case XMLResource.EJB_TYPE :
- helper.setFeature(CommonPackage.eINSTANCE.getJNDIEnvRefsGroup_ResourceRefs());
- break;
- case XMLResource.WEB_APP_TYPE :
- helper.setFeature(CommonPackage.eINSTANCE.getJNDIEnvRefsGroup_ResourceRefs());
- break;
- }
- helper.setValue(ref);
- }
- return helper;
- }
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.jst.j2ee/j2eecreation/org/eclipse/jst/j2ee/internal/reference/ResourceReferenceDataModel.java b/plugins/org.eclipse.jst.j2ee/j2eecreation/org/eclipse/jst/j2ee/internal/reference/ResourceReferenceDataModel.java
deleted file mode 100644
index 9deb2292c..000000000
--- a/plugins/org.eclipse.jst.j2ee/j2eecreation/org/eclipse/jst/j2ee/internal/reference/ResourceReferenceDataModel.java
+++ /dev/null
@@ -1,77 +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.reference;
-
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.jst.j2ee.internal.project.J2EECreationResourceHandler;
-import org.eclipse.wst.common.frameworks.internal.operations.WTPOperation;
-import org.eclipse.wst.common.frameworks.internal.plugin.WTPCommonPlugin;
-
-
-public class ResourceReferenceDataModel extends ReferenceDataModel {
- /**
- * Required, type String
- */
- public static final String TYPE = "ResourseReferenceDataModel.TYPE"; //$NON-NLS-1$
- /**
- * Required, type String
- */
- public static final String AUTHENTICATION = "ResourseReferenceDataModel.AUTHENTICATION"; //$NON-NLS-1$
- /**
- * Required, type String
- */
- public static final String SHARING_SCOPE = "ResourseReferenceDataModel.SHARING_SCOPE"; //$NON-NLS-1$
-
- protected void init() {
- super.init();
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.wst.common.internal.emfworkbench.operation.EditModelOperationDataModel#initValidBaseProperties()
- */
- protected void initValidBaseProperties() {
- addValidBaseProperty(TYPE);
- addValidBaseProperty(AUTHENTICATION);
- addValidBaseProperty(SHARING_SCOPE);
- super.initValidBaseProperties();
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.jst.j2ee.internal.internal.reference.ReferenceDataModel#doValidateProperty(java.lang.String)
- */
- protected IStatus doValidateProperty(String propertyName) {
- IStatus status = super.doValidateProperty(propertyName);
-
- if (TYPE.equals(propertyName) || AUTHENTICATION.equals(propertyName)) {
- String temp = getStringProperty(propertyName);
- if (temp == null || temp.trim().equals("")) { //$NON-NLS-1$
- if (TYPE.equals(propertyName)) {
- return WTPCommonPlugin.createErrorStatus(J2EECreationResourceHandler.getString("ResourceReferenceDataModel_UI_0")); //$NON-NLS-1$
- } else if (AUTHENTICATION.equals(propertyName)) {
- return WTPCommonPlugin.createErrorStatus(J2EECreationResourceHandler.getString("ResourceReferenceDataModel_UI_1")); //$NON-NLS-1$
- }
- }
- }
- return status;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.wst.common.frameworks.internal.operation.WTPOperationDataModel#getDefaultOperation()
- */
- public WTPOperation getDefaultOperation() {
- return new ResourceReferenceCreationOperation(this);
- }
-
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.jst.j2ee/j2eecreation/org/eclipse/jst/j2ee/internal/reference/ServiceReferenceCreationOperation.java b/plugins/org.eclipse.jst.j2ee/j2eecreation/org/eclipse/jst/j2ee/internal/reference/ServiceReferenceCreationOperation.java
deleted file mode 100644
index 18b6edf26..000000000
--- a/plugins/org.eclipse.jst.j2ee/j2eecreation/org/eclipse/jst/j2ee/internal/reference/ServiceReferenceCreationOperation.java
+++ /dev/null
@@ -1,252 +0,0 @@
-/*
- * Created on Feb 6, 2004
- *
- * To change the template for this generated file go to
- * Window - Preferences - Java - Code Generation - Code and Comments
- */
-package org.eclipse.jst.j2ee.internal.reference;
-
-import java.util.List;
-
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.ecore.EPackage;
-import org.eclipse.jem.java.JavaClass;
-import org.eclipse.jem.java.JavaRefFactory;
-import org.eclipse.jst.j2ee.client.ApplicationClient;
-import org.eclipse.jst.j2ee.common.CommonFactory;
-import org.eclipse.jst.j2ee.common.Description;
-import org.eclipse.jst.j2ee.common.QName;
-import org.eclipse.jst.j2ee.ejb.EnterpriseBean;
-import org.eclipse.jst.j2ee.internal.J2EEVersionConstants;
-import org.eclipse.jst.j2ee.internal.client.impl.ClientFactoryImpl;
-import org.eclipse.jst.j2ee.internal.common.CommonPackage;
-import org.eclipse.jst.j2ee.internal.common.XMLResource;
-import org.eclipse.jst.j2ee.internal.webservices.WebServiceClientGenerator;
-import org.eclipse.jst.j2ee.internal.webservices.WebServicesClientDataRegistry;
-import org.eclipse.jst.j2ee.webapplication.WebApp;
-import org.eclipse.jst.j2ee.webservice.internal.wsclient.Webservice_clientPackage;
-import org.eclipse.jst.j2ee.webservice.wsclient.ComponentScopedRefs;
-import org.eclipse.jst.j2ee.webservice.wsclient.PortComponentRef;
-import org.eclipse.jst.j2ee.webservice.wsclient.ServiceRef;
-import org.eclipse.jst.j2ee.webservice.wsclient.WebServicesClient;
-import org.eclipse.jst.j2ee.webservice.wsclient.Webservice_clientFactory;
-import org.eclipse.wst.common.componentcore.internal.operation.ModelModifierOperation;
-import org.eclipse.wst.common.internal.emfworkbench.integration.ModifierHelper;
-import org.eclipse.wst.server.core.IRuntime;
-import org.eclipse.wst.server.core.ServerCore;
-
-
-/**
- * @author dfholttp
- *
- * To change the template for this generated type comment go to Window - Preferences - Java - Code
- * Generation - Code and Comments
- */
-public class ServiceReferenceCreationOperation extends ModelModifierOperation {
- ServiceReferenceDataModel dataModel;
- ServiceRef ref;
- private int j2eeVersion = J2EEVersionConstants.J2EE_1_4_ID;
-
- /**
- * @param dataModel
- */
- public ServiceReferenceCreationOperation(ServiceReferenceDataModel dataModel) {
- super(dataModel);
- this.dataModel = dataModel;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.jem.util.emf.workbench.operation.ModelModifierOperation#addHelpers()
- */
- protected void addHelpers() {
- WebServiceClientGenerator actualGen = getWebServiceClientGenerator();
- if (actualGen != null)
- actualGen.genWebServiceClientArtifacts(dataModel);
- if (!dataModel.didGenDescriptors())
- modifier.addHelper(createHelpers());
-
- if (actualGen != null)
- createPortCompRefHelpers();
- }
-
- protected WebServiceClientGenerator getWebServiceClientGenerator() {
- List generators = WebServicesClientDataRegistry.getInstance().getWSClientGeneratorExtensions();
- WebServiceClientGenerator actualGen = null;
-
- IRuntime runtime = ServerCore.getProjectProperties(dataModel.getTargetProject()).getRuntimeTarget();
- if (runtime == null)
- return null;
- String serverTargetID = runtime.getRuntimeType().getId();
-
- for (int i = 0; i < generators.size(); i++) {
- WebServiceClientGenerator gen = (WebServiceClientGenerator) generators.get(i);
- if (gen.isRuntimeSupported(serverTargetID)) {
- if (serverTargetID.equals(WebServiceClientGenerator.GENERIC_J2EE_CONTAINER)) {
- // AXIS is only supported for web projects
- if (dataModel.getDeploymentDescriptorType() != XMLResource.WEB_APP_TYPE)
- break;
- }
- actualGen = gen;
- break;
- }
- }
- return actualGen;
- }
-
- /*
- * @see SimpleCommandWizardPage#createCommandHelper()
- */
- public ModifierHelper createHelpers() {
- ModifierHelper helper = null;
- ref = Webservice_clientFactory.eINSTANCE.createServiceRef();
-
- if (dataModel != null) {
- helper = new ModifierHelper();
- EObject owner = (EObject) dataModel.getProperty(ReferenceDataModel.OWNER);
- switch (dataModel.getDeploymentDescriptorType()) {
- case XMLResource.APP_CLIENT_TYPE :
- if (((ApplicationClient) owner).getVersionID() == J2EEVersionConstants.J2EE_1_4_ID) {
- helper.setFeature(ClientFactoryImpl.getPackage().getApplicationClient_ServiceRefs());
- helper.setOwner(owner);
- Description descriptionObj = CommonFactory.eINSTANCE.createDescription();
- descriptionObj.setValue(dataModel.getStringProperty(ReferenceDataModel.DESCRIPTION).trim());
- ref.getDescriptions().add(descriptionObj);
- ref.setDescription(dataModel.getStringProperty(ReferenceDataModel.DESCRIPTION).trim());
- } else {
- helper.setFeature(Webservice_clientPackage.eINSTANCE.getWebServicesClient_ServiceRefs());
- //TODO fix up for artifact edit
- //helper.setOwner(WebServicesManager.getInstance().getDefaultWebServicesResource(owner, getArtifactEdit()).getWebServicesClient());
- ref.setDescription(dataModel.getStringProperty(ReferenceDataModel.DESCRIPTION).trim());
- j2eeVersion = J2EEVersionConstants.J2EE_1_3_ID;
- }
- break;
- case XMLResource.EJB_TYPE :
- if (((EnterpriseBean) owner).getVersionID() == J2EEVersionConstants.EJB_2_1_ID) {
- helper.setFeature(CommonPackage.eINSTANCE.getJNDIEnvRefsGroup_ServiceRefs());
- helper.setOwner(owner);
- Description descriptionObj = CommonFactory.eINSTANCE.createDescription();
- descriptionObj.setValue(dataModel.getStringProperty(ReferenceDataModel.DESCRIPTION).trim());
- ref.getDescriptions().add(descriptionObj);
- ref.setDescription(dataModel.getStringProperty(ReferenceDataModel.DESCRIPTION).trim());
- } else {
- j2eeVersion = J2EEVersionConstants.J2EE_1_3_ID;
- return createEJB13Helper(owner, helper);
- }
- break;
- case XMLResource.WEB_APP_TYPE :
- if (((WebApp) owner).getVersionID() == J2EEVersionConstants.WEB_2_4_ID) {
- helper.setFeature(CommonPackage.eINSTANCE.getJNDIEnvRefsGroup_ServiceRefs());
- helper.setOwner(owner);
- Description descriptionObj = CommonFactory.eINSTANCE.createDescription();
- descriptionObj.setValue(dataModel.getStringProperty(ReferenceDataModel.DESCRIPTION).trim());
- ref.getDescriptions().add(descriptionObj);
- ref.setDescription(dataModel.getStringProperty(ReferenceDataModel.DESCRIPTION).trim());
- } else {
- helper.setFeature(Webservice_clientPackage.eINSTANCE.getWebServicesClient_ServiceRefs());
- //TODO fix up for artifact edit
- //helper.setOwner(WebServicesManager.getInstance().getDefaultWebServicesResource(owner, getArtifactEdit()).getWebServicesClient());
- ref.setDescription(dataModel.getStringProperty(ReferenceDataModel.DESCRIPTION).trim());
- j2eeVersion = J2EEVersionConstants.J2EE_1_3_ID;
- }
- break;
- }
- }
-
- ref.setServiceRefName(dataModel.getStringProperty(ReferenceDataModel.REF_NAME).trim());
- String serviceInterfaceName = dataModel.getServiceInterfaceName();
- ref.setServiceInterface((JavaClass) JavaRefFactory.eINSTANCE.reflectType(serviceInterfaceName, (EObject) dataModel.getProperty(ReferenceDataModel.OWNER)));
- ref.setWsdlFile(dataModel.getStringProperty(ServiceReferenceDataModel.WSDL_FILE).trim());
- if (dataModel.getStringProperty(ServiceReferenceDataModel.JAX_RPC_MAPPING_FILE) != null && !dataModel.getStringProperty(ServiceReferenceDataModel.JAX_RPC_MAPPING_FILE).equals("")) //$NON-NLS-1$
- ref.setJaxrpcMappingFile(dataModel.getStringProperty(ServiceReferenceDataModel.JAX_RPC_MAPPING_FILE).trim());
- QName qName = ((CommonPackage) EPackage.Registry.INSTANCE.getEPackage(CommonPackage.eNS_URI)).getCommonFactory().createQName();
-
- if (j2eeVersion == J2EEVersionConstants.J2EE_1_3_ID) {
- qName.setLocalPart(dataModel.getStringProperty(ServiceReferenceDataModel.QNAME_lOCAL_PART));
- qName.setNamespaceURI(dataModel.getStringProperty(ServiceReferenceDataModel.QNAME_NAMESPACE_URI));
- } else {
- qName.setValues("prefix", dataModel.getStringProperty(ServiceReferenceDataModel.QNAME_NAMESPACE_URI), dataModel.getStringProperty(ServiceReferenceDataModel.QNAME_lOCAL_PART)); //$NON-NLS-1$
- }
- ref.setServiceQname(qName);
- ref.setDescription(dataModel.getStringProperty(ReferenceDataModel.DESCRIPTION).trim());
- helper.setValue(ref);
- return helper;
- }
-
- /*
- * @see SimpleCommandWizardPage#createCommandHelper()
- */
- public void createPortCompRefHelpers() {
- ModifierHelper helper = null;
- if (dataModel != null) {
- helper = new ModifierHelper();
- String[] serEndpoints = dataModel.getServiceEndpointInterfaceNames();
- if (serEndpoints == null || serEndpoints.length == 0)
- return;
- String serviceEndpointInterface;
- for (int i = 0; i < serEndpoints.length; i++) {
- PortComponentRef portCompRef = Webservice_clientFactory.eINSTANCE.createPortComponentRef();
- helper.setOwner(ref);
- serviceEndpointInterface = serEndpoints[i];
- portCompRef.setServiceEndpointInterface((JavaClass) JavaRefFactory.eINSTANCE.reflectType(serviceEndpointInterface, (EObject) dataModel.getProperty(ReferenceDataModel.OWNER)));
- helper.setFeature(Webservice_clientPackage.eINSTANCE.getServiceRef_PortComponentRefs());
- helper.setValue(portCompRef);
- modifier.addHelper(helper);
- }
- }
- }
-
- /**
- * @return
- */
- private ModifierHelper createEJB13Helper(EObject ownerEJB, ModifierHelper helper) {
- //TODO fix up for artifact edit
-// ref = Webservice_clientFactory.eINSTANCE.createServiceRef();
-// WebServicesClient webServiceClient = WebServicesManager.getInstance().getDefaultWebServicesResource(ownerEJB, getArtifactEdit()).getWebServicesClient();
-//
-// ref.setServiceRefName(dataModel.getStringProperty(ReferenceDataModel.REF_NAME).trim());
-// String serviceInterfaceName = dataModel.getServiceInterfaceName();
-// ref.setServiceInterface((JavaClass) JavaRefFactory.eINSTANCE.reflectType(serviceInterfaceName, (EObject) dataModel.getProperty(ReferenceDataModel.OWNER)));
-// ref.setWsdlFile(dataModel.getStringProperty(ServiceReferenceDataModel.WSDL_FILE).trim());
-// if (dataModel.getStringProperty(ServiceReferenceDataModel.JAX_RPC_MAPPING_FILE) != null && !dataModel.getStringProperty(ServiceReferenceDataModel.JAX_RPC_MAPPING_FILE).equals("")) //$NON-NLS-1$
-// ref.setJaxrpcMappingFile(dataModel.getStringProperty(ServiceReferenceDataModel.JAX_RPC_MAPPING_FILE).trim());
-// QName qName = ((CommonPackage) EPackage.Registry.INSTANCE.getEPackage(CommonPackage.eNS_URI)).getCommonFactory().createQName();
-// qName.setLocalPart(dataModel.getStringProperty(ServiceReferenceDataModel.QNAME_lOCAL_PART));
-// qName.setNamespaceURI(dataModel.getStringProperty(ServiceReferenceDataModel.QNAME_NAMESPACE_URI));
-// ref.setServiceQname(qName);
-// ref.setDescription(dataModel.getStringProperty(ReferenceDataModel.DESCRIPTION).trim());
-//
-// ComponentScopedRefs compScopedRef = getComponentScopedRef((EnterpriseBean) ownerEJB, webServiceClient);
-// if (compScopedRef == null) {
-// compScopedRef = Webservice_clientFactory.eINSTANCE.createComponentScopedRefs();
-// compScopedRef.setComponentName(((EnterpriseBean) ownerEJB).getName());
-// helper.setOwner(webServiceClient);
-// helper.setFeature(Webservice_clientPackage.eINSTANCE.getWebServicesClient_ComponentScopedRefs());
-// compScopedRef.getServiceRefs().add(ref);
-// helper.setValue(compScopedRef);
-// } else {
-// helper.setOwner(compScopedRef);
-// helper.setFeature(Webservice_clientPackage.eINSTANCE.getComponentScopedRefs_ServiceRefs());
-// helper.setValue(ref);
-// }
-// return helper;
- return null;
- }
-
- /**
- * @param webServiceRes
- * @return
- */
- private ComponentScopedRefs getComponentScopedRef(EnterpriseBean ownerEJB, WebServicesClient webServiceClient) {
- List existingRefs = webServiceClient.getComponentScopedRefs();
- if (existingRefs != null) {
- for (int i = 0; i < existingRefs.size(); i++) {
- if (((ComponentScopedRefs) existingRefs.get(i)).getComponentName().equals(ownerEJB.getName())) {
- return (ComponentScopedRefs) existingRefs.get(i);
- }
- }
- }
- return null;
- }
-}
diff --git a/plugins/org.eclipse.jst.j2ee/j2eecreation/org/eclipse/jst/j2ee/internal/reference/ServiceReferenceDataModel.java b/plugins/org.eclipse.jst.j2ee/j2eecreation/org/eclipse/jst/j2ee/internal/reference/ServiceReferenceDataModel.java
deleted file mode 100644
index 6cdc1f7a3..000000000
--- a/plugins/org.eclipse.jst.j2ee/j2eecreation/org/eclipse/jst/j2ee/internal/reference/ServiceReferenceDataModel.java
+++ /dev/null
@@ -1,322 +0,0 @@
-package org.eclipse.jst.j2ee.internal.reference;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IWorkspaceRoot;
-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.emf.common.util.URI;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.jem.util.emf.workbench.ProjectUtilities;
-import org.eclipse.jst.j2ee.internal.common.XMLResource;
-import org.eclipse.jst.j2ee.internal.project.J2EECreationResourceHandler;
-import org.eclipse.jst.j2ee.internal.webservices.WSDLServiceExtManager;
-import org.eclipse.jst.j2ee.internal.webservices.WSDLServiceHelper;
-import org.eclipse.jst.j2ee.internal.webservices.WebServicesClientDataHelper;
-import org.eclipse.wst.common.frameworks.internal.operations.WTPOperation;
-import org.eclipse.wst.common.frameworks.internal.plugin.WTPCommonPlugin;
-import org.eclipse.wst.common.internal.emfworkbench.WorkbenchResourceHelper;
-
-public class ServiceReferenceDataModel extends ReferenceDataModel implements WebServicesClientDataHelper {
- /**
- * Required, type String
- */
- public static final String TARGET_WEB_SERVICE = "ServiceReferenceDataModel.TARGET_WEB_SERVICE"; //$NON-NLS-1$
- /**
- * Required, type String
- */
- public static final String WSDL_FILE = "ServiceReferenceDataModel.WSDL_FILE"; //$NON-NLS-1$
- /**
- * Required, type String
- */
- public static final String JAX_RPC_MAPPING_FILE = "ServiceReferenceDataModel.JAX_RPC_MAPPING_FILE"; //$NON-NLS-1$
- /**
- * Required, type String
- */
- public static final String QNAME_NAMESPACE_URI = "ServiceReferenceDataModel.QNAME_NAMESPACE_URI"; //$NON-NLS-1$
- /**
- * Required, type String
- */
- public static final String QNAME_lOCAL_PART = "ServiceReferenceDataModel.QNAME_lOCAL_PART"; //$NON-NLS-1$
- /**
- * Required, type String
- */
- public static final String WSDL_URL = "ServiceReferenceDataModel.WSDL_URL"; //$NON-NLS-1$
- /**
- * Required, type String
- */
- public static final String QNAME = "ServiceReferenceDataModel.QNAME"; //$NON-NLS-1$
- /**
- * Required, type String
- */
- public static final String LINKS = "ServiceReferenceDataModel.LINK"; //$NON-NLS-1$
-
- private String[] serviceEndpointInterfaceNames = null;
- private String serviceInterfaceName = null;
- private boolean didGenDescriptor = false;
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.jem.util.emf.workbench.operation.EditModelOperationDataModel#initValidBaseProperties()
- */
- protected void initValidBaseProperties() {
- addValidBaseProperty(TARGET_WEB_SERVICE);
- addValidBaseProperty(WSDL_FILE);
- addValidBaseProperty(JAX_RPC_MAPPING_FILE);
- addValidBaseProperty(QNAME_NAMESPACE_URI);
- addValidBaseProperty(QNAME_lOCAL_PART);
- addValidBaseProperty(WSDL_URL);
- addValidBaseProperty(QNAME);
- addValidBaseProperty(LINKS);
- super.initValidBaseProperties();
- }
-
- /*
- * (non-Javadoc)
- *
- * @see com.ibm.etools.j2ee.reference.ReferenceDataModel#doSetProperty(java.lang.String,
- * java.lang.Object)
- */
- protected boolean doSetProperty(String propertyName, Object propertyValue) {
- boolean doSet = super.doSetProperty(propertyName, propertyValue);
- if (propertyName.equals(TARGET_WEB_SERVICE)) {
- notifyDefaultChange(REF_NAME);
- notifyDefaultChange(WSDL_FILE);
- notifyDefaultChange(WSDL_URL);
- notifyDefaultChange(QNAME);
- notifyDefaultChange(QNAME_NAMESPACE_URI);
- notifyDefaultChange(QNAME_lOCAL_PART);
- }
- return doSet;
- }
-
- protected Object getLocationForServiceFromWSIL(EObject wsdl) {
- // Fix to get "external" workspace wsdl file because wsilparser uses generic resource set
- WSDLServiceHelper serviceHelper = WSDLServiceExtManager.getServiceHelper();
- if (wsdl.eResource() == null)
- return serviceHelper.getServiceDefinitionLocation(wsdl);
- URI uri = wsdl.eResource().getURI();
- IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
- IPath rootPath = root.getLocation();
- IPath wsdlPath = new Path(uri.toFileString());
- if (wsdlPath.matchingFirstSegments(rootPath) == rootPath.segmentCount()) {
- IFile wsdlFile = root.getFile(wsdlPath.removeFirstSegments(rootPath.segmentCount()));
- if (wsdlFile.exists()) {
- return wsdlFile.getProjectRelativePath().removeFirstSegments(1).toString();
- }
- }
- return null;
- }
-
- protected Object getDefaultProperty(String propertyName) {
- WSDLServiceHelper serviceHelper = WSDLServiceExtManager.getServiceHelper();
- if (propertyName.equals(REF_NAME)) {
- Object wsdl = getProperty(TARGET_WEB_SERVICE);
- if (wsdl != null)
- return "service/" + serviceHelper.getServiceLocalPart(wsdl); //$NON-NLS-1$
- } else if (propertyName.equals(WSDL_FILE)) {
- EObject wsdl = (EObject)getProperty(TARGET_WEB_SERVICE);
- if (wsdl != null) {
- boolean isInternal = WorkbenchResourceHelper.getFile(wsdl) != null && WorkbenchResourceHelper.getFile(wsdl).exists();
- if (isInternal)
- return WorkbenchResourceHelper.getFile(wsdl).getProjectRelativePath().removeFirstSegments(1).toString();
-
- Object location = getLocationForServiceFromWSIL(wsdl);
- if (location != null)
- return location;
- }
- } else if (propertyName.equals(WSDL_URL)) {
- EObject wsdl = (EObject) getProperty(TARGET_WEB_SERVICE);
- if (wsdl != null) {
- boolean isInternal = WorkbenchResourceHelper.getFile(wsdl) != null && WorkbenchResourceHelper.getFile(wsdl).exists();
- if (isInternal)
- return "file:/" + WorkbenchResourceHelper.getFile(wsdl).getRawLocation().toString(); //$NON-NLS-1$
- return serviceHelper.getServiceDefinitionLocation(wsdl);
- }
- } else if (propertyName.equals(QNAME)) {
- EObject wsdl = (EObject) getProperty(TARGET_WEB_SERVICE);
- if (wsdl != null)
- return serviceHelper.getServiceQName(wsdl);
- } else if (propertyName.equals(QNAME_NAMESPACE_URI)) {
- EObject wsdl = (EObject) getProperty(TARGET_WEB_SERVICE);
- if (wsdl != null) {
- Object qName = serviceHelper.getServiceQName(wsdl);
- if (qName != null)
- return serviceHelper.getServiceNamespaceURI(wsdl);
- }
- } else if (propertyName.equals(QNAME_lOCAL_PART)) {
- EObject wsdl = (EObject) getProperty(TARGET_WEB_SERVICE);
- if (wsdl != null) {
- Object qName = serviceHelper.getServiceQName(wsdl);
- if (qName != null)
- return serviceHelper.getServiceLocalPart(wsdl);
- }
- }
- return super.getDefaultProperty(propertyName);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see com.ibm.etools.j2ee.reference.ReferenceDataModel#doValidateProperty(java.lang.String)
- */
- protected IStatus doValidateProperty(String propertyName) {
- IStatus stat = super.doValidateProperty(propertyName);
- WSDLServiceHelper serviceHelper = WSDLServiceExtManager.getServiceHelper();
- if (!serviceHelper.isService(getProperty(TARGET_WEB_SERVICE))) {
- return WTPCommonPlugin.createErrorStatus(J2EECreationResourceHandler.getString("ServiceReferenceDataModel_ERROR_8")); //$NON-NLS-1$
- }
- return stat;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.jem.util.operation.WTPOperationDataModel#getDefaultOperation()
- */
- public WTPOperation getDefaultOperation() {
- return new ServiceReferenceCreationOperation(this);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see com.ibm.wtp.j2ee.webservices.WebServicesClientDataHelper#getWSDLUrl()
- */
- public String getWSDLUrl() {
- return getStringProperty(WSDL_URL);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see com.ibm.wtp.j2ee.webservices.WebServicesClientDataHelper#getServiceQName()
- */
- public String getServiceQName() {
- return getStringProperty(QNAME_NAMESPACE_URI) + ":" + getStringProperty(QNAME_lOCAL_PART); //$NON-NLS-1$
- }
-
- /*
- * (non-Javadoc)
- *
- * @see com.ibm.wtp.j2ee.webservices.WebServicesClientDataHelper#getServiceInterfaceName()
- */
- public String getServiceInterfaceName() {
- return serviceInterfaceName;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see com.ibm.wtp.j2ee.webservices.WebServicesClientDataHelper#getServiceEndpointInterfaceNames()
- */
- public String[] getServiceEndpointInterfaceNames() {
- return serviceEndpointInterfaceNames;
- }
-
-
- /*
- * (non-Javadoc)
- *
- * @see com.ibm.wtp.j2ee.webservices.WebServicesClientDataHelper#setServiceInterfaceName(java.lang.String)
- */
- public void setServiceInterfaceName(String name) {
- serviceInterfaceName = name;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see com.ibm.wtp.j2ee.webservices.WebServicesClientDataHelper#setServiceEndpointInterfaceNames(java.lang.String[])
- */
- public void setServiceEndpointInterfaceNames(String[] names) {
- serviceEndpointInterfaceNames = names;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see com.ibm.wtp.j2ee.webservices.WebServicesClientDataHelper#getProjectName()
- */
- public String getProjectName() {
- Object owner = getProperty(OWNER);
- String name = ProjectUtilities.getProject(owner).getName();
- return name;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see com.ibm.wtp.j2ee.webservices.WebServicesClientDataHelper#getOutputWSDLFileName()
- */
- public String getOutputWSDLFileName() {
- WSDLServiceHelper serviceHelper = WSDLServiceExtManager.getServiceHelper();
- Object owner = getProperty(OWNER);
- String outputLocation = null;
- IProject project;
- switch (getDeploymentDescriptorType()) {
- case XMLResource.APP_CLIENT_TYPE :
- project = ProjectUtilities.getProject(owner);
- outputLocation = project.getFullPath().toString() + "\\appClientModule\\META-INF\\"; //$NON-NLS-1$
- break;
- case XMLResource.EJB_TYPE :
- project = ProjectUtilities.getProject(owner);
- outputLocation = project.getFullPath().toString() + "\\ejbModule\\META-INF\\"; //$NON-NLS-1$
- break;
- case XMLResource.WEB_APP_TYPE :
- project = ProjectUtilities.getProject(owner);
- outputLocation = project.getFullPath().toString() + "\\Web Content\\WEB-INF\\"; //$NON-NLS-1$
- break;
- }
- EObject service = (EObject) getProperty(TARGET_WEB_SERVICE);
- if (service == null)
- return ""; //$NON-NLS-1$
- return outputLocation + serviceHelper.getServiceLocalPart(service) + ".wsdl"; //$NON-NLS-1$
- }
-
- /*
- * (non-Javadoc)
- *
- * @see com.ibm.wtp.j2ee.webservices.WebServicesClientDataHelper#shouldDeploy()
- */
- public boolean shouldDeploy() {
- return false;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see com.ibm.wtp.j2ee.webservices.WebServicesClientDataHelper#shouldGenDescriptors()
- */
- public boolean shouldGenDescriptors() {
- return false;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see com.ibm.wtp.j2ee.webservices.WebServicesClientDataHelper#setDidGenDescriptors(boolean)
- */
- public void setDidGenDescriptors(boolean b) {
- didGenDescriptor = b;
- }
-
- public boolean didGenDescriptors() {
- return didGenDescriptor;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.jem.util.operation.WTPOperationDataModel#isResultProperty(java.lang.String)
- */
- protected boolean isResultProperty(String propertyName) {
- if (propertyName.equals(JAX_RPC_MAPPING_FILE))
- return true;
- return super.isResultProperty(propertyName);
- }
-
-}
diff --git a/plugins/org.eclipse.jst.j2ee/j2eecreation/org/eclipse/jst/j2ee/internal/rename/ClasspathRenameInfo.java b/plugins/org.eclipse.jst.j2ee/j2eecreation/org/eclipse/jst/j2ee/internal/rename/ClasspathRenameInfo.java
deleted file mode 100644
index ba2780c43..000000000
--- a/plugins/org.eclipse.jst.j2ee/j2eecreation/org/eclipse/jst/j2ee/internal/rename/ClasspathRenameInfo.java
+++ /dev/null
@@ -1,76 +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.rename;
-
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.core.resources.IProject;
-
-/**
- * A simple structure that remembers for a given project, the manifest entries to be deleted and the
- * build path entries to be deleted
- */
-public class ClasspathRenameInfo {
- /**
- * The project from which the dependencies will be removed
- */
- protected IProject targetProject;
- /**
- * The literal manifest entries to be removed; String
- */
- protected List manifestEntries;
- /**
- * The project references to be removed from the build path; IProject
- */
- protected List referencedProjects;
-
- public ClasspathRenameInfo(IProject project) {
- super();
- targetProject = project;
- }
-
- /**
- * Gets the manifestEntries.
- *
- * @return Returns a List
- */
- public List getManifestEntries() {
- if (manifestEntries == null)
- manifestEntries = new ArrayList();
- return manifestEntries;
- }
-
-
- /**
- * Gets the referencedProjects.
- *
- * @return Returns a List
- */
- public List getReferencedProjects() {
- if (referencedProjects == null)
- referencedProjects = new ArrayList();
- return referencedProjects;
- }
-
-
- /**
- * Gets the targetProject.
- *
- * @return Returns a IProject
- */
- public IProject getTargetProject() {
- return targetProject;
- }
-
-
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.jst.j2ee/j2eecreation/org/eclipse/jst/j2ee/internal/rename/RenameModuleDependencyOperation.java b/plugins/org.eclipse.jst.j2ee/j2eecreation/org/eclipse/jst/j2ee/internal/rename/RenameModuleDependencyOperation.java
deleted file mode 100644
index 7b40e10e8..000000000
--- a/plugins/org.eclipse.jst.j2ee/j2eecreation/org/eclipse/jst/j2ee/internal/rename/RenameModuleDependencyOperation.java
+++ /dev/null
@@ -1,267 +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.rename;
-
-
-import java.io.IOException;
-import java.lang.reflect.InvocationTargetException;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.HashMap;
-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.ResourcesPlugin;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.SubProgressMonitor;
-import org.eclipse.jdt.core.IClasspathEntry;
-import org.eclipse.jdt.core.IJavaProject;
-import org.eclipse.jdt.core.JavaCore;
-import org.eclipse.jdt.core.JavaModelException;
-import org.eclipse.jem.util.emf.workbench.ProjectUtilities;
-import org.eclipse.jem.workbench.utility.JemProjectUtilities;
-import org.eclipse.jst.j2ee.application.Module;
-import org.eclipse.jst.j2ee.commonarchivecore.internal.helpers.ArchiveManifest;
-import org.eclipse.jst.j2ee.commonarchivecore.internal.util.ArchiveUtil;
-import org.eclipse.jst.j2ee.internal.earcreation.EAREditModel;
-import org.eclipse.jst.j2ee.internal.earcreation.EARNatureRuntime;
-import org.eclipse.jst.j2ee.internal.plugin.J2EEPlugin;
-import org.eclipse.jst.j2ee.internal.project.J2EECreationResourceHandler;
-import org.eclipse.jst.j2ee.internal.project.J2EEModuleNature;
-import org.eclipse.jst.j2ee.internal.project.J2EENature;
-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;
-
-public class RenameModuleDependencyOperation extends WTPOperation {
-
- protected List earEditModels;
- protected Set projects;
- protected IProject renamedProject = null;
- protected Map renameInfos;
- protected IProgressMonitor monitor;
- protected static String MOD_DEP_RENAME_ERRORS = J2EECreationResourceHandler.getString("Errors_occurred_renaming_module_dependencies_UI_"); //$NON-NLS-1$
-
- public RenameModuleDependencyOperation(List earEditModels, Set projects, IProject renamedProject) {
- this.earEditModels = earEditModels;
- this.projects = projects;
- this.renamedProject = renamedProject;
- }
-
- protected Map getRenameInfos() {
- if (renameInfos == null)
- renameInfos = new HashMap();
- return renameInfos;
- }
-
- protected ClasspathRenameInfo getRenameInfo(IProject referencingProject) {
- ClasspathRenameInfo info = (ClasspathRenameInfo) getRenameInfos().get(referencingProject);
- if (info != null)
- return info;
- info = new ClasspathRenameInfo(referencingProject);
- renameInfos.put(referencingProject, info);
- return info;
- }
-
- /**
- * @see HeadlessJ2EEOperation#execute(IProgressMonitor)
- */
- protected void execute(IProgressMonitor aMonitor) throws CoreException, InvocationTargetException, InterruptedException {
- this.monitor = aMonitor;
- gatherRenameInfoIfNecessary();
- executeRenameInfo();
- }
-
- /*
- * Iterate the edit models; for each edit model, iterate the projects; for each project... find
- * the module for the project find all the modules that reference the module for each of those,
- * resolve back to a project and cache the runtime classpath entry and project name going away
- */
- protected void gatherRenameInfo() {
- for (int i = 0; i < earEditModels.size(); i++) {
- EAREditModel model = (EAREditModel) earEditModels.get(i);
- gatherRenameInfo(model);
- }
- }
-
- protected void gatherRenameInfo(EAREditModel editModel) {
- EARNatureRuntime runtime = editModel.getEARNature();
- Map urisToNatures = runtime.getModuleProjects();
- for (Iterator iterator = projects.iterator(); iterator.hasNext();) {
- IProject project = (IProject) iterator.next();
- gatherRenameInfo(runtime, urisToNatures, project);
- }
- }
-
- /*
- * If this project is referenced by the EAR iterate all the other projects referenced by the EAR
- * for each project p if the p references the referenced project, add the reference to the
- * rename info
- */
- protected void gatherRenameInfo(EARNatureRuntime runtime, Map urisToNatures, IProject referencedProject) {
- Module m = runtime.getModule(referencedProject);
- if (m == null)
- return;
-
- Iterator it = urisToNatures.entrySet().iterator();
- while (it.hasNext()) {
- Map.Entry entry = (Map.Entry) it.next();
- String uri = (String) entry.getKey();
- J2EENature nature = (J2EENature) entry.getValue();
- if (nature == null || referencedProject.equals(nature.getProject()))
- continue;
- gatherRenameInfo(uri, nature, referencedProject, m.getUri());
- }
- }
-
- protected void gatherRenameInfo(String testUri, J2EENature testNature, IProject referencedProject, String moduleUri) {
- ArchiveManifest mf = J2EEProjectUtilities.readManifest(testNature.getProject());
- if (mf == null)
- return;
- String[] classpath = J2EEProjectUtilities.readManifest(testNature.getProject()).getClassPathTokenized();
- for (int i = 0; i < classpath.length; i++) {
- String resolved = ArchiveUtil.deriveEARRelativeURI(classpath[i], moduleUri);
- if (!moduleUri.equals(resolved))
- continue;
- ClasspathRenameInfo info = getRenameInfo(testNature.getProject());
- info.getManifestEntries().add(classpath[i]);
- info.getReferencedProjects().add(referencedProject);
- }
- }
-
- protected void executeRenameInfo() throws InvocationTargetException {
- if (renameInfos == null)
- return;
- Iterator it = renameInfos.values().iterator();
- while (it.hasNext()) {
- ClasspathRenameInfo info = (ClasspathRenameInfo) it.next();
- IProject p = info.getTargetProject();
- J2EEModuleNature nature = (J2EEModuleNature) J2EENature.getRegisteredRuntime(p);
- if (nature == null)
- continue;
- if (nature.isBinaryProject()) {
- String message = J2EECreationResourceHandler.getString("Can_not_rename_module_dependency_from_project_UI_", new Object[]{p.getName()}); //$NON-NLS-1$
- addErrorStatus(message);
- continue;
- }
- try {
- replaceManifest(nature, info);
- replaceBuildPath(nature, info);
- } catch (Exception ex) {
- throw new WFTWrappedException(ex);
- }
- }
- }
-
- protected void replaceManifest(J2EENature nature, ClasspathRenameInfo info) throws IOException {
- ArchiveManifest mf = J2EEProjectUtilities.readManifest(nature.getProject());
- if (mf == null)
- return;
- String[] entries = mf.getClassPathTokenized();
- StringBuffer sb = new StringBuffer();
- boolean empty = true;
- for (int i = 0; i < entries.length; i++) {
- String entry = entries[i];
- if (info.getManifestEntries().contains(entry)) {
- String suffix = entry.substring(entry.lastIndexOf('.'));
- entry = renamedProject.getName();
- entry = entry.concat(suffix);
- }
- if (!empty)
- sb.append(" "); //$NON-NLS-1$
- empty = false;
- sb.append(entry);
- }
- mf.setClassPath(sb.toString());
- J2EEProjectUtilities.writeManifest(nature.getProject(), mf);
- }
-
- protected void replaceBuildPath(J2EENature nature, ClasspathRenameInfo info) throws JavaModelException {
- IJavaProject javaP = JemProjectUtilities.getJavaProject(nature.getProject());
- if (javaP == null)
- return;
- List result = new ArrayList();
- IClasspathEntry[] entries = javaP.getRawClasspath();
- for (int i = 0; i < entries.length; i++) {
- IClasspathEntry entry = entries[i];
- if (shouldKeepEntry(entry, info))
- result.add(entry);
- else {
- IPath path = renamedProject.getFullPath();
- IClasspathEntry renamedEntry = JavaCore.newProjectEntry(path, true);
- result.add(renamedEntry);
- }
- }
- IClasspathEntry[] toArray = (IClasspathEntry[]) result.toArray(new IClasspathEntry[result.size()]);
- javaP.setRawClasspath(toArray, new SubProgressMonitor(monitor, 1));
- }
-
- protected boolean shouldKeepEntry(IClasspathEntry entry, ClasspathRenameInfo info) {
- if (entry.getEntryKind() != IClasspathEntry.CPE_PROJECT)
- return true;
-
- IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(entry.getPath().toString());
- return !info.getReferencedProjects().contains(project);
- }
-
- /**
- * Return a list of all the files that will get modified as a result of running this operation;
- * used for validateEdit
- */
- protected List getAffectedFiles() {
- gatherRenameInfoIfNecessary();
- if (renameInfos == null || renameInfos.isEmpty())
- return Collections.EMPTY_LIST;
- List result = new ArrayList();
- Iterator it = renameInfos.values().iterator();
- while (it.hasNext()) {
- ClasspathRenameInfo info = (ClasspathRenameInfo) it.next();
- IProject p = info.getTargetProject();
- IFile aFile = J2EEProjectUtilities.getManifestFile(p);
- if (aFile != null && aFile.exists()) {
- result.add(aFile);
- result.addAll(ProjectUtilities.getFilesAffectedByClasspathChange(p));
- }
- }
- return result;
- }
-
- /*
- * Iterate the edit models; for each edit model, iterate the projects; for each project... find
- * the module for the project find all the modules that reference the module for each of those,
- * resolve back to a project and cache the runtime classpath entry and project name going away
- */
- protected void gatherRenameInfoIfNecessary() {
- if (renameInfos == null || renameInfos.isEmpty()) {
- for (int i = 0; i < earEditModels.size(); i++) {
- EAREditModel model = (EAREditModel) earEditModels.get(i);
- gatherRenameInfo(model);
- }
- }
- }
-
- protected void addErrorStatus(String message) {
- IStatus newStatus = J2EEPlugin.newErrorStatus(message, null);
- addStatus(newStatus);
- // if (status == null)
- // status = newStatus;
- // else if (status.isMultiStatus())
- // ((MultiStatus)status).add(newStatus);
- // else
- // status = new MultiStatus(J2EEPlugin.PLUGIN_ID, 0, new IStatus[]{status},
- // status.getMessage(), null);
- }
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.jst.j2ee/j2eecreation/org/eclipse/jst/j2ee/internal/rename/RenameModuleOperation.java b/plugins/org.eclipse.jst.j2ee/j2eecreation/org/eclipse/jst/j2ee/internal/rename/RenameModuleOperation.java
deleted file mode 100644
index 87ff78b83..000000000
--- a/plugins/org.eclipse.jst.j2ee/j2eecreation/org/eclipse/jst/j2ee/internal/rename/RenameModuleOperation.java
+++ /dev/null
@@ -1,273 +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.rename;
-
-import java.lang.reflect.InvocationTargetException;
-import java.util.ArrayList;
-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 org.eclipse.core.resources.IProject;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.emf.common.command.AbstractCommand;
-import org.eclipse.emf.common.command.CompoundCommand;
-import org.eclipse.emf.common.util.URI;
-import org.eclipse.jst.j2ee.application.Module;
-import org.eclipse.jst.j2ee.internal.J2EEEditModel;
-import org.eclipse.jst.j2ee.internal.earcreation.AddModuleToEARProjectCommand;
-import org.eclipse.jst.j2ee.internal.earcreation.EAREditModel;
-import org.eclipse.jst.j2ee.internal.earcreation.EARNatureRuntime;
-import org.eclipse.jst.j2ee.internal.earcreation.RemoveModuleFromEARProjectCommand;
-import org.eclipse.jst.j2ee.internal.earcreation.UpdateModuleReferencesInEARProjectCommand;
-import org.eclipse.jst.j2ee.internal.project.J2EECreationResourceHandler;
-import org.eclipse.wst.common.frameworks.internal.operations.WTPOperation;
-import org.eclipse.wst.common.internal.emfworkbench.EMFWorkbenchContext;
-import org.eclipse.wst.common.internal.emfworkbench.WorkbenchResourceHelper;
-import org.eclipse.wst.common.internal.emfworkbench.integration.ComposedEditModel;
-import org.eclipse.wst.common.internal.emfworkbench.integration.EditModel;
-import org.eclipse.wst.common.internal.emfworkbench.integration.LooseComposedEditModel;
-
-
-public class RenameModuleOperation extends WTPOperation {
- protected RenameOptions options;
- protected IProject renamedProject = null;
- protected LooseComposedEditModel renameEditModel = null;
- /*
- * key is an EAREditModel and the value is a list of rename commands. We cache the commands and
- * execute later because the modules still need to exist when we go to change module dependency
- * references.
- */
- protected Map deferredCommands;
- protected IProgressMonitor monitor;
- protected RenameModuleDependencyOperation renameModuleDependencyOperation;
- protected List dirtyEarModels;
- protected static String EDIT_MODEL_KEY = "RENAME_MODULES"; //$NON-NLS-1$
-
- public RenameModuleOperation(RenameOptions options) {
- this.options = options;
- }
-
- /**
- * @see HeadlessJ2EEOperation#execute(IProgressMonitor)
- */
- protected void execute(IProgressMonitor aMonitor) throws CoreException, InvocationTargetException, InterruptedException {
- this.monitor = aMonitor;
- try {
- buildRenameCommandsIfNecessary();
- if (options.shouldRenameModuleDependencies()) {
- renameModuleDependencies();
- }
- checkIfEarsAreDirty();
- executeDeferredCommands();
- saveModelsIfNecessary();
- } finally {
- releaseModels();
- }
- }
-
- protected void checkIfEarsAreDirty() {
- dirtyEarModels = new ArrayList();
- if (deferredCommands == null)
- return;
- Iterator models = deferredCommands.keySet().iterator();
- while (models.hasNext()) {
- EAREditModel model = (EAREditModel) models.next();
- if (model.isDirty() && !dirtyEarModels.contains(model)) {
- dirtyEarModels.add(model);
- }
- }
- }
-
- protected void buildRenameCommands() {
- deferredCommands = new HashMap();
- List earProjects = EARNatureRuntime.getAllEARProjectsInWorkbench();
- for (int i = 0; i < earProjects.size(); i++) {
- IProject p = (IProject) earProjects.get(i);
- EARNatureRuntime runtime = EARNatureRuntime.getRuntime(p);
- if (runtime != null)
- buildRenameCommands(runtime);
- }
- }
-
- protected void buildRenameCommands(EARNatureRuntime runtime) {
- List commands = new ArrayList();
- List projects = options.getModuleAndUtilityProjects();
- EAREditModel model = null;
- try {
- model = runtime.getEarEditModelForWrite(this);
- if (options.shouldRenameModules()) {
- for (int i = 0; i < projects.size(); i++) {
- IProject project = (IProject) projects.get(i);
- Module m = runtime.getModule(project);
- if (m != null) {
- String uri;
- //Do not rename the module uri unless it was
- //the same as the original project name.
- boolean changedUri = false;
- if (!m.getUri().startsWith(project.getName()))
- uri = m.getUri();
- else {
- changedUri = true;
- // the following was taken from
- // WebProjectInfo.getDefaultUri()
- uri = options.getNewName().replace(' ', '_');
- uri += "." + URI.createURI(m.getUri()).fileExtension(); //$NON-NLS-1$
- }
- //AbstractCommand.class.getClass();
- CompoundCommand compoundCommand = new CompoundCommand();
- compoundCommand.append(new RemoveModuleFromEARProjectCommand(m, runtime.getProject()));
- renamedProject = project.getWorkspace().getRoot().getProject(options.getNewName());
- compoundCommand.append(new AddModuleToEARProjectCommand(renamedProject, runtime.getProject(), uri, options.getNewContextRoot(), null));
- if (changedUri)
- compoundCommand.append(new UpdateModuleReferencesInEARProjectCommand(runtime.getProject(), m, uri));
- commands.add(compoundCommand);
- }
- }
- }
- } finally {
- if (!commands.isEmpty()) {
- deferredCommands.put(model, commands);
- } else {
- model.releaseAccess(this);
- }
-
- }
- }
-
- /**
- * Do this for unhandled exceptions
- */
- /**
- * Do this for unhandled exceptions
- */
- protected void releaseModels() {
- if (renameEditModel != null) {
- renameEditModel = null;
- }
- if (deferredCommands != null) {
- Iterator iterator = deferredCommands.keySet().iterator();
- EditModel model = null;
- while (iterator.hasNext()) {
- model = (EditModel) iterator.next();
- model.releaseAccess(this);
- }
- deferredCommands.clear();
- }
- }
-
- public void release() {
- releaseModels();
- }
-
- /**
- * After a normal execution flow, save the models if necessary
- */
- protected void saveModelsIfNecessary() {
- if (deferredCommands == null)
- return;
- Iterator models = deferredCommands.keySet().iterator();
- while (models.hasNext()) {
- EAREditModel model = (EAREditModel) models.next();
- if (model.isDirty()) {
- if (dirtyEarModels.contains(model)) {
- model.saveIfNecessary(this);
- } else {
- model.save(this);
- }
- }
- }
- }
-
- protected void renameModuleDependencies() throws InvocationTargetException, InterruptedException {
- getRenameModuleDependencyOperation().run(monitor);
- }
-
- protected void executeDeferredCommands() {
- Iterator it = deferredCommands.entrySet().iterator();
- while (it.hasNext()) {
- Map.Entry entry = (Map.Entry) it.next();
- List commands = (List) entry.getValue();
- executeCommands(commands);
- }
- }
-
- protected void executeCommands(List commands) {
- for (int i = 0; i < commands.size(); i++) {
- AbstractCommand cmd = (AbstractCommand) commands.get(i);
- cmd.execute();
- }
- }
-
- /**
- * Use this only for validate edits
- */
- public ComposedEditModel getRenameEditModel() {
- if (renameEditModel == null)
- initializeRenameEditModel();
- return renameEditModel;
- }
-
- protected void initializeRenameEditModel() {
- if (options.getAllProjectsToRename().size() == 0) {
- throw new RuntimeException(J2EECreationResourceHandler.getString("RenameModuleOperation_UI_0")); //$NON-NLS-1$
- }
- IProject project = null;
- project = (IProject) options.getAllProjectsToRename().get(0);
- buildRenameCommandsIfNecessary();
- renameEditModel = new LooseComposedEditModel(EDIT_MODEL_KEY, (EMFWorkbenchContext) WorkbenchResourceHelper.getEMFContext(project)) {
- /**
- * @see org.eclipse.jst.j2ee.internal.internal.workbench.EditModel#getNonResourceFiles()
- */
- public List getNonResourceFiles() {
- List result = super.getNonResourceFiles();
- result.addAll(getAffectedNonResourceFiles());
- return result;
- }
- };
- Iterator it = deferredCommands.keySet().iterator();
- while (it.hasNext()) {
- renameEditModel.addChild((J2EEEditModel) it.next());
- }
- }
-
- protected void buildRenameCommandsIfNecessary() {
- if (deferredCommands != null && !deferredCommands.isEmpty())
- return;
- buildRenameCommands();
- }
-
- /**
- * Return a list of all the non-resource files that will get modified as a result of running
- * this operation; used for validate edit.
- */
- protected List getAffectedNonResourceFiles() {
- if (options.shouldRenameModuleDependencies())
- return getRenameModuleDependencyOperation().getAffectedFiles();
- return Collections.EMPTY_LIST;
- }
-
- protected RenameModuleDependencyOperation getRenameModuleDependencyOperation() {
- if (renameModuleDependencyOperation == null) {
- List earEditModels = new ArrayList();
- earEditModels.addAll(deferredCommands.keySet());
- renameModuleDependencyOperation = new RenameModuleDependencyOperation(earEditModels, new HashSet(options.getModuleAndUtilityProjects()), renamedProject);
- }
- return renameModuleDependencyOperation;
- }
-
- public IStatus getStatus() {
- return renameModuleDependencyOperation.getStatus();
- }
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.jst.j2ee/j2eecreation/org/eclipse/jst/j2ee/internal/rename/RenameOptions.java b/plugins/org.eclipse.jst.j2ee/j2eecreation/org/eclipse/jst/j2ee/internal/rename/RenameOptions.java
deleted file mode 100644
index 3041a2415..000000000
--- a/plugins/org.eclipse.jst.j2ee/j2eecreation/org/eclipse/jst/j2ee/internal/rename/RenameOptions.java
+++ /dev/null
@@ -1,165 +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.rename;
-
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-
-public class RenameOptions {
- protected boolean isEARRename;
- protected boolean renameProjects;
- protected boolean renameModules;
- protected boolean renameModuleDependencies;
- protected List selectedProjects;
- /** Applicable for EAR rename */
- protected List selectedReferencedProjects;
- protected String newName = null;
- protected String newContextRoot = null;
- protected boolean bogus;
-
- /**
- * Constructor for RenameOptions.
- */
- public RenameOptions() {
- super();
- }
-
-
- public boolean shouldRenameModules() {
- return renameModules;
- }
-
-
- public void setRenameModules(boolean renameModulesFromAllEARs) {
- this.renameModules = renameModulesFromAllEARs;
- }
-
-
- public boolean shouldRenameProjects() {
- return renameProjects;
- }
-
-
- public void setRenameProjects(boolean renameProjects) {
- this.renameProjects = renameProjects;
- }
-
-
- public boolean shouldRenameModuleDependencies() {
- return renameModuleDependencies;
- }
-
-
- public void setRenameModuleDependencies(boolean renameReferencesFromModuleDependencies) {
- this.renameModuleDependencies = renameReferencesFromModuleDependencies;
- }
-
- public List getModuleAndUtilityProjects() {
- if (isEARRename)
- return getSelectedReferencedProjects();
- return getSelectedProjects();
- }
-
- public List getAllProjectsToRename() {
- List result = new ArrayList();
- result.addAll(getSelectedProjects());
- result.addAll(getSelectedReferencedProjects());
- return result;
- }
-
- /**
- * Gets the selectedProjects.
- *
- * @return Returns a List
- */
- public List getSelectedProjects() {
- if (selectedProjects == null)
- return Collections.EMPTY_LIST;
- return selectedProjects;
- }
-
- /**
- * Sets the selectedProjects.
- *
- * @param selectedProjects
- * The selectedProjects to set
- */
- public void setSelectedProjects(List selectedProjects) {
- this.selectedProjects = selectedProjects;
- }
-
- /**
- * Gets the selectedReferencedProjects.
- *
- * @return Returns a List
- */
- public List getSelectedReferencedProjects() {
- if (selectedReferencedProjects == null)
- return Collections.EMPTY_LIST;
- return selectedReferencedProjects;
- }
-
- /**
- * Sets the selectedReferencedProjects.
- *
- * @param selectedReferencedProjects
- * The selectedReferencedProjects to set
- */
- public void setSelectedReferencedProjects(List selectedReferencedProjects) {
- this.selectedReferencedProjects = selectedReferencedProjects;
- }
-
- public boolean isEARRename() {
- return isEARRename;
- }
-
- public void setIsEARRename(boolean isEARRename) {
- this.isEARRename = isEARRename;
- }
-
- /**
- * Gets the newName.
- *
- * @return Returns a String
- */
- public String getNewName() {
- return newName;
- }
-
- /**
- * Sets the newName.
- *
- * @param newName
- * The newName to set
- */
- public void setNewName(String newName) {
- this.newName = newName;
- }
-
- /**
- * Gets the newContextRoot.
- *
- * @return Returns a String
- */
- public String getNewContextRoot() {
- return newContextRoot;
- }
-
- /**
- * Sets the newContextRoot.
- *
- * @param newContextRoot
- * The newContextRoot to set
- */
- public void setNewContextRoot(String newContextRoot) {
- this.newContextRoot = newContextRoot;
- }
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.jst.j2ee/j2eecreation/org/eclipse/jst/j2ee/internal/rename/RenameUtilityJarMetadataOperation.java b/plugins/org.eclipse.jst.j2ee/j2eecreation/org/eclipse/jst/j2ee/internal/rename/RenameUtilityJarMetadataOperation.java
deleted file mode 100644
index 85ad36438..000000000
--- a/plugins/org.eclipse.jst.j2ee/j2eecreation/org/eclipse/jst/j2ee/internal/rename/RenameUtilityJarMetadataOperation.java
+++ /dev/null
@@ -1,86 +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 27, 2004
- *
- * TODO To change the template for this generated file go to
- * Window - Preferences - Java - Code Style - Code Templates
- */
-package org.eclipse.jst.j2ee.internal.rename;
-
-import java.lang.reflect.InvocationTargetException;
-
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IWorkspaceRoot;
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-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.wst.common.frameworks.internal.operations.WTPOperation;
-
-
-
-/**
- * @author mdelder
- *
- * TODO To change the template for this generated type comment go to Window - Preferences - Java -
- * Code Style - Code Templates
- */
-public class RenameUtilityJarMetadataOperation extends WTPOperation {
-
- private IProject newUtilityJarProject;
- private IProject oldUtilityJarProject;
-
- public RenameUtilityJarMetadataOperation(IProject oldUtilityJar, IProject newUtilityJar) {
- this.oldUtilityJarProject = oldUtilityJar;
- this.newUtilityJarProject = newUtilityJar;
- }
-
- /*
- * (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 {
-
- if (this.oldUtilityJarProject == null || this.newUtilityJarProject == null)
- return;
-
- IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
- EAREditModel model = null;
- if (this.newUtilityJarProject.isAccessible()) {
-
- IProject[] allProjects = root.getProjects();
- for (int i = 0; i < allProjects.length; i++) {
- EARNatureRuntime earNature = EARNatureRuntime.getRuntime(allProjects[i]);
- if (earNature != null) {
- model = earNature.getEarEditModelForWrite(this);
- try {
- UtilityJARMapping mapping = model.getUtilityJARMapping(this.oldUtilityJarProject);
- if (mapping != null) {
- model.getUtilityJARMappings().remove(mapping);
- model.addUtilityJARMapping(mapping.getUri(), newUtilityJarProject);
- }
- } finally {
- if (model != null) {
- model.saveIfNecessary(monitor, this);
- model.releaseAccess(this);
- model = null;
- }
- }
- }
- }
- }
- }
-
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.jst.j2ee/j2eecreation/org/eclipse/jst/j2ee/internal/rename/UpdateWebContextRootMetadataOperation.java b/plugins/org.eclipse.jst.j2ee/j2eecreation/org/eclipse/jst/j2ee/internal/rename/UpdateWebContextRootMetadataOperation.java
deleted file mode 100644
index 14b7b5fdb..000000000
--- a/plugins/org.eclipse.jst.j2ee/j2eecreation/org/eclipse/jst/j2ee/internal/rename/UpdateWebContextRootMetadataOperation.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 27, 2004
- *
- * TODO To change the template for this generated file go to
- * Window - Preferences - Java - Code Style - Code Templates
- */
-package org.eclipse.jst.j2ee.internal.rename;
-
-import java.lang.reflect.InvocationTargetException;
-
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IWorkspaceRoot;
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.jst.j2ee.application.Module;
-import org.eclipse.jst.j2ee.application.WebModule;
-import org.eclipse.jst.j2ee.internal.earcreation.EAREditModel;
-import org.eclipse.jst.j2ee.internal.earcreation.EARNatureRuntime;
-import org.eclipse.jst.j2ee.internal.earcreation.modulemap.ModuleMapping;
-import org.eclipse.wst.common.frameworks.internal.operations.WTPOperation;
-
-
-
-/**
- * @author mdelder
- *
- * TODO To change the template for this generated type comment go to Window - Preferences - Java -
- * Code Style - Code Templates
- */
-public class UpdateWebContextRootMetadataOperation extends WTPOperation {
-
- private IProject newWebProject;
- private String newContextRoot;
-
- public UpdateWebContextRootMetadataOperation(IProject newWebProject, String newContextRoot) {
- this.newWebProject = newWebProject;
- this.newContextRoot = newContextRoot;
- }
-
- /*
- * (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 {
-
- if (this.newWebProject == null)
- return;
-
- IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
- EAREditModel model = null;
- if (this.newWebProject.isAccessible()) {
-
- IProject[] allProjects = root.getProjects();
- for (int i = 0; i < allProjects.length; i++) {
- EARNatureRuntime earNature = EARNatureRuntime.getRuntime(allProjects[i]);
- if (earNature != null) {
- model = earNature.getEarEditModelForWrite(this);
- try {
- ModuleMapping mapping = model.getModuleMapping(this.newWebProject);
- if (mapping != null) {
- Module module = mapping.getModule();
- if (module != null && module.isWebModule()) // should always be true
- ((WebModule) module).setContextRoot(this.newContextRoot);
- }
- } finally {
- if (model != null) {
- model.saveIfNecessary(monitor, this);
- model.releaseAccess(this);
- model = null;
- }
- }
- }
- }
- }
- }
-
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.jst.j2ee/j2eecreation/org/eclipse/jst/j2ee/internal/servertarget/IServerTargetConstants.java b/plugins/org.eclipse.jst.j2ee/j2eecreation/org/eclipse/jst/j2ee/internal/servertarget/IServerTargetConstants.java
deleted file mode 100644
index d54ae2061..000000000
--- a/plugins/org.eclipse.jst.j2ee/j2eecreation/org/eclipse/jst/j2ee/internal/servertarget/IServerTargetConstants.java
+++ /dev/null
@@ -1,41 +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 6, 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.servertarget;
-
-
-/**
- * @author vijayb
- *
- * To change the template for this generated type comment go to Window>Preferences>Java>Code
- * Generation>Code and Comments
- */
-public interface IServerTargetConstants {
- String EAR_TYPE = "j2ee.ear"; //$NON-NLS-1$
- String WEB_TYPE = "j2ee.web"; //$NON-NLS-1$
- String WEB_PORTAL_TYPE = "j2ee.web.portal"; //$NON-NLS-1$
- String EJB_TYPE = "j2ee.ejb"; //$NON-NLS-1$
- String APP_CLIENT_TYPE = "j2ee.appclient"; //$NON-NLS-1$
- String CONNECTOR_TYPE = "j2ee.connector"; //$NON-NLS-1$
- String J2EE_12 = "1.2"; //$NON-NLS-1$
- String J2EE_13 = "1.3"; //$NON-NLS-1$
- String J2EE_14 = "1.4"; //$NON-NLS-1$
- String SERVER_FILE_NAME = ".server"; //$NON-NLS-1$
- String aesV4ServerTargetId = "com.ibm.etools.websphere.aes.v4";//$NON-NLS-1$
- String v5ServerTargetId = "com.ibm.etools.websphere.serverTarget.base.v5";//$NON-NLS-1$
- String v51ServerTargetId = "com.ibm.etools.websphere.serverTarget.base.v51";//$NON-NLS-1$
-
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.jst.j2ee/j2eecreation/org/eclipse/jst/j2ee/internal/servertarget/ITargetRuntimeExtensionHandler.java b/plugins/org.eclipse.jst.j2ee/j2eecreation/org/eclipse/jst/j2ee/internal/servertarget/ITargetRuntimeExtensionHandler.java
deleted file mode 100644
index 5b7882d8c..000000000
--- a/plugins/org.eclipse.jst.j2ee/j2eecreation/org/eclipse/jst/j2ee/internal/servertarget/ITargetRuntimeExtensionHandler.java
+++ /dev/null
@@ -1,29 +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 Feb 5, 2004
- *
- * To change the template for this generated file go to
- * Window - Preferences - Java - Code Generation - Code and Comments
- */
-package org.eclipse.jst.j2ee.internal.servertarget;
-
-import org.eclipse.core.resources.IProject;
-
-/**
- * @author vijayb
- *
- * To change the template for this generated type comment go to Window - Preferences - Java - Code
- * Generation - Code and Comments
- */
-public interface ITargetRuntimeExtensionHandler {
- public boolean removeTargetRuntimeClasspath(IProject project);
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.jst.j2ee/j2eecreation/org/eclipse/jst/j2ee/internal/servertarget/J2EEProjectServerTargetDataModel.java b/plugins/org.eclipse.jst.j2ee/j2eecreation/org/eclipse/jst/j2ee/internal/servertarget/J2EEProjectServerTargetDataModel.java
deleted file mode 100644
index eef3f6ede..000000000
--- a/plugins/org.eclipse.jst.j2ee/j2eecreation/org/eclipse/jst/j2ee/internal/servertarget/J2EEProjectServerTargetDataModel.java
+++ /dev/null
@@ -1,199 +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.servertarget;
-
-import java.util.Collections;
-import java.util.List;
-
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.jst.j2ee.internal.J2EEVersionConstants;
-import org.eclipse.jst.j2ee.internal.plugin.J2EEPlugin;
-import org.eclipse.jst.j2ee.internal.project.J2EECreationResourceHandler;
-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.WTPPropertyDescriptor;
-import org.eclipse.wst.server.core.IRuntime;
-import org.eclipse.wst.server.core.internal.ResourceManager;
-
-public class J2EEProjectServerTargetDataModel extends WTPOperationDataModel {
-
- public J2EEProjectServerTargetDataModel() {
- super();
- }
-
- private static final String DEFAULT_TARGET_ID = "org.eclipse.jst.server.core.runtimeType"; //$NON-NLS-1$
-
- /**
- * required, type String
- */
- public static final String PROJECT_NAME = "J2EEProjectServerTargetDataModel.PROJECT_NAME"; //$NON-NLS-1$
-
- /**
- * required, not defaulted. If null, will not run.
- */
- public static final String RUNTIME_TARGET_ID = "J2EEProjectServerTargetDataModel.RUNTIME_TARGET_ID"; //$NON-NLS-1$
-
- /**
- * optional, default true, type Boolean. Set this to true if the operation
- * is supposed to update all dependent modules and projects in an ear if the
- * passed project name is an ear project
- */
- public static final String UPDATE_MODULES = "J2EEProjectServerTargetDataModel.UPDATE_MODULES"; //$NON-NLS-1$
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.wst.common.frameworks.internal.operation.WTPOperationDataModel#getDefaultOperation()
- */
- public WTPOperation getDefaultOperation() {
- return new J2EEProjectServerTargetOperation(this);
- }
-
- protected void initValidBaseProperties() {
- super.initValidBaseProperties();
- addValidBaseProperty(PROJECT_NAME);
- addValidBaseProperty(RUNTIME_TARGET_ID);
- addValidBaseProperty(UPDATE_MODULES);
- }
-
- public IProject getProject() {
- String name = (String) getProperty(PROJECT_NAME);
- if (name != null && name.length() > 0)
- return ResourcesPlugin.getWorkspace().getRoot().getProject(name);
- return null;
- }
-
- public IRuntime getRuntimeTarget() {
- String serverTargetId = (String) getProperty(RUNTIME_TARGET_ID);
- return ResourceManager.getInstance().getRuntime(serverTargetId);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.wst.common.frameworks.internal.operation.WTPOperationDataModel#getDefaultProperty(java.lang.String)
- */
- protected Object getDefaultProperty(String propertyName) {
- if (propertyName.equals(RUNTIME_TARGET_ID))
- return getDefaultServerTargetID();
- else if (propertyName.equals(UPDATE_MODULES)) {
- return Boolean.TRUE;
- }
- return super.getDefaultProperty(propertyName);
- }
-
- private Integer getDefaultVersionID() {
- return new Integer(J2EEVersionConstants.J2EE_1_4_ID);
- }
-
- /**
- * @return
- */
- private Object getDefaultServerTargetID() {
- List targets = getValidServerTargets();
- if (!targets.isEmpty()) {
- IRuntime target = null;
- for (int i = targets.size() - 1; i < targets.size() && i >= 0; i--) {
- target = (IRuntime) targets.get(i);
- String id = target.getRuntimeType().getId();
- if (DEFAULT_TARGET_ID.equals(id))
- return target.getId();
- }
- if (target != null)
- return target.getId();
- }
- return null;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.wst.common.frameworks.internal.operation.WTPOperationDataModel#doGetValidPropertyValues(java.lang.String)
- */
- protected WTPPropertyDescriptor[] doGetValidPropertyDescriptors(String propertyName) {
- if (propertyName.equals(RUNTIME_TARGET_ID))
- return getValidServerTargetDescriptors();
- return super.doGetValidPropertyDescriptors(propertyName);
- }
-
- private WTPPropertyDescriptor[] getValidServerTargetDescriptors() {
- List targets = getValidServerTargets();
- WTPPropertyDescriptor[] descriptors = null;
- if (!targets.isEmpty()) {
- int serverTargetListSize = targets.size();
- descriptors = new WTPPropertyDescriptor[serverTargetListSize];
- for (int i = 0; i < targets.size(); i++) {
- IRuntime runtime = (IRuntime) targets.get(i);
- descriptors[i] = new WTPPropertyDescriptor(runtime.getId(), runtime.getName());
- }
- } else {
- descriptors = new WTPPropertyDescriptor[0];
- }
- return descriptors;
- }
-
- private 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;
- }
-
- /**
- * @return
- */
- private List getValidServerTargets() {
- List validServerTargets = null;
- //TODO: api is needed from the server target helper to get all server targets
- //validServerTargets = ServerTargetHelper.getServerTargets(IServerTargetConstants.EAR_TYPE, IServerTargetConstants.J2EE_14);
- 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;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.wst.common.frameworks.internal.operation.WTPOperationDataModel#doValidateProperty(java.lang.String)
- */
- protected IStatus doValidateProperty(String propertyName) {
- if (propertyName.equals(RUNTIME_TARGET_ID))
- return validateServerTarget();
- return super.doValidateProperty(propertyName);
- }
-
- /**
- * @return
- */
- private IStatus validateServerTarget() {
- List targets = getValidServerTargets();
- if (targets.isEmpty()) {
- return J2EEPlugin.newErrorStatus(J2EECreationResourceHandler.getString("ServerTargetDataModel_UI_7"), null); //$NON-NLS-1$
- }
- IRuntime target = getRuntimeTarget();
- if (target == null) {
- return J2EEPlugin.newErrorStatus(J2EECreationResourceHandler.getString("ServerTargetDataModel_UI_8"), null); //$NON-NLS-1$
- } else if (!targets.contains(target)) {
- return J2EEPlugin.newErrorStatus(J2EECreationResourceHandler.getString("ServerTargetDataModel_UI_9"), null); //$NON-NLS-1$
- }
- return OK_STATUS;
- }
-
-}
diff --git a/plugins/org.eclipse.jst.j2ee/j2eecreation/org/eclipse/jst/j2ee/internal/servertarget/J2EEProjectServerTargetDataModelProvider.java b/plugins/org.eclipse.jst.j2ee/j2eecreation/org/eclipse/jst/j2ee/internal/servertarget/J2EEProjectServerTargetDataModelProvider.java
deleted file mode 100644
index 2bc3da144..000000000
--- a/plugins/org.eclipse.jst.j2ee/j2eecreation/org/eclipse/jst/j2ee/internal/servertarget/J2EEProjectServerTargetDataModelProvider.java
+++ /dev/null
@@ -1,282 +0,0 @@
-package org.eclipse.jst.j2ee.internal.servertarget;
-
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.List;
-
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.jst.j2ee.internal.J2EEVersionConstants;
-import org.eclipse.jst.j2ee.internal.common.XMLResource;
-import org.eclipse.jst.j2ee.internal.plugin.J2EEPlugin;
-import org.eclipse.jst.j2ee.internal.project.J2EECreationResourceHandler;
-import org.eclipse.jst.j2ee.project.datamodel.properties.IJ2EEProjectServerTargetDataModelProperties;
-import org.eclipse.wst.common.frameworks.datamodel.AbstractDataModelProvider;
-import org.eclipse.wst.common.frameworks.datamodel.DataModelPropertyDescriptor;
-import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
-import org.eclipse.wst.common.frameworks.datamodel.IDataModelOperation;
-import org.eclipse.wst.server.core.IRuntime;
-import org.eclipse.wst.server.core.ServerUtil;
-import org.eclipse.wst.server.core.internal.ResourceManager;
-
-public class J2EEProjectServerTargetDataModelProvider extends AbstractDataModelProvider
- implements IJ2EEProjectServerTargetDataModelProperties {
-
- private static final String DEFAULT_TARGET_ID = "org.eclipse.jst.server.core.runtimeType"; //$NON-NLS-1$
-
- public void init() {
- model.setProperty(RUNTIME_TARGET_ID, getDefaultServerTargetID());
- super.init();
- }
-
- public IDataModelOperation getDefaultOperation() {
- return new J2EEProjectServerTargetOp(model);
- }
-
- public String[] getPropertyNames() {
- return new String[]{PROJECT_NAME, RUNTIME_TARGET_ID, J2EE_VERSION_ID,
- DEPLOYMENT_TYPE_ID, UPDATE_MODULES};
- }
-
- public IProject getProject() {
- String name = (String) getProperty(PROJECT_NAME);
- if (name != null && name.length() > 0)
- return ResourcesPlugin.getWorkspace().getRoot().getProject(name);
- return null;
- }
-
- public IRuntime getRuntimeTarget() {
- String serverTargetId = (String) getProperty(RUNTIME_TARGET_ID);
- return ResourceManager.getInstance().getRuntime(serverTargetId);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.wst.common.frameworks.internal.operation.WTPOperationDataModel#getDefaultProperty(java.lang.String)
- */
- public Object getDefaultProperty(String propertyName) {
- if (propertyName.equals(RUNTIME_TARGET_ID))
- return getDefaultServerTargetID();
- else if (propertyName.equals(J2EE_VERSION_ID))
- return getDefaultVersionID();
- else if (propertyName.equals(UPDATE_MODULES)) {
- return Boolean.TRUE;
- }
- return super.getDefaultProperty(propertyName);
- }
-
- private Integer getDefaultVersionID() {
- return new Integer(J2EEVersionConstants.J2EE_1_4_ID);
- }
-
- /**
- * @return
- */
- private Object getDefaultServerTargetID() {
- List targets = getValidServerTargets();
- if (!targets.isEmpty()) {
- IRuntime target = null;
- for (int i = targets.size() - 1; i < targets.size() && i >= 0; i--) {
- target = (IRuntime) targets.get(i);
- if (DEFAULT_TARGET_ID.equals(target.getId()))
- return target.getId();
- }
- if (target != null)
- return target.getId();
- }
- return null;
- }
-
- /**
- * This should only be used by clients that need to interact with the Server tooling directly.
- * The return value corresponds to the type id associated with a runtime target.
- *
- * @return
- */
- public String computeTypeId() {
- int type = -1;
- if (getDataModel().isPropertySet(DEPLOYMENT_TYPE_ID))
- type = getIntProperty(DEPLOYMENT_TYPE_ID);
-// else {
-// J2EENature nature = J2EENature.getRegisteredRuntime(getProject());
-// if (nature != null)
-// type = nature.getDeploymentDescriptorType();
-// else
-// type = getIntProperty(DEPLOYMENT_TYPE_ID);
-// }
- return computeTypeId(type);
- }
-
- /**
- * @param deploymentDescriptorType2
- * @return
- */
- private String computeTypeId(int deploymentDescriptorType) {
- switch (deploymentDescriptorType) {
- case XMLResource.APPLICATION_TYPE :
- return IServerTargetConstants.EAR_TYPE;
- case XMLResource.APP_CLIENT_TYPE :
- return IServerTargetConstants.APP_CLIENT_TYPE;
- case XMLResource.EJB_TYPE :
- return IServerTargetConstants.EJB_TYPE;
- case XMLResource.WEB_APP_TYPE :
- return IServerTargetConstants.WEB_TYPE;
- case XMLResource.RAR_TYPE :
- return IServerTargetConstants.CONNECTOR_TYPE;
- }
- return null;
- }
-
- /**
- * This is only to be used by clients that need to interact with the Server tooling directly.
- * The return value corresponds to the version id associated with a runtime target.
- */
- public String computeVersionId() {
- int version = -1;
- if (getDataModel().isPropertySet(J2EE_VERSION_ID))
- version = getIntProperty(J2EE_VERSION_ID);
-// else {
-// J2EENature nature = J2EENature.getRegisteredRuntime(getProject());
-// if (nature != null)
-// version = nature.getJ2EEVersion();
-// else
-// version = getIntProperty(J2EE_VERSION_ID);
-// }
- return computeVersionId(version);
- }
-
- /**
- * @param version
- * @return
- */
- private String computeVersionId(int version) {
- switch (version) {
- case J2EEVersionConstants.J2EE_1_2_ID :
- return IServerTargetConstants.J2EE_12;
- case J2EEVersionConstants.J2EE_1_3_ID :
- return IServerTargetConstants.J2EE_13;
- case J2EEVersionConstants.J2EE_1_4_ID :
- return IServerTargetConstants.J2EE_14;
- }
- return null;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.wst.common.frameworks.internal.operation.WTPOperationDataModel#doGetValidPropertyValues(java.lang.String)
- */
- public DataModelPropertyDescriptor[] getValidPropertyDescriptors(String propertyName) {
- if (propertyName.equals(RUNTIME_TARGET_ID))
- return getValidServerTargetDescriptors();
- return super.getValidPropertyDescriptors(propertyName);
- }
-
- private DataModelPropertyDescriptor[] getValidServerTargetDescriptors() {
- List targets = getValidServerTargets();
- DataModelPropertyDescriptor[] descriptors = null;
- if (!targets.isEmpty()) {
- int serverTargetListSize = targets.size();
- descriptors = new DataModelPropertyDescriptor[serverTargetListSize];
- for (int i = 0; i < targets.size(); i++) {
- IRuntime runtime = (IRuntime) targets.get(i);
- descriptors[i] = new DataModelPropertyDescriptor(runtime.getId(), runtime.getName());
- }
- } else {
- descriptors = new DataModelPropertyDescriptor[0];
- }
- return descriptors;
- }
-
- public boolean propertySet(String propertyName, Object propertyValue) {
- if (propertyName.equals(J2EE_VERSION_ID)) {
- IRuntime target = getServerTargetByID(getStringProperty(RUNTIME_TARGET_ID));
- if (target == null)
- setProperty(RUNTIME_TARGET_ID, null);
- model.notifyPropertyChange(RUNTIME_TARGET_ID, IDataModel.VALID_VALUES_CHG);
- }else if (RUNTIME_TARGET_ID.equals(propertyName)) {
- setProperty(RUNTIME_TARGET_ID, propertyValue);
- }
- return true;
- }
-
-
- private 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;
- }
- /**
- * @return
- */
- private List getValidServerTargets() {
- List validServerTargets = null;
- //TODO: api is needed from the server target helper to get all server targets
- //validServerTargets = ServerTargetHelper.getServerTargets(IServerTargetConstants.EAR_TYPE, IServerTargetConstants.J2EE_14);
- validServerTargets = getServerTargets("", ""); //$NON-NLS-1$ //$NON-NLS-2$
- if (validServerTargets != null && validServerTargets.isEmpty())
- validServerTargets = null;
- if (validServerTargets == null)
- return Collections.EMPTY_LIST;
- return validServerTargets;
- }
-
- public static List getServerTargets(String type, String version) {
- List targets = Arrays.asList(ServerUtil.getRuntimes(type, version));
- return targets;
- }
- /**
- * @return
- */
-// private List getValidServerTargets() {
-// List validServerTargets = null;
-// String type = computeTypeId();
-// if (type != null) {
-// String version = computeVersionId();
-// if (version != null) {
-// validServerTargets = ServerTargetHelper.getServerTargets(type, version);
-// if (validServerTargets != null && validServerTargets.isEmpty())
-// validServerTargets = null;
-// }
-// }
-// if (validServerTargets == null)
-// return Collections.EMPTY_LIST;
-// return validServerTargets;
-// }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.wst.common.frameworks.internal.operation.WTPOperationDataModel#doValidateProperty(java.lang.String)
- */
- public IStatus validate(String propertyName) {
- if (propertyName.equals(RUNTIME_TARGET_ID))
- return validateServerTarget();
- return super.validate(propertyName);
- }
-
- /**
- * @return
- */
- private IStatus validateServerTarget() {
- List targets = getValidServerTargets();
- if (targets.isEmpty()) {
- return J2EEPlugin.newErrorStatus(J2EECreationResourceHandler.getString("ServerTargetDataModel_UI_7"), null); //$NON-NLS-1$
- }
- IRuntime target = getRuntimeTarget();
- if (target == null) {
- return J2EEPlugin.newErrorStatus(J2EECreationResourceHandler.getString("ServerTargetDataModel_UI_8"), null); //$NON-NLS-1$
- } else if (!targets.contains(target)) {
- return J2EEPlugin.newErrorStatus(J2EECreationResourceHandler.getString("ServerTargetDataModel_UI_9"), null); //$NON-NLS-1$
- }
- return OK_STATUS;
- }
-
-}
diff --git a/plugins/org.eclipse.jst.j2ee/j2eecreation/org/eclipse/jst/j2ee/internal/servertarget/J2EEProjectServerTargetOp.java b/plugins/org.eclipse.jst.j2ee/j2eecreation/org/eclipse/jst/j2ee/internal/servertarget/J2EEProjectServerTargetOp.java
deleted file mode 100644
index e96d06986..000000000
--- a/plugins/org.eclipse.jst.j2ee/j2eecreation/org/eclipse/jst/j2ee/internal/servertarget/J2EEProjectServerTargetOp.java
+++ /dev/null
@@ -1,61 +0,0 @@
-package org.eclipse.jst.j2ee.internal.servertarget;
-
-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.jst.j2ee.project.datamodel.properties.IJ2EEProjectServerTargetDataModelProperties;
-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.server.core.IRuntime;
-import org.eclipse.wst.server.core.ServerCore;
-import org.eclipse.wst.server.core.internal.ResourceManager;
-
-public class J2EEProjectServerTargetOp extends AbstractDataModelOperation {
-
- /**
- * @param operationDataModel
- */
- public J2EEProjectServerTargetOp(IDataModel model) {
- super(model);
- // TODO Auto-generated constructor stub
- }
-
- public IStatus execute(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
- String serverTargetId = model.getStringProperty(IJ2EEProjectServerTargetDataModelProperties.RUNTIME_TARGET_ID);
- IRuntime runtime = ResourceManager.getInstance().getRuntime(serverTargetId);
- IProject project = null;
- String name = model.getStringProperty(IJ2EEProjectServerTargetDataModelProperties.PROJECT_NAME);
- if (name != null && name.length() > 0)
- project = ResourcesPlugin.getWorkspace().getRoot().getProject(name);
- if (runtime != null && project != null) {
- try {
- ServerCore.getProjectProperties(project).setRuntimeTarget(runtime, monitor);
- if (model.getBooleanProperty(IJ2EEProjectServerTargetDataModelProperties.UPDATE_MODULES)
- && project.hasNature(IModuleConstants.MODULE_NATURE_ID)) {
- //ServerTargetHelper.setNewServerTargetForEARModules(runtime, project);
- //ServerTargetHelper.setNewServerTargetForEARUtilityJars(runtime, project);
- }
- } catch (CoreException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- }
- return OK_STATUS;
- }
-
- public IStatus redo(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
- // TODO Auto-generated method stub
- return null;
- }
-
- public IStatus undo(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
- // TODO Auto-generated method stub
- return null;
- }
-
-}
diff --git a/plugins/org.eclipse.jst.j2ee/j2eecreation/org/eclipse/jst/j2ee/internal/servertarget/J2EEProjectServerTargetOperation.java b/plugins/org.eclipse.jst.j2ee/j2eecreation/org/eclipse/jst/j2ee/internal/servertarget/J2EEProjectServerTargetOperation.java
deleted file mode 100644
index 147a20d93..000000000
--- a/plugins/org.eclipse.jst.j2ee/j2eecreation/org/eclipse/jst/j2ee/internal/servertarget/J2EEProjectServerTargetOperation.java
+++ /dev/null
@@ -1,46 +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.servertarget;
-
-import java.lang.reflect.InvocationTargetException;
-
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.jst.j2ee.internal.earcreation.EARNatureRuntime;
-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 J2EEProjectServerTargetOperation extends WTPOperation {
-
- /**
- * @param operationDataModel
- */
- public J2EEProjectServerTargetOperation(J2EEProjectServerTargetDataModel operationDataModel) {
- super(operationDataModel);
- // TODO Auto-generated constructor stub
- }
-
- protected void execute(IProgressMonitor monitor) throws CoreException, InvocationTargetException, InterruptedException {
- J2EEProjectServerTargetDataModel dataModel = (J2EEProjectServerTargetDataModel) operationDataModel;
- IRuntime runtime = dataModel.getRuntimeTarget();
- IProject project = dataModel.getProject();
- if (runtime != null) {
- ServerCore.getProjectProperties(project).setRuntimeTarget(runtime, monitor);
- if (dataModel.getBooleanProperty(J2EEProjectServerTargetDataModel.UPDATE_MODULES) && EARNatureRuntime.hasRuntime(project)) {
- ServerTargetHelper.setNewServerTargetForEARModules(runtime, project);
- ServerTargetHelper.setNewServerTargetForEARUtilityJars(runtime, project);
- }
- }
- }
-
-}
diff --git a/plugins/org.eclipse.jst.j2ee/j2eecreation/org/eclipse/jst/j2ee/internal/servertarget/ServerTargetDataModel.java b/plugins/org.eclipse.jst.j2ee/j2eecreation/org/eclipse/jst/j2ee/internal/servertarget/ServerTargetDataModel.java
deleted file mode 100644
index 863e399b9..000000000
--- a/plugins/org.eclipse.jst.j2ee/j2eecreation/org/eclipse/jst/j2ee/internal/servertarget/ServerTargetDataModel.java
+++ /dev/null
@@ -1,328 +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&gt;Preferences&gt;Java&gt;Code Generation&gt;Code and
- * Comments
- */
-package org.eclipse.jst.j2ee.internal.servertarget;
-
-import java.util.Collections;
-import java.util.List;
-
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.jst.j2ee.internal.J2EEVersionConstants;
-import org.eclipse.jst.j2ee.internal.common.XMLResource;
-import org.eclipse.jst.j2ee.internal.plugin.J2EEPlugin;
-import org.eclipse.jst.j2ee.internal.project.J2EECreationResourceHandler;
-import org.eclipse.jst.j2ee.internal.project.J2EENature;
-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.WTPPropertyDescriptor;
-import org.eclipse.wst.server.core.IRuntime;
-import org.eclipse.wst.server.core.internal.ResourceManager;
-
-/**
- * @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 ServerTargetDataModel extends WTPOperationDataModel {
-
- private static final String DEFAULT_TARGET_ID = "org.eclipse.jst.server.core.runtimeType"; //$NON-NLS-1$
- /**
- * required, type String
- */
- public static final String PROJECT_NAME = "ServerTargetDataModel.PROJECT_NAME"; //$NON-NLS-1$
- /**
- * required, not defaulted. If null, will not run.
- */
- public static final String RUNTIME_TARGET_ID = "ServerTargetDataModel.RUNTIME_TARGET_ID"; //$NON-NLS-1$
- /**
- * Optional - This needs to be set if the PROJECT_NAME does not exist.
- *
- * @link J2EEVersionConstants
- */
- public static final String J2EE_VERSION_ID = "ServerTargetDataModel.J2EE_VERSION_ID"; //$NON-NLS-1$
-
- /**
- * optional, default true, type Boolean. Set this to true if the operation is supposed to update
- * all dependent modules and projects in an ear if the passed project name is an ear project
- */
- public static final String UPDATE_MODULES = "ServerTargetDataModel.UPDATE_MODULES"; //$NON-NLS-1$
-
- /**
- * Optional - This needs to be set if the PROJECT_NAME does not exist.
- *
- * @link XMLResource#APP_CLIENT_TYPE
- * @link XMLResource#APPLICATION_TYPE
- * @link XMLResource#EJB_TYPE
- * @link XMLResource#RAR_TYPE
- * @link XMLResource#WEB_APP_TYPE
- */
- public static final String DEPLOYMENT_TYPE_ID = "ServerTargetDataModel.DD_TYPE_ID"; //$NON-NLS-1$
-
- public ServerTargetDataModel() {
- super();
- //TODO add listening mechanism to & fire change events when new server targets are
- // added/removed
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.wst.common.frameworks.internal.operation.WTPOperationDataModel#getDefaultOperation()
- */
- public WTPOperation getDefaultOperation() {
- return new ServerTargetOperation(this);
- }
-
- protected void initValidBaseProperties() {
- super.initValidBaseProperties();
- addValidBaseProperty(PROJECT_NAME);
- addValidBaseProperty(RUNTIME_TARGET_ID);
- addValidBaseProperty(J2EE_VERSION_ID);
- addValidBaseProperty(DEPLOYMENT_TYPE_ID);
- addValidBaseProperty(UPDATE_MODULES);
- }
-
- public IProject getProject() {
- String name = (String) getProperty(PROJECT_NAME);
- if (name != null && name.length() > 0)
- return ResourcesPlugin.getWorkspace().getRoot().getProject(name);
- return null;
- }
-
- public IRuntime getRuntimeTarget() {
- String serverTargetId = (String) getProperty(RUNTIME_TARGET_ID);
- return ResourceManager.getInstance().getRuntime(serverTargetId);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.wst.common.frameworks.internal.operation.WTPOperationDataModel#getDefaultProperty(java.lang.String)
- */
- protected Object getDefaultProperty(String propertyName) {
- if (propertyName.equals(RUNTIME_TARGET_ID))
- return getDefaultServerTargetID();
- else if (propertyName.equals(J2EE_VERSION_ID))
- return getDefaultVersionID();
- else if (propertyName.equals(UPDATE_MODULES)) {
- return Boolean.TRUE;
- }
- return super.getDefaultProperty(propertyName);
- }
-
- private Integer getDefaultVersionID() {
- return new Integer(J2EEVersionConstants.J2EE_1_4_ID);
- }
-
- /**
- * @return
- */
- private Object getDefaultServerTargetID() {
- List targets = getValidServerTargets();
- if (!targets.isEmpty()) {
- IRuntime target = null;
- for (int i = targets.size() - 1; i < targets.size() && i >= 0; i--) {
- target = (IRuntime) targets.get(i);
- if (DEFAULT_TARGET_ID.equals(target.getId()))
- return target.getId();
- }
- if (target != null)
- return target.getId();
- }
- return null;
- }
-
- /**
- * This should only be used by clients that need to interact with the Server tooling directly.
- * The return value corresponds to the type id associated with a runtime target.
- *
- * @return
- */
- public String computeTypeId() {
- int type = -1;
- if (isSet(DEPLOYMENT_TYPE_ID))
- type = getIntProperty(DEPLOYMENT_TYPE_ID);
- else {
- J2EENature nature = J2EENature.getRegisteredRuntime(getProject());
- if (nature != null)
- type = nature.getDeploymentDescriptorType();
- else
- type = getIntProperty(DEPLOYMENT_TYPE_ID);
- }
- return computeTypeId(type);
- }
-
- /**
- * @param deploymentDescriptorType2
- * @return
- */
- private String computeTypeId(int deploymentDescriptorType) {
- switch (deploymentDescriptorType) {
- case XMLResource.APPLICATION_TYPE :
- return IServerTargetConstants.EAR_TYPE;
- case XMLResource.APP_CLIENT_TYPE :
- return IServerTargetConstants.APP_CLIENT_TYPE;
- case XMLResource.EJB_TYPE :
- return IServerTargetConstants.EJB_TYPE;
- case XMLResource.WEB_APP_TYPE :
- return IServerTargetConstants.WEB_TYPE;
- case XMLResource.RAR_TYPE :
- return IServerTargetConstants.CONNECTOR_TYPE;
- }
- return null;
- }
-
- /**
- * This is only to be used by clients that need to interact with the Server tooling directly.
- * The return value corresponds to the version id associated with a runtime target.
- */
- public String computeVersionId() {
- int version = -1;
- if (isSet(J2EE_VERSION_ID))
- version = getIntProperty(J2EE_VERSION_ID);
- else {
- J2EENature nature = J2EENature.getRegisteredRuntime(getProject());
- if (nature != null)
- version = nature.getJ2EEVersion();
- else
- version = getIntProperty(J2EE_VERSION_ID);
- }
- return computeVersionId(version);
- }
-
- /**
- * @param version
- * @return
- */
- private String computeVersionId(int version) {
- switch (version) {
- case J2EEVersionConstants.J2EE_1_2_ID :
- return IServerTargetConstants.J2EE_12;
- case J2EEVersionConstants.J2EE_1_3_ID :
- return IServerTargetConstants.J2EE_13;
- case J2EEVersionConstants.J2EE_1_4_ID :
- return IServerTargetConstants.J2EE_14;
- }
- return null;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.wst.common.frameworks.internal.operation.WTPOperationDataModel#doGetValidPropertyValues(java.lang.String)
- */
- protected WTPPropertyDescriptor[] doGetValidPropertyDescriptors(String propertyName) {
- if (propertyName.equals(RUNTIME_TARGET_ID))
- return getValidServerTargetDescriptors();
- return super.doGetValidPropertyDescriptors(propertyName);
- }
-
- private WTPPropertyDescriptor[] getValidServerTargetDescriptors() {
- List targets = getValidServerTargets();
- WTPPropertyDescriptor[] descriptors = null;
- if (!targets.isEmpty()) {
- int serverTargetListSize = targets.size();
- descriptors = new WTPPropertyDescriptor[serverTargetListSize];
- for (int i = 0; i < targets.size(); i++) {
- IRuntime runtime = (IRuntime) targets.get(i);
- descriptors[i] = new WTPPropertyDescriptor(runtime.getId(), runtime.getName());
- }
- } else {
- descriptors = new WTPPropertyDescriptor[0];
- }
- return descriptors;
- }
-
- /*
- * (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) {
- super.doSetProperty(propertyName, propertyValue);
- if (propertyName.equals(J2EE_VERSION_ID)) {
- IRuntime target = getServerTargetByID(getStringProperty(RUNTIME_TARGET_ID));
- if (target == null)
- setProperty(RUNTIME_TARGET_ID, null);
- notifyValidValuesChange(RUNTIME_TARGET_ID);
- }
- return true;
- }
-
-
- private 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;
- }
-
- /**
- * @return
- */
- private List getValidServerTargets() {
- List validServerTargets = null;
- String type = computeTypeId();
- if (type != null) {
- String version = computeVersionId();
- if (version != null) {
- validServerTargets = ServerTargetHelper.getServerTargets(type, version);
- if (validServerTargets != null && validServerTargets.isEmpty())
- validServerTargets = null;
- }
- }
- if (validServerTargets == null)
- return Collections.EMPTY_LIST;
- return validServerTargets;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.wst.common.frameworks.internal.operation.WTPOperationDataModel#doValidateProperty(java.lang.String)
- */
- protected IStatus doValidateProperty(String propertyName) {
- if (propertyName.equals(RUNTIME_TARGET_ID))
- return validateServerTarget();
- return super.doValidateProperty(propertyName);
- }
-
- /**
- * @return
- */
- private IStatus validateServerTarget() {
- List targets = getValidServerTargets();
- if (targets.isEmpty()) {
- return J2EEPlugin.newErrorStatus(J2EECreationResourceHandler.getString("ServerTargetDataModel_UI_7"), null); //$NON-NLS-1$
- }
- IRuntime target = getRuntimeTarget();
- if (target == null) {
- return J2EEPlugin.newErrorStatus(J2EECreationResourceHandler.getString("ServerTargetDataModel_UI_8"), null); //$NON-NLS-1$
- } else if (!targets.contains(target)) {
- return J2EEPlugin.newErrorStatus(J2EECreationResourceHandler.getString("ServerTargetDataModel_UI_9"), null); //$NON-NLS-1$
- }
- return OK_STATUS;
- }
-
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.jst.j2ee/j2eecreation/org/eclipse/jst/j2ee/internal/servertarget/ServerTargetHelper.java b/plugins/org.eclipse.jst.j2ee/j2eecreation/org/eclipse/jst/j2ee/internal/servertarget/ServerTargetHelper.java
deleted file mode 100644
index c9c4871bf..000000000
--- a/plugins/org.eclipse.jst.j2ee/j2eecreation/org/eclipse/jst/j2ee/internal/servertarget/ServerTargetHelper.java
+++ /dev/null
@@ -1,486 +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 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.internal.servertarget;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.List;
-import java.util.Set;
-
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.jdt.core.IClasspathEntry;
-import org.eclipse.jdt.core.IJavaProject;
-import org.eclipse.jdt.core.JavaCore;
-import org.eclipse.jdt.core.JavaModelException;
-import org.eclipse.jem.util.logger.proxy.Logger;
-import org.eclipse.jem.workbench.utility.JemProjectUtilities;
-import org.eclipse.jst.j2ee.applicationclient.internal.creation.ApplicationClientNatureRuntime;
-import org.eclipse.jst.j2ee.internal.earcreation.EAREditModel;
-import org.eclipse.jst.j2ee.internal.earcreation.EARNatureRuntime;
-import org.eclipse.jst.j2ee.internal.earcreation.IEARNatureConstants;
-import org.eclipse.jst.j2ee.internal.moduleextension.EarModuleManager;
-import org.eclipse.jst.j2ee.internal.moduleextension.WebModuleExtension;
-import org.eclipse.jst.j2ee.internal.project.IConnectorNatureConstants;
-import org.eclipse.jst.j2ee.internal.project.IEJBNatureConstants;
-import org.eclipse.jst.j2ee.internal.project.IWebNatureConstants;
-import org.eclipse.jst.j2ee.internal.project.J2EENature;
-import org.eclipse.wst.server.core.IRuntime;
-import org.eclipse.wst.server.core.ServerCore;
-import org.eclipse.wst.server.core.ServerUtil;
-
-/**
- * @author vijayb
- * @deprecated - Use server core api to set Runtime Targets. Use artifact edit api to
- * get to any j2ee related methods in the class.
- * To change the template for this generated type comment go to Window>Preferences>Java>Code
- * Generation>Code and Comments
- */
-public class ServerTargetHelper {
- public static final String JAVA_NATURE_ID = "org.eclipse.jdt.core.javanature"; //$NON-NLS-1$
-
- public static final String SERVER_CONTAINER = "org.eclipse.jst.server.core.container"; //$NON-NLS-1$
-
- /**
- *
- */
- public ServerTargetHelper() {
- super();
- // TODO Auto-generated constructor stub
- }
-
- public static void cleanUpNonServerTargetClasspath(IProject project) {
- List existingClasspathEntries = ServerTargetHelper.getExistingNonServerTargetClasspath(project);
- if (!existingClasspathEntries.isEmpty())
- ServerTargetHelper.removeNonSeverTargetClasspathEntries(project, existingClasspathEntries);
- }
-
- /**
- * @param existingClasspathEntries
- */
- public static void removeNonSeverTargetClasspathEntries(IProject project, List existingClasspathEntries) {
- try {
- JemProjectUtilities.removeFromJavaClassPath(project, existingClasspathEntries);
- } catch (JavaModelException jme) {
- Logger.getLogger().logError(jme);
- }
- }
-
- /**
- * @param project
- */
- // public static void syncNoServerTargetForEARModules(IProject project) {
- // removeServerTargetForEARModuleProjects(project);
- // removeServerTargetForEARUtilsProject(project);
- // }
- /**
- * @param project
- */
- // public static void removeServerTargetForEAR(IProject project, boolean
- // updateModules) {
- // //We don't need to remove a server target anyomre as it need to be
- // // there
- // //ServerTargetManager.removeServerTarget(project, null);
- // if (updateModules) {
- // removeServerTargetForEARModuleProjects(project);
- // removeServerTargetForEARUtilsProject(project);
- // }
- // }
- /**
- * @param project
- */
- // private static void removeServerTargetForEARModuleProjects(IProject
- // project) {
- // List moduleProjects =
- // ServerTargetHelper.getAllEarModuleProjects(project);
- // if (!moduleProjects.isEmpty()) {
- // for (int i = 0; i < moduleProjects.size(); i++) {
- // IProject moduleProject = (IProject) moduleProjects.get(i);
- // ServerTargetType tt =
- // ServerTargetManager.getServerTargetType(moduleProject);
- // if (tt != null) {
- // J2EEJavaProjectInfo info = getNewJ2EEProjectInfo(moduleProject);
- // if (info != null) {
- // info.setProject(moduleProject);
- // try {
- // info.calculateServerClasspathEntries();
- // info.getJavaProject().setRawClasspath(info.getClasspathEntries(), null);
- // } catch (JavaModelException jme) {
- // Logger.getLogger().logTrace(jme);
- // }
- // }
- // }
- // }
- // }
- // }
- /**
- * @param project
- */
- // private static void removeServerTargetForEARUtilsProject(IProject
- // project) {
- // EARNatureRuntime nature = EARNatureRuntime.getRuntime(project);
- // EAREditModel editModel = null;
- // Object key = new ServerTargetHelper();
- // try {
- // editModel = nature.getEarEditModelForRead(key);
- // List utilProjects =
- // ServerTargetHelper.getAllEarUtilityProjects(editModel, project);
- // if (!utilProjects.isEmpty()) {
- // for (int i = 0; i < utilProjects.size(); i++) {
- // IProject moduleProject = (IProject) utilProjects.get(i);
- // //We don't need to remove a server target anyomre as it need to be there
- // //ServerTargetType existingTargetType =
- // // ServerTargetManager.getServerTargetType(moduleProject);
- // //if (existingTargetType != null) {
- // //if (!editModel.isEjbClientJarProject(moduleProject))
- // //We don't need to remove a server target anyomre as it
- // // need to be there
- // //ServerTargetManager.removeServerTarget(moduleProject,null);
- // //else
- // // removeServerTargetForEJBClientJar(moduleProject);
- // }
- // }
- // } finally {
- // editModel.releaseAccess(key);
- // }
- // }
- /**
- * @param moduleProject
- */
- // public static void removeServerTargetForEJBClientJar(IProject
- // ejbClientJarProject) {
- // EjbModuleExtension ejbExt = EarModuleManager.getEJBModuleExtension();
- // J2EEJavaProjectInfo info = ejbExt.createProjectInfo();
- // if (info != null) {
- // info.setProject(ejbClientJarProject);
- // try {
- // info.calculateServerClasspathEntries();
- // info.getJavaProject().setRawClasspath(info.getClasspathEntries(), null);
- // } catch (JavaModelException jme) {
- // Logger.getLogger().logTrace(jme);
- // }
- // }
- // }
- // public static void removeServerTargetOnProject(IProject project, String
- // projectType) {
- // setServerClassPathForJ2EEProject(project, projectType);
- // }
- /**
- * @param project
- */
- // public static void setServerClassPathForJ2EEProject(IProject project,
- // String projectType) {
- // try {
- // J2EEJavaProjectInfo info = getNewJ2EEProjectInfo(project, projectType);
- // if (info != null) {
- // info.setProject(project);
- // info.calculateServerClasspathEntries();
- // info.getJavaProject().setRawClasspath(info.getClasspathEntries(), null);
- // }
- // } catch (JavaModelException jme) {
- // Logger.getLogger().logError(jme);
- // }
- // }
- // public static J2EEJavaProjectInfo getNewJ2EEProjectInfo(IProject project,
- // String projectType)
- // {
- // if (projectType.equals(IServerTargetConstants.APP_CLIENT_TYPE))
- // return new ApplicationClientProjectInfo();
- // else if (projectType.equals(IServerTargetConstants.WEB_TYPE)) {
- // WebModuleExtension webExt = EarModuleManager.getWebModuleExtension();
- // J2EEJavaProjectInfo info = webExt.createProjectInfo();
- // String webNature = J2EENature.getRegisteredRuntimeID(project);
- // info.setJ2EEVersion(webNature.equals(J2EEVersionConstants.VERSION_1_3_TEXT)
- // ?
- // J2EEVersionConstants.J2EE_1_3_ID : J2EEVersionConstants.J2EE_1_2_ID);
- // return info;
- // } else if (projectType.equals(IServerTargetConstants.EJB_TYPE)) {
- // EjbModuleExtension ejbExt = EarModuleManager.getEJBModuleExtension();
- // return ejbExt.createProjectInfo();
- // } else if (projectType.equals(IServerTargetConstants.CONNECTOR_TYPE)) {
- // JcaModuleExtension jcaExt = EarModuleManager.getJCAModuleExtension();
- // return jcaExt.createProjectInfo();
- // }
- // return null;
- // }
- // public static J2EEJavaProjectInfo getNewJ2EEProjectInfo(IProject project)
- // {
- // if (J2EENature.hasRuntime(project, IEJBNatureConstants.EJB_NATURE_IDS)) {
- // EjbModuleExtension ejbExt = EarModuleManager.getEJBModuleExtension();
- // return ejbExt.createProjectInfo();
- // } else if (J2EENature.hasRuntime(project,
- // IWebNatureConstants.J2EE_NATURE_ID)) {
- // WebModuleExtension webExt = EarModuleManager.getWebModuleExtension();
- // return webExt.createProjectInfo();
- // } else if (ApplicationClientNatureRuntime.hasRuntime(project))
- // return new ApplicationClientProjectInfo();
- // else if (J2EENature.hasRuntime(project,
- // IConnectorNatureConstants.CONNECTOR_NATURE_ID)) {
- // JcaModuleExtension jcaExt = EarModuleManager.getJCAModuleExtension();
- // return jcaExt.createProjectInfo();
- // }
- // return null;
- // }
- public static void setNewServerTargetForEARModules(IRuntime newServerTarget, IProject project) {
- List moduleProjects = ServerTargetHelper.getAllEarModuleProjects(project);
- if (!moduleProjects.isEmpty()) {
- for (int i = 0; i < moduleProjects.size(); i++) {
- IProject moduleProject = (IProject) moduleProjects.get(i);
- String[] projectAttr = ServerTargetHelper.getProjectTypeAndJ2EELevel(moduleProject);
- if (projectAttr[0] != null && projectAttr[1] != null) {
- IRuntime existingTargetType = ServerCore.getProjectProperties(moduleProject).getRuntimeTarget();
- if (existingTargetType != null) {
- if (!existingTargetType.getId().equals(newServerTarget.getId()))
- setServerTargetForModuleProject(newServerTarget, moduleProject, projectAttr);
- // TODO Move the WLP sync to this method
- } else
- setServerTargetForModuleProject(newServerTarget, moduleProject, projectAttr);
- }
- }
- }
- }
-
- public static void setServerTargetForModuleProject(IRuntime newServerTarget, IProject moduleProject, String[] projectAttr) {
- ServerTargetHelper.cleanUpNonServerTargetClasspath(moduleProject);
- setServerTarget(moduleProject, newServerTarget, null);
- }
-
- public static List getWebProjectsInEAR(IProject earProject) {
- List moduleProjects = ServerTargetHelper.getAllEarModuleProjects(earProject);
- if (!moduleProjects.isEmpty()) {
- List webProjects = new ArrayList();
- for (int i = 0; i < moduleProjects.size(); i++) {
- IProject project = (IProject) moduleProjects.get(i);
- WebModuleExtension webExt = EarModuleManager.getWebModuleExtension();
- if (webExt.hasRuntime(project))
- webProjects.add(project);
- }
- return webProjects;
- }
- return Collections.EMPTY_LIST;
- }
-
- /**
- * @param newServerTarget
- * @param tt
- * @param project
- */
- public static void setNewServerTargetForEARUtilityJars(IRuntime newServerTarget, IProject project) {
- EARNatureRuntime nature = EARNatureRuntime.getRuntime(project);
- EAREditModel editModel = null;
- Object key = new ServerTargetHelper();
- try {
- editModel = nature.getEarEditModelForRead(key);
- List utilProjects = ServerTargetHelper.getAllEarUtilityProjects(editModel, project);
- if (!utilProjects.isEmpty()) {
- for (int i = 0; i < utilProjects.size(); i++) {
- IProject moduleProject = (IProject) utilProjects.get(i);
- IRuntime existingTargetType = ServerCore.getProjectProperties(moduleProject).getRuntimeTarget();
- if (existingTargetType != null) {
- if (!existingTargetType.getId().equals(newServerTarget.getId())) {
- setServerTargetForUtilProject(newServerTarget, moduleProject);
- }
- } else {
- setServerTargetForUtilProject(newServerTarget, moduleProject);
- }
- }
- }
- } finally {
- editModel.releaseAccess(key);
- }
- }
-
- public static void setServerTargetForUtilProject(IRuntime newServerTarget, IProject moduleProject) {
- ServerTargetHelper.cleanUpNonServerTargetClasspath(moduleProject);
- setServerTarget(moduleProject, newServerTarget, null);
- }
-
- public static void setServerTarget(IProject project, IRuntime runtime, IProgressMonitor monitor) {
- try {
- ServerCore.getProjectProperties(project).setRuntimeTarget(runtime, monitor);
- } catch (CoreException ce) {
- Logger.getLogger().logError(ce);
- }
- }
-
- /**
- * @param earProject
- */
- public static List getAllEarModuleProjects(IProject earProject) {
- EARNatureRuntime nature = EARNatureRuntime.getRuntime(earProject);
- EAREditModel editModel = null;
- List moduleProjects = new ArrayList();
- Object key = new ServerTargetHelper();
- try {
- editModel = nature.getEarEditModelForRead(key);
- Set allModuleProjects = editModel.getModuleMappedModuleProjects();
- if (!allModuleProjects.isEmpty())
- moduleProjects.addAll(allModuleProjects);
- return moduleProjects;
- } finally {
- if (editModel != null)
- editModel.releaseAccess(key);
- }
- }
-
- public static String[] getProjectTypeAndJ2EELevel(IProject project) {
- String[] projectAttr = new String[2];
- boolean isJ2EE13 = true;
- if (EARNatureRuntime.hasRuntime(project)) {
- projectAttr[0] = IServerTargetConstants.EAR_TYPE;
- isJ2EE13 = EARNatureRuntime.getRuntime(project).isJ2EE1_3();
- } else if (J2EENature.hasRuntime(project, IEJBNatureConstants.EJB_NATURE_IDS)) {
- projectAttr[0] = IServerTargetConstants.EJB_TYPE;
- isJ2EE13 = J2EENature.getRuntime(project, IEJBNatureConstants.EJB_NATURE_IDS).isJ2EE1_3();
- } else if (J2EENature.hasRuntime(project, IWebNatureConstants.J2EE_NATURE_ID)) {
- projectAttr[0] = IServerTargetConstants.WEB_TYPE;
- isJ2EE13 = J2EENature.getRuntime(project, IWebNatureConstants.J2EE_NATURE_ID).isJ2EE1_3();
- } else if (ApplicationClientNatureRuntime.hasRuntime(project)) {
- projectAttr[0] = IServerTargetConstants.APP_CLIENT_TYPE;
- isJ2EE13 = ApplicationClientNatureRuntime.getRuntime(project).isJ2EE1_3();
- } else if (J2EENature.hasRuntime(project, IConnectorNatureConstants.NATURE_ID)) {
- projectAttr[0] = IServerTargetConstants.CONNECTOR_TYPE;
- isJ2EE13 = J2EENature.getRuntime(project, IConnectorNatureConstants.NATURE_ID).isJ2EE1_3();
- } else if (hasJavaNature(project))
- projectAttr[0] = null;
- if (projectAttr[0] != null && projectAttr[0].length() > 0) {
- if (isJ2EE13)
- projectAttr[1] = IServerTargetConstants.J2EE_13;
- else
- projectAttr[1] = IServerTargetConstants.J2EE_12;
- }
- return projectAttr;
- }
-
- /**
- * @param project
- * @return
- */
- public static boolean hasJavaNature(IProject project) {
- try {
- return project.hasNature(JAVA_NATURE_ID);
- } catch (CoreException ce) {
- Logger.getLogger().logTrace(ce);
- }
- return false;
- }
-
- /**
- * @param earProject
- */
- public static List getAllEarUtilityProjects(EAREditModel earEditModel, IProject earProject) {
- List utilityProjects = new ArrayList();
- Set utilProjects = earEditModel.getModuleMappedUtilityJarProjects();
- if (!utilProjects.isEmpty())
- utilityProjects.addAll(utilProjects);
- return utilityProjects;
- }
-
- public static int getExistingServerTargetIndex(List validServerTargets, IProject project) {
- if (validServerTargets != null) {
- IRuntime st = ServerCore.getProjectProperties(project).getRuntimeTarget();
- if (st != null) {
- for (int i = 0; i < validServerTargets.size(); i++) {
- if (((IRuntime) validServerTargets.get(i)).getId() == st.getId())
- return i;
- }
- }
- }
- return -1;
- }
-
- public static List getExistingNonServerTargetClasspath(IProject project) {
- IJavaProject javaProject = null;
- List list = new ArrayList();
- try {
- javaProject = (IJavaProject) project.getNature(JavaCore.NATURE_ID);
- } catch (Exception e) {
- }
- if (javaProject != null) {
- try {
- IClasspathEntry[] cp = javaProject.getRawClasspath();
- int size = cp.length;
- for (int i = 0; i < size; i++) {
- int entryKind = cp[i].getEntryKind();
- if (entryKind != IClasspathEntry.CPE_SOURCE && entryKind != IClasspathEntry.CPE_LIBRARY && entryKind != IClasspathEntry.CPE_PROJECT && (entryKind == IClasspathEntry.CPE_VARIABLE && isWASVariable(cp[i])) && (entryKind != IClasspathEntry.CPE_CONTAINER || !cp[i].getPath().segment(0).equals(SERVER_CONTAINER))) {
- list.add(cp[i]);
- }
- }
- } catch (Exception e) {
- }
- return list;
- }
- return list;
- }
-
- /**
- * @param entry
- * @return
- */
- private static boolean isWASVariable(IClasspathEntry entry) {
- // TODO This is no longer valid in the base.
- // IPath path = entry.getPath();
- // if (path != null && path.segmentCount() != 0) {
- // String classpathVariable = path.segment(0);
- // return
- // classpathVariable.equals(IEJBNatureConstants.WAS_PLUGINDIR_VARIABLE)
- // ||
- // classpathVariable.equals(IEJBNatureConstants.WAS_50_PLUGINDIR_VARIABLE)
- // ||
- // classpathVariable.equals(IEJBNatureConstants.SERVERJDK_50_PLUGINDIR_VARIABLE)
- // ||
- // classpathVariable.equals(IEJBNatureConstants.SERVERJDK_PLUGINDIR_VARIABLE)
- // || classpathVariable.equals(J2EEPlugin.SOAP_PLUGINDIR_VARIABLE)
- // || classpathVariable.equals(J2EEPlugin.SOAPSEC_PLUGINDIR_VARIABLE);
- // //|| classpathVariable.equals(J2EEPlugin.XERCES_IMPL_VARIABLE)
- // //|| classpathVariable.equals(J2EEPlugin.XERCES_PLUGINDIR_VARIABLE)
- // //|| classpathVariable.equals(J2EEPlugin.WORF_PLUGINDIR_VARIABLE)
- // //|| classpathVariable.equals(J2EEPlugin.MAIL_CLASSPATH_VARIABLE)
- // //||
- // classpathVariable.equals(J2EEPlugin.ACTIVATION_CLASSPATH_VARIABLE);
- // }
- return false;
- }
-
- /**
- * @param earProject
- * @param st
- * @return
- */
- public static boolean serverTargetValidForEAR(IProject earProject, IRuntime st) {
- return !(J2EENature.hasRuntime(earProject, IEARNatureConstants.NATURE_ID) && st.getId().equals(IServerTargetConstants.aesV4ServerTargetId));
- }
-
- public static List getServerTargets(String type, String version) {
- List targets = Arrays.asList(ServerUtil.getRuntimes(type, version));
- return targets;
- }
- /*
- * public static ITargetType getV50TargetType(IProject project, IServerTarget v50ServerTarget) {
- * if (J2EENature.hasRuntime(project, IEARNatureConstants.NATURE_ID)) return
- * ServerTargetManager.getTargetType(v50ServerTarget, IServerTargetConstants.EAR_TYPE); if
- * (J2EENature.hasRuntime(project, IApplicationClientNatureConstants.NATURE_ID)) return
- * ServerTargetManager.getTargetType(v50ServerTarget, IServerTargetConstants.EAR_TYPE); else if
- * (J2EENature.hasRuntime(project, IEJBNatureConstants.NATURE_ID)) return
- * ServerTargetManager.getTargetType(v50ServerTarget, IServerTargetConstants.EJB_TYPE); else if
- * (J2EENature.hasRuntime(project, IWebNatureConstants.J2EE_NATURE_ID)) return
- * ServerTargetManager.getTargetType(v50ServerTarget, IServerTargetConstants.WEB_TYPE); return
- * null; }
- */
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.jst.j2ee/j2eecreation/org/eclipse/jst/j2ee/internal/servertarget/ServerTargetOperation.java b/plugins/org.eclipse.jst.j2ee/j2eecreation/org/eclipse/jst/j2ee/internal/servertarget/ServerTargetOperation.java
deleted file mode 100644
index 1e141b9c3..000000000
--- a/plugins/org.eclipse.jst.j2ee/j2eecreation/org/eclipse/jst/j2ee/internal/servertarget/ServerTargetOperation.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
- *******************************************************************************/
-/*
- * Created on Oct 27, 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.servertarget;
-
-import java.lang.reflect.InvocationTargetException;
-
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.jst.j2ee.internal.earcreation.EARNatureRuntime;
-import org.eclipse.wst.common.frameworks.internal.operations.WTPOperation;
-import org.eclipse.wst.server.core.IRuntime;
-import org.eclipse.wst.server.core.ServerCore;
-
-/**
- * @author jsholl
- * @deprecated - Use server core api to set Runtime Targets. Use artifact edit api to
- * get to any j2ee related methods in the class.
- * 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 ServerTargetOperation extends WTPOperation {
- public ServerTargetOperation(ServerTargetDataModel dataModel) {
- super(dataModel);
- }
-
- protected void execute(IProgressMonitor monitor) throws CoreException, InvocationTargetException, InterruptedException {
- ServerTargetDataModel dataModel = (ServerTargetDataModel) operationDataModel;
- IRuntime runtime = dataModel.getRuntimeTarget();
- IProject project = dataModel.getProject();
- if (runtime != null) {
- ServerCore.getProjectProperties(project).setRuntimeTarget(runtime, monitor);
- if (dataModel.getBooleanProperty(ServerTargetDataModel.UPDATE_MODULES) && EARNatureRuntime.hasRuntime(project)) {
- ServerTargetHelper.setNewServerTargetForEARModules(runtime, project);
- ServerTargetHelper.setNewServerTargetForEARUtilityJars(runtime, project);
- }
- }
- }
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.jst.j2ee/j2eecreation/org/eclipse/jst/j2ee/internal/servertarget/SyncEARServerTargetDataModel.java b/plugins/org.eclipse.jst.j2ee/j2eecreation/org/eclipse/jst/j2ee/internal/servertarget/SyncEARServerTargetDataModel.java
deleted file mode 100644
index 63a365bbf..000000000
--- a/plugins/org.eclipse.jst.j2ee/j2eecreation/org/eclipse/jst/j2ee/internal/servertarget/SyncEARServerTargetDataModel.java
+++ /dev/null
@@ -1,39 +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 Feb 3, 2004
- *
- * To change the template for this generated file go to
- * Window - Preferences - Java - Code Generation - Code and Comments
- */
-package org.eclipse.jst.j2ee.internal.servertarget;
-
-/**
- * @author vijayb
- * @deprecated - Use server core api to set Runtime Targets. Use artifact edit api to
- * get to any j2ee related methods in the class.
- * To change the template for this generated type comment go to Window - Preferences - Java - Code
- * Generation - Code and Comments
- */
-public class SyncEARServerTargetDataModel extends ServerTargetDataModel {
-
- /**
- * default false, type Boolean. Set this to true if the operation is supposed to sync all
- * dependent modules and projects in an ear if the passed project name is an ear project
- */
-
- public static final String SYNC_SERVER_TARGET_MODULES = "ServerTargetDataModel.SYNC_SERVER_TARGET_MODULES"; //$NON-NLS-1$
-
- protected void initValidBaseProperties() {
- super.initValidBaseProperties();
- addValidBaseProperty(SYNC_SERVER_TARGET_MODULES);
- }
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.jst.j2ee/j2eecreation/org/eclipse/jst/j2ee/internal/servertarget/SyncEARServerTargetOperation.java b/plugins/org.eclipse.jst.j2ee/j2eecreation/org/eclipse/jst/j2ee/internal/servertarget/SyncEARServerTargetOperation.java
deleted file mode 100644
index 594ef4d93..000000000
--- a/plugins/org.eclipse.jst.j2ee/j2eecreation/org/eclipse/jst/j2ee/internal/servertarget/SyncEARServerTargetOperation.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
- *******************************************************************************/
-/*
- * Created on Feb 3, 2004
- *
- * To change the template for this generated file go to
- * Window - Preferences - Java - Code Generation - Code and Comments
- */
-package org.eclipse.jst.j2ee.internal.servertarget;
-
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.jst.j2ee.internal.earcreation.EARNatureRuntime;
-import org.eclipse.wst.server.core.IRuntime;
-
-/**
- * @author vijayb
- * @deprecated - Use server core api to set Runtime Targets. Use artifact edit api to
- * get to any j2ee related methods in the class.
- * To change the template for this generated type comment go to Window - Preferences - Java - Code
- * Generation - Code and Comments
- */
-public class SyncEARServerTargetOperation extends ServerTargetOperation {
- /**
- * @param dataModel
- */
- public SyncEARServerTargetOperation(ServerTargetDataModel dataModel) {
- super(dataModel);
-
- }
-
- protected void execute(IProgressMonitor monitor) throws CoreException, InterruptedException {
- ServerTargetDataModel dataModel = (ServerTargetDataModel) operationDataModel;
- IRuntime runtime = dataModel.getRuntimeTarget();
- IProject project = dataModel.getProject();
- if (runtime != null) {
- if (dataModel.getBooleanProperty(SyncEARServerTargetDataModel.SYNC_SERVER_TARGET_MODULES) && EARNatureRuntime.hasRuntime(project)) {
- ServerTargetHelper.setNewServerTargetForEARModules(runtime, project);
- ServerTargetHelper.setNewServerTargetForEARUtilityJars(runtime, project);
- }
- }
- }
-
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.jst.j2ee/j2eecreation/org/eclipse/jst/j2ee/internal/servertarget/TargetRuntimeExtension.java b/plugins/org.eclipse.jst.j2ee/j2eecreation/org/eclipse/jst/j2ee/internal/servertarget/TargetRuntimeExtension.java
deleted file mode 100644
index 6b2498962..000000000
--- a/plugins/org.eclipse.jst.j2ee/j2eecreation/org/eclipse/jst/j2ee/internal/servertarget/TargetRuntimeExtension.java
+++ /dev/null
@@ -1,62 +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 Feb 5, 2004
- *
- * To change the template for this generated file go to
- * Window - Preferences - Java - Code Generation - Code and Comments
- */
-package org.eclipse.jst.j2ee.internal.servertarget;
-
-import org.eclipse.core.runtime.IConfigurationElement;
-import org.eclipse.core.runtime.Plugin;
-
-/**
- * @author vijayb
- * @deprecated
- * To change the template for this generated type comment go to Window - Preferences - Java - Code
- * Generation - Code and Comments
- */
-public class TargetRuntimeExtension {
- String groupID;
- String className;
- IConfigurationElement configElement;
- Plugin plugin;
-
- /**
- *
- */
- public TargetRuntimeExtension() {
- super();
- }
-
- public TargetRuntimeExtension(Plugin aPlugin, IConfigurationElement element, String groupId, String handlerClass) {
- super();
- plugin = aPlugin;
- configElement = element;
- groupID = groupId;
- className = handlerClass;
- }
-
- /**
- * @return
- */
- public String getGroupId() {
- return groupID;
- }
-
- /**
- * @param string
- */
- public void setGroupId(String string) {
- groupID = string;
- }
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.jst.j2ee/j2eecreation/org/eclipse/jst/j2ee/internal/servertarget/TargetRuntimeExtensionHandlerReader.java b/plugins/org.eclipse.jst.j2ee/j2eecreation/org/eclipse/jst/j2ee/internal/servertarget/TargetRuntimeExtensionHandlerReader.java
deleted file mode 100644
index 8c36e0dcb..000000000
--- a/plugins/org.eclipse.jst.j2ee/j2eecreation/org/eclipse/jst/j2ee/internal/servertarget/TargetRuntimeExtensionHandlerReader.java
+++ /dev/null
@@ -1,143 +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 Feb 5, 2004
- *
- * To change the template for this generated file go to
- * Window - Preferences - Java - Code Generation - Code and Comments
- */
-package org.eclipse.jst.j2ee.internal.servertarget;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.HashMap;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IConfigurationElement;
-import org.eclipse.core.runtime.IPluginRegistry;
-import org.eclipse.core.runtime.Plugin;
-import org.eclipse.jem.util.RegistryReader;
-import org.eclipse.jst.j2ee.internal.plugin.J2EEPlugin;
-
-/**
- * @author vijayb
- * @deprecated
- * To change the template for this generated type comment go to Window - Preferences - Java - Code
- * Generation - Code and Comments
- */
-public class TargetRuntimeExtensionHandlerReader extends RegistryReader {
- static TargetRuntimeExtensionHandlerReader instance = null;
- protected ITargetRuntimeExtensionHandler targetRuntimeExtHandler;
- protected String HANDLER_EXT_Id = "targetRuntimeExtensionHandler"; //$NON-NLS-1$
- protected TargetRuntimeExtension extension = null;
- protected String HANDLER_CLASSNAME = "className"; //$NON-NLS-1$
- protected String HANDLER_GROUP_ID = "groupID"; //$NON-NLS-1$
- protected HashMap handlerExtensions = null;
-
- /**
- * @param registry
- * @param plugin
- * @param extensionPoint
- */
- public TargetRuntimeExtensionHandlerReader(IPluginRegistry registry, String plugin, String extensionPoint) {
- super(plugin, extensionPoint);
- }
-
- /**
- *
- */
- public TargetRuntimeExtensionHandlerReader() {
- super(J2EEPlugin.PLUGIN_ID, "TargetRuntimeExtHandler"); //$NON-NLS-1$
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.wst.common.frameworks.internal.RegistryReader#readElement(org.eclipse.core.runtime.IConfigurationElement)
- */
- public boolean readElement(IConfigurationElement element) {
- if (!element.getName().equals(HANDLER_EXT_Id))
- return false;
- String group = element.getAttribute(HANDLER_GROUP_ID);
- String className = element.getAttribute(HANDLER_CLASSNAME);
- if (group == null) {
- logMissingAttribute(element, "Missing group target runtime extension specification."); //$NON-NLS-1$
- return false;
- }
- try {
- Plugin plugin = element.getDeclaringExtension().getDeclaringPluginDescriptor().getPlugin();
- extension = new TargetRuntimeExtension(plugin, element, group, className);
- addExtensionPoint(extension);
- return true;
- } catch (CoreException ce) {
- ce.printStackTrace();
- }
- return false;
- }
-
- /**
- * Sets the extension point.
- *
- * @param extensions
- * The extensions to set
- */
- protected void addExtensionPoint(TargetRuntimeExtension newExtension) {
- if (handlerExtensions == null)
- handlerExtensions = new HashMap();
- Collection temp = null;
- Object holder = handlerExtensions.get(newExtension.getGroupId());
- if (temp == null) {
- temp = new ArrayList();
- temp.add(newExtension);
- } else {
- handlerExtensions.remove(newExtension.getGroupId());
- temp = (Collection) holder;
- temp.add(newExtension);
- }
- handlerExtensions.put(newExtension.getGroupId(), temp);
- }
-
- /**
- * Gets the instance.
- *
- * @return Returns a TargetRuntimeExtensionHandlerReader
- */
- public static TargetRuntimeExtensionHandlerReader getInstance() {
- if (instance == null)
- instance = new TargetRuntimeExtensionHandlerReader();
- return instance;
- }
-
- public ITargetRuntimeExtensionHandler getEJBExtHandler() {
- if (targetRuntimeExtHandler == null && handlerExtensions != null) {
- TargetRuntimeExtension codegenExt = null;
- ArrayList ibmExtensions = (ArrayList) handlerExtensions.get("IBM"); //$NON-NLS-1$
- if (ibmExtensions != null) {
- for (int i = 0; i < ibmExtensions.size(); i++) {
- Object obj = ibmExtensions.get(i);
- if (obj instanceof TargetRuntimeExtension) {
- codegenExt = (TargetRuntimeExtension) obj;
- break;
- }
- }
- }
- if (codegenExt != null) {
- IConfigurationElement cElement = codegenExt.configElement;
- try {
- targetRuntimeExtHandler = (ITargetRuntimeExtensionHandler) cElement.createExecutableExtension("run"); //$NON-NLS-1$
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
- }
- return targetRuntimeExtHandler;
- }
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.jst.j2ee/j2eecreation/org/eclipse/jst/j2ee/project/datamodel/properties/IFlexibleJavaProjectCreationDataModelProperties.java b/plugins/org.eclipse.jst.j2ee/j2eecreation/org/eclipse/jst/j2ee/project/datamodel/properties/IFlexibleJavaProjectCreationDataModelProperties.java
deleted file mode 100644
index 0e81cbb8e..000000000
--- a/plugins/org.eclipse.jst.j2ee/j2eecreation/org/eclipse/jst/j2ee/project/datamodel/properties/IFlexibleJavaProjectCreationDataModelProperties.java
+++ /dev/null
@@ -1,51 +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.project.datamodel.properties;
-
-import org.eclipse.wst.common.frameworks.datamodel.properties.IFlexibleProjectCreationDataModelProperties;
-/**
- * <p>
- * IFlexibleJavaProjectCreationDataModelProperties provides properties to the DataModel associated with the
- * FlexibleJavaProjectCreationDataModelProvider
- * @see org.eclipse.jst.j2ee.application.internal.operations.FlexibleJavaProjectCreationDataModelProvider
- * </p>
- * <p>
- * This interface is not intended to be implemented by clients.
- * </p>
- *
- * @see org.eclipse.wst.common.frameworks.datamodel.IDataModelProvider
- * @see org.eclipse.wst.common.frameworks.datamodel.DataModelFactory
- * @see org.eclipse.wst.common.frameworks.datamodel.IDataModelProperties
- *
- * @plannedfor 1.0
- */
-public interface IFlexibleJavaProjectCreationDataModelProperties extends IFlexibleProjectCreationDataModelProperties {
- /**
- * Required, type IDataModel. The user set IDataModel used to handle the creation of a server target for the project to be
- * created. Providers which currently exist for this IDataModel include J2EEProjectServerTargetDataModelProvider.
- */
- public static final String NESTED_MODEL_SERVER_TARGET = "IFlexibleProjectCreationDataModelProperties.NESTED_MODEL_SERVER_TARGET"; //$NON-NLS-1$
-
- /**
- * Optional, type Boolean The default value is <code>Boolean.TRUE</code>. If this property is set
- * to <code>Boolean.TRUE</code> then the server target specified by dataModel property <code>SERVER_TARGET_ID</code>
- * will be set on the generated artifact.
- *
- * @see SERVER_TARGET_ID
- */
- public static final String ADD_SERVER_TARGET = "IFlexibleProjectCreationDataModelProperties.ADD_SERVER_TARGET"; //$NON-NLS-1$
- /**
- * Optional, type String. This is used to specify the server target and is required if
- * the <code>ADD_SERVER_TARGET</code> property is set to <code>Boolean.TRUE</code>.
- */
- public static final String RUNTIME_TARGET_ID = IJ2EEProjectServerTargetDataModelProperties.RUNTIME_TARGET_ID;
-
-}
diff --git a/plugins/org.eclipse.jst.j2ee/j2eecreation/org/eclipse/jst/j2ee/project/datamodel/properties/IJ2EEProjectServerTargetDataModelProperties.java b/plugins/org.eclipse.jst.j2ee/j2eecreation/org/eclipse/jst/j2ee/project/datamodel/properties/IJ2EEProjectServerTargetDataModelProperties.java
deleted file mode 100644
index 6c7a8c7f4..000000000
--- a/plugins/org.eclipse.jst.j2ee/j2eecreation/org/eclipse/jst/j2ee/project/datamodel/properties/IJ2EEProjectServerTargetDataModelProperties.java
+++ /dev/null
@@ -1,40 +0,0 @@
-package org.eclipse.jst.j2ee.project.datamodel.properties;
-
-import org.eclipse.wst.common.frameworks.datamodel.IDataModelProperties;
-
-public interface IJ2EEProjectServerTargetDataModelProperties extends IDataModelProperties{
-
- /**
- * required, type String
- */
- public static final String PROJECT_NAME = "IJ2EEProjectServerTargetDataModelProperties.PROJECT_NAME"; //$NON-NLS-1$
- /**
- * required, not defaulted. If null, will not run.
- */
- public static final String RUNTIME_TARGET_ID = "IJ2EEProjectServerTargetDataModelProperties.RUNTIME_TARGET_ID"; //$NON-NLS-1$
- /**
- * Optional - This needs to be set if the PROJECT_NAME does not exist.
- *
- * @link J2EEVersionConstants
- */
- public static final String J2EE_VERSION_ID = "IJ2EEProjectServerTargetDataModelProperties.J2EE_VERSION_ID"; //$NON-NLS-1$
-
- /**
- * optional, default true, type Boolean. Set this to true if the operation is supposed to update
- * all dependent modules and projects in an ear if the passed project name is an ear project
- */
- public static final String UPDATE_MODULES = "IJ2EEProjectServerTargetDataModelProperties.UPDATE_MODULES"; //$NON-NLS-1$
-
- /**
- * Optional - This needs to be set if the PROJECT_NAME does not exist.
- *
- * @link XMLResource#APP_CLIENT_TYPE
- * @link XMLResource#APPLICATION_TYPE
- * @link XMLResource#EJB_TYPE
- * @link XMLResource#RAR_TYPE
- * @link XMLResource#WEB_APP_TYPE
- */
- public static final String DEPLOYMENT_TYPE_ID = "IJ2EEProjectServerTargetDataModelProperties.DD_TYPE_ID"; //$NON-NLS-1$
-
-
-}

Back to the top