Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/org.eclipse.jst.j2ee/archiveops/org')
-rw-r--r--plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/archive/IArchiveExportParticipant.java47
-rw-r--r--plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/datamodel/properties/IAddWebComponentToEnterpriseApplicationDataModelProperties.java19
-rw-r--r--plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/datamodel/properties/IAppClientComponentExportDataModelProperties.java30
-rw-r--r--plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/datamodel/properties/IAppClientComponentImportDataModelProperties.java31
-rw-r--r--plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/datamodel/properties/IEARComponentExportDataModelProperties.java30
-rw-r--r--plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/datamodel/properties/IEARComponentImportDataModelProperties.java79
-rw-r--r--plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/datamodel/properties/IJ2EEComponentCreationDataModelProperties.java105
-rw-r--r--plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/datamodel/properties/IJ2EEComponentExportDataModelProperties.java94
-rw-r--r--plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/datamodel/properties/IJ2EEComponentImportDataModelProperties.java90
-rw-r--r--plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/datamodel/properties/IJ2EEModuleImportDataModelProperties.java52
-rw-r--r--plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/datamodel/properties/IJ2EEUtilityJarListImportDataModelProperties.java72
-rw-r--r--plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/datamodel/properties/IJavaComponentCreationDataModelProperties.java64
-rw-r--r--plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/datamodel/properties/IJavaUtilityJarImportDataModelProperties.java37
-rw-r--r--plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/datamodel/properties/package.xml19
-rw-r--r--plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/internal/archive/AppClientArchiveTypeHandler.java31
-rw-r--r--plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/internal/archive/AppClientComponentArchiveLoadAdapter.java29
-rw-r--r--plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/internal/archive/AppClientComponentArchiveSaveAdapter.java21
-rw-r--r--plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/internal/archive/ArchiveExportParticipantsExtensionPoint$PluginUtil.properties4
-rw-r--r--plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/internal/archive/ArchiveExportParticipantsExtensionPoint.java436
-rw-r--r--plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/internal/archive/ArchiveWrapper.java599
-rw-r--r--plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/internal/archive/ComponentArchiveLoadAdapter.java704
-rw-r--r--plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/internal/archive/ComponentArchiveSaveAdapter.java285
-rw-r--r--plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/internal/archive/ConnectorComponentArchiveLoadAdapter.java299
-rw-r--r--plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/internal/archive/ConnectorComponentArchiveSaveAdapter.java21
-rw-r--r--plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/internal/archive/ConnectorComponentArchiveTypeHandler.java31
-rw-r--r--plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/internal/archive/ConnectorComponentNestedJARArchiveLoadAdapter.java151
-rw-r--r--plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/internal/archive/EARComponentArchiveLoadAdapter.java152
-rw-r--r--plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/internal/archive/EARComponentArchiveSaveAdapter.java21
-rw-r--r--plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/internal/archive/EARComponentArchiveTypeHandler.java31
-rw-r--r--plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/internal/archive/EJBComponentArchiveLoadAdapter.java31
-rw-r--r--plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/internal/archive/EJBComponentArchiveSaveAdapter.java22
-rw-r--r--plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/internal/archive/EJBComponentArchiveTypeHandler.java31
-rw-r--r--plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/internal/archive/J2EEComponentArchiveLoadAdapter.java36
-rw-r--r--plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/internal/archive/J2EEComponentArchiveSaveAdapter.java175
-rw-r--r--plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/internal/archive/J2EEJavaComponentArchiveSaveAdapter.java20
-rw-r--r--plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/internal/archive/JavaComponentArchiveLoadAdapter.java37
-rw-r--r--plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/internal/archive/JavaComponentArchiveSaveAdapter.java21
-rw-r--r--plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/internal/archive/JavaEEArchiveUtilities.java746
-rw-r--r--plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/internal/archive/JavaEEEMFArchiveAdapterHelper.java298
-rw-r--r--plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/internal/archive/JavaEEEMFZipFileLoadAdapterImpl.java60
-rw-r--r--plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/internal/archive/WebComponentArchiveLoadAdapter.java152
-rw-r--r--plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/internal/archive/WebComponentArchiveSaveAdapter.java132
-rw-r--r--plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/internal/archive/WebComponentArchiveTypeHandler.java31
-rw-r--r--plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/internal/archive/operations/AppClientArchiveOpsResourceHandler.java40
-rw-r--r--plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/internal/archive/operations/AppClientComponentExportOperation.java65
-rw-r--r--plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/internal/archive/operations/AppClientComponentImportOperation.java34
-rw-r--r--plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/internal/archive/operations/AppClientComponentLoadStrategyImpl.java30
-rw-r--r--plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/internal/archive/operations/AppClientComponentSaveStrategyImpl.java21
-rw-r--r--plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/internal/archive/operations/ComponentLoadStrategyImpl.java692
-rw-r--r--plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/internal/archive/operations/ComponentSaveStrategyImpl.java283
-rw-r--r--plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/internal/archive/operations/ConnectorComponentSaveStrategyImpl.java21
-rw-r--r--plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/internal/archive/operations/DependentJarExportMerger.java129
-rw-r--r--plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/internal/archive/operations/EARArchiveOpsResourceHandler.java49
-rw-r--r--plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/internal/archive/operations/EARComponentExportOperation.java93
-rw-r--r--plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/internal/archive/operations/EARComponentImportOperation.java216
-rw-r--r--plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/internal/archive/operations/EARComponentLoadStrategyImpl.java215
-rw-r--r--plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/internal/archive/operations/EARComponentSaveStrategyImpl.java248
-rw-r--r--plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/internal/archive/operations/EJBArchiveOpsResourceHandler.java52
-rw-r--r--plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/internal/archive/operations/EJBComponentSaveStrategyImpl.java21
-rw-r--r--plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/internal/archive/operations/IOverwriteHandler.java142
-rw-r--r--plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/internal/archive/operations/ImportOption.java90
-rw-r--r--plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/internal/archive/operations/J2EEArtifactExportOperation.java295
-rw-r--r--plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/internal/archive/operations/J2EEArtifactImportOperation.java158
-rw-r--r--plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/internal/archive/operations/J2EEComponentLoadStrategyImpl.java35
-rw-r--r--plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/internal/archive/operations/J2EEComponentSaveStrategyImpl.java153
-rw-r--r--plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/internal/archive/operations/J2EEImportConstants.java27
-rw-r--r--plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/internal/archive/operations/J2EEJavaComponentSaveStrategyImpl.java20
-rw-r--r--plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/internal/archive/operations/JavaComponentLoadStrategyImpl.java35
-rw-r--r--plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/internal/archive/operations/JavaComponentSaveStrategyImpl.java21
-rw-r--r--plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/internal/archive/operations/OverwriteHandlerException.java42
70 files changed, 0 insertions, 8603 deletions
diff --git a/plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/archive/IArchiveExportParticipant.java b/plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/archive/IArchiveExportParticipant.java
deleted file mode 100644
index b38176d8b..000000000
--- a/plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/archive/IArchiveExportParticipant.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/******************************************************************************
- * Copyright (c) 2005, 2007 BEA Systems, Inc.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Konstantin Komissarchik
- ******************************************************************************/
-
-package org.eclipse.jst.j2ee.archive;
-
-import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
-import org.eclipse.wst.common.frameworks.datamodel.IDataModelOperation;
-
-/**
- * Used in conjunction with the <code>org.eclipse.jst.j2ee.archiveExportParticipants</code>
- * extension point in order to extend the base module archive export operation.
- *
- * @since 3.0
- * @author <a href="mailto:kosta@bea.com">Konstantin Komissarchik</a>
- */
-
-public interface IArchiveExportParticipant
-{
- /**
- * Creates the data model that will be used to configure the operation.
- *
- * @param rootArchiveExportDataModel the data model of the module archive export
- * operation that this participant is extending
- * @return the created data model
- */
-
- IDataModel createDataModel( IDataModel rootArchiveExportDataModel );
-
- /**
- * Creates the operation that will be invoked in order to let this extension
- * participate in the export process.
- *
- * @param extensionDataModel the data model associated with this export
- * participant (previously returned by the createDataModel() method)
- * @return the created operation
- */
-
- IDataModelOperation createOperation( IDataModel extensionDataModel );
-}
diff --git a/plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/datamodel/properties/IAddWebComponentToEnterpriseApplicationDataModelProperties.java b/plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/datamodel/properties/IAddWebComponentToEnterpriseApplicationDataModelProperties.java
deleted file mode 100644
index 45d5e29ea..000000000
--- a/plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/datamodel/properties/IAddWebComponentToEnterpriseApplicationDataModelProperties.java
+++ /dev/null
@@ -1,19 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jst.j2ee.datamodel.properties;
-
-import org.eclipse.wst.common.componentcore.datamodel.properties.ICreateReferenceComponentsDataModelProperties;
-
-public interface IAddWebComponentToEnterpriseApplicationDataModelProperties extends ICreateReferenceComponentsDataModelProperties{
-
- public static final String CONTEXT_ROOT = "IAddWebComponentToEnterpriseApplicationDataModelProperties.CONTEXT_ROOT"; //$NON-NLS-1$
-
-}
diff --git a/plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/datamodel/properties/IAppClientComponentExportDataModelProperties.java b/plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/datamodel/properties/IAppClientComponentExportDataModelProperties.java
deleted file mode 100644
index 00fa5d0ba..000000000
--- a/plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/datamodel/properties/IAppClientComponentExportDataModelProperties.java
+++ /dev/null
@@ -1,30 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jst.j2ee.datamodel.properties;
-/**
- * <p>
- * IAppClientComponentExportDataModelProperties provides properties to the IDataModel associated with the
- * AppClientComponentExportDataModelProvider.
- * NOTE: The associated Provider and Operations will be created during M5
- * </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 IAppClientComponentExportDataModelProperties extends IJ2EEComponentExportDataModelProperties {
-
-}
diff --git a/plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/datamodel/properties/IAppClientComponentImportDataModelProperties.java b/plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/datamodel/properties/IAppClientComponentImportDataModelProperties.java
deleted file mode 100644
index f2895dc90..000000000
--- a/plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/datamodel/properties/IAppClientComponentImportDataModelProperties.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jst.j2ee.datamodel.properties;
-
-/**
- * <p>
- * IAppClientComponentImportDataModelProperties provides properties to the IDataModel associated with the
- * AppClientComponentImportDataModelProvider.
- * NOTE: The associated Provider and Operations will be created during M5
- * </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 IAppClientComponentImportDataModelProperties extends IJ2EEModuleImportDataModelProperties {
-
-}
diff --git a/plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/datamodel/properties/IEARComponentExportDataModelProperties.java b/plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/datamodel/properties/IEARComponentExportDataModelProperties.java
deleted file mode 100644
index d6e8b1a81..000000000
--- a/plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/datamodel/properties/IEARComponentExportDataModelProperties.java
+++ /dev/null
@@ -1,30 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jst.j2ee.datamodel.properties;
-/**
- * <p>
- * IEARComponentExportDataModelProperties provides properties to the DataModel associated with the
- * EARComponentExportDataModelProvider.
- * NOTE: The associated Provider and Operations will be created during M5
- * </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 IEARComponentExportDataModelProperties extends IJ2EEComponentExportDataModelProperties {
-
-}
diff --git a/plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/datamodel/properties/IEARComponentImportDataModelProperties.java b/plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/datamodel/properties/IEARComponentImportDataModelProperties.java
deleted file mode 100644
index c30fa4a1b..000000000
--- a/plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/datamodel/properties/IEARComponentImportDataModelProperties.java
+++ /dev/null
@@ -1,79 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jst.j2ee.datamodel.properties;
-
-/**
- * <p>
- * IEARComponentImportDataModelProperties provides properties to the IDataModel associated with the
- * EARComponentImportDataModelProvider. NOTE: The associated Provider and Operations will be created
- * during M5
- * </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 IEARComponentImportDataModelProperties extends IJ2EEComponentImportDataModelProperties {
-
- /**
- * Optional, type IPath default is ear location
- */
- public static final String NESTED_MODULE_ROOT = "IEnterpriseApplicationImportDataModelProperties.NESTED_MODULE_ROOT"; //$NON-NLS-1$
-
- /**
- * Optional, A List containing utililty jars. This list should consist of the CommonArchive
- * Archives of all the Utility Jars that should be extracted into projects.
- */
- public static final String UTILITY_LIST = "IEnterpriseApplicationImportDataModelProperties.UTILITY_LIST"; //$NON-NLS-1$
- /**
- * Optional, A List containing modules to be imported list;
- */
- public static final String SELECTED_MODELS_LIST = "IEnterpriseApplicationImportDataModelProperties.SELECTED_MODELS_LIST"; //$NON-NLS-1$
- /**
- * Optional, A List containing ejb client jars associated with any ejb components which are to
- * be imported.
- */
- public static final String EJB_CLIENT_LIST = "IEnterpriseApplicationImportDataModelProperties.EJB_CLIENT_LIST"; //$NON-NLS-1$
-
- /**
- * Optional. This is a list of data models. This list must contain all non-utilty projects in
- * the ear to be imported
- */
- public static final String MODULE_MODELS_LIST = "IEnterpriseApplicationImportDataModelProperties.MODULE_MODELS_LIST"; //$NON-NLS-1$
-
- /**
- * Optional. This is a list of data models. This list must contain all utility jars selected to
- * be imported
- */
- public static final String UTILITY_MODELS_LIST = "IEnterpriseApplicationImportDataModelProperties.UTILITY_MODELS_LIST"; //$NON-NLS-1$
-
- /**
- * This is an unsettable property which will return all the project DataModels.
- */
- public static final String ALL_PROJECT_MODELS_LIST = "IEnterpriseApplicationImportDataModelProperties.ALL_PROJECT_MODELS_LIST"; //$NON-NLS-1$
-
- /**
- * This is an unsettable property which will return .
- */
- public static final String UNHANDLED_PROJECT_MODELS_LIST = "IEnterpriseApplicationImportDataModelProperties.UNHANDLED_PROJECT_MODELS_LIST"; //$NON-NLS-1$
-
- /**
- * This is an unsettable property which will return .
- */
- public static final String HANDLED_PROJECT_MODELS_LIST = "IEnterpriseApplicationImportDataModelProperties.HANDLED_PROJECT_MODELS_LIST"; //$NON-NLS-1$
-
-
-}
diff --git a/plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/datamodel/properties/IJ2EEComponentCreationDataModelProperties.java b/plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/datamodel/properties/IJ2EEComponentCreationDataModelProperties.java
deleted file mode 100644
index 3771f1538..000000000
--- a/plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/datamodel/properties/IJ2EEComponentCreationDataModelProperties.java
+++ /dev/null
@@ -1,105 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2005, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jst.j2ee.datamodel.properties;
-
-import org.eclipse.jst.j2ee.project.facet.IJ2EEFacetProjectCreationDataModelProperties;
-import org.eclipse.wst.common.frameworks.internal.DoNotUseMeThisWillBeDeletedPost15;
-
-
-
-/**
- * <p>
- * IJ2EEComponentCreationDataModelProperties provides properties to the
- * J2EEComponentCreationDataModelProvider as well as all extending interfaces extending
- * IJ2EEComponentCreationDataModelProperties
- * @see org.eclipse.jst.j2ee.internal.archive.operations.J2EEComponentCreationDataModelProvider
- * </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
- * @see org.eclipse.jst.j2ee.datamodel.properties.IJavaComponentCreationDataModelProperties
- * @plannedfor 1.0
- */
-
-/**
- * This has been slated for removal post WTP 1.5. Do not use this class/interface
- *
- * @deprecated
- *
- * @see IJ2EEFacetProjectCreationDataModelProperties
- */
-public interface IJ2EEComponentCreationDataModelProperties extends IJavaComponentCreationDataModelProperties, DoNotUseMeThisWillBeDeletedPost15{
-
- /**
- * Required, type Boolean, the default value is <code>Boolean.FALSE</code>.
- */
- public static final String ADD_TO_EAR = "IJ2EEComponentCreationDataModelProperties.ADD_TO_EAR"; //$NON-NLS-1$
-
- public static final String MODULE_URI = "IJ2EEComponentCreationDataModelProperties.MODULE_URI"; //$NON-NLS-1$
- /**
- * type String, this property needs to be set if the value of the property ADD_TO_EAR is set to <code>Boolean.TRUE</code>
- */
- public static final String EAR_COMPONENT_NAME = "IJ2EEComponentCreationDataModelProperties.EAR_COMPONENT_NAME"; //$NON-NLS-1$
- /**
- * type String, this property needs to be set if the value of the property ADD_TO_EAR is set to <code>Boolean.TRUE</code>
- */
- public static final String EAR_COMPONENT_DEPLOY_NAME = "IJ2EEComponentCreationDataModelProperties.EAR_COMPONENT_DEPLOY_NAME"; //$NON-NLS-1$
- /**
- * type ComponentHandle, this property needs to be set if the value of the property ADD_TO_EAR is set to <code>Boolean.TRUE</code>. Represents
- * a handle to the EAR
- */
- public static final String EAR_COMPONENT_PROJECT = "IJ2EEComponentCreationDataModelProperties.EAR_COMPONENT_PROJECT"; //$NON-NLS-1$
-
- /**
- * type Boolean; the default value is <code>Boolean.TRUE</code>, this is UI only property
- */
- public static final String UI_SHOW_EAR_SECTION = "IJ2EEComponentCreationDataModelProperties.UI_SHOW_EAR_SECTION"; //$NON-NLS-1$
-
- /**
- * Optional, type String
- * String indicates the name of the the folder where the deployment descriptor exists.
- * Each J2EE componenr provider will default the Deployment descriptor folder.
- *
- */
-
- public static final String DD_FOLDER = "IJ2EEComponentCreationDataModelProperties.DD_FOLDER"; //$NON-NLS-1$
-
- /**
- * Required, type Integer. The user defined version of the component.
- */
- public static final String COMPONENT_VERSION = "IComponentCreationDataModelProperties.COMPONENT_VERSION"; //$NON-NLS-1$
-
- /**
- * type Integer
- */
- public static final String VALID_COMPONENT_VERSIONS_FOR_PROJECT_RUNTIME = "IComponentCreationDataModelProperties.VALID_COMPONENT_VERSIONS_FOR_PROJECT_RUNTIME"; //$NON-NLS-1$
- /**
- * type AddComponentToEnterpriseApplicationDataModel
- */
- public static final String NESTED_ADD_COMPONENT_TO_EAR_DM = "IComponentCreationDataModelProperties.NESTED_ADD_COMPONENT_TO_EAR_DM"; //$NON-NLS-1$
- /**
- * type EARComponentCreationDataModel
- */
- public static final String NESTED_EAR_COMPONENT_CREATION_DM = "IComponentCreationDataModelProperties.NESTED_EAR_COMPONENT_CREATION_DM"; //$NON-NLS-1$
- /**
- * type UpdateManifestDataModel
- */
- public static final String NESTED_UPDATE_MANIFEST_DM = "IComponentCreationDataModelProperties.NESTED_UPDATE_MANIFEST_DM"; //$NON-NLS-1$
- /**
- * type ClassPathSelection
- */
- public static final String CLASSPATH_SELECTION = "IComponentCreationDataModelProperties.CLASSPATH_SELECTION"; //$NON-NLS-1$
-
-}
diff --git a/plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/datamodel/properties/IJ2EEComponentExportDataModelProperties.java b/plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/datamodel/properties/IJ2EEComponentExportDataModelProperties.java
deleted file mode 100644
index d8663bf1e..000000000
--- a/plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/datamodel/properties/IJ2EEComponentExportDataModelProperties.java
+++ /dev/null
@@ -1,94 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jst.j2ee.datamodel.properties;
-
-import org.eclipse.jst.j2ee.archive.IArchiveExportParticipant;
-import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
-import org.eclipse.wst.common.frameworks.datamodel.IDataModelProperties;
-/**
- * <p>
- * IJ2EEComponentExportDataModelProperties provides properties to the IDataModel associated with the
- * J2EEComponentExportDataModelProvider as well as all extending interfaces extending
- * IJ2EEComponentExportDataModelProperties specifically all J2EE component specific exports.
- * NOTE: The associated Provider and Operations will be created during M5
- * </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 IJ2EEComponentExportDataModelProperties extends IDataModelProperties {
-
- /**
- * Required, type String. The user defined name of the project to be exported.
- */
- public static final String PROJECT_NAME = "IJ2EEComponentExportDataModelProperties.PROJECT_NAME"; //$NON-NLS-1$
-
- /**
- * Required, type IPath. The user defined export location including fully qualified Path and archive file
- * to be created name.
- */
- public static final String ARCHIVE_DESTINATION = "IJ2EEComponentExportDataModelProperties.ARCHIVE_DESTINATION"; //$NON-NLS-1$
- /**
- * Optional, type Boolean. If <code>Boolean.TRUE</code> source and class fields will both be archived and exported.
- * Otherwise if <code>Boolean.FALSE</code> only output files are exported.
- */
- public static final String EXPORT_SOURCE_FILES = "IJ2EEComponentExportDataModelProperties.EXPORT_SOURCE_FILES"; //$NON-NLS-1$
- /**
- * Optional, type Boolean. If <code>Boolean.TRUE</code> and an archive with the same name exists in the
- * ARCHIVE_DESTINATION, the existing will be overwritten by the archive to be created. Otherwise,
- * if <code>Boolean.FALSE</code> a error message will be show indicating name collisions.
- */
- public static final String OVERWRITE_EXISTING = "IJ2EEComponentExportDataModelProperties.OVERWRITE_EXISTING"; //$NON-NLS-1$
- /**
- * Optional, type boolean, Default <code>Boolean.TRUE</code> indicating a Build runs before exporting thus output files are created
- * and archived. However, if <code>Boolean.FALSE</code> the component is archived as is.
- */
- public static final String RUN_BUILD = "IJ2EEComponentExportDataModelProperties.RUN_BUILD"; //$NON-NLS-1$}
-
- public static final String COMPONENT = "IJ2EEComponentExportDataModelProperties.COMPONENT"; //$NON-NLS-1$
-
- /**
- * @since 3.0
- */
-
- public static final String OPTIMIZE_FOR_SPECIFIC_RUNTIME = "IJ2EEComponentExportDataModelProperties.OPTIMIZE_FOR_SPECIFIC_RUNTIME";
-
- /**
- * @since 3.0
- */
-
- public static final String RUNTIME = "IJ2EEComponentExportDataModelProperties.RUNTIME"; //$NON-NLS-1
-
- /**
- * @since 3.0
- */
-
- public static final String RUNTIME_SPECIFIC_PARTICIPANTS
- = "IJ2EEComponentExportDataModelProperties.RUNTIME_SPECIFIC_PARTICIPANTS"; //$NON-NLS-1
-
- /**
- * @since 3.0
- */
-
- interface IArchiveExportParticipantData
- {
- String getId();
- IArchiveExportParticipant getParticipant();
- IDataModel getDataModel();
- }
-
-}
diff --git a/plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/datamodel/properties/IJ2EEComponentImportDataModelProperties.java b/plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/datamodel/properties/IJ2EEComponentImportDataModelProperties.java
deleted file mode 100644
index 645eeea06..000000000
--- a/plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/datamodel/properties/IJ2EEComponentImportDataModelProperties.java
+++ /dev/null
@@ -1,90 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jst.j2ee.datamodel.properties;
-
-import org.eclipse.wst.common.frameworks.datamodel.IDataModelProperties;
-
-/**
- * <p>
- * IJ2EEComponentImportDataModelProperties provides properties to the IDataModel associated with the
- * J2EEComponentImportDataModelProvider as well as all extending interfaces extending
- * IJ2EEComponentImportDataModelProperties specifically all J2EE component specific imports.
- *
- * NOTE: The associated Provider and Operations will be created during M5
- * </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 IJ2EEComponentImportDataModelProperties extends IDataModelProperties {
-
- /**
- * Required, type String, name of the file to be imported.
- */
- public static final String FILE_NAME = "IJ2EEArtifactImportDataModelProperties.FILE_NAME"; //$NON-NLS-1$
-
- /**
- * Optional, type Archive, used when a file is available as an object rather than a url (i.e.
- * using the FILE_NAME property will not work).
- * @deprecated use {@link #ARCHIVE_WRAPPER}
- */
- public static final String FILE = "IJ2EEArtifactImportDataModelProperties.FILE"; //$NON-NLS-1$
- /**
- * Required, type String, name of the Project which the Archive will be imported.
- */
- public static final String PROJECT_NAME = "IJ2EEComponentImportDataModelProperties.PROJECT_NAME"; //$NON-NLS-1$
-
- /**
- * Unsettable property used to retreive the component after the operation has executed.
- */
- public static final String COMPONENT = "IJ2EEComponentImportDataModelProperties.COMPONENT"; //$NON-NLS-1$
-
- /**
- * Unsettable property used for archive switch.
- */
- public static final String ARCHIVE_WRAPPER = "IJ2EEComponentImportDataModelProperties.ARCHIVE_WRAPPER"; //$NON-NLS-1$
-
-
- /**
- * Optional, type IOverwriteHandler. Defines a IOverwriteHandler for the component in the
- * workspace if an existing component should be overwritten (OVERWRITE_COMPONENT).
- */
- public static final String OVERWRITE_HANDLER = "IJ2EEArtifactImportDataModelProperties.OVERWRITE_HANDLER"; //$NON-NLS-1$
-
- /**
- * Optional, type SaveFilter, default is null
- * @deprecated
- */
- public static final String SAVE_FILTER = "IJ2EEArtifactImportDataModelProperties.SAVE_FILTER"; //$NON-NLS-1$
-
- /**
- * Optional, type Boolean - Should the archive be closed on dispose?
- */
- public static final String CLOSE_ARCHIVE_ON_DISPOSE = "IJ2EEArtifactImportDataModelProperties.closeArchiveOnDispose"; //$NON-NLS-1$
- /**
- * Optional - type List, populated list of files previously selected. This can be used for GUIs
- * which wish to show preivous selections.
- */
- public static final String FILE_SELECTION_HISTORY = "IJ2EEArtifactImportDataModelProperties.FILE_SELECTION_HISTORY"; //$NON-NLS-1$
- /**
- * Optional, type IDataModel. This IDataModel will have a J2EE specific component creation
- * provider associated with it.
- */
- public static final String NESTED_MODEL_J2EE_COMPONENT_CREATION = "IJ2EEArtifactImportDataModelProperties.NESTED_MODEL_J2EE_COMPONENT_CREATION"; //$NON-NLS-1$
-
-}
diff --git a/plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/datamodel/properties/IJ2EEModuleImportDataModelProperties.java b/plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/datamodel/properties/IJ2EEModuleImportDataModelProperties.java
deleted file mode 100644
index 25c1ca9e2..000000000
--- a/plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/datamodel/properties/IJ2EEModuleImportDataModelProperties.java
+++ /dev/null
@@ -1,52 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jst.j2ee.datamodel.properties;
-
-import org.eclipse.wst.common.frameworks.internal.DoNotUseMeThisWillBeDeletedPost15;
-
-
-/**
- * <p>
- * IJ2EEModuleImportDataModelProperties provides properties to the IDataModel associated with the
- * J2EEModuleImportDataModelProvider as well as all extending interfaces extending
- * IJ2EEModuleImportDataModelProperties specifically all J2EE component specific imports.
- *
- * NOTE: The associated Provider and Operations will be created during M5
- * </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 IJ2EEModuleImportDataModelProperties extends IJ2EEComponentImportDataModelProperties {
-
- /**
- * @deprecated use the {@link IJ2EEFacetProjectCreationDataModelProperties#EAR_PROJECT_NAME} on the nested project creation model
- *
- * @see DoNotUseMeThisWillBeDeletedPost15
- */
- public static final String EAR_COMPONENT_NAME = "IJ2EEModuleImportDataModelProperties.EAR_COMPONENT_NAME"; //$NON-NLS-1$
- /**
- * @deprecated use the {@link IJ2EEFacetProjectCreationDataModelProperties#ADD_TO_EAR} on the nested project creation model
- *
- * @see DoNotUseMeThisWillBeDeletedPost15
- */
- public static final String ADD_TO_EAR = "IJ2EEModuleImportDataModelProperties.ADD_TO_EAR"; //$NON-NLS-1$
-
- public static final String EXTENDED_IMPORT_FACTORY = "IJ2EEModuleImportDataModelProperties.EXTENDED_IMPORT_FACTORY"; //$NON-NLS-1$
-
-
-}
diff --git a/plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/datamodel/properties/IJ2EEUtilityJarListImportDataModelProperties.java b/plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/datamodel/properties/IJ2EEUtilityJarListImportDataModelProperties.java
deleted file mode 100644
index d60cf433f..000000000
--- a/plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/datamodel/properties/IJ2EEUtilityJarListImportDataModelProperties.java
+++ /dev/null
@@ -1,72 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jst.j2ee.datamodel.properties;
-
-import org.eclipse.wst.common.frameworks.datamodel.IDataModelProperties;
-
-public interface IJ2EEUtilityJarListImportDataModelProperties extends IDataModelProperties{
-
- /**
- * Required. The EAR Project to which Utility Jars should be added.
- */
- public static final String EAR_PROJECT_NAME = IJavaUtilityJarImportDataModelProperties.EAR_PROJECT_NAME;
-
- /**
- * Optional. Boolean Property. True indicates to create a Project Can be used with
- * LINK_IMPORT="true|"false" or BINARY_IMPORT="true|false" The default value is true.
- */
- public static final String CREATE_PROJECT = "J2EEUtilityJarListImportDataModel.CREATE_PROJECT"; //$NON-NLS-1$
-
- /**
- * Optional. Boolean property. True indicates to import the jar as a linked project Can be
- * specified with BINARY_IMPORT="true|false" and/or CREATE_PROJECT="true|false" The default
- * value is false.
- */
- public static final String LINK_IMPORT = "J2EEUtilityJarListImportDataModel.LINK_IMPORT"; //$NON-NLS-1$
-
- /**
- * Optional. Boolean Property. True indicates to create a Project Can be used with
- * LINK_IMPORT="true|"false" or BINARY_IMPORT="true|false" The default value is true.
- */
- public static final String CREATE_LINKED_PROJECT = "J2EEUtilityJarListImportDataModel.CREATE_LINKED_PROJECT"; //$NON-NLS-1$
-
- /**
- * Optional. Boolean property. True indicates to import the jar as a linked project Can be
- * specified with BINARY_IMPORT="true|false" and/or CREATE_PROJECT="true|false" The default
- * value is false.
- */
- public static final String COPY = "J2EEUtilityJarListImportDataModel.COPY"; //$NON-NLS-1$
-
- /**
- * Optional. Boolean property. True indicates to import the jar as a binary project Can be
- * specified with LINK_IMPORT="true|false" and/or CREATE_PROJECT="true|false" The default value
- * is false.
- */
- public static final String BINARY_IMPORT = "J2EEUtilityJarListImportDataModel.BINARY_IMPORT"; //$NON-NLS-1$
-
- /**
- * Required. A java.util.List of fully qualified file names for each Utility Jar that should be
- * imported.
- */
- public static final String UTILITY_JAR_LIST = "J2EEUtilityJarListImportDataModel.UTILITY_JAR_LIST"; //$NON-NLS-1$
-
- public static final String AVAILABLE_JARS_DIRECTORY = "J2EEUtilityJarListImportDataModel.AVAILABLE_JARS_DIRECTORY"; //$NON-NLS-1$
-
- public static final String PROJECT_ROOT = "J2EEUtilityJarListImportDataModel.PROJECT_ROOT"; //$NON-NLS-1$
-
- public static final String OVERRIDE_PROJECT_ROOT = "J2EEUtilityJarListImportDataModel.OVERRIDE_PROJECT_ROOT"; //$NON-NLS-1$
-
- public static final String OVERWRITE_IF_NECESSARY = "J2EEUtilityJarListImportDataModel.OVERWRITE_IF_NECESSARY"; //$NON-NLS-1$
-
- public static final String CREATE_LINKED_PATH_VARIABLE = "J2EEUtilityJarListImportDataModel.CREATE_LINKED_PATH"; //$NON-NLS-1$
-
- public static final String LINKED_PATH_VARIABLE = "J2EEUtilityJarListImportDataModel.LINKED_PATH_VARIABLE"; //$NON-NLS-1$
-}
diff --git a/plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/datamodel/properties/IJavaComponentCreationDataModelProperties.java b/plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/datamodel/properties/IJavaComponentCreationDataModelProperties.java
deleted file mode 100644
index dd037fd8d..000000000
--- a/plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/datamodel/properties/IJavaComponentCreationDataModelProperties.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jst.j2ee.datamodel.properties;
-
-import org.eclipse.jst.common.project.facet.IJavaFacetInstallDataModelProperties;
-import org.eclipse.jst.j2ee.project.datamodel.properties.IJ2EEProjectServerTargetDataModelProperties;
-import org.eclipse.wst.common.componentcore.datamodel.properties.IComponentCreationDataModelProperties;
-import org.eclipse.wst.common.frameworks.internal.DoNotUseMeThisWillBeDeletedPost15;
-
-/**
- * <p>
- * IJavaComponentCreationDataModelProperties provides properties to the
- * JavaComponentCreationDataModelProvider as well as all extending interfaces extending
- * IJavaComponentCreationDataModelProperties specifically, but not limited to all J2EE component related
- * creation.
- * @see org.eclipse.jst.j2ee.internal.archive.operations.JavaComponentCreationDataModelProvider
- * </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
- */
-
-/**
- * This has been slated for removal post WTP 1.5. Do not use this class/interface
- *
- * @deprecated
- *
- * @see IJavaFacetInstallDataModelProperties
- */
-public interface IJavaComponentCreationDataModelProperties extends IComponentCreationDataModelProperties, DoNotUseMeThisWillBeDeletedPost15 {
- /**
- * Optional, type String
- * String indicating the name of the the root Java Source Folder in the component being created.
- * The DataModelProvider will default the Java Source Folder to the Component folder.
- *
- */
- public static final String JAVASOURCE_FOLDER = "IJavaComponentCreationDataModelProperties.JAVASOURCE_FOLDER";
- /**
- * Optional, type String
- * String indicating the name of the the root folder containing the Manifest.MF in the component being created.
- * The DataModelProvider will default the Manifest folder to the Component folder/META-INF.
- */
- public static final String MANIFEST_FOLDER = "IJavaComponentCreationDataModelProperties.MANIFEST_FOLDER";
-
- /**
- * Required, type String. This is used to specify the server target.
- *
- */
- public static final String RUNTIME_TARGET_ID = IJ2EEProjectServerTargetDataModelProperties.RUNTIME_TARGET_ID;
-}
diff --git a/plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/datamodel/properties/IJavaUtilityJarImportDataModelProperties.java b/plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/datamodel/properties/IJavaUtilityJarImportDataModelProperties.java
deleted file mode 100644
index a8570f94e..000000000
--- a/plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/datamodel/properties/IJavaUtilityJarImportDataModelProperties.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jst.j2ee.datamodel.properties;
-
-/**
- * <p>
- * IJavaUtilityJarImportDataModelProperties provides properties to the IDataModel associated with the
- * JavaUtilityJarImportDataModelProvider.
- *
- * NOTE: The associated Provider and Operations will be created during M5
- * </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 IJavaUtilityJarImportDataModelProperties extends IJ2EEComponentImportDataModelProperties {
- /**
- * Required, type String. Represents the name of the Project containing the EAR component, which the utility
- * jar will be added.
- */
- public static final String EAR_PROJECT_NAME = "J2EEUtilityJarImportDataModel.EAR_PROJECT_NAME"; //$NON-NLS-1$
-
-}
diff --git a/plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/datamodel/properties/package.xml b/plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/datamodel/properties/package.xml
deleted file mode 100644
index 3bf43aad3..000000000
--- a/plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/datamodel/properties/package.xml
+++ /dev/null
@@ -1,19 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<html>
- <head>
- <meta
- name="root"
- content="../../../../../../../" />
- <title>j2ee module common data model api overview</title>
- </head>
-
- <body>
- <abstract>
- This package includes the api the common create, import and export j2ee modules. It also includes the enterprise application and applciation client creation, import and export api. The interfaces in this package
- define the properties that can be set on the j2ee modules data models that are used to run the data model operations and drive the wizard data, validation.
- </abstract>
-
- <a href="#top">top</a>
- </body>
-</html>
- \ No newline at end of file
diff --git a/plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/internal/archive/AppClientArchiveTypeHandler.java b/plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/internal/archive/AppClientArchiveTypeHandler.java
deleted file mode 100644
index e839d8025..000000000
--- a/plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/internal/archive/AppClientArchiveTypeHandler.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2005, 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jst.j2ee.internal.archive;
-
-import org.eclipse.core.runtime.Path;
-import org.eclipse.jst.j2ee.internal.J2EEConstants;
-import org.eclipse.jst.jee.archive.IArchive;
-import org.eclipse.jst.jee.archive.IArchiveHandler;
-
-public class AppClientArchiveTypeHandler implements IArchiveHandler {
-
- public boolean handlesArchive(IArchive archive) {
- if (archive.getLoadAdapter() instanceof AppClientComponentArchiveLoadAdapter) {
- return true;
- } else if (archive.containsArchiveResource(new Path(J2EEConstants.APP_CLIENT_DD_URI))) {
- return true;
- } else {
- // TODO handle the no DD case
- return false;
- }
- }
-
-}
diff --git a/plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/internal/archive/AppClientComponentArchiveLoadAdapter.java b/plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/internal/archive/AppClientComponentArchiveLoadAdapter.java
deleted file mode 100644
index 56387a5f7..000000000
--- a/plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/internal/archive/AppClientComponentArchiveLoadAdapter.java
+++ /dev/null
@@ -1,29 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jst.j2ee.internal.archive;
-
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.Path;
-import org.eclipse.jst.j2ee.internal.J2EEConstants;
-import org.eclipse.wst.common.componentcore.resources.IVirtualComponent;
-
-public class AppClientComponentArchiveLoadAdapter extends ComponentArchiveLoadAdapter {
-
- public AppClientComponentArchiveLoadAdapter(IVirtualComponent vComponent) {
- super(vComponent);
- }
-
- @Override
- protected IPath getDefaultModelObjectPath() {
- return new Path(J2EEConstants.APP_CLIENT_DD_URI);
- }
-
-}
diff --git a/plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/internal/archive/AppClientComponentArchiveSaveAdapter.java b/plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/internal/archive/AppClientComponentArchiveSaveAdapter.java
deleted file mode 100644
index 632669faa..000000000
--- a/plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/internal/archive/AppClientComponentArchiveSaveAdapter.java
+++ /dev/null
@@ -1,21 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jst.j2ee.internal.archive;
-
-import org.eclipse.wst.common.componentcore.resources.IVirtualComponent;
-
-public class AppClientComponentArchiveSaveAdapter extends J2EEComponentArchiveSaveAdapter {
-
- public AppClientComponentArchiveSaveAdapter(IVirtualComponent vComponent) {
- super(vComponent);
- }
-
-}
diff --git a/plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/internal/archive/ArchiveExportParticipantsExtensionPoint$PluginUtil.properties b/plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/internal/archive/ArchiveExportParticipantsExtensionPoint$PluginUtil.properties
deleted file mode 100644
index 24734903a..000000000
--- a/plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/internal/archive/ArchiveExportParticipantsExtensionPoint$PluginUtil.properties
+++ /dev/null
@@ -1,4 +0,0 @@
-missingAttribute = Extension element <{2}> is missing required attribute "{3}". [plugin: "{0}"; extension point: "{1}"]
-missingElement = Extension element <{2}> is missing required child element <{3}>. [plugin: "{0}"; extension point: "{1}"]
-failedToCreate = Failed to instantiate class {0}.
-doesNotImplement = Class {0} does not implement {1} interface.
diff --git a/plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/internal/archive/ArchiveExportParticipantsExtensionPoint.java b/plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/internal/archive/ArchiveExportParticipantsExtensionPoint.java
deleted file mode 100644
index 7075a1e20..000000000
--- a/plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/internal/archive/ArchiveExportParticipantsExtensionPoint.java
+++ /dev/null
@@ -1,436 +0,0 @@
-/******************************************************************************
- * Copyright (c) 2005, 2007 BEA Systems, Inc.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Konstantin Komissarchik
- ******************************************************************************/
-
-package org.eclipse.jst.j2ee.internal.archive;
-
-import static org.eclipse.jst.j2ee.internal.archive.ArchiveExportParticipantsExtensionPoint.PluginUtil.*;
-import static org.eclipse.jst.j2ee.internal.plugin.J2EEPlugin.*;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.List;
-
-import org.eclipse.core.expressions.EvaluationContext;
-import org.eclipse.core.expressions.EvaluationResult;
-import org.eclipse.core.expressions.Expression;
-import org.eclipse.core.expressions.ExpressionConverter;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IConfigurationElement;
-import org.eclipse.core.runtime.IExtension;
-import org.eclipse.core.runtime.IExtensionPoint;
-import org.eclipse.core.runtime.IExtensionRegistry;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.jst.j2ee.archive.IArchiveExportParticipant;
-import org.eclipse.jst.j2ee.internal.archive.ArchiveExportParticipantsExtensionPoint.PluginUtil.InvalidExtensionException;
-import org.eclipse.osgi.util.NLS;
-import org.eclipse.wst.common.project.facet.core.runtime.IRuntime;
-import org.eclipse.wst.common.project.facet.core.runtime.IRuntimeComponent;
-import org.eclipse.wst.common.project.facet.core.runtime.IRuntimeComponentType;
-import org.eclipse.wst.common.project.facet.core.runtime.IRuntimeComponentVersion;
-import org.eclipse.wst.common.project.facet.core.runtime.RuntimeManager;
-import org.osgi.framework.Bundle;
-
-/**
- * Contains the logic for processing the <code>org.eclipse.jst.j2ee.archiveExportParticipants</code>
- * extension point.
- *
- * @author <a href="mailto:kosta@bea.com">Konstantin Komissarchik</a>
- */
-
-public final class ArchiveExportParticipantsExtensionPoint
-{
- public static final String EXTENSION_POINT_ID = "archiveExportParticipants"; //$NON-NLS-1$
-
- private static final String EL_PARTICIPANT = "participant"; //$NON-NLS-1$
- private static final String EL_RUNTIME_COMPONENT = "runtime-component"; //$NON-NLS-1$
- private static final String EL_FACTORY = "factory"; //$NON-NLS-1$
- private static final String EL_ENABLEMENT = "enablement";
- private static final String ATTR_ID = "id"; //$NON-NLS-1$
- private static final String ATTR_TYPE = "type"; //$NON-NLS-1$
- private static final String ATTR_VERSION = "version"; //$NON-NLS-1$
- private static final String ATTR_CLASS = "class"; //$NON-NLS-1$
-
- private static List<ParticipantInfo> extensions = null;
-
- public static class ParticipantInfo
- {
- private String id;
- private String pluginId = null;
- private String className = null;
- private IRuntimeComponentType runtimeComponentType = null;
- private String runtimeComponentVersionExpr = null;
- private Expression enablementCondition = null;
-
- public String getId()
- {
- return this.id;
- }
-
- public IArchiveExportParticipant loadParticipant()
- {
- try
- {
- return instantiate( this.pluginId, this.className, IArchiveExportParticipant.class );
- }
- catch( CoreException e )
- {
- log( e.getStatus() );
- return null;
- }
- }
- }
-
- public static List<ParticipantInfo> getExtensions( final IProject project,
- final IRuntime runtime )
- {
- readExtensions();
-
- final List<ParticipantInfo> result = new ArrayList<ParticipantInfo>();
-
- for( ParticipantInfo partInfo : extensions )
- {
- boolean match = false;
-
- for( IRuntimeComponent rc : runtime.getRuntimeComponents() )
- {
- final IRuntimeComponentType rct = rc.getRuntimeComponentType();
-
- if( rct == partInfo.runtimeComponentType )
- {
- final IRuntimeComponentVersion rcv = rc.getRuntimeComponentVersion();
-
- try
- {
- if( rct.getVersions( partInfo.runtimeComponentVersionExpr ).contains( rcv ) )
- {
- match = true;
- break;
- }
- }
- catch( CoreException e )
- {
- logError( -1, e.getMessage(), e );
- }
- }
- }
-
- if( match && partInfo.enablementCondition != null )
- {
- final EvaluationContext evalContext = new EvaluationContext( null, project );
- evalContext.setAllowPluginActivation( true );
-
- try
- {
- final EvaluationResult evalResult
- = partInfo.enablementCondition.evaluate( evalContext );
-
- if( evalResult != EvaluationResult.TRUE )
- {
- match = false;
- }
- }
- catch( CoreException e )
- {
- logError( -1, e.getMessage(), e );
- }
- }
-
- if( match )
- {
- result.add( partInfo );
- }
- }
-
- return Collections.unmodifiableList( result );
- }
-
- private static synchronized void readExtensions()
- {
- if( extensions != null )
- {
- return;
- }
-
- extensions = new ArrayList<ParticipantInfo>();
-
- for( IConfigurationElement element
- : getTopLevelElements( findExtensions( PLUGIN_ID, EXTENSION_POINT_ID ) ) )
- {
- if( element.getName().equals( EL_PARTICIPANT ) )
- {
- try
- {
- readExtension( element );
- }
- catch( InvalidExtensionException e )
- {
- // Continue. The problem has been reported to the user via the log.
- }
- }
- }
- }
-
- private static void readExtension( final IConfigurationElement config )
-
- throws InvalidExtensionException
-
- {
- final ParticipantInfo info = new ParticipantInfo();
-
- info.pluginId = config.getContributor().getName();
- info.id = info.pluginId + "." + findRequiredAttribute( config, ATTR_ID );
-
- final IConfigurationElement elFactory = findRequiredElement( config, EL_FACTORY );
- info.className = findRequiredAttribute( elFactory, ATTR_CLASS );
-
- final IConfigurationElement elRuntimeComponent
- = findRequiredElement( config, EL_RUNTIME_COMPONENT );
-
- final String rcTypeString = findRequiredAttribute( elRuntimeComponent, ATTR_TYPE );
-
- if( ! RuntimeManager.isRuntimeComponentTypeDefined( rcTypeString ) )
- {
- // TODO: Log the problem
- throw new InvalidExtensionException();
- }
-
- info.runtimeComponentType = RuntimeManager.getRuntimeComponentType( rcTypeString );
- info.runtimeComponentVersionExpr = elRuntimeComponent.getAttribute( ATTR_VERSION );
-
- final IConfigurationElement elEnablement = findOptionalElement( config, EL_ENABLEMENT );
-
- try
- {
- info.enablementCondition = ExpressionConverter.getDefault().perform( elEnablement );
- }
- catch( CoreException e )
- {
- logError( -1, e.getMessage(), e );
- throw new InvalidExtensionException();
- }
-
- extensions.add( info );
- }
-
- /**
- * Utility methods that are helpful for implementing extension points.
- *
- * @author <a href="mailto:kosta@bea.com">Konstantin Komissarchik</a>
- */
-
- public static final class PluginUtil
- {
- public static final class InvalidExtensionException
-
- extends Exception
-
- {
- private static final long serialVersionUID = 1L;
- }
-
- private PluginUtil() {}
-
- public static Collection<IExtension> findExtensions( final String pluginId,
- final String extensionPointId )
- {
- final IExtensionRegistry registry = Platform.getExtensionRegistry();
- final IExtensionPoint point = registry.getExtensionPoint( pluginId, extensionPointId );
-
- if( point == null )
- {
- throw new RuntimeException();
- }
-
- final List<IExtension> extensions = new ArrayList<IExtension>();
-
- for( IExtension extension : point.getExtensions() )
- {
- extensions.add( extension );
- }
-
- return extensions;
- }
-
- public static Collection<IConfigurationElement> getTopLevelElements( final Collection<IExtension> extensions )
- {
- final List<IConfigurationElement> elements = new ArrayList<IConfigurationElement>();
-
- for( IExtension extension : extensions )
- {
- for( IConfigurationElement element : extension.getConfigurationElements() )
- {
- elements.add( element );
- }
- }
-
- return elements;
- }
-
- public static void reportMissingAttribute( final IConfigurationElement el,
- final String attribute )
- {
- final String pluginId = el.getContributor().getName();
- final String extPointId = el.getDeclaringExtension().getExtensionPointUniqueIdentifier();
-
- final String msg
- = Resources.bind( Resources.missingAttribute, pluginId, extPointId, el.getName(),
- attribute );
-
- log( createErrorStatus( -1, msg, null ) );
- }
-
- public static void reportMissingElement( final IConfigurationElement el,
- final String element )
- {
- final String pluginId = el.getContributor().getName();
- final String extPointId = el.getDeclaringExtension().getExtensionPointUniqueIdentifier();
-
- final String msg
- = Resources.bind( Resources.missingElement, pluginId, extPointId, el.getName(),
- element );
-
- log( createErrorStatus( -1, msg, null ) );
- }
-
- public static String findRequiredAttribute( final IConfigurationElement el,
- final String attribute )
-
- throws InvalidExtensionException
-
- {
- final String val = el.getAttribute( attribute );
-
- if( val == null )
- {
- reportMissingAttribute( el, attribute );
- throw new InvalidExtensionException();
- }
-
- return val;
- }
-
- public static IConfigurationElement findRequiredElement( final IConfigurationElement el,
- final String childElement )
-
- throws InvalidExtensionException
-
- {
- final IConfigurationElement[] children = el.getChildren( childElement );
-
- if( children.length == 0 )
- {
- reportMissingElement( el, childElement );
- throw new InvalidExtensionException();
- }
-
- return children[ 0 ];
- }
-
- public static IConfigurationElement findOptionalElement( final IConfigurationElement el,
- final String childElement )
- {
- final IConfigurationElement[] children = el.getChildren( childElement );
-
- if( children.length == 0 )
- {
- return null;
- }
- else
- {
- return children[ 0 ];
- }
- }
-
- public static String getElementValue( final IConfigurationElement el,
- final String defaultValue )
- {
- if( el != null )
- {
- String text = el.getValue();
-
- if( text != null )
- {
- text = text.trim();
-
- if( text.length() > 0 )
- {
- return text;
- }
- }
- }
-
- return defaultValue;
- }
-
- @SuppressWarnings( "unchecked" )
- public static <T> T instantiate( final String pluginId,
- final String clname,
- final Class<T> interfc )
-
- throws CoreException
-
- {
- final Bundle bundle = Platform.getBundle( pluginId );
-
- final Object obj;
-
- try
- {
- final Class cl = bundle.loadClass( clname );
- obj = cl.newInstance();
- }
- catch( Exception e )
- {
- final String msg = NLS.bind( Resources.failedToCreate, clname );
- throw new CoreException( createErrorStatus( -1, msg, e ) );
- }
-
- if( ! interfc.isAssignableFrom( obj.getClass() ) )
- {
- final String msg
- = NLS.bind( Resources.doesNotImplement, clname, interfc.getClass().getName() );
-
- throw new CoreException( createErrorStatus( -1, msg, null ) );
- }
-
- return (T) obj;
- }
-
- private static final class Resources
-
- extends NLS
-
- {
- public static String missingAttribute;
- public static String missingElement;
- public static String failedToCreate;
- public static String doesNotImplement;
-
- static
- {
- initializeMessages( PluginUtil.class.getName(), Resources.class );
- }
-
- public static String bind( final String message,
- final String arg1,
- final String arg2,
- final String arg3,
- final String arg4 )
- {
- return bind( message, new Object[] { arg1, arg2, arg3, arg4 } );
- }
- }
-
- }
-
-}
diff --git a/plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/internal/archive/ArchiveWrapper.java b/plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/internal/archive/ArchiveWrapper.java
deleted file mode 100644
index 41b2ed4ce..000000000
--- a/plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/internal/archive/ArchiveWrapper.java
+++ /dev/null
@@ -1,599 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jst.j2ee.internal.archive;
-
-import java.io.FileNotFoundException;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.Path;
-import org.eclipse.jem.util.logger.proxy.Logger;
-import org.eclipse.jst.j2ee.application.WebModule;
-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.ModuleFile;
-import org.eclipse.jst.j2ee.commonarchivecore.internal.WARFile;
-import org.eclipse.jst.j2ee.commonarchivecore.internal.impl.FileImpl;
-import org.eclipse.jst.j2ee.commonarchivecore.internal.util.ArchiveUtil;
-import org.eclipse.jst.j2ee.ejb.EJBJar;
-import org.eclipse.jst.j2ee.internal.J2EEConstants;
-import org.eclipse.jst.j2ee.internal.J2EEVersionConstants;
-import org.eclipse.jst.j2ee.internal.archive.operations.EARArchiveOpsResourceHandler;
-import org.eclipse.jst.javaee.application.Application;
-import org.eclipse.jst.javaee.application.Module;
-import org.eclipse.jst.jee.archive.ArchiveModelLoadException;
-import org.eclipse.jst.jee.archive.ArchiveOpenFailureException;
-import org.eclipse.jst.jee.archive.IArchive;
-import org.eclipse.jst.jee.archive.IArchiveResource;
-import org.eclipse.jst.jee.util.internal.JavaEEQuickPeek;
-
-public class ArchiveWrapper {
-
- //TODO remove commonArchive; possibly remove this entire class and
- //code directly to IArchive
- private Archive commonArchive = null;
- private IArchive archive = null;
- private JavaEEQuickPeek jqp = null;
-
- public ArchiveWrapper(IArchive archive) {
- this.archive = archive;
- JavaEEArchiveUtilities jea = JavaEEArchiveUtilities.INSTANCE;
- jqp = jea.getJavaEEQuickPeek(archive);
- }
-
- public ArchiveWrapper(Archive mFile) {
- this.commonArchive = mFile;
- int type = J2EEConstants.UNKNOWN;
-
- if (mFile.isApplicationClientFile()) {
- type = J2EEConstants.APPLICATION_CLIENT_TYPE;
- } else if (mFile.isEARFile()) {
- type = J2EEConstants.APPLICATION_TYPE;
- } else if (mFile.isEJBJarFile()) {
- type = J2EEConstants.EJB_TYPE;
- } else if (mFile.isWARFile()) {
- type = J2EEConstants.WEB_TYPE;
- } else if (mFile.isRARFile()) {
- type = J2EEConstants.CONNECTOR_TYPE;
- }
- if (type != J2EEConstants.UNKNOWN) {
- int version = ArchiveUtil.getFastSpecVersion((ModuleFile) mFile);
- jqp = new JavaEEQuickPeek(type, version);
- } else {
- jqp = new JavaEEQuickPeek(null);
- }
- }
-
- public JavaEEQuickPeek getJavaEEQuickPeek() {
- return jqp;
- }
-
- public Archive getCommonArchive() {
- return (Archive) commonArchive;
- }
-
- public Object getUnderLyingArchive() {
- if (archive != null) {
- return archive;
- }
- if (commonArchive != null) {
- return commonArchive;
- }
- fail();
- return null;
- }
-
- private ArchiveWrapper cachedParent = null;
-
- public ArchiveWrapper getParent() {
- if (null != cachedParent) {
- return cachedParent;
- }
- if (archive != null) {
- cachedParent = new ArchiveWrapper(archive.getArchive());
- return cachedParent;
- }
- if (commonArchive != null) {
- cachedParent = new ArchiveWrapper((Archive) commonArchive.eContainer());
- return cachedParent;
- }
- fail();
- return null;
- }
-
- public IArchive getIArchive() {
- return archive;
- }
-
- public void close() {
- try {
- if (commonArchive != null && commonArchive.isOpen()) {
- commonArchive.close();
- }
- if (archive != null && archive.isOpen()) {
- JavaEEArchiveUtilities.INSTANCE.closeArchive(archive);
- }
- } catch (RuntimeException e) {
- Logger.getLogger().logError(e);
- throw e;
- }
- }
-
- public IPath getPath() {
- if (commonArchive != null) {
- IPath path = new Path(commonArchive.getURI());
- return path;
- }
- if (archive != null) {
- return archive.getPath();
- }
- fail();
- return null;
- }
-
- private void fail() {
- throw new RuntimeException("ArchiveWrapper is inconsistent.");
- }
-
- public int getSize() {
- if (commonArchive != null)
- return commonArchive.getFiles().size();
- else
- return archive.getArchiveResources().size();
- }
-
- private List<ArchiveWrapper> cachedWebLibs;
-
- public List<ArchiveWrapper> getWebLibs() {
- if (cachedWebLibs != null) {
- return cachedWebLibs;
- }
- if (jqp.getType() != J2EEVersionConstants.WEB_TYPE) {
- fail();
- }
-
- cachedWebLibs = new ArrayList<ArchiveWrapper>();
-
- if (commonArchive != null) {
- WARFile war = (WARFile) commonArchive;
- List libs = war.getLibArchives();
- for (int i = 0; i < libs.size(); i++) {
- cachedWebLibs.add(new ArchiveWrapper((Archive) libs.get(i)));
- }
- return cachedWebLibs;
- }
- if (archive != null) {
- List<IArchiveResource> resources = archive.getArchiveResources();
- for (IArchiveResource resource : resources) {
- if (resource.getType() != IArchiveResource.DIRECTORY_TYPE) {
- IPath path = resource.getPath();
- if (path.segmentCount() > 2) {
- if (path.segment(0).equals("WEB-INF") && path.segment(1).equals("lib")) {
- String lastSegment = path.lastSegment();
- if (lastSegment.endsWith("jar") || lastSegment.endsWith("zip")) {
- IArchive webLib;
- try {
- webLib = archive.getNestedArchive(resource);
- cachedWebLibs.add(new ArchiveWrapper(webLib));
- } catch (ArchiveOpenFailureException e) {
- Logger.getLogger().logError(e);
- }
- }
- }
- }
- }
- }
- return cachedWebLibs;
- }
- fail();
- return null;
- }
-
- private List <String>cachedDDMappedModuleURIs = null;
-
- public List<String> getDDMappedModuleURIs() {
- if(cachedDDMappedModuleURIs != null){
- return cachedDDMappedModuleURIs;
- }
- if (jqp.getType() != J2EEVersionConstants.APPLICATION_TYPE) {
- fail();
- }
-
- cachedDDMappedModuleURIs = new ArrayList<String>();
-
- if (commonArchive != null) {
- EARFile ear = (EARFile) commonArchive;
- List earMods = ear.getModuleFiles();
- for (int i = 0; i < earMods.size(); i++) {
- cachedDDMappedModuleURIs.add(((Archive) earMods.get(i)).getURI());
- }
- return cachedDDMappedModuleURIs;
- } else if(archive != null) {
- if(archive.containsArchiveResource(new Path(J2EEConstants.APPLICATION_DD_URI))){
- if(jqp.getJavaEEVersion() == JavaEEQuickPeek.JEE_5_0_ID){
- try {
- Application application = (Application) archive.getModelObject();
- List modules = application.getModules();
- for(int i=0;i<modules.size();i++){
- Module module = (Module)modules.get(i);
- String uri = module.getUri();
- cachedDDMappedModuleURIs.add(uri);
- }
- } catch (ArchiveModelLoadException e) {
- Logger.getLogger().logError(e);
- }
- } else {
- try{
- org.eclipse.jst.j2ee.application.Application application = (org.eclipse.jst.j2ee.application.Application)archive.getModelObject();
- List modules = application.getModules();
- for(int i=0;i<modules.size();i++){
- org.eclipse.jst.j2ee.application.Module module = (org.eclipse.jst.j2ee.application.Module)modules.get(i);
- String uri = module.getUri();
- cachedDDMappedModuleURIs.add(uri);
- }
- }catch (ArchiveModelLoadException e) {
- Logger.getLogger().logError(e);
- }
- }
- }
- }
- return cachedDDMappedModuleURIs;
- }
-
-
- private List<ArchiveWrapper> cachedEARModules;
-
- public List<ArchiveWrapper> getEarModules() {
- if (cachedEARModules != null) {
- return cachedEARModules;
- }
- if (jqp.getType() != J2EEVersionConstants.APPLICATION_TYPE) {
- fail();
- }
- cachedEARModules = new ArrayList<ArchiveWrapper>();
-
- if (commonArchive != null) {
- EARFile ear = (EARFile) commonArchive;
- List earMods = ear.getModuleFiles();
- for (int i = 0; i < earMods.size(); i++) {
- cachedEARModules.add(new ArchiveWrapper((Archive) earMods.get(i)));
- }
- return cachedEARModules;
- }
- if (archive != null) {
- if(jqp.getJavaEEVersion() == JavaEEQuickPeek.JEE_5_0_ID){
- List<IArchiveResource> resources = archive.getArchiveResources();
- for (IArchiveResource resource : resources) {
- if (resource.getType() != IArchiveResource.DIRECTORY_TYPE) {
- IPath path = resource.getPath();
- if (path.segmentCount() > 0) {
- String lastSegment = path.lastSegment();
- if (lastSegment.endsWith("jar") || lastSegment.endsWith("zip") || lastSegment.endsWith("rar") || lastSegment.endsWith("war")) {
- IArchive earmodule;
- try {
- earmodule = archive.getNestedArchive(resource);
- cachedEARModules.add(new ArchiveWrapper(earmodule));
- } catch (ArchiveOpenFailureException e) {
- Logger.getLogger().logError(e);
- }
- }
- }
- }
- }
- } else {
- try {
- org.eclipse.jst.j2ee.application.Application app = (org.eclipse.jst.j2ee.application.Application)archive.getModelObject();
- List modules = app.getModules();
- for(int i=0;i<modules.size();i++){
- org.eclipse.jst.j2ee.application.Module mod = (org.eclipse.jst.j2ee.application.Module)modules.get(i);
- String uri = mod.getUri();
- IPath path = new Path(uri);
- if(archive.containsArchiveResource(path)){
- try {
- IArchiveResource resource = archive.getArchiveResource(path);
- IArchive earmodule;
- earmodule = archive.getNestedArchive(resource);
- cachedEARModules.add(new ArchiveWrapper(earmodule));
- } catch (ArchiveOpenFailureException e) {
- Logger.getLogger().logError(e);
- } catch (FileNotFoundException e) {
- org.eclipse.jst.j2ee.internal.plugin.J2EEPlugin.logError(e);
- }
- }
- }
- } catch (ArchiveModelLoadException e) {
- org.eclipse.jst.j2ee.internal.plugin.J2EEPlugin.logError(e);
- }
- }
- return cachedEARModules;
- }
- fail();
- return null;
- }
-
- public String getName() {
- if (commonArchive != null) {
- return commonArchive.getName();
- }
- if (archive != null) {
- return archive.getPath().lastSegment();
- }
- fail();
- return null;
- }
-
- public boolean isModule() {
- if (isApplicationClientFile()) {
- return true;
- }
- if (isWARFile()) {
- return true;
- }
- if (isEJBJarFile()) {
- return true;
- }
- if (isRARFile()) {
- return true;
- }
- return false;
- }
-
- public boolean isApplicationClientFile() {
- if (commonArchive != null)
- return commonArchive.isApplicationClientFile();
- if (archive != null)
- return (JavaEEArchiveUtilities.INSTANCE.getJavaEEQuickPeek(archive).getType() == J2EEConstants.APPLICATION_CLIENT_TYPE);
- fail();
- return false;
- }
-
- public boolean isWARFile() {
- if (commonArchive != null)
- return commonArchive.isWARFile();
- if (archive != null)
- return (JavaEEArchiveUtilities.INSTANCE.getJavaEEQuickPeek(archive).getType() == J2EEConstants.WEB_TYPE);
- fail();
- return false;
- }
-
- public boolean isEJBJarFile() {
- if (commonArchive != null)
- return commonArchive.isEJBJarFile();
- if (archive != null)
- return (JavaEEArchiveUtilities.INSTANCE.getJavaEEQuickPeek(archive).getType() == J2EEConstants.EJB_TYPE);
- fail();
- return false;
- }
-
- public boolean isEarFile() {
- if (commonArchive != null)
- return commonArchive.isEARFile();
- if (archive != null)
- return (JavaEEArchiveUtilities.INSTANCE.getJavaEEQuickPeek(archive).getType() == J2EEConstants.APPLICATION_TYPE);
- fail();
- return false;
- }
-
- public boolean isRARFile() {
- if (commonArchive != null)
- return commonArchive.isRARFile();
- if (archive != null)
- return (JavaEEArchiveUtilities.INSTANCE.getJavaEEQuickPeek(archive).getType() == J2EEConstants.CONNECTOR_TYPE);
- fail();
- return false;
- }
-
- // This is an array so we can tell the difference between initialized and null vs not initialized
- private String[] cachedWebContextRoot = null;
-
- public String getWebContextRoot() {
- if (cachedWebContextRoot != null) {
- return cachedWebContextRoot[0];
- }
-
- if (!isWARFile()) {
- fail();
- return null;
- }
- cachedWebContextRoot = new String[1];
-
- if (commonArchive != null) {
- cachedWebContextRoot[0] = ((WebModule) ((EARFile) commonArchive.getContainer()).getModule(commonArchive.getURI(), null)).getContextRoot();
- return cachedWebContextRoot[0];
- }
- if (archive != null) {
- IArchive earArchive = archive.getArchive();
- if(earArchive.containsArchiveResource(new Path(J2EEConstants.APPLICATION_DD_URI))){
- JavaEEQuickPeek earJQP = JavaEEArchiveUtilities.INSTANCE.getJavaEEQuickPeek(earArchive);
- if(earJQP.getJavaEEVersion() == JavaEEQuickPeek.JEE_5_0_ID){
- try {
- Application application = (Application) earArchive.getModelObject();
- String moduleName = archive.getPath().toString();
- Module module = (Module) application.getFirstModule(moduleName);
- if(module != null){
- cachedWebContextRoot[0] = module.getWeb().getContextRoot();
- } else {
- cachedWebContextRoot[0] = getDefaultContextRoot();
- }
- } catch (ArchiveModelLoadException e) {
- Logger.getLogger().logError(e);
- }
- } else {
- try{
- org.eclipse.jst.j2ee.application.Application application = (org.eclipse.jst.j2ee.application.Application)earArchive.getModelObject();
- String moduleName = archive.getPath().toString();
- org.eclipse.jst.j2ee.application.WebModule module = (org.eclipse.jst.j2ee.application.WebModule)application.getFirstModule(moduleName);
- if(module == null){
- cachedWebContextRoot[0] = null;
- } else {
- cachedWebContextRoot[0] = module.getContextRoot();
- }
- } catch (ArchiveModelLoadException e) {
- Logger.getLogger().logError(e);
- }
- }
- } else {
- cachedWebContextRoot[0] = getDefaultContextRoot();
- }
- return cachedWebContextRoot[0];
- }
- fail();
- return null;
- }
-
- private String getDefaultContextRoot() {
- //J2EE spec 8.3.1.3.c (pg 149)
- String contextRoot = archive.getPath().toString();
- contextRoot = contextRoot.substring(0, contextRoot.lastIndexOf('.'));
- return contextRoot;
- }
-
- // This is an array so we can tell the difference between initialized and null vs not initialized
- private HashMap<ArchiveWrapper, ArchiveWrapper> cachedEJBClientArchiveWrapper = null;
-
- public ArchiveWrapper getEJBClientArchiveWrapper(ArchiveWrapper ejbWrapper) {
- if (cachedEJBClientArchiveWrapper == null) {
- cachedEJBClientArchiveWrapper = new HashMap<ArchiveWrapper, ArchiveWrapper>();
- }
-
- if(cachedEJBClientArchiveWrapper.containsKey(ejbWrapper)){
- return cachedEJBClientArchiveWrapper.get(ejbWrapper);
- }
-
-
- if (!ejbWrapper.isEJBJarFile() || !isEarFile()) {
- fail();
- return null;
- }
-
- ArchiveWrapper ejbClientArchiveWrapper = null;
- try{
- if (commonArchive != null) {
- try {
- EJBJar jar = ((EJBJarFile) ejbWrapper.getUnderLyingArchive()).getDeploymentDescriptor();
- if (jar != null) {
- if (jar.getEjbClientJar() != null) {
- String clientName = jar.getEjbClientJar();
- ejbClientArchiveWrapper = new ArchiveWrapper((Archive) ((EARFile) commonArchive).getFile(clientName));
- }
- }
- return ejbClientArchiveWrapper;
- } catch (FileNotFoundException e) {
- Logger.getLogger().logError(e);
- }
- }
- if (archive != null) {
- try {
- JavaEEQuickPeek jqp = JavaEEArchiveUtilities.INSTANCE.getJavaEEQuickPeek(ejbWrapper.archive);
- String clientJarName = null;
- if(jqp.getVersion() == J2EEVersionConstants.EJB_3_0_ID){
- if(ejbWrapper.archive.containsArchiveResource(new Path(J2EEConstants.EJBJAR_DD_URI))){
- org.eclipse.jst.javaee.ejb.EJBJar edd = (org.eclipse.jst.javaee.ejb.EJBJar) ejbWrapper.archive.getModelObject();
- clientJarName = edd.getEjbClientJar();
- }
- } else {
- EJBJar jar = (EJBJar)ejbWrapper.archive.getModelObject();
- if (jar != null) {
- clientJarName = jar.getEjbClientJar();
- }
- }
-
- if (null != clientJarName) {
- IPath clientJarPath = new Path(clientJarName);
- if(archive.containsArchiveResource(clientJarPath)){
- IArchiveResource clientJar = archive.getArchiveResource(clientJarPath);
- if(null != clientJar){
- if (clientJar.getType() == IArchiveResource.ARCHIVE_TYPE) {
- ejbClientArchiveWrapper = new ArchiveWrapper((IArchive) clientJar);
- } else {
- try {
- ejbClientArchiveWrapper = new ArchiveWrapper(archive.getNestedArchive(clientJar));
- } catch (ArchiveOpenFailureException e) {
- Logger.getLogger().logError(e);
- }
- }
- }
- } else {
- Logger.getLogger().logWarning(EARArchiveOpsResourceHandler.bind(EARArchiveOpsResourceHandler.MISSING_CLIENT_JAR, new Object[] {clientJarName, ejbWrapper.getName(), archive.getPath()}));
- }
- }
- return ejbClientArchiveWrapper;
- } catch (FileNotFoundException e) {
- Logger.getLogger().logError(e);
- } catch (ArchiveModelLoadException e) {
- Logger.getLogger().logError(e);
- }
- }
- } finally {
- cachedEJBClientArchiveWrapper.put(ejbWrapper, ejbClientArchiveWrapper);
- }
- fail();
- return null;
- }
-
- private List<ArchiveWrapper> cachedEARUtilitiesAndWebLibs = null;
-
- public List<ArchiveWrapper> getEARUtilitiesAndWebLibs() {
- if (null != cachedEARUtilitiesAndWebLibs) {
- return cachedEARUtilitiesAndWebLibs;
- }
-
- if (!isEarFile()) {
- fail();
- return null;
- }
-
- cachedEARUtilitiesAndWebLibs = new ArrayList<ArchiveWrapper>();
- if (commonArchive != null) {
- List files = commonArchive.getFiles();
- for (int i = 0; i < files.size(); i++) {
- FileImpl file = (FileImpl) files.get(i);
- if (file.isArchive() && !file.isModuleFile() && file.getURI().endsWith(".jar")) { //$NON-NLS-1$
- cachedEARUtilitiesAndWebLibs.add(new ArchiveWrapper((Archive) file));
- }
- if (file.isWARFile()) {
- ArchiveWrapper wrapper = new ArchiveWrapper((Archive) file);
- cachedEARUtilitiesAndWebLibs.addAll(wrapper.getWebLibs());
- }
- }
- return cachedEARUtilitiesAndWebLibs;
- }
- if (archive != null) {
- List files = archive.getArchiveResources();
- for (int i = 0; i < files.size(); i++) {
- IArchiveResource file = (IArchiveResource) files.get(i);
- String lastSegment = file.getPath().lastSegment();
- if (lastSegment.endsWith(".jar") || lastSegment.endsWith(".rar") || lastSegment.endsWith(".war") || lastSegment.endsWith("zip")) {
- IArchive nestedArchive;
- try {
- nestedArchive = archive.getNestedArchive(file);
- ArchiveWrapper nestedWrapper = new ArchiveWrapper(nestedArchive);
- if (nestedWrapper.isWARFile()) {
- cachedEARUtilitiesAndWebLibs.addAll(nestedWrapper.getWebLibs());
- } else if (!nestedWrapper.isModule()) {
- cachedEARUtilitiesAndWebLibs.add(nestedWrapper);
- }
- } catch (ArchiveOpenFailureException e) {
- Logger.getLogger().logError(e);
- }
- }
- }
- return cachedEARUtilitiesAndWebLibs;
-
- }
- fail();
- return null;
- }
-
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/internal/archive/ComponentArchiveLoadAdapter.java b/plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/internal/archive/ComponentArchiveLoadAdapter.java
deleted file mode 100644
index 1b457b745..000000000
--- a/plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/internal/archive/ComponentArchiveLoadAdapter.java
+++ /dev/null
@@ -1,704 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jst.j2ee.internal.archive;
-
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
-import java.io.FileInputStream;
-import java.io.FileNotFoundException;
-import java.io.IOException;
-import java.io.InputStream;
-import java.util.ArrayList;
-import java.util.Enumeration;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.zip.ZipEntry;
-import java.util.zip.ZipException;
-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.ResourcesPlugin;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.Path;
-import org.eclipse.emf.common.util.URI;
-import org.eclipse.jdt.core.IJavaProject;
-import org.eclipse.jdt.core.IPackageFragmentRoot;
-import org.eclipse.jdt.core.JavaCore;
-import org.eclipse.jem.util.logger.proxy.Logger;
-import org.eclipse.jst.j2ee.classpathdep.IClasspathDependencyConstants;
-import org.eclipse.jst.j2ee.componentcore.J2EEModuleVirtualComponent;
-import org.eclipse.jst.j2ee.internal.J2EEConstants;
-import org.eclipse.jst.j2ee.internal.archive.operations.EARArchiveOpsResourceHandler;
-import org.eclipse.jst.j2ee.internal.classpathdep.ClasspathDependencyManifestUtil;
-import org.eclipse.jst.j2ee.internal.classpathdep.ClasspathDependencyVirtualComponent;
-import org.eclipse.jst.j2ee.internal.project.J2EEProjectUtilities;
-import org.eclipse.jst.jee.archive.AbstractArchiveLoadAdapter;
-import org.eclipse.jst.jee.archive.ArchiveModelLoadException;
-import org.eclipse.jst.jee.archive.IArchive;
-import org.eclipse.jst.jee.archive.IArchiveLoadAdapter;
-import org.eclipse.jst.jee.archive.IArchiveResource;
-import org.eclipse.jst.jee.archive.internal.ArchiveURIConverter;
-import org.eclipse.jst.jee.archive.internal.ArchiveUtil;
-import org.eclipse.wst.common.componentcore.UnresolveableURIException;
-import org.eclipse.wst.common.componentcore.internal.ComponentResource;
-import org.eclipse.wst.common.componentcore.internal.DependencyType;
-import org.eclipse.wst.common.componentcore.internal.StructureEdit;
-import org.eclipse.wst.common.componentcore.internal.resources.VirtualArchiveComponent;
-import org.eclipse.wst.common.componentcore.resources.IVirtualComponent;
-import org.eclipse.wst.common.componentcore.resources.IVirtualContainer;
-import org.eclipse.wst.common.componentcore.resources.IVirtualFile;
-import org.eclipse.wst.common.componentcore.resources.IVirtualFolder;
-import org.eclipse.wst.common.componentcore.resources.IVirtualReference;
-import org.eclipse.wst.common.componentcore.resources.IVirtualResource;
-
-public abstract class ComponentArchiveLoadAdapter extends AbstractArchiveLoadAdapter {
-
- protected static final String DOT_SQLJ = ".sqlj"; //$NON-NLS-1$
-
- protected static final String DOT_JSP = ".jsp"; //$NON-NLS-1$
-
- protected static final String DOT_PROJECT = ".project"; //$NON-NLS-1$
-
- protected static final String DOT_CLASSPATH = ".classpath"; //$NON-NLS-1$
-
- protected static final String DOT_SETTINGS = ".settings"; //$NON-NLS-1$
-
- protected static final String DOT_CVS_IGORE = ".cvsignore"; //$NON-NLS-1$
-
- protected IVirtualComponent vComponent;
-
- protected boolean exportSource = true;
-
- private List zipFiles = new ArrayList();
-
- private List javaClasspathURIs = new ArrayList();
-
- protected boolean includeClasspathComponents = true;
-
- protected class FilesHolder {
-
- private Map pathsToArchiveResources = new HashMap();
-
- private Map pathsToWorkbenchResources = new HashMap();
-
- private Map workbenchResourcesToPaths = new HashMap();
-
- private Map pathsToDiskFiles;
-
- private Map pathsToZipEntry = new HashMap();
-
- public void removeIFile(IFile file) {
- IPath path = (IPath) workbenchResourcesToPaths.get(file);
- remove(path);
- }
-
- public void remove(IPath path) {
- pathsToArchiveResources.remove(path);
- Object resource = pathsToWorkbenchResources.remove(path);
- if (resource != null) {
- workbenchResourcesToPaths.remove(resource);
- }
- if (pathsToDiskFiles != null) {
- pathsToDiskFiles.remove(path);
- }
- }
-
- public void addFile(IArchiveResource file) {
- IPath path = file.getPath();
- pathsToArchiveResources.put(path, file);
- }
-
- public void addFile(IArchiveResource file, java.io.File externalDiskFile) {
- IPath path = file.getPath();
- pathsToArchiveResources.put(path, file);
- if (null == pathsToDiskFiles) {
- pathsToDiskFiles = new HashMap();
- }
- pathsToDiskFiles.put(path, externalDiskFile);
- }
-
- public void addFile(IArchiveResource file, IResource resource) {
- IPath path = file.getPath();
- pathsToArchiveResources.put(path, file);
- pathsToWorkbenchResources.put(path, resource);
- }
-
- public InputStream getInputStream(IPath path) throws IOException, FileNotFoundException {
- java.io.File diskFile = null;
-
- if (pathsToDiskFiles != null && pathsToDiskFiles.containsKey(path)) {
- diskFile = (java.io.File) pathsToDiskFiles.get(path);
- } else if (pathsToWorkbenchResources != null && pathsToWorkbenchResources.containsKey(path)) {
- IResource resource = (IResource) pathsToWorkbenchResources.get(path);
- diskFile = new java.io.File(resource.getLocation().toOSString());
- }
- if (diskFile != null) {
- return new FileInputStream(diskFile);
- } else if (pathsToZipEntry.containsKey(path)) {
- Map fileURIMap = (Map) pathsToZipEntry.get(path);
- Iterator it = fileURIMap.keySet().iterator();
-
- String sourceFileUri = ""; //$NON-NLS-1$
- ZipFile zipFile = null;
-
- // there is only one key, pair
- while (it.hasNext()) {
- sourceFileUri = (String) it.next();
- zipFile = (ZipFile) fileURIMap.get(sourceFileUri);
- }
- ZipEntry entry = zipFile.getEntry(sourceFileUri);
- InputStream in = zipFile.getInputStream(entry);
- return in;
- } else {
- IArchiveResource res = getArchiveResource(path);
- return ComponentArchiveLoadAdapter.this.getSuperInputStream(res);
- }
- }
-
- public List<IArchiveResource> getFiles() {
- return new ArrayList<IArchiveResource>(pathsToArchiveResources.values());
- }
-
- public boolean contains(IPath path) {
- return pathsToArchiveResources.containsKey(path);
- }
-
- public IArchiveResource getArchiveResource(IPath path) {
- return (IArchiveResource) pathsToArchiveResources.get(path);
- }
-
- public void addEntry(ZipEntry entry, ZipFile zipFile, IPath runtimePath) {
- if (runtimePath != null) {
- if (!runtimePath.equals("/")) //$NON-NLS-1$
- runtimePath = runtimePath.append(entry.getName());
- else
- runtimePath = new Path(entry.getName());
- } else {
- runtimePath = new Path(entry.getName());
- }
-
- IArchiveResource file = createFile(runtimePath);
-
- Map fileURIMap = new HashMap();
- fileURIMap.put(entry.getName(), zipFile);
-
- pathsToZipEntry.put(file.getPath(), fileURIMap);
- pathsToArchiveResources.put(file.getPath(), file);
- }
- }
-
- protected FilesHolder filesHolder;
-
- private IVirtualFile manifestFile = null;
-
- public ComponentArchiveLoadAdapter(IVirtualComponent vComponent) {
- this(vComponent, true);
- }
-
- public ComponentArchiveLoadAdapter(IVirtualComponent vComponent, boolean includeClasspathComponents) {
- this.vComponent = vComponent;
- filesHolder = new FilesHolder();
- setIncludeClasspathComponents(includeClasspathComponents);
- }
-
- public void setIncludeClasspathComponents(boolean includeClasspathComponents) {
- this.includeClasspathComponents = includeClasspathComponents;
- if (includeClasspathComponents) {
- this.manifestFile = vComponent.getRootFolder().getFile(new Path(J2EEConstants.MANIFEST_URI));
- saveJavaClasspathReferences();
- } else {
- this.manifestFile = null;
- javaClasspathURIs.clear();
- }
- }
-
- public IArchiveResource getArchiveResource(IPath resourcePath) throws FileNotFoundException {
- initArchiveResources();
- return filesHolder.getArchiveResource(resourcePath);
- }
-
- public boolean containsArchiveResource(IPath path) {
- initArchiveResources();
- return filesHolder.contains(path);
- }
-
- protected boolean archiveResourcesInitialized = false;
-
- protected void initArchiveResources() {
- if (!archiveResourcesInitialized) {
- archiveResourcesInitialized = true;
- aggregateSourceFiles();
- aggregateClassFiles();
- addUtilities();
- }
- }
-
- public List<IArchiveResource> getArchiveResources() {
-
- initArchiveResources();
- return filesHolder.getFiles();
- }
-
- /**
- * Adds library cp entries that point to class folders and have been tagged with the publish/export attribute.
- */
- protected void addMappedClassFolders(final IPath targetRuntimePath) {
- // retrieve all mapped class folders
- if (vComponent instanceof J2EEModuleVirtualComponent) {
- try {
- final J2EEModuleVirtualComponent j2eeComponent = (J2EEModuleVirtualComponent) vComponent;
- final IVirtualReference[] cpRefs = j2eeComponent.getJavaClasspathReferences();
- for (int j = 0; j < cpRefs.length; j++) {
- final IVirtualReference ref = cpRefs[j];
- final IPath runtimePath = ref.getRuntimePath();
- // only process mappings with the specified runtime path
- if (ref.getReferencedComponent() instanceof ClasspathDependencyVirtualComponent
- && runtimePath.equals(targetRuntimePath)) {
- final ClasspathDependencyVirtualComponent comp = (ClasspathDependencyVirtualComponent) ref.getReferencedComponent();
- if (comp.isClassFolder()) {
- final IContainer classFolder = comp.getClassFolder();
- if (classFolder != null && classFolder.exists()) {
- aggregateOutputFiles(new IResource[]{classFolder}, runtimePath.makeRelative(), classFolder.getProjectRelativePath().segmentCount());
- }
- }
- }
- }
- } catch (CoreException e) {
- Logger.getLogger().logError(e);
- }
- }
- }
-
- protected void saveJavaClasspathReferences() {
- if (vComponent instanceof J2EEModuleVirtualComponent) {
- final J2EEModuleVirtualComponent j2eeComp = (J2EEModuleVirtualComponent) vComponent;
- final IVirtualReference[] refs = j2eeComp.getJavaClasspathReferences();
- if (refs == null) {
- return;
- }
- for (int i = 0; i < refs.length; i++) {
- if (refs[i].getRuntimePath().equals(IClasspathDependencyConstants.RUNTIME_MAPPING_INTO_CONTAINER_PATH)) {
- javaClasspathURIs.add(refs[i].getArchiveName());
- }
- }
- }
- }
-
- protected void addUtilities() {
- IVirtualReference[] components = vComponent.getReferences();
- for (int i = 0; i < components.length; i++) {
- IVirtualReference reference = components[i];
- IVirtualComponent referencedComponent = reference.getReferencedComponent();
-
- if (referencedComponent.isBinary() && reference.getDependencyType() == DependencyType.CONSUMES) {
- java.io.File diskFile = ((VirtualArchiveComponent) referencedComponent).getUnderlyingDiskFile();
- ZipFile zipFile;
- IPath path = reference.getRuntimePath();
- try {
- zipFile = ArchiveUtil.newZipFile(diskFile);
- zipFiles.add(zipFile);
- Enumeration enumeration = zipFile.entries();
- while (enumeration.hasMoreElements()) {
- ZipEntry entry = (ZipEntry) enumeration.nextElement();
- filesHolder.addEntry(entry, zipFile, path);
- }
- } catch (ZipException e) {
- Logger.getLogger().logError(e);
- } catch (IOException e) {
- Logger.getLogger().logError(e);
- }
- }
- }
- }
-
- /**
- * This is a cache of the IResource roots for all java source folders and is
- * used by {@link #inJavaSrc(IVirtualResource)}.
- */
- private IResource[] sourceRoots = null;
-
- protected void aggregateSourceFiles() {
- try {
- IVirtualFolder rootFolder = vComponent.getRootFolder();
- IVirtualResource[] members = rootFolder.members();
- IPackageFragmentRoot[] srcPkgs = J2EEProjectUtilities.getSourceContainers(vComponent.getProject());
- sourceRoots = new IResource[srcPkgs.length];
- for (int i = 0; i < srcPkgs.length; i++) {
- sourceRoots[i] = srcPkgs[i].getCorrespondingResource();
- }
- inJavaSrc = false;
- aggregateFiles(members);
- } catch (CoreException e) {
- Logger.getLogger().logError(e);
- }
- }
-
- protected void aggregateClassFiles() {
- StructureEdit se = null;
- try {
- IPackageFragmentRoot[] sourceRoots = J2EEProjectUtilities.getSourceContainers(vComponent.getProject());
- se = StructureEdit.getStructureEditForRead(vComponent.getProject());
- for (int i = 0; i < sourceRoots.length; i++) {
- IPath outputPath = sourceRoots[i].getRawClasspathEntry().getOutputLocation();
- if (outputPath == null) {
- IProject project = vComponent.getProject();
- if (project.hasNature(JavaCore.NATURE_ID)) {
- IJavaProject javaProject = JavaCore.create(project);
- outputPath = javaProject.getOutputLocation();
- }
- }
-
- if (outputPath != null) {
- IContainer javaOutputContainer = outputPath.segmentCount() > 1 ? (IContainer) ResourcesPlugin.getWorkspace().getRoot().getFolder(outputPath) : (IContainer) ResourcesPlugin
- .getWorkspace().getRoot().getProject(outputPath.lastSegment());
- IPath runtimePath = null;
- try {
- ComponentResource[] componentResources = se.findResourcesBySourcePath(sourceRoots[i].getResource().getProjectRelativePath());
- if (componentResources.length > 0) {
- IPath tmpRuntimePath = componentResources[0].getRuntimePath();
- IPath tmpSourcePath = componentResources[0].getSourcePath();
- if (!tmpRuntimePath.equals(tmpSourcePath)) {
- while (tmpSourcePath.segmentCount() > 0 && tmpRuntimePath.segmentCount() > 0 && tmpRuntimePath.lastSegment().equals(tmpSourcePath.lastSegment())) {
- tmpRuntimePath = tmpRuntimePath.removeLastSegments(1);
- tmpSourcePath = tmpSourcePath.removeLastSegments(1);
- }
- if (tmpRuntimePath.segmentCount() != 0) {
- runtimePath = tmpRuntimePath.makeRelative();
- }
- }
- }
- } catch (UnresolveableURIException e) {
- Logger.getLogger().logError(e);
- }
- if (null == runtimePath) {
- runtimePath = new Path(""); //$NON-NLS-1$
- }
-
- aggregateOutputFiles(new IResource[] { javaOutputContainer }, runtimePath, javaOutputContainer.getProjectRelativePath().segmentCount());
- }
- }
- } catch (CoreException e) {
- Logger.getLogger().logError(e);
- } finally {
- if (se != null) {
- se.dispose();
- }
- }
- }
-
- protected boolean aggregateOutputFiles(IResource[] resources, final IPath runtimePathPrefix, int outputFolderSegmentCount) throws CoreException {
- boolean fileAdded = false;
- for (int i = 0; i < resources.length; i++) {
- IArchiveResource cFile = null;
- if (!resources[i].exists()) {
- continue;
- }
- // We have to avoid duplicates between the source and output folders
- // (non-java
- // resources)
- IPath runtimePath = runtimePathPrefix.append(resources[i].getProjectRelativePath().removeFirstSegments(outputFolderSegmentCount));
- if (runtimePath == null)
- continue;
- if (resources[i].getType() == IResource.FILE) {
- if (!shouldInclude(runtimePath))
- continue;
- cFile = createFile(runtimePath);
- cFile.setLastModified(getLastModified(resources[i]));
- filesHolder.addFile(cFile, resources[i]);
- fileAdded = true;
- } else if (shouldInclude((IContainer) resources[i])) {
- IResource[] nestedResources = ((IContainer) resources[i]).members();
- aggregateOutputFiles(nestedResources, runtimePathPrefix, outputFolderSegmentCount);
- if (!filesHolder.contains(runtimePath)) {
- if (!shouldInclude(runtimePath))
- continue;
- cFile = createDirectory(runtimePath);
- cFile.setLastModified(getLastModified(resources[i]));
- filesHolder.addFile(cFile);
- fileAdded = true;
- }
- }
- }
- return fileAdded;
- }
-
- /**
- * This is used to track whether {@link #aggregateFiles(IVirtualResource[])}
- * is currently within a Java Source folder.
- */
- private boolean inJavaSrc = false;
-
- protected boolean aggregateFiles(IVirtualResource[] virtualResources) throws CoreException {
- boolean fileAdded = false;
- for (int i = 0; i < virtualResources.length; i++) {
- if (!virtualResources[i].exists()) {
- continue;
- }
- // We have to avoid duplicates between the source and output folders
- // (non-java
- // resources)
- IPath runtimePath = virtualResources[i].getRuntimePath();
- if (runtimePath == null)
- continue;
- runtimePath = runtimePath.setDevice(null).makeRelative();
- if (filesHolder.contains(runtimePath))
- continue;
-
- IArchiveResource cFile = null;
-
- if (virtualResources[i].getType() == IVirtualResource.FILE) {
- if (!shouldInclude(runtimePath))
- continue;
- IResource resource = virtualResources[i].getUnderlyingResource();
- // want to ignore derived resources nested within Java src
- // directories; this covers the case where
- // a user has nested a Java output directory within a Java src
- // directory (note: should ideally be
- // respecting Java src path exclusion filters)
- if (inJavaSrc && resource.isDerived()) {
- continue;
- }
- cFile = createFile(runtimePath);
- cFile.setLastModified(getLastModified(resource));
- filesHolder.addFile(cFile, resource);
- fileAdded = true;
- } else if (shouldInclude((IVirtualContainer) virtualResources[i])) {
- boolean inJavaSrcAtThisLevel = inJavaSrc;
- try {
- if (!inJavaSrc) {
- // if not already inside a Java src dir, check again
- inJavaSrc = inJavaSrc(virtualResources[i]);
- }
- IVirtualResource[] nestedVirtualResources = ((IVirtualContainer) virtualResources[i]).members();
- aggregateFiles(nestedVirtualResources);
- if (!filesHolder.contains(runtimePath)) {
- if (!shouldInclude(runtimePath))
- continue;
- IResource resource = virtualResources[i].getUnderlyingResource();
- if (inJavaSrc && resource.isDerived()) {
- continue;
- }
- cFile = createDirectory(runtimePath);
- cFile.setLastModified(getLastModified(resource));
- filesHolder.addFile(cFile);
- fileAdded = true;
- }
- } finally {
- inJavaSrc = inJavaSrcAtThisLevel;
- }
- }
- }
- return fileAdded;
- }
-
- /**
- * Determines if the specified IVirtualResource maps to a IResource that is
- * contained within a Java src root.
- *
- * @param virtualResource
- * IVirtualResource to check.
- * @param sourceRoots
- * Current Java src roots.
- * @return True if contained in a Java src root, false otherwise.
- */
- protected boolean inJavaSrc(final IVirtualResource virtualResource) {
- if (sourceRoots.length == 0) {
- return false;
- }
- // all mapped resources must be associated with Java src for the
- // resource to be considered in Java src
- final IResource[] resources = virtualResource.getUnderlyingResources();
- boolean inJavaSrc = false;
- for (int i = 0; i < resources.length; i++) {
- inJavaSrc = false;
- for (int j = 0; j < sourceRoots.length; j++) {
- if (sourceRoots[j].getFullPath().isPrefixOf(resources[i].getFullPath())) {
- inJavaSrc = true;
- break;
- }
- }
- // if this one was not in Java src, can break
- if (!inJavaSrc) {
- break;
- }
- }
-
- return inJavaSrc;
- }
-
- protected long getLastModified(IResource aResource) {
- return aResource.getLocation().toFile().lastModified();
- }
-
- public void setExportSource(boolean newExportSource) {
- exportSource = newExportSource;
- }
-
- public boolean isExportSource() {
- return exportSource;
- }
-
- protected boolean shouldInclude(IContainer aContainer) {
- return true;
- }
-
- protected boolean shouldInclude(IVirtualContainer vContainer) {
- IContainer iContainer = (IContainer) vContainer.getUnderlyingResource();
- return shouldInclude(iContainer);
- }
-
- // TODO add a mechanism for ignoring specific file types
- protected boolean shouldInclude(IPath path) {
- String lastSegment = path.lastSegment();
- if (null == lastSegment) {
- return false;
- }
- if (lastSegment.endsWith(DOT_PROJECT) || lastSegment.endsWith(DOT_CLASSPATH) || lastSegment.endsWith(DOT_CVS_IGORE) || path.segment(0).startsWith(DOT_SETTINGS)) {
- return false;
- }
- return isExportSource() || !isSource(path);
- }
-
- // TODO add a mechanism for ignoring specific file types
- protected boolean isSource(IPath path) {
- if (path == null)
- return false;
- return path.lastSegment().endsWith(JavaEEArchiveUtilities.DOT_JAVA) || path.lastSegment().endsWith(DOT_SQLJ);
- }
-
- protected void addExternalFile(IPath path, java.io.File externalDiskFile) {
- IArchiveResource aFile = createFile(path);
- filesHolder.addFile(aFile, externalDiskFile);
- }
-
- protected InputStream getSuperInputStream(IArchiveResource archiveResource) throws IOException, FileNotFoundException {
- if (archiveResource.getType() == IArchive.ARCHIVE_TYPE) {
- IArchiveLoadAdapter nestedLoadAdapter = (IArchiveLoadAdapter)((IArchive)archiveResource).getLoadAdapter();
- if(nestedLoadAdapter instanceof ComponentArchiveLoadAdapter){
- ((ComponentArchiveLoadAdapter)nestedLoadAdapter).setExportSource(isExportSource());
- }
- }
-
- return super.getInputStream(archiveResource);
- }
-
- public InputStream getInputStream(IArchiveResource archiveResource) throws IOException, FileNotFoundException {
- IPath path = archiveResource.getPath();
- // If the MANIFEST.MF of a module component is being requested and that
- // module component references
- // Java build path-based components, need to dynamically update the
- // manifest classpath to reflect the resolved
- // contributions from the build path
- if (includeClasspathComponents && path.equals(J2EEConstants.MANIFEST_URI) && !javaClasspathURIs.isEmpty() && manifestFile != null && manifestFile.getUnderlyingFile() != null
- && manifestFile.getUnderlyingFile().exists()) {
- // update the manifest classpath for the component
- ByteArrayOutputStream baos = new ByteArrayOutputStream();
- ClasspathDependencyManifestUtil.updateManifestClasspath(manifestFile.getUnderlyingFile(), javaClasspathURIs, baos);
- return new ByteArrayInputStream(baos.toByteArray());
- }
-
- if (filesHolder.contains(path)) {
- return filesHolder.getInputStream(path);
- }
- IVirtualFolder rootFolder = vComponent.getRootFolder();
- IVirtualResource vResource = rootFolder.findMember(path);
- String filePath = null;
- if (null != vResource && vResource.exists()) {
- filePath = vResource.getUnderlyingResource().getLocation().toOSString();
- java.io.File file = new java.io.File(filePath);
- return new FileInputStream(file);
- }
- String eString = EARArchiveOpsResourceHandler.ARCHIVE_OPERATION_FileNotFound;
- throw new FileNotFoundException(eString);
- }
-
- public IVirtualComponent getComponent() {
- return vComponent;
- }
-
- protected JavaEEEMFArchiveAdapterHelper emfHelper = null;
-
- protected void initEMFHelper() {
- if (emfHelper == null) {
- emfHelper = new JavaEEEMFArchiveAdapterHelper(getArchive());
- emfHelper.setArchiveURIConverter(new ArchiveURIConverter(emfHelper.getArchive()) {
- protected URI convertPathToURI(IPath modelObjectPath) {
- // TODO find a better way to getplatformURI
- IPath path = getComponent().getRootFolder().getFile(modelObjectPath).getUnderlyingFile().getFullPath();
- return URI.createURI("platform:/resource/" + path.toString());
- }
- });
- }
- }
-
- public boolean containsModelObject(IPath modelObjectPath) {
- initEMFHelper();
- if (IArchive.EMPTY_MODEL_PATH == modelObjectPath) {
- modelObjectPath = getDefaultModelObjectPath();
- }
- return emfHelper.containsModelObject(modelObjectPath);
- }
-
- public Object getModelObject(IPath modelObjectPath) throws ArchiveModelLoadException {
- initEMFHelper();
- if (IArchive.EMPTY_MODEL_PATH == modelObjectPath) {
- modelObjectPath = getDefaultModelObjectPath();
- }
- return emfHelper.getModelObject(modelObjectPath);
- }
-
- protected IPath getDefaultModelObjectPath() {
- return new Path("/"); //$NON-NLS-1$
- }
-
- public String toString() {
- int packageLength = this.getClass().getPackage().getName().length() + 1;
- StringBuffer buffer = new StringBuffer(this.getClass().getName().substring(packageLength));
- buffer.append(", Component: "); //$NON-NLS-1$
- buffer.append(getComponent());
- return buffer.toString();
- }
-
- /**
- * protected IProgressMonitor monitor = null;
- *
- * public void setProgressMonitor(IProgressMonitor monitor){ this.monitor =
- * monitor; }
- *
- * protected final int FILE_SAVE_WORK = 100;
- *
- * public FileIterator getFileIterator() throws IOException { return new
- * FileIteratorImpl(getContainer().getFiles()){ protected SubProgressMonitor
- * lastSubMon = null; boolean firstVisit = true;
- *
- * public File next() { if(firstVisit){ firstVisit = false; if(monitor !=
- * null){
- * monitor.beginTask(ProjectSupportResourceHandler.getString(ProjectSupportResourceHandler.Exporting_archive,
- * new Object [] { getContainer().getURI() }), files.size() *
- * FILE_SAVE_WORK); } } if(lastSubMon != null){ lastSubMon.done();
- * lastSubMon = null; } else if(monitor != null){
- * monitor.worked(FILE_SAVE_WORK); } File file = super.next(); if(monitor !=
- * null){ if(file.isContainer() &&
- * ComponentArchiveLoadAdapter.class.isInstance(((ContainerImpl)file).getLoadStrategy())){
- * ComponentArchiveLoadAdapter ls =
- * (ComponentArchiveLoadAdapter)((ContainerImpl)file).getLoadStrategy();
- * lastSubMon = new SubProgressMonitor(monitor, FILE_SAVE_WORK,
- * SubProgressMonitor.PREPEND_MAIN_LABEL_TO_SUBTASK);
- * ls.setProgressMonitor(lastSubMon); } else {
- * monitor.subTask(file.getURI()); } } return file; } }; }
- */
-}
diff --git a/plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/internal/archive/ComponentArchiveSaveAdapter.java b/plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/internal/archive/ComponentArchiveSaveAdapter.java
deleted file mode 100644
index 07c1be8bf..000000000
--- a/plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/internal/archive/ComponentArchiveSaveAdapter.java
+++ /dev/null
@@ -1,285 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jst.j2ee.internal.archive;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.core.resources.IContainer;
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IFolder;
-import org.eclipse.core.resources.IWorkspaceRoot;
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.NullProgressMonitor;
-import org.eclipse.core.runtime.SubProgressMonitor;
-import org.eclipse.emf.ecore.resource.Resource;
-import org.eclipse.jst.j2ee.internal.archive.operations.EJBArchiveOpsResourceHandler;
-import org.eclipse.jst.j2ee.internal.archive.operations.IOverwriteHandler;
-import org.eclipse.jst.j2ee.internal.archive.operations.OverwriteHandlerException;
-import org.eclipse.jst.jee.archive.AbstractArchiveSaveAdapter;
-import org.eclipse.jst.jee.archive.ArchiveSaveFailureException;
-import org.eclipse.jst.jee.archive.IArchive;
-import org.eclipse.jst.jee.archive.IArchiveResource;
-import org.eclipse.wst.common.componentcore.ComponentCore;
-import org.eclipse.wst.common.componentcore.datamodel.properties.ICreateReferenceComponentsDataModelProperties;
-import org.eclipse.wst.common.componentcore.internal.operation.CreateReferenceComponentsDataModelProvider;
-import org.eclipse.wst.common.componentcore.internal.resources.VirtualArchiveComponent;
-import org.eclipse.wst.common.componentcore.internal.util.IModuleConstants;
-import org.eclipse.wst.common.componentcore.resources.IVirtualComponent;
-import org.eclipse.wst.common.componentcore.resources.IVirtualFile;
-import org.eclipse.wst.common.componentcore.resources.IVirtualFolder;
-import org.eclipse.wst.common.frameworks.datamodel.DataModelFactory;
-import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
-import org.eclipse.wst.common.frameworks.internal.DoNotUseMeThisWillBeDeletedPost15;
-
-// hari: make abstract
-public class ComponentArchiveSaveAdapter extends AbstractArchiveSaveAdapter {
-
- protected IDataModel dataModel;
-
- protected IVirtualComponent vComponent;
-
- protected IOverwriteHandler overwriteHandler;
-
- protected IProgressMonitor progressMonitor;
-
- private String archiveComponentsDeployPath;
-
- private List archiveComponents;
-
- private Map archiveComponentURIMap;
-
- public ComponentArchiveSaveAdapter(IVirtualComponent vComponent) {
- super();
- if (null == vComponent) {
- throw new NullPointerException();
- }
- this.vComponent = vComponent;
- }
-
- public void setDataModel(IDataModel dataModel) {
- this.dataModel = dataModel;
- }
-
- public void setOverwriteHandler(IOverwriteHandler newOverwriteHandler) {
- overwriteHandler = newOverwriteHandler;
- }
-
- public void setProgressMonitor(IProgressMonitor newProgressMonitor) {
- progressMonitor = newProgressMonitor;
- }
-
- protected void validateEdit(IFile aFile) {
- if (overwriteHandler == null)
- return;
- if (!(aFile.exists() && aFile.isReadOnly()))
- return;
-
- overwriteHandler.validateEdit(aFile);
- }
-
- protected boolean shouldOverwrite(String uri) {
- if (overwriteHandler.isOverwriteNone())
- return false;
- return (overwriteHandler.isOverwriteResources() || overwriteHandler.isOverwriteAll() || overwriteHandler.shouldOverwrite(uri));
- }
-
- protected OutputStream getOutputStreamForResource(Resource aResource) throws IOException {
- // this method has no references in the hirarchy
- return null;
- }
-
- public void save(IProgressMonitor monitor) throws ArchiveSaveFailureException {
- final int SUPER_TICKS = 1000;
- final int LOCAL_TICKS = 10;
- final int TOTAL_TICKS = SUPER_TICKS + LOCAL_TICKS;
- try {
- monitor.beginTask("Importing " + vComponent.getName(), TOTAL_TICKS);
- super.save(new SubProgressMonitor(monitor, SUPER_TICKS));
- linkArchiveComponents();
- monitor.worked(LOCAL_TICKS);
- } finally {
- monitor.done();
- }
- }
-
- public void save(IArchiveResource aFile) throws ArchiveSaveFailureException {
-
- try {
- if (progressMonitor == null)
- progressMonitor = new NullProgressMonitor();
- progressMonitor.subTask(aFile.getPath().toString());
- InputStream in = aFile.getInputStream();
-
- IPath projectRelativePath = getProjectRelativePath(aFile);
- if (aFile.getType() == IArchiveResource.ARCHIVE_TYPE) {
- saveAsArchiveComponent((IArchive) aFile, projectRelativePath, in);
- } else if (aFile.getType() != IArchiveResource.DIRECTORY_TYPE) {
- saveToOutputPath(projectRelativePath, in);
- } else {
- createDirectory(projectRelativePath);
- }
- } catch (OverwriteHandlerException ohe) {
- throw ohe;
- } catch (Exception e) {
- String errorString = EJBArchiveOpsResourceHandler.ARCHIVE_OPERATION_SaveFile + aFile.getPath();
- throw new ArchiveSaveFailureException(errorString);
- } finally {
- if(null != progressMonitor){
- progressMonitor.worked(1);
- }
- }
- }
-
- /**
- * Returns the project relative path for where the specified file should be
- * saved.
- *
- * @param aFile
- * @return
- */
- protected IPath getProjectRelativePath(IArchiveResource aFile) {
- IPath path = aFile.getPath();
- IFile iFile = null;
- if (path.lastSegment() != null && path.lastSegment().startsWith(IModuleConstants.DOT_SETTINGS)) {
- iFile = vComponent.getProject().getFile(path);
- } else {
- IVirtualFolder rootFolder = vComponent.getRootFolder();
- IVirtualFile vFile = rootFolder.getFile(path);
- iFile = vFile.getUnderlyingFile();
- }
- return iFile.getProjectRelativePath();
- }
-
- /**
- * Creates the IFolder specified by the project relative path.
- *
- * @param projectRelativePath
- * @throws CoreException
- */
- protected void createDirectory(IPath projectRelativePath) throws CoreException {
- IFolder iFolder = vComponent.getProject().getFolder(projectRelativePath);
- if (!iFolder.exists()) {
- mkdirs(iFolder);
- }
- }
-
- /**
- * Creates the specified IFolder
- *
- * @param folder
- * @throws CoreException
- */
- protected void mkdirs(IFolder folder) throws CoreException {
- IContainer container = folder.getParent();
- if (!container.exists()) {
- mkdirs((IFolder) container);
- }
- folder.create(true, true, null);
- }
-
- /**
- * Save the specified Archive to the specified project relative path using
- * the passed input stream.
- *
- * @param archive
- * @param projectRelativePath
- * @param in
- * @throws Exception
- */
- protected void saveAsArchiveComponent(IArchive archive, IPath projectRelativePath, InputStream in) throws Exception {
- IFile iFile = saveToOutputPathIFile(projectRelativePath, in);
- // TODO investigate removing this block and related variables and
- // linkArchiveComponents(); see bugzilla 159160
- if (shouldLinkAsComponentRef(archive)) {
- IVirtualComponent archiveComponent = ComponentCore.createArchiveComponent(vComponent.getProject(), VirtualArchiveComponent.LIBARCHIVETYPE + iFile.getFullPath().toString());
- if (archiveComponents == null) {
- archiveComponents = new ArrayList();
- archiveComponentURIMap = new HashMap();
- archiveComponentsDeployPath = IPath.SEPARATOR + projectRelativePath.removeLastSegments(1).toString();
- }
- archiveComponents.add(archiveComponent);
- archiveComponentURIMap.put(archiveComponent, iFile.getName());
- }
- }
-
- protected boolean shouldLinkAsComponentRef(IArchive archive) {
- return false;
- }
-
- protected void linkArchiveComponents() {
- if (archiveComponents != null && archiveComponents.size() > 0) {
- IDataModel createReferencesDataModel = DataModelFactory.createDataModel(new CreateReferenceComponentsDataModelProvider());
- createReferencesDataModel.setProperty(ICreateReferenceComponentsDataModelProperties.SOURCE_COMPONENT, vComponent);
- createReferencesDataModel.setProperty(ICreateReferenceComponentsDataModelProperties.TARGET_COMPONENTS_DEPLOY_PATH, archiveComponentsDeployPath);
- createReferencesDataModel.setProperty(ICreateReferenceComponentsDataModelProperties.TARGET_COMPONENT_LIST, archiveComponents);
- createReferencesDataModel.setProperty(ICreateReferenceComponentsDataModelProperties.TARGET_COMPONENTS_TO_URI_MAP, archiveComponentURIMap);
- try {
- createReferencesDataModel.getDefaultOperation().execute(null, null);
- } catch (ExecutionException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- }
- }
-
- /**
- * Saves to the specified project relative output path. Warning this method
- * will be changed post 1.5 to return an IFile
- *
- * @param projectRelativePath
- * @param in
- * @throws Exception
- */
- protected void saveToOutputPath(IPath projectRelativePath, InputStream in) throws Exception {
- saveToOutputPathIFile(projectRelativePath, in);
- }
-
- /**
- * TODO refactor change the method above to return IFile
- * {@link DoNotUseMeThisWillBeDeletedPost15}
- */
- protected IFile saveToOutputPathIFile(IPath projectRelativePath, InputStream in) throws Exception {
- IFile iFile = vComponent.getProject().getFile(projectRelativePath);
- saveToIFile(iFile, in);
- return iFile;
- }
-
- protected void saveToIFile(IFile iFile, InputStream in) throws Exception {
- validateEdit(iFile);
- if (iFile.exists())
- iFile.setContents(in, true, true, null);
- else {
- mkdirs(iFile.getFullPath().removeLastSegments(1), ResourcesPlugin.getWorkspace().getRoot());
- iFile.create(in, true, null);
- }
- }
-
- protected void mkdirs(IPath path, IWorkspaceRoot root) throws CoreException {
- if (path.segmentCount() <= 1)
- return;
- IFolder folder = root.getFolder(path);
- if (!folder.exists()) {
- mkdirs(path.removeLastSegments(1), root);
- folder.create(true, true, null);
- }
- }
-
-}
diff --git a/plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/internal/archive/ConnectorComponentArchiveLoadAdapter.java b/plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/internal/archive/ConnectorComponentArchiveLoadAdapter.java
deleted file mode 100644
index b128e0876..000000000
--- a/plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/internal/archive/ConnectorComponentArchiveLoadAdapter.java
+++ /dev/null
@@ -1,299 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jst.j2ee.internal.archive;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-import org.eclipse.core.resources.IContainer;
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IFolder;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.Path;
-import org.eclipse.jdt.core.IJavaProject;
-import org.eclipse.jdt.core.IPackageFragmentRoot;
-import org.eclipse.jdt.core.JavaCore;
-import org.eclipse.jdt.core.JavaModelException;
-import org.eclipse.jem.util.logger.proxy.Logger;
-import org.eclipse.jst.j2ee.internal.J2EEConstants;
-import org.eclipse.jst.j2ee.internal.project.J2EEProjectUtilities;
-import org.eclipse.jst.jee.archive.ArchiveOpenFailureException;
-import org.eclipse.jst.jee.archive.ArchiveOptions;
-import org.eclipse.jst.jee.archive.IArchive;
-import org.eclipse.jst.jee.archive.IArchiveFactory;
-import org.eclipse.jst.jee.archive.IArchiveResource;
-import org.eclipse.wst.common.componentcore.resources.IVirtualComponent;
-import org.eclipse.wst.common.componentcore.resources.IVirtualContainer;
-
-public class ConnectorComponentArchiveLoadAdapter extends ComponentArchiveLoadAdapter {
-
- private int dotJavaLength = JavaEEArchiveUtilities.DOT_JAVA.length();
-
- private List alreadyIndexed = new ArrayList();
-
- private Map classesMap;
-
- private IFile knownDD;
-
- public static String[] knownLibExtensions = { ".jar", //$NON-NLS-1$
- ".zip", //$NON-NLS-1$
- ".so", //$NON-NLS-1$
- ".o", //$NON-NLS-1$
- ".sl", //$NON-NLS-1$
- ".dll", //$NON-NLS-1$
- };
-
- public ConnectorComponentArchiveLoadAdapter(IVirtualComponent vComponent) {
- this(vComponent, true);
- }
-
- public ConnectorComponentArchiveLoadAdapter(IVirtualComponent vComponent, boolean includeClasspathComponents) {
- super(vComponent, includeClasspathComponents);
- knownDD = vComponent.getRootFolder().getFile(J2EEConstants.RAR_DD_URI).getUnderlyingFile();
- }
-
- public List<IArchiveResource> getArchiveResources() {
- addNestedJARsFromSourceRoots();
- aggregateSourceFiles();
- return filesHolder.getFiles();
- }
-
- private void addNestedJARsFromSourceRoots() {
- IPackageFragmentRoot[] sourceRoots = J2EEProjectUtilities.getSourceContainers(vComponent.getProject());
- for (int i = 0; i < sourceRoots.length; i++) {
- IArchiveResource aFile;
- try {
- aFile = getNestedJar(sourceRoots[i]);
- if (null != aFile) {
- filesHolder.addFile(aFile);
- }
- } catch (JavaModelException e) {
- Logger.getLogger().logError(e);
- } catch (ArchiveOpenFailureException e) {
- Logger.getLogger().logError(e);
- }
- }
- }
-
- private IArchiveResource getNestedJar(IPackageFragmentRoot sourceRoot) throws JavaModelException, ArchiveOpenFailureException {
- IPath outputPath = sourceRoot.getRawClasspathEntry().getOutputLocation();
- if (outputPath == null) {
- IProject project = vComponent.getProject();
- try {
- if (project.hasNature(JavaCore.NATURE_ID)) {
- IJavaProject javaProject = JavaCore.create(project);
- outputPath = javaProject.getOutputLocation();
- }
- } catch (CoreException e) {
- Logger.getLogger().logError(e);
- }
- if (outputPath == null) {
- return null;
- }
- }
-
- IFolder javaOutputFolder = ResourcesPlugin.getWorkspace().getRoot().getFolder(outputPath);
- indexClassesForOutputFolder(javaOutputFolder);
- IContainer sourceContainer = (IContainer) sourceRoot.getResource();
-
- int sourceContainerSegmentCount = sourceContainer.getProjectRelativePath().segmentCount();
- boolean isModuleRoot = knownDD.getProjectRelativePath().toString().startsWith(sourceContainer.getProjectRelativePath().toString());
- Set iFilesSet = new HashSet();
- boolean foundJava = gatherFilesForJAR(iFilesSet, sourceContainer, isModuleRoot, false, sourceContainerSegmentCount);
- if (!isModuleRoot || foundJava) {
- List <IFile> iFilesList = Collections.list(Collections.enumeration(iFilesSet));
- for (int i = 0; i < iFilesList.size(); i++) {
- filesHolder.removeIFile((IFile) iFilesList.get(i));
- }
- IArchiveResource nestedArchive = createNestedArchive(iFilesList, sourceContainer, javaOutputFolder);
- return nestedArchive;
- }
- return null;
- }
-
- private boolean gatherFilesForJAR(Collection iFiles, IContainer current, boolean isModuleRoot, boolean foundJava, int sourceContainerSegmentCount) {
- IResource[] members = null;
- try {
- members = current.members();
- } catch (CoreException core) {
- // TODO
- // throw new ArchiveRuntimeException(core);
- }
-
- IContainer ddFolder = vComponent.getRootFolder().getFolder(J2EEConstants.META_INF).getUnderlyingFolder();
-
- for (int i = 0; i < members.length; i++) {
- IResource res = members[i];
- if (res.getType() == IResource.FOLDER) {
- if (!ddFolder.equals(res)) {//if it's not the dd folder
- foundJava = gatherFilesForJAR(iFiles, (IFolder) res, isModuleRoot, foundJava, sourceContainerSegmentCount) || foundJava;
- }
- } else {// it must be a file
- IFile srcFile = (IFile) res;
- if (belongsInNestedJAR(srcFile, isModuleRoot)) {
- if (JavaEEArchiveUtilities.isJava(srcFile)) {
- if (exportSource) {
- iFiles.add(srcFile); // don't need to check
- // duplicates here
- }
- String className = srcFile.getProjectRelativePath().removeFirstSegments(sourceContainerSegmentCount).toString();
- className = className.substring(0, className.length() - dotJavaLength);
- List classes = retrieveClasses(className);
- if (null != classes) {
- Iterator iterator = classes.iterator();
- while (iterator.hasNext()) {
- IFile clazz = (IFile) iterator.next();
- if (!iFiles.contains(clazz)) {
- // .class need to check for duplicates
- iFiles.add(clazz);
- }
- }
- }
- } else {
- if (!iFiles.contains(srcFile)) {
- // if it's not src, then it could be .class and need
- // to check for duplicates
- iFiles.add(srcFile);
- }
- }
- if (isModuleRoot)
- foundJava = foundJava || JavaEEArchiveUtilities.isJava(srcFile) || JavaEEArchiveUtilities.isClass(srcFile);
- }
- }
- }
- return foundJava;
- }
-
- private IArchive createNestedArchive(List <IFile> files, IContainer sourceContainer, IFolder javaOutputFolder) throws ArchiveOpenFailureException {
- ConnectorComponentNestedJARArchiveLoadAdapter nestedLoader = new ConnectorComponentNestedJARArchiveLoadAdapter(files, sourceContainer, javaOutputFolder);
- ArchiveOptions nestedOptions = new ArchiveOptions();
- nestedOptions.setOption(ArchiveOptions.LOAD_ADAPTER, nestedLoader);
- IArchive nestedArchive = IArchiveFactory.INSTANCE.openArchive(nestedOptions);
- nestedArchive.setPath(new Path(computeUniqueArchiveURI(sourceContainer)));
- nestedArchive.setArchive(archive);
- return nestedArchive;
- }
-
- private String computeUniqueArchiveURI(IResource resource) {
- int increment = 0;
- String name = resource.getName();
- StringBuffer sb = null;
- do {
- sb = new StringBuffer(name.length() + 5);
- sb.append('_');
- sb.append(name);
- if (increment > 0)
- sb.append(increment);
- sb.append(".jar"); //$NON-NLS-1$
- increment++;
- } while (filesHolder.contains(new Path(sb.toString())));
- return sb.toString();
- }
-
- private boolean belongsInNestedJAR(IFile iFile, boolean isModuleRoot) {
- if (isModuleRoot && isDeploymentDescriptor(iFile)) {
- return false;
- }
- for (int i = 0; i < knownLibExtensions.length; i++) {
- if (JavaEEArchiveUtilities.hasExtension(iFile, knownLibExtensions[i]))
- return false;
- }
- return true;
- }
-
- protected boolean shouldInclude(IPath path) {
- String lastSegment = path.lastSegment();
- return null != lastSegment && !JavaEEArchiveUtilities.hasExtension(lastSegment, JavaEEArchiveUtilities.DOT_CLASS) && !JavaEEArchiveUtilities.hasExtension(lastSegment, JavaEEArchiveUtilities.DOT_JAVA);
- }
-
- /**
- * Find all the .class files and index them so inner classes can be located.
- */
- private void indexClassesForOutputFolder(IFolder javaOutputFolder) {
- if (null == javaOutputFolder || alreadyIndexed.contains(javaOutputFolder)) {
- return;
- }
- alreadyIndexed.add(javaOutputFolder);
- int segmentCount = javaOutputFolder.getProjectRelativePath().segmentCount();
- indexClasses(javaOutputFolder, segmentCount);
- }
-
- private void indexClasses(IResource resource, int javaOutputSegmentCount) {
- switch (resource.getType()) {
- case IResource.FILE:
- indexClass((IFile) resource, javaOutputSegmentCount);
- break;
- case IResource.FOLDER:
- try {
- IResource[] members = ((IFolder) resource).members();
- for (int i = 0; i < members.length; i++) {
- indexClasses(members[i], javaOutputSegmentCount);
- }
- } catch (CoreException e) {
- Logger.getLogger().logError(e);
- }
- break;
- }
- }
-
- private void indexClass(IFile iFile, int javaOutputSegmentCount) {
- if (!JavaEEArchiveUtilities.isClass(iFile))
- return;
- if (classesMap == null)
- classesMap = new HashMap();
- String name = iFile.getName();
- IPath relPath = iFile.getProjectRelativePath().removeFirstSegments(javaOutputSegmentCount);
- String key = relPath.toString();
- if (name.indexOf('$') != -1) {
- key = key.substring(0, key.indexOf('$'));
- } else {
- key = key.substring(0, key.indexOf('.'));
- }
- List inners = (List) classesMap.get(key);
- if (inners == null) {
- inners = new ArrayList(1);
- classesMap.put(key, inners);
- }
- inners.add(iFile);
- }
-
- public List retrieveClasses(String key) {
- if (classesMap == null)
- return null;
- return (List) classesMap.get(key);
- }
-
- private boolean isDeploymentDescriptor(IFile iFile) {
- return knownDD.equals(iFile);
- }
-
- @Override
- protected IPath getDefaultModelObjectPath() {
- return new Path(J2EEConstants.RAR_DD_URI);
- }
-
- protected boolean shouldInclude(IVirtualContainer vContainer) {
- boolean isDDFolder = vComponent.getRootFolder().getFolder(J2EEConstants.META_INF).equals(vContainer);
- return isDDFolder || !inJavaSrc(vContainer);
- }
-
-}
diff --git a/plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/internal/archive/ConnectorComponentArchiveSaveAdapter.java b/plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/internal/archive/ConnectorComponentArchiveSaveAdapter.java
deleted file mode 100644
index d1dd89c15..000000000
--- a/plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/internal/archive/ConnectorComponentArchiveSaveAdapter.java
+++ /dev/null
@@ -1,21 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jst.j2ee.internal.archive;
-
-import org.eclipse.wst.common.componentcore.resources.IVirtualComponent;
-
-public class ConnectorComponentArchiveSaveAdapter extends J2EEComponentArchiveSaveAdapter {
-
- public ConnectorComponentArchiveSaveAdapter(IVirtualComponent vComponent) {
- super(vComponent);
- }
-
-}
diff --git a/plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/internal/archive/ConnectorComponentArchiveTypeHandler.java b/plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/internal/archive/ConnectorComponentArchiveTypeHandler.java
deleted file mode 100644
index 0393c78f4..000000000
--- a/plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/internal/archive/ConnectorComponentArchiveTypeHandler.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2005, 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jst.j2ee.internal.archive;
-
-import org.eclipse.core.runtime.Path;
-import org.eclipse.jst.j2ee.internal.J2EEConstants;
-import org.eclipse.jst.jee.archive.IArchive;
-import org.eclipse.jst.jee.archive.IArchiveHandler;
-
-public class ConnectorComponentArchiveTypeHandler implements IArchiveHandler {
-
- public boolean handlesArchive(IArchive archive) {
- if (archive.getLoadAdapter() instanceof ConnectorComponentArchiveLoadAdapter) {
- return true;
- } else if (archive.containsArchiveResource(new Path(J2EEConstants.RAR_DD_URI))) {
- return true;
- } else {
- // TODO handle the no DD case
- return false;
- }
- }
-
-}
diff --git a/plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/internal/archive/ConnectorComponentNestedJARArchiveLoadAdapter.java b/plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/internal/archive/ConnectorComponentNestedJARArchiveLoadAdapter.java
deleted file mode 100644
index 0812304d2..000000000
--- a/plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/internal/archive/ConnectorComponentNestedJARArchiveLoadAdapter.java
+++ /dev/null
@@ -1,151 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jst.j2ee.internal.archive;
-
-import java.io.FileNotFoundException;
-import java.io.IOException;
-import java.io.InputStream;
-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.IResource;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.Path;
-import org.eclipse.jst.j2ee.internal.J2EEConstants;
-import org.eclipse.jst.jee.archive.AbstractArchiveLoadAdapter;
-import org.eclipse.jst.jee.archive.ArchiveModelLoadException;
-import org.eclipse.jst.jee.archive.IArchiveResource;
-
-public class ConnectorComponentNestedJARArchiveLoadAdapter extends AbstractArchiveLoadAdapter {
-
- private List<IFile> iFiles;
-
- private int sourceSegmentCount;
-
- private int outputSegmentCount;
-
- private Map<IPath, IFile> pathsToIFiles;
-
- private Map<IPath, IArchiveResource> pathsToIArchiveResources;
-
- private IContainer sourceContainer;
-
- /**
- * Constructor for NestedJARLoadStrategyImpl.
- */
- public ConnectorComponentNestedJARArchiveLoadAdapter(List<IFile> iFiles, IContainer sourceContainer, IFolder javaOutputFolder) {
- super();
- this.iFiles = iFiles;
- this.sourceContainer = sourceContainer;
- sourceSegmentCount = sourceContainer.getProjectRelativePath().segmentCount();
- outputSegmentCount = javaOutputFolder.getProjectRelativePath().segmentCount();
- }
-
- public String toString() {
- int packageLength = this.getClass().getPackage().getName().length() + 1;
- StringBuffer buffer = new StringBuffer(this.getClass().getName().substring(packageLength));
- buffer.append(", Source Container: "); //$NON-NLS-1$
- buffer.append(sourceContainer.getName());
- return buffer.toString();
- }
-
- private boolean indexed = false;
-
- private List<IArchiveResource> fullIndex = null;
-
- public List<IArchiveResource> getArchiveResources() {
- if (!indexed) {
- indexed = true;
- pathsToIFiles = new HashMap<IPath, IFile>();
- pathsToIArchiveResources = new HashMap<IPath, IArchiveResource>();
- for (IFile iFile : iFiles) {
- IPath relPath;
- if (JavaEEArchiveUtilities.isClass(iFile)) {
- relPath = getRelativePath(iFile, outputSegmentCount);
- } else {
- relPath = getRelativePath(iFile, sourceSegmentCount);
- }
- addFile(iFile, relPath);
- }
- IPath manifestPath = new Path(J2EEConstants.MANIFEST_URI);
- if (!pathsToIArchiveResources.containsKey(manifestPath)) {
- IArchiveResource manifest = createManifest(manifestPath);
- pathsToIArchiveResources.put(manifest.getPath(), manifest);
- }
- List<IArchiveResource> list = new ArrayList();
- list.addAll(pathsToIArchiveResources.values());
- fullIndex = Collections.unmodifiableList(list);
- }
- return fullIndex;
- }
-
- protected void addFile(IFile iFile, IPath relPath) {
- IArchiveResource aFile = createFile(iFile, relPath);
- pathsToIArchiveResources.put(aFile.getPath(), aFile);
- pathsToIFiles.put(aFile.getPath(), iFile);
- }
-
- protected long getLastModified(IResource aResource) {
- return aResource.getLocation().toFile().lastModified();
- }
-
- private IArchiveResource createFile(IFile iFile, IPath relPath) {
- IArchiveResource cFile = createFile(relPath);
- cFile.setLastModified(getLastModified(iFile));
- return cFile;
- }
-
- private IPath getRelativePath(IFile file, int parentSegmentCount) {
- return file.getProjectRelativePath().removeFirstSegments(parentSegmentCount);
- }
-
- public boolean containsArchiveResource(IPath resourcePath) {
- if (!indexed) {
- getArchiveResources();
- }
- return pathsToIArchiveResources.containsKey(resourcePath);
- }
-
- public IArchiveResource getArchiveResource(IPath resourcePath) throws FileNotFoundException {
- if (!indexed) {
- getArchiveResources();
- }
- return pathsToIArchiveResources.get(resourcePath);
- }
-
- public InputStream getInputStream(IArchiveResource archiveResource) throws IOException, FileNotFoundException {
- IFile file = pathsToIFiles.get(archiveResource.getPath());
- if (file != null) {
- try {
- return file.getContents();
- } catch (CoreException core) {
- throw new IOException("Unable to get contents from " + file.getProjectRelativePath() + " message " + core.getLocalizedMessage());
- }
- }
- throw new FileNotFoundException(archiveResource.getPath().toString());
- }
-
- public boolean containsModelObject(IPath modelObjectPath) {
- return false;
- }
-
- public Object getModelObject(IPath modelObjectPath) throws ArchiveModelLoadException {
- return null; // no model objects here
- }
-
-}
diff --git a/plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/internal/archive/EARComponentArchiveLoadAdapter.java b/plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/internal/archive/EARComponentArchiveLoadAdapter.java
deleted file mode 100644
index 3b49f870b..000000000
--- a/plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/internal/archive/EARComponentArchiveLoadAdapter.java
+++ /dev/null
@@ -1,152 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 2008 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- * Stefan Dimov, stefan.dimov@sap.com - bug 207826
- * Kaloyan Raev, kaloyan.raev@sap.com - bug 220912
- *******************************************************************************/
-package org.eclipse.jst.j2ee.internal.archive;
-
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileNotFoundException;
-import java.io.IOException;
-import java.io.InputStream;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.Path;
-import org.eclipse.jst.j2ee.classpathdep.IClasspathDependencyConstants;
-import org.eclipse.jst.j2ee.componentcore.J2EEModuleVirtualComponent;
-import org.eclipse.jst.j2ee.internal.J2EEConstants;
-import org.eclipse.jst.j2ee.internal.classpathdep.ClasspathDependencyVirtualComponent;
-import org.eclipse.jst.j2ee.internal.project.J2EEProjectUtilities;
-import org.eclipse.jst.jee.archive.ArchiveOpenFailureException;
-import org.eclipse.jst.jee.archive.IArchive;
-import org.eclipse.jst.jee.archive.IArchiveLoadAdapter;
-import org.eclipse.jst.jee.archive.IArchiveResource;
-import org.eclipse.jst.jee.archive.internal.ArchiveUtil;
-import org.eclipse.jst.jee.util.internal.JavaEEQuickPeek;
-import org.eclipse.wst.common.componentcore.internal.resources.VirtualArchiveComponent;
-import org.eclipse.wst.common.componentcore.resources.IVirtualComponent;
-import org.eclipse.wst.common.componentcore.resources.IVirtualReference;
-
-public class EARComponentArchiveLoadAdapter extends ComponentArchiveLoadAdapter {
-
- // Optimization to directly copy binary files
- private Map<IArchiveResource, File> binaryResourcesToDiskFiles = new HashMap<IArchiveResource, File>();
-
- public EARComponentArchiveLoadAdapter(IVirtualComponent vComponent) {
- super(vComponent);
- }
-
- public EARComponentArchiveLoadAdapter(IVirtualComponent vComponent, boolean includeClasspathComponents) {
- super(vComponent, includeClasspathComponents);
- }
-
- public List<IArchiveResource> getArchiveResources() {
- aggregateSourceFiles();
- addModulesAndUtilities();
- List<IArchiveResource> files = filesHolder.getFiles();
- IPath manifestPath = new Path(J2EEConstants.MANIFEST_URI);
- if (!filesHolder.contains(manifestPath)) {
- IArchiveResource manifest = createManifest(manifestPath);
- files.add(manifest);
- }
- return files;
- }
-
- public InputStream getInputStream(IArchiveResource archiveResource) throws IOException, FileNotFoundException {
- if (binaryResourcesToDiskFiles.containsKey(archiveResource)) {
- java.io.File diskFile = binaryResourcesToDiskFiles.get(archiveResource);
- return new FileInputStream(diskFile);
- }
- return super.getInputStream(archiveResource);
- }
-
- public void addModulesAndUtilities() {
- IVirtualReference[] components = J2EEProjectUtilities.getComponentReferences(vComponent);
- for (int i = 0; i < components.length; i++) {
- IVirtualReference reference = components[i];
- IVirtualComponent referencedComponent = reference.getReferencedComponent();
-
- try {
- IArchive nestedModuleArchive = JavaEEArchiveUtilities.INSTANCE.openArchive(referencedComponent);
- String sPath = reference.getArchiveName();
- String srtp = reference.getRuntimePath().toString();
- if (srtp.startsWith("" + IPath.SEPARATOR)) srtp = srtp.substring(1);
- String spt = srtp + IPath.SEPARATOR + sPath;
- if (spt.startsWith("" + IPath.SEPARATOR)) spt = spt.substring(1);
- nestedModuleArchive.setPath(new Path(spt));
- nestedModuleArchive.setArchive(archive);
- filesHolder.addFile(nestedModuleArchive);
-
- if (referencedComponent.isBinary()) {
- java.io.File diskFile = null;
- diskFile = ((VirtualArchiveComponent) referencedComponent).getUnderlyingDiskFile();
- if (!diskFile.exists()) {
- IFile wbFile = ((VirtualArchiveComponent) referencedComponent).getUnderlyingWorkbenchFile();
- diskFile = new File(wbFile.getLocation().toOSString());
- }
- binaryResourcesToDiskFiles.put(nestedModuleArchive, diskFile);
- } else {
- // Bug 220912 - set "export source" flag before calling JavaEEQuickPeek
- if (nestedModuleArchive.getType() == IArchive.ARCHIVE_TYPE) {
- IArchiveLoadAdapter nestedLoadAdapter = (IArchiveLoadAdapter)((IArchive)nestedModuleArchive).getLoadAdapter();
- if(nestedLoadAdapter instanceof ComponentArchiveLoadAdapter){
- ((ComponentArchiveLoadAdapter)nestedLoadAdapter).setExportSource(isExportSource());
- }
- }
-
- JavaEEQuickPeek quickPeek = JavaEEArchiveUtilities.INSTANCE.getJavaEEQuickPeek(nestedModuleArchive);
- switch (quickPeek.getType()) {
- case JavaEEQuickPeek.CONNECTOR_TYPE:
- case JavaEEQuickPeek.EJB_TYPE:
- case JavaEEQuickPeek.WEB_TYPE:
- ((ComponentArchiveLoadAdapter) nestedModuleArchive.getLoadAdapter()).setIncludeClasspathComponents(includeClasspathComponents);
- addClasspathComponentDependencies(referencedComponent);
- }
-
- }
- } catch (ArchiveOpenFailureException e) {
- ArchiveUtil.warn(e);
- }
- }
- }
-
- private void addClasspathComponentDependencies(final IVirtualComponent referencedComponent) {
- // retrieve all Java classpath component dependencies
- if (includeClasspathComponents && referencedComponent instanceof J2EEModuleVirtualComponent) {
- final IVirtualReference[] cpRefs = ((J2EEModuleVirtualComponent) referencedComponent).getJavaClasspathReferences();
- for (int j = 0; j < cpRefs.length; j++) {
- final IVirtualReference ref = cpRefs[j];
- // only ../ runtime paths contribute to the EAR
- if (ref.getRuntimePath().equals(IClasspathDependencyConstants.RUNTIME_MAPPING_INTO_CONTAINER_PATH)) {
- if (ref.getReferencedComponent() instanceof ClasspathDependencyVirtualComponent) {
- final ClasspathDependencyVirtualComponent comp = (ClasspathDependencyVirtualComponent) ref.getReferencedComponent();
- File cpEntryFile = comp.getUnderlyingDiskFile();
- if (!cpEntryFile.exists()) {
- final IFile wbFile = comp.getUnderlyingWorkbenchFile();
- cpEntryFile = new File(wbFile.getLocation().toOSString());
- }
- addExternalFile(new Path(ref.getArchiveName()), cpEntryFile);
- }
- }
- }
- }
- }
-
- @Override
- protected IPath getDefaultModelObjectPath() {
- return new Path(J2EEConstants.APPLICATION_DD_URI);
- }
-
-}
diff --git a/plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/internal/archive/EARComponentArchiveSaveAdapter.java b/plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/internal/archive/EARComponentArchiveSaveAdapter.java
deleted file mode 100644
index 7a5ff80cf..000000000
--- a/plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/internal/archive/EARComponentArchiveSaveAdapter.java
+++ /dev/null
@@ -1,21 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jst.j2ee.internal.archive;
-
-import org.eclipse.wst.common.componentcore.resources.IVirtualComponent;
-
-public class EARComponentArchiveSaveAdapter extends ComponentArchiveSaveAdapter {
-
- public EARComponentArchiveSaveAdapter(IVirtualComponent component) {
- super(component);
- }
-
-}
diff --git a/plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/internal/archive/EARComponentArchiveTypeHandler.java b/plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/internal/archive/EARComponentArchiveTypeHandler.java
deleted file mode 100644
index c1b81438e..000000000
--- a/plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/internal/archive/EARComponentArchiveTypeHandler.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2005, 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jst.j2ee.internal.archive;
-
-import org.eclipse.core.runtime.Path;
-import org.eclipse.jst.j2ee.internal.J2EEConstants;
-import org.eclipse.jst.jee.archive.IArchive;
-import org.eclipse.jst.jee.archive.IArchiveHandler;
-
-public class EARComponentArchiveTypeHandler implements IArchiveHandler {
-
- public boolean handlesArchive(IArchive archive) {
- if (archive.getLoadAdapter() instanceof EARComponentArchiveLoadAdapter) {
- return true;
- } else if (archive.containsArchiveResource(new Path(J2EEConstants.APPLICATION_DD_URI))) {
- return true;
- } else {
- // TODO handle the no DD case
- return false;
- }
- }
-
-}
diff --git a/plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/internal/archive/EJBComponentArchiveLoadAdapter.java b/plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/internal/archive/EJBComponentArchiveLoadAdapter.java
deleted file mode 100644
index 9eef178d3..000000000
--- a/plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/internal/archive/EJBComponentArchiveLoadAdapter.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jst.j2ee.internal.archive;
-
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.Path;
-import org.eclipse.jst.j2ee.internal.J2EEConstants;
-import org.eclipse.wst.common.componentcore.resources.IVirtualComponent;
-
-public class EJBComponentArchiveLoadAdapter extends J2EEComponentArchiveLoadAdapter {
-
- public EJBComponentArchiveLoadAdapter(IVirtualComponent vComponent) {
- this(vComponent, true);
- }
-
- public EJBComponentArchiveLoadAdapter(IVirtualComponent vComponent, boolean includeClasspathComponents) {
- super(vComponent, includeClasspathComponents);
- }
-
- protected IPath getDefaultModelObjectPath() {
- return new Path(J2EEConstants.EJBJAR_DD_URI);
- }
-}
diff --git a/plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/internal/archive/EJBComponentArchiveSaveAdapter.java b/plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/internal/archive/EJBComponentArchiveSaveAdapter.java
deleted file mode 100644
index 0c04bfe96..000000000
--- a/plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/internal/archive/EJBComponentArchiveSaveAdapter.java
+++ /dev/null
@@ -1,22 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jst.j2ee.internal.archive;
-
-import org.eclipse.wst.common.componentcore.resources.IVirtualComponent;
-
-public class EJBComponentArchiveSaveAdapter extends J2EEComponentArchiveSaveAdapter {
-
- public EJBComponentArchiveSaveAdapter(IVirtualComponent vComponent) {
- super(vComponent);
- }
-
-
-}
diff --git a/plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/internal/archive/EJBComponentArchiveTypeHandler.java b/plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/internal/archive/EJBComponentArchiveTypeHandler.java
deleted file mode 100644
index fd90d8d92..000000000
--- a/plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/internal/archive/EJBComponentArchiveTypeHandler.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2005, 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jst.j2ee.internal.archive;
-
-import org.eclipse.core.runtime.Path;
-import org.eclipse.jst.j2ee.internal.J2EEConstants;
-import org.eclipse.jst.jee.archive.IArchive;
-import org.eclipse.jst.jee.archive.IArchiveHandler;
-
-public class EJBComponentArchiveTypeHandler implements IArchiveHandler {
-
- public boolean handlesArchive(IArchive archive) {
- if (archive.getLoadAdapter() instanceof EJBComponentArchiveLoadAdapter) {
- return true;
- } else if (archive.containsArchiveResource(new Path(J2EEConstants.EJBJAR_DD_URI))) {
- return true;
- } else {
- // TODO handle the no DD case
- return false;
- }
- }
-
-}
diff --git a/plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/internal/archive/J2EEComponentArchiveLoadAdapter.java b/plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/internal/archive/J2EEComponentArchiveLoadAdapter.java
deleted file mode 100644
index f7cd5d395..000000000
--- a/plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/internal/archive/J2EEComponentArchiveLoadAdapter.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jst.j2ee.internal.archive;
-
-import java.util.List;
-
-import org.eclipse.jst.j2ee.classpathdep.IClasspathDependencyConstants;
-import org.eclipse.jst.jee.archive.IArchiveResource;
-import org.eclipse.wst.common.componentcore.resources.IVirtualComponent;
-
-public abstract class J2EEComponentArchiveLoadAdapter extends ComponentArchiveLoadAdapter{
-
- public J2EEComponentArchiveLoadAdapter(IVirtualComponent component) {
- super(component);
- }
-
- public J2EEComponentArchiveLoadAdapter(IVirtualComponent component, boolean includeClasspathComponents) {
- super(component, includeClasspathComponents);
- }
-
- public List <IArchiveResource> getArchiveResources() {
- super.getArchiveResources();
- if (includeClasspathComponents) {
- addMappedClassFolders(IClasspathDependencyConstants.RUNTIME_MAPPING_INTO_COMPONENT_PATH);
- }
- return filesHolder.getFiles();
- }
-}
diff --git a/plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/internal/archive/J2EEComponentArchiveSaveAdapter.java b/plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/internal/archive/J2EEComponentArchiveSaveAdapter.java
deleted file mode 100644
index 95b12b547..000000000
--- a/plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/internal/archive/J2EEComponentArchiveSaveAdapter.java
+++ /dev/null
@@ -1,175 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jst.j2ee.internal.archive;
-
-import org.eclipse.core.resources.IContainer;
-import org.eclipse.core.resources.IFolder;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.NullProgressMonitor;
-import org.eclipse.core.runtime.Path;
-import org.eclipse.core.runtime.SubProgressMonitor;
-import org.eclipse.jdt.core.IClasspathEntry;
-import org.eclipse.jdt.core.IJavaProject;
-import org.eclipse.jdt.core.JavaCore;
-import org.eclipse.jem.util.logger.proxy.Logger;
-import org.eclipse.jem.workbench.utility.JemProjectUtilities;
-import org.eclipse.jst.jee.archive.ArchiveSaveFailureException;
-import org.eclipse.jst.jee.archive.IArchiveResource;
-import org.eclipse.wst.common.componentcore.resources.IVirtualComponent;
-
-import com.ibm.icu.util.StringTokenizer;
-
-public abstract class J2EEComponentArchiveSaveAdapter extends ComponentArchiveSaveAdapter {
-
- protected final String DOT_CLASS = ".class"; //$NON-NLS-1$
-
- protected final String DOT_JAVA = ".java"; //$NON-NLS-1$
-
- protected final String IMPORTED_CLASSES = "ImportedClasses"; //$NON-NLS-1$
-
- public J2EEComponentArchiveSaveAdapter(IVirtualComponent vComponent) {
- super(vComponent);
- }
-
- public void save(IProgressMonitor monitor) throws ArchiveSaveFailureException {
- final int SUPER_TICKS = 1000;
- final int LOCAL_TICKS = 10;
- final int REFRESH_TICKS = 100;
- final int TOTAL_TICKS = SUPER_TICKS + LOCAL_TICKS + REFRESH_TICKS;
-
- try {
- monitor.beginTask("Importing " + vComponent.getName(), TOTAL_TICKS);
- super.save(new SubProgressMonitor(monitor, SUPER_TICKS));
- linkImportedClassesFolderIfNecessary();
- monitor.worked(LOCAL_TICKS);
- try {
- vComponent.getProject().refreshLocal(IResource.DEPTH_INFINITE, new SubProgressMonitor(monitor, REFRESH_TICKS));
- } catch (CoreException ex) {
- Logger.getLogger().logError(ex);
- }
- } finally {
- monitor.done();
- }
- }
-
- public boolean endsWithClassType(String aFileName) {
-
- if (aFileName != null && aFileName.endsWith(DOT_CLASS))
- return true;
- return false;
- }
-
- protected boolean shouldSave(IArchiveResource aFile) {
- if (endsWithClassType(aFile.getPath().lastSegment())) {
- boolean shouldSave = isClassWithoutSource(aFile);
- if (shouldSave && !importedClassesFolderCreated) {
- createImportedClassesFolder();
- }
- return shouldSave;
- }
- return super.shouldSave(aFile);
- }
-
- /*
- * public void save(ArchiveManifest aManifest) throws SaveFailureException {
- * IVirtualFolder rootFolder = vComponent.getRootFolder(); IVirtualFile
- * vFile = rootFolder.getFile(new Path(J2EEConstants.MANIFEST_URI)); IFile
- * iFile = vFile.getUnderlyingFile(); validateEdit(iFile); OutputStream out =
- * new WorkbenchByteArrayOutputStream(iFile); try { aManifest.write(out); }
- * catch (IOException e) { Logger.getLogger().logError(e); } finally { try {
- * out.close(); } catch (IOException e) { Logger.getLogger().logError(e); } } }
- */
- protected boolean importedClassesFolderCreated = false;
-
- protected IFolder importedClassesFolder;
-
- protected void createImportedClassesFolder() {
- importedClassesFolderCreated = true;
- IContainer jarParent = vComponent.getRootFolder().getUnderlyingFolder().getParent();
- importedClassesFolder = jarParent.getFolder(new Path(IMPORTED_CLASSES));
- try {
- importedClassesFolder.create(true, true, null);
- } catch (CoreException e1) {
- Logger.getLogger().logError(e1);
- }
- }
-
- protected void linkImportedClassesFolderIfNecessary() {
- if (importedClassesFolder != null) {
- try {
- vComponent.getRootFolder().getFolder(getImportedClassesRuntimePath()).createLink(importedClassesFolder.getProjectRelativePath(), 0, null);
- if (shouldAddImportedClassesToClasspath()) {
- if (JemProjectUtilities.getJavaProject(vComponent.getProject()) != null) {
- IJavaProject javaProject = JavaCore.create(vComponent.getProject());
- IClasspathEntry[] javaClasspath = javaProject.getRawClasspath();
- IClasspathEntry[] newJavaClasspath = new IClasspathEntry[javaClasspath.length + 1];
- System.arraycopy(javaClasspath, 0, newJavaClasspath, 0, javaClasspath.length);
- newJavaClasspath[newJavaClasspath.length - 1] = JavaCore.newLibraryEntry(importedClassesFolder.getFullPath(), null, null, true);
- javaProject.setRawClasspath(newJavaClasspath, new NullProgressMonitor());
- }
- }
- } catch (CoreException e) {
- Logger.getLogger().logError(e);
- }
- }
- }
-
- protected boolean shouldAddImportedClassesToClasspath() {
- return true;
- }
-
- protected IPath getImportedClassesRuntimePath() {
- return new Path("/");
- }
-
- @Override
- protected IPath getProjectRelativePath(IArchiveResource aFile) {
- if (endsWithClassType(aFile.getPath().lastSegment())) {
- return importedClassesFolder.getFile(getImportedClassesURI(aFile)).getProjectRelativePath();
- }
- return super.getProjectRelativePath(aFile);
- }
-
- protected IPath getImportedClassesURI(IArchiveResource aFile) {
- return aFile.getPath();
- }
-
- protected boolean isClassWithoutSource(IArchiveResource aFile) {
- String javaUri = classUriToJavaUri(aFile.getPath().toString());
- if (javaUri == null)
- return false;
- return !archive.containsArchiveResource(new Path(javaUri));
- }
-
- public String classUriToJavaUri(String classUri) {
- if (classUri == null || !classUri.endsWith(DOT_CLASS))
- return null;
-
- String truncated = truncateIgnoreCase(classUri, DOT_CLASS);
- StringTokenizer tok = new StringTokenizer(truncated, "$"); //$NON-NLS-1$
- return tok.nextToken().concat(DOT_JAVA);
- }
-
- /**
- * Return a substring of the first parameter, up to the last index of the
- * second
- */
- public static String truncateIgnoreCase(String aString, String trailingSubString) {
- int index = aString.toLowerCase().lastIndexOf(trailingSubString.toLowerCase());
- if (index != -1)
- return aString.substring(0, index);
- return aString;
- }
-
-}
diff --git a/plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/internal/archive/J2EEJavaComponentArchiveSaveAdapter.java b/plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/internal/archive/J2EEJavaComponentArchiveSaveAdapter.java
deleted file mode 100644
index d53454bea..000000000
--- a/plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/internal/archive/J2EEJavaComponentArchiveSaveAdapter.java
+++ /dev/null
@@ -1,20 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jst.j2ee.internal.archive;
-
-import org.eclipse.wst.common.componentcore.resources.IVirtualComponent;
-
-public class J2EEJavaComponentArchiveSaveAdapter extends J2EEComponentArchiveSaveAdapter {
-
- public J2EEJavaComponentArchiveSaveAdapter(IVirtualComponent vComponent) {
- super(vComponent);
- }
-}
diff --git a/plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/internal/archive/JavaComponentArchiveLoadAdapter.java b/plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/internal/archive/JavaComponentArchiveLoadAdapter.java
deleted file mode 100644
index 4aeb03dfb..000000000
--- a/plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/internal/archive/JavaComponentArchiveLoadAdapter.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jst.j2ee.internal.archive;
-
-import java.util.List;
-
-import org.eclipse.jst.j2ee.classpathdep.IClasspathDependencyConstants;
-import org.eclipse.jst.jee.archive.IArchiveResource;
-import org.eclipse.wst.common.componentcore.resources.IVirtualComponent;
-
-public class JavaComponentArchiveLoadAdapter extends ComponentArchiveLoadAdapter {
-
- public JavaComponentArchiveLoadAdapter(IVirtualComponent vComponent) {
- super(vComponent);
- }
-
- public JavaComponentArchiveLoadAdapter(IVirtualComponent vComponent, boolean includeClasspathComponents) {
- super(vComponent, includeClasspathComponents);
- }
-
- public List <IArchiveResource> getArchiveResources() {
- super.getArchiveResources();
- if (includeClasspathComponents) {
- addMappedClassFolders(IClasspathDependencyConstants.RUNTIME_MAPPING_INTO_COMPONENT_PATH);
- }
- return filesHolder.getFiles();
- }
-
-}
diff --git a/plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/internal/archive/JavaComponentArchiveSaveAdapter.java b/plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/internal/archive/JavaComponentArchiveSaveAdapter.java
deleted file mode 100644
index 585d873d4..000000000
--- a/plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/internal/archive/JavaComponentArchiveSaveAdapter.java
+++ /dev/null
@@ -1,21 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jst.j2ee.internal.archive;
-
-import org.eclipse.wst.common.componentcore.resources.IVirtualComponent;
-
-public class JavaComponentArchiveSaveAdapter extends ComponentArchiveSaveAdapter {
-
- public JavaComponentArchiveSaveAdapter(IVirtualComponent vComponent) {
- super(vComponent);
- }
-
-}
diff --git a/plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/internal/archive/JavaEEArchiveUtilities.java b/plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/internal/archive/JavaEEArchiveUtilities.java
deleted file mode 100644
index 02cf96814..000000000
--- a/plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/internal/archive/JavaEEArchiveUtilities.java
+++ /dev/null
@@ -1,746 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2005, 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jst.j2ee.internal.archive;
-
-import java.io.FileNotFoundException;
-import java.io.IOException;
-import java.io.InputStream;
-import java.util.Arrays;
-import java.util.List;
-import java.util.Map;
-import java.util.WeakHashMap;
-import java.util.jar.Attributes;
-import java.util.jar.Manifest;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.Path;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.jdt.core.ToolFactory;
-import org.eclipse.jdt.core.util.IAnnotation;
-import org.eclipse.jdt.core.util.IClassFileAttribute;
-import org.eclipse.jdt.core.util.IClassFileReader;
-import org.eclipse.jdt.core.util.IRuntimeVisibleAnnotationsAttribute;
-import org.eclipse.jst.j2ee.componentcore.J2EEModuleVirtualArchiveComponent;
-import org.eclipse.jst.j2ee.internal.J2EEConstants;
-import org.eclipse.jst.j2ee.internal.J2EEVersionConstants;
-import org.eclipse.jst.j2ee.internal.componentcore.JavaEEBinaryComponentLoadAdapter;
-import org.eclipse.jst.j2ee.internal.project.J2EEProjectUtilities;
-import org.eclipse.jst.j2ee.project.EarUtilities;
-import org.eclipse.jst.j2ee.project.JavaEEProjectUtilities;
-import org.eclipse.jst.jee.archive.ArchiveModelLoadException;
-import org.eclipse.jst.jee.archive.ArchiveOpenFailureException;
-import org.eclipse.jst.jee.archive.ArchiveOptions;
-import org.eclipse.jst.jee.archive.IArchive;
-import org.eclipse.jst.jee.archive.IArchiveFactory;
-import org.eclipse.jst.jee.archive.IArchiveLoadAdapter;
-import org.eclipse.jst.jee.archive.IArchiveResource;
-import org.eclipse.jst.jee.archive.internal.ArchiveFactoryImpl;
-import org.eclipse.jst.jee.archive.internal.ArchiveImpl;
-import org.eclipse.jst.jee.archive.internal.ArchiveUtil;
-import org.eclipse.jst.jee.archive.internal.ZipFileArchiveLoadAdapterImpl;
-import org.eclipse.jst.jee.util.internal.JavaEEQuickPeek;
-import org.eclipse.wst.common.componentcore.ComponentCore;
-import org.eclipse.wst.common.componentcore.resources.IVirtualComponent;
-
-public class JavaEEArchiveUtilities extends ArchiveFactoryImpl implements IArchiveFactory {
-
- /**
- * Default value = Boolean.TRUE Valid values = Boolean.TRUE or Boolean.FALSE
- *
- * An ArchiveOption used to specify whether
- * {@link #openArchive(ArchiveOptions)} should attempt to discriminate
- * between different Java EE archive types. The default behavior is to
- * always discriminate fully for all types except EJB 3.0 archives
- * {@link #DISCRIMINATE_EJB_ANNOTATIONS}. In order to fully discriminate
- * EJB 3.0 archives, it is necessary to set both this flag and
- * {@link #DISCRIMINATE_EJB_ANNOTATIONS} to true.
- */
- public static final String DISCRIMINATE_JAVA_EE = "DISCRIMINATE_EJB"; //$NON-NLS-1$
-
- /**
- * Default value = Boolean.TRUE Valid values = Boolean.TRUE or Boolean.FALSE
- *
- * An ArchiveOption used to specify whether
- * {@link #openArchive(ArchiveOptions)} should attempt to fully discriminate
- * a JAR file from an EJB JAR file. This option is only relevant if the
- * {@link #DISCRIMINATE_JAVA_EE} option is also set to Boolean.TRUE. If both
- * options are set to true then as a last resort all .class files byte codes
- * will be analyzed for EJB annotations in order to discriminate whether the
- * specified IArchive is an EJB 3.0 jar.
- */
- public static final String DISCRIMINATE_EJB_ANNOTATIONS = "DISCRIMINATE_EJB_ANNOTATIONS"; //$NON-NLS-1$
-
- /**
- * Default value = null
- *
- * An ArchiveOption used to specify the original load adapter in the case it
- * swapped out with an {@link #JavaEEWrappingLoadAdapter}.
- */
- public static final String WRAPPED_LOAD_ADAPTER = "WRAPPED_LOAD_ADAPTER"; //$NON-NLS-1$
-
- private JavaEEArchiveUtilities() {
- }
-
- public static JavaEEArchiveUtilities INSTANCE = new JavaEEArchiveUtilities();
-
- public static final String DOT_JAVA = ".java"; //$NON-NLS-1$
-
- public static final String DOT_CLASS = ".class"; //$NON-NLS-1$
-
- public static boolean isJava(IFile iFile) {
- return hasExtension(iFile, DOT_JAVA);
- }
-
- public static boolean isClass(IFile iFile) {
- return hasExtension(iFile, DOT_CLASS);
- }
-
- public static boolean hasExtension(IFile iFile, String ext) {
- String name = iFile.getName();
- return hasExtension(name, ext);
- }
-
- public static boolean hasExtension(String name, String ext) {
- int offset = ext.length();
- return name.regionMatches(true, name.length() - offset, ext, 0, offset);
- }
-
- public IArchive openArchive(IVirtualComponent virtualComponent) throws ArchiveOpenFailureException {
- if (virtualComponent.isBinary()) {
- J2EEModuleVirtualArchiveComponent archiveComponent = (J2EEModuleVirtualArchiveComponent) virtualComponent;
- JavaEEBinaryComponentLoadAdapter loadAdapter = new JavaEEBinaryComponentLoadAdapter(archiveComponent);
- ArchiveOptions archiveOptions = new ArchiveOptions();
- archiveOptions.setOption(ArchiveOptions.LOAD_ADAPTER, loadAdapter);
- archiveOptions.setOption(ArchiveOptions.ARCHIVE_PATH, loadAdapter.getArchivePath());
- IArchive parentEARArchive = null;
- try {
- if(archiveComponent.isLinkedToEAR()){
- try {
- IProject earProject = virtualComponent.getProject();
- if(earProject != null && EarUtilities.isEARProject(earProject)){
- IVirtualComponent earComponent = ComponentCore.createComponent(virtualComponent.getProject());
- if(earComponent != null) {
- parentEARArchive = openArchive(earComponent);
- if(parentEARArchive != null) {
- archiveOptions.setOption(ArchiveOptions.PARENT_ARCHIVE, parentEARArchive);
- }
- }
- }
- } catch(ArchiveOpenFailureException e) {
- org.eclipse.jst.j2ee.internal.plugin.J2EEPlugin.logError(e);
- }
- }
- return openArchive(archiveOptions);
- } finally {
- if(parentEARArchive != null){
- archiveOptions.removeOption(ArchiveOptions.PARENT_ARCHIVE);
- closeArchive(parentEARArchive);
- }
- }
- }
- int type = J2EEVersionConstants.UNKNOWN;
- IArchiveLoadAdapter archiveLoadAdapter = null;
- if (J2EEProjectUtilities.isEARProject(virtualComponent.getProject())) {
- archiveLoadAdapter = new EARComponentArchiveLoadAdapter(virtualComponent);
- type = J2EEVersionConstants.APPLICATION_TYPE;
- } else if (J2EEProjectUtilities.isEJBComponent(virtualComponent)) {
- archiveLoadAdapter = new EJBComponentArchiveLoadAdapter(virtualComponent);
- type = J2EEVersionConstants.EJB_TYPE;
- } else if (J2EEProjectUtilities.isApplicationClientComponent(virtualComponent)) {
- archiveLoadAdapter = new AppClientComponentArchiveLoadAdapter(virtualComponent);
- type = J2EEVersionConstants.APPLICATION_CLIENT_TYPE;
- } else if (J2EEProjectUtilities.isJCAComponent(virtualComponent)) {
- archiveLoadAdapter = new ConnectorComponentArchiveLoadAdapter(virtualComponent);
- type = J2EEVersionConstants.CONNECTOR_TYPE;
- } else if (J2EEProjectUtilities.isDynamicWebComponent(virtualComponent)) {
- archiveLoadAdapter = new WebComponentArchiveLoadAdapter(virtualComponent);
- type = J2EEVersionConstants.WEB_TYPE;
- } else if (J2EEProjectUtilities.isUtilityProject(virtualComponent.getProject())) {
- archiveLoadAdapter = new JavaComponentArchiveLoadAdapter(virtualComponent);
- }
-
- if (archiveLoadAdapter != null) {
- ArchiveOptions options = new ArchiveOptions();
- options.setOption(ArchiveOptions.LOAD_ADAPTER, archiveLoadAdapter);
- IArchive archive = super.openArchive(options);
- if (type != J2EEVersionConstants.UNKNOWN) {
- int version = J2EEVersionConstants.UNKNOWN;
- String versionStr = JavaEEProjectUtilities.getJ2EEDDProjectVersion(virtualComponent.getProject());
- if(versionStr == null){
- versionStr = J2EEProjectUtilities.getJ2EEProjectVersion(virtualComponent.getProject());
- }
- switch (type) {
- case J2EEVersionConstants.APPLICATION_CLIENT_TYPE:
- case J2EEVersionConstants.APPLICATION_TYPE:
- if (versionStr.equals(J2EEVersionConstants.VERSION_1_2_TEXT)) {
- version = J2EEVersionConstants.J2EE_1_2_ID;
- } else if (versionStr.equals(J2EEVersionConstants.VERSION_1_3_TEXT)) {
- version = J2EEVersionConstants.J2EE_1_3_ID;
- } else if (versionStr.equals(J2EEVersionConstants.VERSION_1_4_TEXT)) {
- version = J2EEVersionConstants.J2EE_1_4_ID;
- } else if (versionStr.equals(J2EEVersionConstants.VERSION_5_0_TEXT)) {
- version = J2EEVersionConstants.JEE_5_0_ID;
- }
- break;
- case J2EEVersionConstants.CONNECTOR_TYPE:
- if (versionStr.equals(J2EEVersionConstants.VERSION_1_0_TEXT)) {
- version = J2EEVersionConstants.JCA_1_0_ID;
- } else if (versionStr.equals(J2EEVersionConstants.VERSION_1_5_TEXT)) {
- version = J2EEVersionConstants.JCA_1_5_ID;
- }
- break;
- case J2EEVersionConstants.EJB_TYPE:
- if (versionStr.equals(J2EEVersionConstants.VERSION_1_1_TEXT)) {
- version = J2EEVersionConstants.EJB_1_1_ID;
- } else if (versionStr.equals(J2EEVersionConstants.VERSION_2_0_TEXT)) {
- version = J2EEVersionConstants.EJB_2_0_ID;
- } else if (versionStr.equals(J2EEVersionConstants.VERSION_2_1_TEXT)) {
- version = J2EEVersionConstants.EJB_2_1_ID;
- } else if (versionStr.equals(J2EEVersionConstants.VERSION_3_0_TEXT)) {
- version = J2EEVersionConstants.EJB_3_0_ID;
- }
- break;
- case J2EEVersionConstants.WEB_TYPE:
- if (versionStr.equals(J2EEVersionConstants.VERSION_2_2_TEXT)) {
- version = J2EEVersionConstants.WEB_2_2_ID;
- } else if (versionStr.equals(J2EEVersionConstants.VERSION_2_3_TEXT)) {
- version = J2EEVersionConstants.WEB_2_3_ID;
- } else if (versionStr.equals(J2EEVersionConstants.VERSION_2_4_TEXT)) {
- version = J2EEVersionConstants.WEB_2_4_ID;
- } else if (versionStr.equals(J2EEVersionConstants.VERSION_2_5_TEXT)) {
- version = J2EEVersionConstants.WEB_2_5_ID;
- }
- break;
- }
- if (version != J2EEVersionConstants.UNKNOWN) {
- archiveToJavaEEQuickPeek.put(archive, new JavaEEQuickPeek(type, version));
- }
- }
- return archive;
- }
- return null;
- }
-
- private Map<IArchive, JavaEEQuickPeek> archiveToJavaEEQuickPeek = new WeakHashMap<IArchive, JavaEEQuickPeek>();
-
- /**
- * Returns a utility for getting the type of Java EE archive, the Java EE
- * version, and the Module version
- *
- * @param archive
- * @return
- */
- public JavaEEQuickPeek getJavaEEQuickPeek(IArchive archive) {
- if (archiveToJavaEEQuickPeek.containsKey(archive)) {
- return archiveToJavaEEQuickPeek.get(archive);
- } else {
- String[] deploymentDescriptorsToCheck = new String[] { J2EEConstants.APPLICATION_DD_URI, J2EEConstants.APP_CLIENT_DD_URI, J2EEConstants.EJBJAR_DD_URI, J2EEConstants.WEBAPP_DD_URI,
- J2EEConstants.RAR_DD_URI };
- for (int i = 0; i < deploymentDescriptorsToCheck.length; i++) {
- final IPath deploymentDescriptorPath = new Path(deploymentDescriptorsToCheck[i]);
- if (archive.containsArchiveResource(deploymentDescriptorPath)) {
- InputStream in = null;
- IArchiveResource dd;
- try {
- dd = archive.getArchiveResource(deploymentDescriptorPath);
- in = dd.getInputStream();
- JavaEEQuickPeek quickPeek = new JavaEEQuickPeek(in);
- archiveToJavaEEQuickPeek.put(archive, quickPeek);
- return quickPeek;
- } catch (FileNotFoundException e) {
- ArchiveUtil.warn(e);
- } catch (IOException e) {
- ArchiveUtil.warn(e);
- }
- }
- }
- JavaEEQuickPeek quickPeek = new JavaEEQuickPeek(null);
- archiveToJavaEEQuickPeek.put(archive, quickPeek);
- return quickPeek;
- }
- }
-
- /**
- * Returns an IArchive. This method will attempt to discriminate the
- * specific Java EE archive type based on the following simple rules. Please
- * note that these rules do not adhere exactly to the Java EE specification
- * because they are written for a tooling environment rather than a runtime
- * environment. Thus these rules attempt to compensate for user error with
- * the understanding that other areas of the tooling environment will help
- * detect and correct these errors.
- *
- * <ol>
- * <li> An archive containing a deployment descriptor is considered to be of
- * that type </li>
- * <li> An archive whose name ends with '.ear' is considered an EAR </li>
- * <li> An archive whose name ends with '.war' is considered a WAR </li>
- * <li> An archive whose name ends with '.jar' and which contains a
- * META-INF/MANIFEST.MF file containing a Main-class attribute is considered
- * an Application Client </li>
- * <li> If the ArchiveOptions specify the
- * {@link #DISCRIMINATE_EJB_ANNOTATIONS} as Boolean.TRUE then if the archive
- * contains any .class file with EJB annotations it is considered an EJB
- * JAR. Be warned that this full check does have performance implications
- * and is not done by default.</li>
- * An archive whose name ends with '.jar' is considered a Utility </li>
- * </ol>
- */
- public IArchive openArchive(ArchiveOptions archiveOptions) throws ArchiveOpenFailureException {
- IArchive simpleArchive = super.openArchive(archiveOptions);
- Object discriminateJavaEE = archiveOptions.getOption(DISCRIMINATE_JAVA_EE);
- if (discriminateJavaEE != null && !((Boolean) discriminateJavaEE).booleanValue()) {
- return simpleArchive;
- }
- return refineForJavaEE(simpleArchive);
- }
-
- private static final String DOT_EAR = ".ear";//$NON-NLS-1$
-
- private static final String DOT_WAR = ".war";//$NON-NLS-1$
-
- private static final String DOT_JAR = ".jar";//$NON-NLS-1$
-
- private IArchive refineForJavaEE(final IArchive simpleArchive) {
- //Check to see if this archive is actually being opened as a nested archive from within an EAR
- //if it is then the EAR's DD needs to be checked to see exactly what type of archive this is.
- if (simpleArchive.getArchiveOptions().hasOption(ArchiveOptions.PARENT_ARCHIVE)) {
- IArchive parent = (IArchive) simpleArchive.getArchiveOptions().getOption(ArchiveOptions.PARENT_ARCHIVE);
- JavaEEQuickPeek qp = getJavaEEQuickPeek(parent);
-
- if (qp.getType() == JavaEEQuickPeek.APPLICATION_TYPE) {
- IPath ddPath = new Path(J2EEConstants.APPLICATION_DD_URI);
- if (parent.containsArchiveResource(ddPath)) {
- try {
- Object ddObj = parent.getModelObject(ddPath);
- IPath archivePath = simpleArchive.getPath();
- if (archivePath == null) {
- Object obj = simpleArchive.getArchiveOptions().getOption(ArchiveOptions.ARCHIVE_PATH);
- if (null != obj) {
- archivePath = (IPath) obj;
- }
- }
- int definedType = J2EEVersionConstants.UNKNOWN;
- if (qp.getVersion() == JavaEEQuickPeek.JEE_5_0_ID) {
- org.eclipse.jst.javaee.application.Application app = (org.eclipse.jst.javaee.application.Application) ddObj;
- org.eclipse.jst.javaee.application.Module module = app.getFirstModule(archivePath.toString());
- //if the archive isn't found, do a smart search for it
- if(module == null){
- IPath noDevicePath = archivePath.setDevice(null);
- for(int i=1; i<noDevicePath.segmentCount() && module == null; i++){
- String stringPath = noDevicePath.removeFirstSegments(i).toString();
- module = app.getFirstModule(stringPath);
- }
- }
- if (null != module) {
- if (module.getEjb() != null) {
- definedType = J2EEVersionConstants.EJB_TYPE;
- } else if (module.getConnector() != null) {
- definedType = J2EEVersionConstants.CONNECTOR_TYPE;
- } else if (module.getJava() != null) {
- definedType = J2EEVersionConstants.APPLICATION_CLIENT_TYPE;
- } else if (module.getWeb() != null) {
- definedType = J2EEVersionConstants.WEB_TYPE;
- }
- }
- } else { //J2EE 1.4 or below, rely solely on DD
- org.eclipse.jst.j2ee.application.Application app = (org.eclipse.jst.j2ee.application.Application) ddObj;
- org.eclipse.jst.j2ee.application.Module module = app.getFirstModule(archivePath.toString());
- //if the archive isn't found, do a smart search for it
- if(module == null){
- IPath noDevicePath = archivePath.setDevice(null);
- for(int i=1; i<noDevicePath.segmentCount() && module == null; i++){
- String stringPath = noDevicePath.removeFirstSegments(i).toString();
- module = app.getFirstModule(stringPath);
- }
- }
- if (null != module) {
- if (module.isEjbModule()) {
- definedType = J2EEVersionConstants.EJB_TYPE;
- } else if (module.isConnectorModule()) {
- definedType = J2EEVersionConstants.CONNECTOR_TYPE;
- } else if (module.isJavaModule()) {
- definedType = J2EEVersionConstants.APPLICATION_CLIENT_TYPE;
- } else if (module.isWebModule()) {
- definedType = J2EEVersionConstants.WEB_TYPE;
- }
- } else { //J2EE 1.4 or below, and not in DD, treat as utility
- JavaEEQuickPeek quickPeek = new JavaEEQuickPeek(null);
- archiveToJavaEEQuickPeek.put(simpleArchive, quickPeek);
- return simpleArchive;
- }
- }
- if (definedType != J2EEVersionConstants.UNKNOWN) {
- String ddToCheck = null;
- switch (definedType) {
- case J2EEVersionConstants.EJB_TYPE:
- ddToCheck = J2EEConstants.EJBJAR_DD_URI;
- break;
- case J2EEVersionConstants.CONNECTOR_TYPE:
- ddToCheck = J2EEConstants.RAR_DD_URI;
- break;
- case J2EEVersionConstants.APPLICATION_CLIENT_TYPE:
- ddToCheck = J2EEConstants.APP_CLIENT_DD_URI;
- break;
- case J2EEVersionConstants.WEB_TYPE:
- ddToCheck = J2EEConstants.WEBAPP_DD_URI;
- break;
- }
- IArchive wrappedForDD = wrapForDD(simpleArchive, definedType, new Path(ddToCheck));
- if (wrappedForDD != null) {
- return wrappedForDD;
- }
- // else there is no DD and we need to decide on a
- // version (letting RARs fall through)
- switch (definedType) {
- case J2EEVersionConstants.EJB_TYPE: {
- JavaEEQuickPeek quickPeek = new JavaEEQuickPeek(JavaEEQuickPeek.EJB_TYPE, JavaEEQuickPeek.EJB_3_0_ID, JavaEEQuickPeek.JEE_5_0_ID);
- archiveToJavaEEQuickPeek.put(simpleArchive, quickPeek);
- wrapArchive(simpleArchive, new Path(J2EEConstants.EJBJAR_DD_URI));
- return simpleArchive;
- }
- case J2EEVersionConstants.APPLICATION_CLIENT_TYPE: {
- JavaEEQuickPeek quickPeek = new JavaEEQuickPeek(JavaEEQuickPeek.APPLICATION_CLIENT_TYPE, JavaEEQuickPeek.JEE_5_0_ID, JavaEEQuickPeek.JEE_5_0_ID);
- archiveToJavaEEQuickPeek.put(simpleArchive, quickPeek);
- wrapArchive(simpleArchive, new Path(J2EEConstants.APPLICATION_DD_URI));
- return simpleArchive;
- }
- case J2EEVersionConstants.WEB_TYPE: {
- JavaEEQuickPeek quickPeek = new JavaEEQuickPeek(JavaEEQuickPeek.WEB_TYPE, JavaEEQuickPeek.WEB_2_5_ID, JavaEEQuickPeek.JEE_5_0_ID);
- archiveToJavaEEQuickPeek.put(simpleArchive, quickPeek);
- wrapArchive(simpleArchive, new Path(J2EEConstants.WEBAPP_DD_URI));
- return simpleArchive;
- }
- }
- }
- } catch (ArchiveModelLoadException e) {
- org.eclipse.jst.j2ee.internal.plugin.J2EEPlugin.logError(e);
- }
- }
- }
- }
-
-
- String[] deploymentDescriptorsToCheck = new String[] { J2EEConstants.APPLICATION_DD_URI, J2EEConstants.APP_CLIENT_DD_URI, J2EEConstants.EJBJAR_DD_URI, J2EEConstants.WEBAPP_DD_URI,
- J2EEConstants.RAR_DD_URI };
- int[] typeToVerify = new int[] { J2EEVersionConstants.APPLICATION_TYPE, J2EEVersionConstants.APPLICATION_CLIENT_TYPE, J2EEVersionConstants.EJB_TYPE, J2EEVersionConstants.WEB_TYPE,
- J2EEConstants.CONNECTOR_TYPE };
- for (int i = 0; i < deploymentDescriptorsToCheck.length; i++) {
- final int currentType = typeToVerify[i];
- final IPath deploymentDescriptorPath = new Path(deploymentDescriptorsToCheck[i]);
- IArchive wrappedForDD = wrapForDD(simpleArchive, currentType, deploymentDescriptorPath);
- if(wrappedForDD != null){
- return wrappedForDD;
- }
- }
- IPath archivePath = simpleArchive.getPath();
- if (archivePath == null) {
- Object obj = simpleArchive.getArchiveOptions().getOption(ArchiveOptions.ARCHIVE_PATH);
- if (null != obj) {
- archivePath = (IPath) obj;
- }
- }
-
- if (archivePath != null) {
- String lastSegment = archivePath.lastSegment().toLowerCase();
- if (lastSegment.endsWith(DOT_EAR)) {
- JavaEEQuickPeek quickPeek = new JavaEEQuickPeek(JavaEEQuickPeek.APPLICATION_TYPE, JavaEEQuickPeek.JEE_5_0_ID, JavaEEQuickPeek.JEE_5_0_ID);
- archiveToJavaEEQuickPeek.put(simpleArchive, quickPeek);
- wrapArchive(simpleArchive, new Path(J2EEConstants.APPLICATION_DD_URI));
- return simpleArchive;
- } else if (lastSegment.endsWith(DOT_WAR)) {
- JavaEEQuickPeek quickPeek = new JavaEEQuickPeek(JavaEEQuickPeek.WEB_TYPE, JavaEEQuickPeek.WEB_2_5_ID, JavaEEQuickPeek.JEE_5_0_ID);
- archiveToJavaEEQuickPeek.put(simpleArchive, quickPeek);
- wrapArchive(simpleArchive, new Path(J2EEConstants.WEBAPP_DD_URI));
- return simpleArchive;
- } else if (lastSegment.endsWith(DOT_JAR)) {
- IPath manifestPath = new Path(J2EEConstants.MANIFEST_URI);
- if (simpleArchive.containsArchiveResource(manifestPath)) {
- InputStream in = null;
- try {
- IArchiveResource manifestResource = simpleArchive.getArchiveResource(manifestPath);
- in = manifestResource.getInputStream();
- Manifest manifest = new Manifest(in);
- Attributes attributes = manifest.getMainAttributes();
- String mainClassName = attributes.getValue("Main-Class");
- if (mainClassName != null) {
- JavaEEQuickPeek quickPeek = new JavaEEQuickPeek(JavaEEQuickPeek.APPLICATION_CLIENT_TYPE, JavaEEQuickPeek.JEE_5_0_ID, JavaEEQuickPeek.JEE_5_0_ID);
- archiveToJavaEEQuickPeek.put(simpleArchive, quickPeek);
- wrapArchive(simpleArchive, new Path(J2EEConstants.APPLICATION_DD_URI));
- return simpleArchive;
- }
- } catch (FileNotFoundException e) {
- ArchiveUtil.warn(e);
- } catch (IOException e) {
- ArchiveUtil.warn(e);
- } finally {
- if (in != null) {
- try {
- in.close();
- } catch (IOException e) {
- ArchiveUtil.warn(e);
- }
- }
- }
- }
- Object discriminateEJB30 = simpleArchive.getArchiveOptions().getOption(DISCRIMINATE_EJB_ANNOTATIONS);
- if (null == discriminateEJB30 || ((Boolean) discriminateEJB30).booleanValue()) {
- if (isEJBArchive(simpleArchive)) {
- JavaEEQuickPeek quickPeek = new JavaEEQuickPeek(JavaEEQuickPeek.EJB_TYPE, JavaEEQuickPeek.EJB_3_0_ID, JavaEEQuickPeek.JEE_5_0_ID);
- archiveToJavaEEQuickPeek.put(simpleArchive, quickPeek);
- wrapArchive(simpleArchive, new Path(J2EEConstants.EJBJAR_DD_URI));
- return simpleArchive;
- }
- }
-
- }
- }
-
- return simpleArchive;
- }
-
- private IArchive wrapForDD(final IArchive simpleArchive, final int currentType, final IPath deploymentDescriptorPath) {
- if (simpleArchive.containsArchiveResource(deploymentDescriptorPath)) {
- InputStream in = null;
- IArchiveResource dd;
- try {
- dd = simpleArchive.getArchiveResource(deploymentDescriptorPath);
- in = dd.getInputStream();
- JavaEEQuickPeek quickPeek = new JavaEEQuickPeek(in);
- if (quickPeek.getType() == currentType && quickPeek.getVersion() != JavaEEQuickPeek.UNKNOWN){
- if(isBinary(simpleArchive) || !simpleArchive.containsModelObject(deploymentDescriptorPath)){
- archiveToJavaEEQuickPeek.put(simpleArchive, quickPeek);
- wrapArchive(simpleArchive, deploymentDescriptorPath);
- return simpleArchive;
- }
- }
- } catch (FileNotFoundException e) {
- ArchiveUtil.warn(e);
- } catch (IOException e) {
- ArchiveUtil.warn(e);
- } finally {
- if (in != null) {
- try {
- in.close();
- } catch (IOException e) {
- ArchiveUtil.warn(e);
- }
- }
- }
- }
- return null;
- }
-
- public static boolean isBinary(IArchive anArchive){
- IArchiveLoadAdapter loadAdapter = null;
- if(anArchive.getArchiveOptions().hasOption(WRAPPED_LOAD_ADAPTER)){
- loadAdapter = (IArchiveLoadAdapter)anArchive.getArchiveOptions().getOption(WRAPPED_LOAD_ADAPTER);
- } else {
- loadAdapter = (IArchiveLoadAdapter)anArchive.getArchiveOptions().getOption(ArchiveOptions.LOAD_ADAPTER);
- }
- if(loadAdapter instanceof JavaEEBinaryComponentLoadAdapter){
- return true;
- } else if(loadAdapter instanceof ZipFileArchiveLoadAdapterImpl){
- return true;
- }
- return false;
- }
-
- public static IArchive findArchive(Object modelObject){
- if(modelObject instanceof EObject){
- EObject eObject = (EObject)modelObject;
- return JavaEEEMFArchiveAdapterHelper.findArchive(eObject);
- }
- return null;
- }
-
- public static IVirtualComponent findComponent(IArchive anArchive){
- IArchiveLoadAdapter loadAdapter = null;
- if(anArchive.getArchiveOptions().hasOption(WRAPPED_LOAD_ADAPTER)){
- loadAdapter = (IArchiveLoadAdapter)anArchive.getArchiveOptions().getOption(WRAPPED_LOAD_ADAPTER);
- } else {
- loadAdapter = (IArchiveLoadAdapter)anArchive.getArchiveOptions().getOption(ArchiveOptions.LOAD_ADAPTER);
- }
- if(loadAdapter instanceof JavaEEBinaryComponentLoadAdapter){
- return ((JavaEEBinaryComponentLoadAdapter)loadAdapter).getArchiveComponent();
- }
- return null;
- }
-
-
- public static class JavaEEWrappingLoadAdapter implements IArchiveLoadAdapter {
-
- private IArchive simpleArchive;
- private IArchiveLoadAdapter simpleLoadAdapter;
- private IPath deploymentDescriptorPath;
- private JavaEEEMFArchiveAdapterHelper emfHelper;
-
- public JavaEEWrappingLoadAdapter(IArchive simpleArchive, IPath deploymentDescriptorPath) {
- this.simpleArchive = simpleArchive;
- this.simpleLoadAdapter = this.simpleArchive.getLoadAdapter();
- this.deploymentDescriptorPath = deploymentDescriptorPath;
- this.emfHelper = new JavaEEEMFArchiveAdapterHelper(this.simpleArchive);
- }
-
- public void close() {
- simpleLoadAdapter.close();
- }
-
- public boolean containsArchiveResource(IPath resourcePath) {
- return simpleLoadAdapter.containsArchiveResource(resourcePath);
- }
-
- public boolean containsModelObject(IPath modelObjectPath) {
- if (simpleLoadAdapter.containsArchiveResource(modelObjectPath)) {
- return true;
- }
- if (IArchive.EMPTY_MODEL_PATH == modelObjectPath) {
- modelObjectPath = deploymentDescriptorPath;
- }
- return emfHelper.containsModelObject(modelObjectPath);
- }
-
- public IArchiveResource getArchiveResource(IPath resourcePath) throws FileNotFoundException {
- return simpleLoadAdapter.getArchiveResource(resourcePath);
- }
-
- public List<IArchiveResource> getArchiveResources() {
- return simpleLoadAdapter.getArchiveResources();
- }
-
- public InputStream getInputStream(IArchiveResource archiveResource) throws IOException, FileNotFoundException {
- return simpleLoadAdapter.getInputStream(archiveResource);
- }
-
- public Object getModelObject(IPath modelObjectPath) throws ArchiveModelLoadException {
- if (simpleLoadAdapter.containsModelObject(modelObjectPath)) {
- return simpleLoadAdapter.getModelObject(modelObjectPath);
- }
- if (IArchive.EMPTY_MODEL_PATH == modelObjectPath) {
- modelObjectPath = deploymentDescriptorPath;
- }
- return emfHelper.getModelObject(modelObjectPath);
- }
-
- public IArchive getArchive() {
- return simpleLoadAdapter.getArchive();
- }
-
- public void setArchive(IArchive archive) {
- simpleLoadAdapter.setArchive(archive);
- }
-
- public IArchiveLoadAdapter getWrappedLoadAdatper() {
- return simpleLoadAdapter;
- }
-
- public String toString() {
- return simpleLoadAdapter.toString();
- }
-
- };
-
- private static void wrapArchive(final IArchive simpleArchive, final IPath deploymentDescriptorPath) {
- IArchiveLoadAdapter wrappingEMFLoadAdapter = new JavaEEWrappingLoadAdapter(simpleArchive, deploymentDescriptorPath);
- simpleArchive.getArchiveOptions().setOption(ArchiveOptions.LOAD_ADAPTER, wrappingEMFLoadAdapter);
- simpleArchive.getArchiveOptions().setOption(WRAPPED_LOAD_ADAPTER, simpleArchive.getLoadAdapter());
- ((ArchiveImpl) simpleArchive).setLoadAdapter(wrappingEMFLoadAdapter);
- }
-
- private static final char[] RUNTIME_VISIBLE = "RuntimeVisibleAnnotations".toCharArray(); //$NON-NLS-1$
-
- private static final char[] STATELESS = "Ljavax/ejb/Stateless;".toCharArray();//$NON-NLS-1$
-
- private static final char[] STATEFUL = "Ljavax/ejb/Stateful;".toCharArray();//$NON-NLS-1$
-
- private static final char[] MESSAGEDRIVEN = "Ljavax/ejb/MessageDriven;".toCharArray();//$NON-NLS-1$
-
- public boolean isEJBArchive(IArchive archive) {
- // first check for the deployment descriptor
- if (archiveToJavaEEQuickPeek.containsKey(archive)) {
- JavaEEQuickPeek qp = JavaEEArchiveUtilities.INSTANCE.getJavaEEQuickPeek(archive);
- if (qp.getType() == JavaEEQuickPeek.EJB_TYPE) {
- return true;
- }
- }
-
- List<IArchiveResource> archiveResources = archive.getArchiveResources();
- for (IArchiveResource archiveResource : archiveResources) {
- if (archiveResource.getType() == IArchiveResource.FILE_TYPE) {
- if (archiveResource.getPath().lastSegment().endsWith(DOT_CLASS)) {
- InputStream ioStream = null;
- try {
- ioStream = archiveResource.getInputStream();
- IClassFileReader classFileReader = ToolFactory.createDefaultClassFileReader(ioStream, IClassFileReader.CLASSFILE_ATTRIBUTES);
- //classFileReader will be null if this is an invalid java .class file
- if(classFileReader != null){
- IClassFileAttribute[] attributes = classFileReader.getAttributes();
- for (IClassFileAttribute attribute : attributes) {
- char[] attributeName = attribute.getAttributeName();
- if (Arrays.equals(attributeName, RUNTIME_VISIBLE)) {
- IRuntimeVisibleAnnotationsAttribute annotationsAttribute = (IRuntimeVisibleAnnotationsAttribute) attribute;
- IAnnotation[] annotations = annotationsAttribute.getAnnotations();
- for (IAnnotation annotation : annotations) {
- char[] typedName = annotation.getTypeName();
- if (Arrays.equals(typedName, STATELESS) || Arrays.equals(typedName, STATEFUL) || Arrays.equals(typedName, MESSAGEDRIVEN)) {
- return true;
- }
- }
- }
- }
- }
- } catch (FileNotFoundException e) {
- ArchiveUtil.warn(e);
- } catch (IOException e) {
- ArchiveUtil.warn(e);
- } finally {
- if (null != ioStream) {
- try {
- ioStream.close();
- } catch (IOException e) {
- ArchiveUtil.warn(e);
- }
- }
- ioStream = null;
- }
- }
- }
- }
- return false;
- }
-
- public Manifest getManifest(IArchive archive) {
- Manifest manifest = null;
- IPath manifestPath = new Path(J2EEConstants.MANIFEST_URI);
- if (archive.containsArchiveResource(manifestPath)) {
- InputStream in = null;
- try {
- IArchiveResource manifestResource = archive.getArchiveResource(manifestPath);
- in = manifestResource.getInputStream();
- manifest = new Manifest(in);
- } catch (FileNotFoundException e) {
- ArchiveUtil.warn(e);
- } catch (IOException e) {
- ArchiveUtil.warn(e);
- } finally {
- if (in != null) {
- try {
- in.close();
- } catch (IOException e) {
- ArchiveUtil.warn(e);
- }
- }
- }
- }
- return manifest;
- }
-}
diff --git a/plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/internal/archive/JavaEEEMFArchiveAdapterHelper.java b/plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/internal/archive/JavaEEEMFArchiveAdapterHelper.java
deleted file mode 100644
index a8d125bd1..000000000
--- a/plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/internal/archive/JavaEEEMFArchiveAdapterHelper.java
+++ /dev/null
@@ -1,298 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2005, 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jst.j2ee.internal.archive;
-
-import java.io.FileNotFoundException;
-import java.io.IOException;
-import java.io.InputStream;
-import java.lang.reflect.Constructor;
-import java.lang.reflect.InvocationTargetException;
-import java.util.HashMap;
-import java.util.Map;
-
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.core.runtime.content.IContentDescription;
-import org.eclipse.emf.common.notify.Adapter;
-import org.eclipse.emf.common.notify.impl.AdapterImpl;
-import org.eclipse.emf.common.util.EList;
-import org.eclipse.emf.common.util.URI;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.ecore.resource.ContentHandler;
-import org.eclipse.emf.ecore.resource.Resource;
-import org.eclipse.emf.ecore.resource.ResourceSet;
-import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl;
-import org.eclipse.jst.jee.archive.ArchiveModelLoadException;
-import org.eclipse.jst.jee.archive.IArchive;
-import org.eclipse.jst.jee.archive.IArchiveResource;
-import org.eclipse.jst.jee.archive.internal.ArchiveURIConverter;
-import org.eclipse.jst.jee.archive.internal.ArchiveUtil;
-import org.eclipse.wst.common.componentcore.internal.impl.WTPResourceFactoryRegistry;
-import org.eclipse.wst.common.internal.emf.resource.EMF2SAXRendererFactory;
-import org.eclipse.wst.common.internal.emf.resource.IRootObjectResource;
-import org.eclipse.wst.common.internal.emf.resource.RendererFactory;
-import org.eclipse.wst.common.internal.emf.resource.TranslatorResourceFactory;
-
-public class JavaEEEMFArchiveAdapterHelper {
-
- public static IArchive findArchive(EObject eObject){
- EList <Adapter> adapters = eObject.eResource().getResourceSet().eAdapters();
- for(Adapter adapter:adapters){
- if(adapter instanceof EMFAddapter){
- return ((EMFAddapter) adapter).getHelper().getArchive();
- }
- }
- return null;
- }
-
- private class EMFAddapter extends AdapterImpl {
- private JavaEEEMFArchiveAdapterHelper helper;
- public EMFAddapter(JavaEEEMFArchiveAdapterHelper helper){
- this.helper = helper;
- }
- public JavaEEEMFArchiveAdapterHelper getHelper() {
- return this.helper;
- }
- };
-
- protected ResourceSet resourceSet;
-
- private EMFAddapter adapter = null;
-
- private IArchive archive = null;
-
- public JavaEEEMFArchiveAdapterHelper() {
- }
-
- public JavaEEEMFArchiveAdapterHelper(IArchive anArchive) {
- setArchive(anArchive);
- }
-
- public void setArchive(IArchive anArchive) {
- this.archive = anArchive;
- }
-
- public IArchive getArchive() {
- return archive;
- }
-
- public boolean containsModelObject(IPath modelObjectPath) {
- IArchive archive = getArchive();
- if (archive.containsArchiveResource(modelObjectPath)) {
- URI uri = getArchiveURIConverter().getURI(modelObjectPath);
- return containsResource(uri);
- }
- return false;
- }
-
- protected boolean containsResource(URI uri) {
- // TODO figure out a way to figure this out without actually
- // loading the resource
- IRootObjectResource resource = (IRootObjectResource) getResourceSet().getResource(uri, true);
- if (resource != null && resource.getRootObject() != null) {
- return true;
- }
- return false;
- }
-
- protected ArchiveURIConverter archiveURIConverter;
-
- public void setArchiveURIConverter(ArchiveURIConverter archiveURIConverter) {
- this.archiveURIConverter = archiveURIConverter;
- }
-
- public ArchiveURIConverter getArchiveURIConverter() {
- if (archiveURIConverter == null) {
- archiveURIConverter = new ArchiveURIConverter(getArchive());
- }
- return archiveURIConverter;
- }
-
- public Resource getResource(IPath resourcePath) throws ArchiveModelLoadException {
- URI uri = getArchiveURIConverter().getURI(resourcePath);
- Resource resource = getResourceSet().getResource(uri, true);
- return resource;
- }
-
- public Object getModelObject(IPath modelObjectPath) throws ArchiveModelLoadException {
- IRootObjectResource resource = (IRootObjectResource) getResource(modelObjectPath);
- return resource.getRootObject();
- }
-
- public ResourceSet getResourceSet() {
- if (resourceSet == null) {
- initializeResourceSet();
- if (null == adapter) {
- adapter = new EMFAddapter(this);
- }
- resourceSet.eAdapters().add(adapter);
- }
- return resourceSet;
- }
-
- public void setResourceSet(org.eclipse.emf.ecore.resource.ResourceSet newResourceSet) {
- if (resourceSet != newResourceSet) {
- // remove adapter from old resource set
- if (resourceSet != null && adapter != null) {
- resourceSet.eAdapters().remove(adapter);
- }
- // add as adapter to new resource set if necessary
- if (newResourceSet != null && !newResourceSet.eAdapters().contains(adapter)) {
- if (adapter == null) {
- adapter = new EMFAddapter(this);
- }
- newResourceSet.eAdapters().add(adapter);
- }
- resourceSet = newResourceSet;
- } // no need to update if old set equals new set (by reference)
- }
-
- public void initializeResourceSet() {
- ResourceSet rs = new ResourceSetImpl() {
- final String JAVA_PROTOCOL_URI_SCHEME = "java";
- private IContentDescription getContentDescription(URI uri) {
- IArchiveResource archiveResource = null;
- InputStream ioStream = null;
- try {
- IPath path = getArchiveURIConverter().getPath(uri);
- archiveResource = getArchive().getArchiveResource(path);
- ioStream = archiveResource.getInputStream();
- IContentDescription description = Platform.getContentTypeManager().getDescriptionFor(ioStream, path.lastSegment(), IContentDescription.ALL);
- return description;
- } catch (FileNotFoundException e) {
- ArchiveUtil.warn(e);
- return null;
- } catch (IOException e) {
- ArchiveUtil.warn(e);
- return null;
- } finally {
- if (ioStream != null) {
- try {
- ioStream.close();
- } catch (IOException e) {
- ArchiveUtil.warn(e);
- }
- }
- }
- }
-
- public Resource createResource(URI uri) {
- return createResource(uri, ContentHandler.UNSPECIFIED_CONTENT_TYPE);
- }
-
- public Resource createResource(URI uri, String contentType) {
- IContentDescription description = null;
- if (!isJavaURI(uri))
- description = getContentDescription(uri);
-
- Resource.Factory resourceFactory = null;
- if (null != description) {
- SAXFactoryKey key = new SAXFactoryKey(uri, description);
- resourceFactory = getSAXResourceFactory(key);
- if (null == resourceFactory) {
- resourceFactory = ((WTPResourceFactoryRegistry) getResourceFactoryRegistry()).getFactory(uri, description);
- Class clazz = resourceFactory.getClass();
- boolean isTranslator = false;
- while (!isTranslator && clazz != null) {
- if (clazz == TranslatorResourceFactory.class) {
- isTranslator = true;
- } else {
- clazz = clazz.getSuperclass();
- }
- }
- if (isTranslator) {
- try {
- Constructor constructor = resourceFactory.getClass().getConstructor(RendererFactory.class);
- EMF2SAXRendererFactory.INSTANCE.setValidating(false);
- resourceFactory = (Resource.Factory) constructor.newInstance(EMF2SAXRendererFactory.INSTANCE);
- } catch (SecurityException e) {
- ArchiveUtil.warn(e);
- } catch (NoSuchMethodException e) {
- ArchiveUtil.warn(e);
- } catch (IllegalArgumentException e) {
- ArchiveUtil.warn(e);
- } catch (InstantiationException e) {
- ArchiveUtil.warn(e);
- } catch (IllegalAccessException e) {
- ArchiveUtil.warn(e);
- } catch (InvocationTargetException e) {
- ArchiveUtil.warn(e);
- }
- }
- setSAXResourceFactory(key, resourceFactory);
- }
- } else {
- resourceFactory = getResourceFactoryRegistry().getFactory(uri);
- }
-
- if (resourceFactory != null) {
- Resource result = resourceFactory.createResource(uri);
- getResources().add(result);
- return result;
- } else {
- return null;
- }
- }
-
- private boolean isJavaURI(URI uri) {
- return JAVA_PROTOCOL_URI_SCHEME.equals(uri.scheme());
- }
- };
- rs.setResourceFactoryRegistry(WTPResourceFactoryRegistry.INSTANCE);
- rs.setURIConverter(getArchiveURIConverter());
- setResourceSet(rs);
- }
-
- private class SAXFactoryKey {
- private URI uri = null;
-
- private IContentDescription description = null;
-
- public SAXFactoryKey(URI uri, IContentDescription description) {
- this.uri = uri;
- this.description = description;
- if(uri == null){
- throw new NullPointerException();
- }
- if(description == null){
- throw new NullPointerException();
- }
- }
-
- @Override
- public boolean equals(Object obj){
- if(obj == null || !(obj instanceof SAXFactoryKey)){
- return false;
- }
- SAXFactoryKey other = (SAXFactoryKey)obj;
- return uri.equals(other.uri) && description.equals(other.description);
- }
-
- @Override
- public int hashCode() {
- return uri.hashCode() + description.hashCode();
- }
- }
-
- private static Map<SAXFactoryKey, Resource.Factory> localFactoryMap = new HashMap<SAXFactoryKey, Resource.Factory>();
-
- private static Resource.Factory getSAXResourceFactory(SAXFactoryKey key) {
- synchronized (localFactoryMap) {
- return localFactoryMap.get(key);
- }
- }
-
- private static void setSAXResourceFactory(SAXFactoryKey key, Resource.Factory resourceFactory) {
- synchronized (localFactoryMap) {
- localFactoryMap.put(key, resourceFactory);
- }
- }
-}
diff --git a/plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/internal/archive/JavaEEEMFZipFileLoadAdapterImpl.java b/plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/internal/archive/JavaEEEMFZipFileLoadAdapterImpl.java
deleted file mode 100644
index 36aa52098..000000000
--- a/plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/internal/archive/JavaEEEMFZipFileLoadAdapterImpl.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2005, 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jst.j2ee.internal.archive;
-
-import java.util.zip.ZipFile;
-
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.emf.ecore.resource.Resource;
-import org.eclipse.jem.util.emf.workbench.WorkbenchResourceHelperBase;
-import org.eclipse.jst.jee.archive.ArchiveModelLoadException;
-import org.eclipse.jst.jee.archive.IArchive;
-import org.eclipse.jst.jee.archive.internal.ZipFileArchiveLoadAdapterImpl;
-
-public class JavaEEEMFZipFileLoadAdapterImpl extends ZipFileArchiveLoadAdapterImpl {
-
- private JavaEEEMFArchiveAdapterHelper emfHelper = new JavaEEEMFArchiveAdapterHelper();
-
- public JavaEEEMFZipFileLoadAdapterImpl() {
- super();
- }
-
- public JavaEEEMFZipFileLoadAdapterImpl(ZipFile zipFile) {
- super(zipFile);
- }
-
- public void setArchive(IArchive archive) {
- super.setArchive(archive);
- emfHelper.setArchive(archive);
- }
-
- public Resource getResource(IPath resourcePath) throws ArchiveModelLoadException {
- return emfHelper.getResource(resourcePath);
- }
-
- public boolean containsModelObject(IPath modelObjectPath) {
- return emfHelper.containsModelObject(modelObjectPath);
- }
-
- public Object getModelObject(IPath modelObjectPath) throws ArchiveModelLoadException {
- return emfHelper.getModelObject(modelObjectPath);
- }
-
- @Override
- public void close() {
- super.close();
- WorkbenchResourceHelperBase.removeAndUnloadAll(emfHelper.getResourceSet().getResources(), emfHelper.getResourceSet());
- }
-
- protected JavaEEEMFArchiveAdapterHelper getEMFHelper() {
- return emfHelper;
- }
-}
diff --git a/plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/internal/archive/WebComponentArchiveLoadAdapter.java b/plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/internal/archive/WebComponentArchiveLoadAdapter.java
deleted file mode 100644
index 4d3431367..000000000
--- a/plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/internal/archive/WebComponentArchiveLoadAdapter.java
+++ /dev/null
@@ -1,152 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jst.j2ee.internal.archive;
-
-import java.io.File;
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.Path;
-import org.eclipse.jst.j2ee.classpathdep.IClasspathDependencyConstants;
-import org.eclipse.jst.j2ee.componentcore.J2EEModuleVirtualComponent;
-import org.eclipse.jst.j2ee.internal.J2EEConstants;
-import org.eclipse.jst.j2ee.internal.classpathdep.ClasspathDependencyVirtualComponent;
-import org.eclipse.jst.j2ee.internal.project.ProjectSupportResourceHandler;
-import org.eclipse.jst.jee.archive.ArchiveOpenFailureException;
-import org.eclipse.jst.jee.archive.ArchiveOptions;
-import org.eclipse.jst.jee.archive.IArchive;
-import org.eclipse.jst.jee.archive.IArchiveResource;
-import org.eclipse.wst.common.componentcore.internal.resources.VirtualArchiveComponent;
-import org.eclipse.wst.common.componentcore.resources.IVirtualComponent;
-import org.eclipse.wst.common.componentcore.resources.IVirtualReference;
-
-public class WebComponentArchiveLoadAdapter extends ComponentArchiveLoadAdapter {
-
- public static IPath WEBLIB = new Path("/WEB-INF/lib"); //$NON-NLS-1$
-
- public WebComponentArchiveLoadAdapter(IVirtualComponent vComponent) {
- super(vComponent);
- }
-
- public WebComponentArchiveLoadAdapter(IVirtualComponent vComponent, boolean includeClasspathComponents) {
- super(vComponent, includeClasspathComponents);
- }
-
- public List <IArchiveResource> getArchiveResources() {
- super.getArchiveResources();
- addLooseLibJARsToFiles();
- if (includeClasspathComponents) {
- addMappedClassFolders(IClasspathDependencyConstants.RUNTIME_MAPPING_INTO_COMPONENT_PATH);
- }
- return filesHolder.getFiles();
- }
-
- public IVirtualReference[] getLibModules() {
- List <IVirtualReference> result = new ArrayList<IVirtualReference>();
- IVirtualReference[] refComponents = null;
- if (!vComponent.isBinary())
- refComponents = ((J2EEModuleVirtualComponent)vComponent).getNonManifestReferences();
- else
- refComponents = vComponent.getReferences();
- // Check the deployed path to make sure it has a lib parent folder and matchs the web.xml
- // base path
- for (int i = 0; i < refComponents.length; i++) {
- if (refComponents[i].getRuntimePath().equals(WEBLIB))
- result.add(refComponents[i]);
- }
-
- return (IVirtualReference[]) result.toArray(new IVirtualReference[result.size()]);
-
- }
-
- public void addLooseLibJARsToFiles() {
- IVirtualReference[] libModules = getLibModules();
- for (int i = 0; i < libModules.length; i++) {
- IVirtualReference iLibModule = libModules[i];
- IVirtualComponent looseComponent = iLibModule.getReferencedComponent();
- if (looseComponent.isBinary()) {
- VirtualArchiveComponent archiveComp = (VirtualArchiveComponent) looseComponent;
- java.io.File diskFile = archiveComp.getUnderlyingDiskFile();
- if (!diskFile.exists()) {
- IFile wbFile = archiveComp.getUnderlyingWorkbenchFile();
- diskFile = new File(wbFile.getLocation().toOSString());
- }
- IPath uri = iLibModule.getRuntimePath().makeRelative().append("/" + diskFile.getName()); //$NON-NLS-1$
- addExternalFile(uri, diskFile);
- } else {
- String name = null;
- String archiveName = iLibModule.getArchiveName();
- if (archiveName != null && archiveName.length() > 0) {
- name = archiveName;
- } else {
- name = looseComponent.getName() + ".jar"; //$NON-NLS-1$
- }
- String prefix = iLibModule.getRuntimePath().makeRelative().toString();
- if (prefix.length() > 0 && prefix.charAt(prefix.length() - 1)!= '/') {
- prefix += "/"; //$NON-NLS-1$
- }
-
- addClasspathComponentDependencies(looseComponent);
- String uri = prefix + name;
-
- try {
- JavaComponentArchiveLoadAdapter archiveLoadAdapter = new JavaComponentArchiveLoadAdapter(looseComponent);
- archiveLoadAdapter.setExportSource(isExportSource());
- ArchiveOptions webLibOptions = new ArchiveOptions();
- webLibOptions.setOption(ArchiveOptions.LOAD_ADAPTER, archiveLoadAdapter);
- IArchive webLibArchive;
- webLibArchive = JavaEEArchiveUtilities.INSTANCE.openArchive(webLibOptions);
- webLibArchive.setPath(new Path(uri));
- webLibArchive.setArchive(archive);
- //this is in case there is a jar in the WEB-INF/lib folder which is also
- //mapped as a project. If it is not removed here, then export will include
- //the jar version instead of the project version.
- filesHolder.remove(webLibArchive.getPath());
- filesHolder.addFile(webLibArchive);
- } catch (ArchiveOpenFailureException e) {
- String message = ProjectSupportResourceHandler.getString(ProjectSupportResourceHandler.UNABLE_TO_LOAD_MODULE_ERROR_, new Object[]{uri, getComponent().getProject().getName(), e.getMessage()});
- org.eclipse.jem.util.logger.proxy.Logger.getLogger().logTrace(message);
- }
- }
- }
- }
-
- private void addClasspathComponentDependencies(final IVirtualComponent referencedComponent) {
- // retrieve all Java classpath component dependencies
- if (includeClasspathComponents && referencedComponent instanceof J2EEModuleVirtualComponent) {
- final IVirtualReference[] cpRefs = ((J2EEModuleVirtualComponent) referencedComponent).getJavaClasspathReferences();
- for (int j = 0; j < cpRefs.length; j++) {
- final IVirtualReference ref = cpRefs[j];
- final IPath runtimePath = ref.getRuntimePath();
-
- // only process ../ mappings
- if (ref.getReferencedComponent() instanceof ClasspathDependencyVirtualComponent
- && runtimePath.equals(IClasspathDependencyConstants.RUNTIME_MAPPING_INTO_CONTAINER_PATH)) {
- final ClasspathDependencyVirtualComponent comp = (ClasspathDependencyVirtualComponent) ref.getReferencedComponent();
- File cpEntryFile = comp.getUnderlyingDiskFile();
- if (!cpEntryFile.exists()) {
- final IFile wbFile = comp.getUnderlyingWorkbenchFile();
- cpEntryFile = new File(wbFile.getLocation().toOSString());
- }
- addExternalFile(new Path("WEB-INF/lib/" + ref.getArchiveName()), cpEntryFile);
- }
- }
- }
- }
-
- @Override
- protected IPath getDefaultModelObjectPath() {
- return new Path(J2EEConstants.WEBAPP_DD_URI);
- }
-
-}
diff --git a/plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/internal/archive/WebComponentArchiveSaveAdapter.java b/plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/internal/archive/WebComponentArchiveSaveAdapter.java
deleted file mode 100644
index c1531f57e..000000000
--- a/plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/internal/archive/WebComponentArchiveSaveAdapter.java
+++ /dev/null
@@ -1,132 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jst.j2ee.internal.archive;
-
-import java.io.FileNotFoundException;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.Path;
-import org.eclipse.jst.j2ee.commonarchivecore.internal.helpers.ArchiveConstants;
-import org.eclipse.jst.j2ee.commonarchivecore.internal.util.ArchiveUtil;
-import org.eclipse.jst.jee.archive.IArchiveResource;
-import org.eclipse.wst.common.componentcore.resources.IVirtualComponent;
-import org.eclipse.wst.common.componentcore.resources.IVirtualFile;
-import org.eclipse.wst.common.componentcore.resources.IVirtualFolder;
-
-public class WebComponentArchiveSaveAdapter extends J2EEComponentArchiveSaveAdapter {
-
- private IPath IMPORTED_CLASSES_PATH = new Path("/" + ArchiveConstants.WEBAPP_CLASSES_URI);
-
- public WebComponentArchiveSaveAdapter(IVirtualComponent vComponent) {
- super(vComponent);
- }
-
- protected boolean shouldAddImportedClassesToClasspath() {
- return false; // never add to classpath because the web app container will pick this up.
- }
-
- protected IPath getImportedClassesURI(IArchiveResource aFile){
- return aFile.getPath().makeRelative().removeFirstSegments(IMPORTED_CLASSES_PATH.segmentCount());
- }
-
- protected IPath getImportedClassesRuntimePath() {
- return IMPORTED_CLASSES_PATH;
- }
-
- protected IPath getProjectRelativePath(IArchiveResource aFile) {
- if (null != nonStandardSourceFiles && nonStandardSourceFiles.containsKey(aFile)) {
- IPath path = nonStandardSourceFiles.get(aFile);
- IVirtualFolder rootFolder = vComponent.getRootFolder();
- IVirtualFile vFile = rootFolder.getFile(path);
- IFile iFile = vFile.getUnderlyingFile();
- return iFile.getProjectRelativePath();
- }
- return super.getProjectRelativePath(aFile);
- }
-
- /**
- * This map handles the case when a java source file is not in the same place as the .class
- * file. For example if all the source files were contained in WEB-INF/source
- */
- protected Map<IArchiveResource, IPath> nonStandardSourceFiles;
-
- protected boolean isClassWithoutSource(IArchiveResource aFile) {
- String javaUri = ArchiveUtil.classUriToJavaUri(aFile.getPath().toString());
- if (javaUri == null)
- return true;
- IPath javaPath = new Path(javaUri);
- if (archive.containsArchiveResource(javaPath)) {
- return false;
- }
- // see if it is a JSP
- String jspUri = javaUri.substring(0, javaUri.indexOf(ArchiveUtil.DOT_JAVA));
- int lastSlash = jspUri.lastIndexOf('/');
- int _index = lastSlash == -1 ? ArchiveConstants.WEBAPP_CLASSES_URI.length() : lastSlash + 1;
- if (jspUri.charAt(_index) == '_') {
- jspUri = jspUri.substring(ArchiveConstants.WEBAPP_CLASSES_URI.length(), _index) + jspUri.substring(_index + 1) + ArchiveUtil.DOT_JSP;
- IPath jspPath = new Path(jspUri);
- if (archive.containsArchiveResource(jspPath)) {
- return false;
- }
- }
-
- //This is to handle archives created by an earlier version
- //The format was to include the source files in a directory called source in WEB-INF
- //Example: class is in WEB-INF/classes/test/Foo.class
- // source is in WEB-INF/source/test/Foo.java
- if(javaPath.segmentCount() > 2 && javaPath.segment(0).equals("WEB-INF") && javaPath.segment(1).equals("classes")){
- String alternateJavaUri = javaUri.replaceFirst("classes", "source");
- IPath alternateJavaPath = new Path(alternateJavaUri);
- if (archive.containsArchiveResource(alternateJavaPath)){
- IArchiveResource sourceFile;
- try {
- sourceFile = archive.getArchiveResource(alternateJavaPath);
- if(sourceFile != null){
- if (nonStandardSourceFiles == null) {
- nonStandardSourceFiles = new HashMap<IArchiveResource, IPath>();
- }
- if (!nonStandardSourceFiles.containsKey(sourceFile)) {
- nonStandardSourceFiles.put(sourceFile, javaPath);
- }
- return false;
- }
- } catch (FileNotFoundException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
-
- }
-
- }
-
- return true;
- }
-
- @Override
- protected List<IArchiveResource> getArchiveResourcesForSave() {
- List <IArchiveResource> sortedFiles = new ArrayList <IArchiveResource>();
- int classIndex = 0;
- for(IArchiveResource resource : super.getArchiveResourcesForSave()){
- if(resource.getPath().lastSegment().endsWith(DOT_CLASS)){
- sortedFiles.add(classIndex++, resource);
- }
- else {
- sortedFiles.add(resource);
- }
- }
- return sortedFiles;
- }
-}
diff --git a/plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/internal/archive/WebComponentArchiveTypeHandler.java b/plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/internal/archive/WebComponentArchiveTypeHandler.java
deleted file mode 100644
index 5a239dc08..000000000
--- a/plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/internal/archive/WebComponentArchiveTypeHandler.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2005, 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jst.j2ee.internal.archive;
-
-import org.eclipse.core.runtime.Path;
-import org.eclipse.jst.j2ee.internal.J2EEConstants;
-import org.eclipse.jst.jee.archive.IArchive;
-import org.eclipse.jst.jee.archive.IArchiveHandler;
-
-public class WebComponentArchiveTypeHandler implements IArchiveHandler {
-
- public boolean handlesArchive(IArchive archive) {
- if (archive.getLoadAdapter() instanceof WebComponentArchiveLoadAdapter) {
- return true;
- } else if (archive.containsArchiveResource(new Path(J2EEConstants.WEBAPP_DD_URI))) {
- return true;
- } else {
- // TODO handle the no DD case
- return false;
- }
- }
-
-}
diff --git a/plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/internal/archive/operations/AppClientArchiveOpsResourceHandler.java b/plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/internal/archive/operations/AppClientArchiveOpsResourceHandler.java
deleted file mode 100644
index 8111e913d..000000000
--- a/plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/internal/archive/operations/AppClientArchiveOpsResourceHandler.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 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.archive.operations;
-
-import org.eclipse.osgi.util.NLS;
-
-public final class AppClientArchiveOpsResourceHandler extends NLS {
-
- private static final String BUNDLE_NAME = "appclientarchiveops";//$NON-NLS-1$
-
- private AppClientArchiveOpsResourceHandler() {
- // Do not instantiate
- }
-
- public static String ARCHIVE_OPERATION_SaveFile;
- public static String ARCHIVE_OPERATION_ProjectNature;
- public static String ARCHIVE_OPERATION_SaveManifest;
- public static String ARCHIVE_OPERATION_FileNotFound;
- public static String ARCHIVE_OPERATION_OpeningArchive;
- public static String ARCHIVE_OPERATION_ImportOperation;
- public static String IMPORT_MOFRESOURCE_STRING;
- public static String APPCLIENT_IMPORT_OPERATION_STRING;
- public static String APPCLIENT_IMPORT_FILE_STRING;
- public static String APPCLIENT_IMPORT_ERROR;
- public static String ARCHIVE_OPERATION_ErrorOccured;
- public static String Application_Client_File_UI_;
- public static String _c__Copyright_IBM_Corporation_2001_1;
-
- static {
- NLS.initializeMessages(BUNDLE_NAME, AppClientArchiveOpsResourceHandler.class);
- }
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/internal/archive/operations/AppClientComponentExportOperation.java b/plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/internal/archive/operations/AppClientComponentExportOperation.java
deleted file mode 100644
index 571c5f745..000000000
--- a/plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/internal/archive/operations/AppClientComponentExportOperation.java
+++ /dev/null
@@ -1,65 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jst.j2ee.internal.archive.operations;
-
-import java.lang.reflect.InvocationTargetException;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.SubProgressMonitor;
-import org.eclipse.emf.ecore.EPackage;
-import org.eclipse.jst.j2ee.commonarchivecore.internal.CommonarchiveFactory;
-import org.eclipse.jst.j2ee.commonarchivecore.internal.CommonarchivePackage;
-import org.eclipse.jst.j2ee.commonarchivecore.internal.exception.SaveFailureException;
-import org.eclipse.jst.j2ee.internal.J2EEConstants;
-import org.eclipse.jst.j2ee.internal.archive.JavaEEArchiveUtilities;
-import org.eclipse.jst.jee.archive.IArchive;
-import org.eclipse.jst.jee.util.internal.JavaEEQuickPeek;
-import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
-
-public class AppClientComponentExportOperation extends J2EEArtifactExportOperation {
-
- public AppClientComponentExportOperation(IDataModel model) {
- super(model);
- }
-
- public void export() throws SaveFailureException, CoreException, InvocationTargetException, InterruptedException {
- IProgressMonitor subMonitor = new SubProgressMonitor(progressMonitor, EXPORT_WORK);
- IArchive archiveFromComponent = null;
- try {
- archiveFromComponent = JavaEEArchiveUtilities.INSTANCE.openArchive(getComponent());
- JavaEEQuickPeek quickPeek = JavaEEArchiveUtilities.INSTANCE.getJavaEEQuickPeek(archiveFromComponent);
- if (quickPeek.getJavaEEVersion() == J2EEConstants.JEE_5_0_ID) {
- saveArchive(archiveFromComponent, getDestinationPath().toOSString(), subMonitor);
- } else {
- CommonarchiveFactory caf = ((CommonarchivePackage) EPackage.Registry.INSTANCE.getEPackage(CommonarchivePackage.eNS_URI)).getCommonarchiveFactory();
- AppClientComponentLoadStrategyImpl ls = new AppClientComponentLoadStrategyImpl(getComponent());
- ls.setExportSource(isExportSource());
- setModuleFile(caf.openApplicationClientFile(ls, getDestinationPath().toOSString()));
- ls.setProgressMonitor(subMonitor);
- getModuleFile().saveAsNoReopen(getDestinationPath().toOSString());
- }
- } catch (SaveFailureException ex) {
- throw ex;
- } catch (Exception e) {
- throw new SaveFailureException(AppClientArchiveOpsResourceHandler.ARCHIVE_OPERATION_OpeningArchive, e);
- } finally {
- if (archiveFromComponent != null)
- JavaEEArchiveUtilities.INSTANCE.closeArchive(archiveFromComponent);
- subMonitor.done();
- }
- }
-
- protected String archiveString() {
- return AppClientArchiveOpsResourceHandler.Application_Client_File_UI_;
- }
-
-}
diff --git a/plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/internal/archive/operations/AppClientComponentImportOperation.java b/plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/internal/archive/operations/AppClientComponentImportOperation.java
deleted file mode 100644
index 47c226fd7..000000000
--- a/plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/internal/archive/operations/AppClientComponentImportOperation.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jst.j2ee.internal.archive.operations;
-
-import org.eclipse.jst.j2ee.commonarchivecore.internal.strategy.SaveStrategy;
-import org.eclipse.jst.j2ee.internal.archive.AppClientComponentArchiveSaveAdapter;
-import org.eclipse.jst.j2ee.internal.archive.ComponentArchiveSaveAdapter;
-import org.eclipse.wst.common.componentcore.resources.IVirtualComponent;
-import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
-
-public class AppClientComponentImportOperation extends J2EEArtifactImportOperation {
-
- public AppClientComponentImportOperation(IDataModel model) {
- super(model);
- }
-
- protected SaveStrategy createSaveStrategy(IVirtualComponent virtualComponent) {
- AppClientComponentSaveStrategyImpl saveStrat = new AppClientComponentSaveStrategyImpl(virtualComponent);
- return saveStrat;
- }
-
- protected ComponentArchiveSaveAdapter getArchiveSaveAdapter(IVirtualComponent virtualComponent) {
- return new AppClientComponentArchiveSaveAdapter(virtualComponent);
- }
-
-}
diff --git a/plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/internal/archive/operations/AppClientComponentLoadStrategyImpl.java b/plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/internal/archive/operations/AppClientComponentLoadStrategyImpl.java
deleted file mode 100644
index 1b3c78b0e..000000000
--- a/plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/internal/archive/operations/AppClientComponentLoadStrategyImpl.java
+++ /dev/null
@@ -1,30 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jst.j2ee.internal.archive.operations;
-
-import org.eclipse.jst.j2ee.applicationclient.componentcore.util.AppClientArtifactEdit;
-import org.eclipse.wst.common.componentcore.ArtifactEdit;
-import org.eclipse.wst.common.componentcore.resources.IVirtualComponent;
-
-public class AppClientComponentLoadStrategyImpl extends ComponentLoadStrategyImpl {
-
- public AppClientComponentLoadStrategyImpl(IVirtualComponent vComponent) {
- super(vComponent);
- }
-
- protected synchronized ArtifactEdit getArtifactEditForRead() {
- if(artifactEdit == null){
- artifactEdit = AppClientArtifactEdit.getAppClientArtifactEditForRead(vComponent);
- }
- return artifactEdit;
- }
-
-}
diff --git a/plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/internal/archive/operations/AppClientComponentSaveStrategyImpl.java b/plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/internal/archive/operations/AppClientComponentSaveStrategyImpl.java
deleted file mode 100644
index 7c769bd1e..000000000
--- a/plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/internal/archive/operations/AppClientComponentSaveStrategyImpl.java
+++ /dev/null
@@ -1,21 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jst.j2ee.internal.archive.operations;
-
-import org.eclipse.wst.common.componentcore.resources.IVirtualComponent;
-
-public class AppClientComponentSaveStrategyImpl extends J2EEComponentSaveStrategyImpl {
-
- public AppClientComponentSaveStrategyImpl(IVirtualComponent vComponent) {
- super(vComponent);
- }
-
-}
diff --git a/plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/internal/archive/operations/ComponentLoadStrategyImpl.java b/plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/internal/archive/operations/ComponentLoadStrategyImpl.java
deleted file mode 100644
index 1dbc63dec..000000000
--- a/plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/internal/archive/operations/ComponentLoadStrategyImpl.java
+++ /dev/null
@@ -1,692 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jst.j2ee.internal.archive.operations;
-
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
-import java.io.FileInputStream;
-import java.io.FileNotFoundException;
-import java.io.IOException;
-import java.io.InputStream;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Enumeration;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.zip.ZipEntry;
-import java.util.zip.ZipException;
-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.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.SubProgressMonitor;
-import org.eclipse.emf.common.util.URI;
-import org.eclipse.emf.ecore.resource.Resource;
-import org.eclipse.jdt.core.IJavaProject;
-import org.eclipse.jdt.core.IPackageFragmentRoot;
-import org.eclipse.jdt.core.JavaCore;
-import org.eclipse.jem.util.emf.workbench.WorkbenchResourceHelperBase;
-import org.eclipse.jem.util.logger.proxy.Logger;
-import org.eclipse.jst.j2ee.classpathdep.IClasspathDependencyConstants;
-import org.eclipse.jst.j2ee.commonarchivecore.internal.File;
-import org.eclipse.jst.j2ee.commonarchivecore.internal.exception.ResourceLoadException;
-import org.eclipse.jst.j2ee.commonarchivecore.internal.helpers.FileIterator;
-import org.eclipse.jst.j2ee.commonarchivecore.internal.helpers.FileIteratorImpl;
-import org.eclipse.jst.j2ee.commonarchivecore.internal.impl.ContainerImpl;
-import org.eclipse.jst.j2ee.commonarchivecore.internal.strategy.LoadStrategyImpl;
-import org.eclipse.jst.j2ee.commonarchivecore.internal.util.ArchiveUtil;
-import org.eclipse.jst.j2ee.componentcore.J2EEModuleVirtualComponent;
-import org.eclipse.jst.j2ee.internal.J2EEConstants;
-import org.eclipse.jst.j2ee.internal.classpathdep.ClasspathDependencyManifestUtil;
-import org.eclipse.jst.j2ee.internal.classpathdep.ClasspathDependencyVirtualComponent;
-import org.eclipse.jst.j2ee.internal.project.J2EEProjectUtilities;
-import org.eclipse.jst.j2ee.internal.project.ProjectSupportResourceHandler;
-import org.eclipse.wst.common.componentcore.ArtifactEdit;
-import org.eclipse.wst.common.componentcore.UnresolveableURIException;
-import org.eclipse.wst.common.componentcore.internal.ArtifactEditModel;
-import org.eclipse.wst.common.componentcore.internal.ComponentResource;
-import org.eclipse.wst.common.componentcore.internal.DependencyType;
-import org.eclipse.wst.common.componentcore.internal.StructureEdit;
-import org.eclipse.wst.common.componentcore.internal.resources.VirtualArchiveComponent;
-import org.eclipse.wst.common.componentcore.internal.util.IModuleConstants;
-import org.eclipse.wst.common.componentcore.resources.IVirtualComponent;
-import org.eclipse.wst.common.componentcore.resources.IVirtualContainer;
-import org.eclipse.wst.common.componentcore.resources.IVirtualFile;
-import org.eclipse.wst.common.componentcore.resources.IVirtualFolder;
-import org.eclipse.wst.common.componentcore.resources.IVirtualReference;
-import org.eclipse.wst.common.componentcore.resources.IVirtualResource;
-
-public abstract class ComponentLoadStrategyImpl extends LoadStrategyImpl {
-
- protected static final String DOT_PROJECT = ".project"; //$NON-NLS-1$
- protected static final String DOT_CLASSPATH = ".classpath"; //$NON-NLS-1$
- protected static final String DOT_SETTINGS = ".settings"; //$NON-NLS-1$
- protected static final String DOT_CVS_IGORE = ".cvsignore"; //$NON-NLS-1$
-
- protected IVirtualComponent vComponent;
- protected boolean exportSource;
- protected ArtifactEdit artifactEdit;
- private List zipFiles = new ArrayList();
- private List javaClasspathURIs = new ArrayList();
- protected boolean includeClasspathComponents = true;
-
- protected class FilesHolder {
-
- private Map urisToFiles = new HashMap();
- private Map urisToResources = new HashMap();
- private Map resourcesToURI = new HashMap();
- private Map urisToDiskFiles;
- private Map urisToZipEntry = new HashMap();
-
- public void removeIFile(IFile file) {
- String uri = (String) resourcesToURI.get(file);
- remove(uri);
- }
-
- public void remove(String uri) {
- urisToFiles.remove(uri);
- Object resource = urisToResources.remove(uri);
- if (resource != null) {
- resourcesToURI.remove(resource);
- }
- if (urisToDiskFiles != null) {
- urisToDiskFiles.remove(uri);
- }
- }
-
- public void addDirectory(File directory) {
- String uri = directory.getURI();
- urisToFiles.put(uri, directory);
- }
-
- public void addFile(File file) {
- String uri = file.getURI();
- urisToFiles.put(uri, file);
- }
-
- public void addFile(File file, java.io.File externalDiskFile) {
- String uri = file.getURI();
- urisToFiles.put(uri, file);
- if (null == urisToDiskFiles) {
- urisToDiskFiles = new HashMap();
- }
- urisToDiskFiles.put(uri, externalDiskFile);
- }
-
- public void addFile(File file, IResource resource) {
- String uri = file.getURI();
- urisToFiles.put(uri, file);
- urisToResources.put(uri, resource);
- }
-
- public InputStream getInputStream(String uri) throws IOException, FileNotFoundException {
- java.io.File diskFile = null;
-
- if (urisToDiskFiles != null && urisToDiskFiles.containsKey(uri)) {
- diskFile = (java.io.File) urisToDiskFiles.get(uri);
- } else if (urisToResources != null && urisToResources.containsKey(uri)) {
- IResource resource = (IResource) urisToResources.get(uri);
- diskFile = new java.io.File(resource.getLocation().toOSString());
- } else {
- Map fileURIMap = (Map) urisToZipEntry.get(uri);
- Iterator it = fileURIMap.keySet().iterator();
-
- String sourceFileUri = ""; //$NON-NLS-1$
- ZipFile zipFile = null;
-
- // there is only one key, pair
- while (it.hasNext()) {
- sourceFileUri = (String) it.next();
- zipFile = (ZipFile) fileURIMap.get(sourceFileUri);
- }
- ZipEntry entry = zipFile.getEntry(sourceFileUri);
- InputStream in = zipFile.getInputStream(entry);
- return in;
- }
- return new FileInputStream(diskFile);
- }
-
- public List getFiles() {
- return new ArrayList(urisToFiles.values());
- }
-
- public boolean contains(String uri) {
- return urisToFiles.containsKey(uri);
- }
-
- public void addEntry(ZipEntry entry, ZipFile zipFile, IPath runtimePath) {
- String uri = runtimePath == null ? null : runtimePath.toString();
- String fileURI = ""; //$NON-NLS-1$
- if (uri != null) {
- if (!uri.equals("/")) //$NON-NLS-1$
- fileURI = uri + entry.getName();
- else
- fileURI = entry.getName();
- } else {
- fileURI = entry.getName();
- }
-
- File file = createFile(fileURI);
-
- Map fileURIMap = new HashMap();
- fileURIMap.put(entry.getName(), zipFile);
-
- urisToZipEntry.put(file.getURI(), fileURIMap);
- urisToFiles.put(file.getURI(), file);
- }
- }
-
- protected FilesHolder filesHolder;
-
- private Exception exception; //TEMP TODO REMOVE
-
- private IVirtualFile manifestFile = null;
-
- public ComponentLoadStrategyImpl(IVirtualComponent vComponent) {
- this(vComponent, true);
- }
-
- public ComponentLoadStrategyImpl(IVirtualComponent vComponent, boolean includeClasspathComponents) {
- this.vComponent = vComponent;
- filesHolder = new FilesHolder();
- exception = new Exception();
- this.includeClasspathComponents = includeClasspathComponents;
- if (includeClasspathComponents) {
- this.manifestFile = vComponent.getRootFolder().getFile(new Path(J2EEConstants.MANIFEST_URI));
- saveJavaClasspathReferences();
- }
- }
-
- public boolean contains(String uri) {
- IVirtualFolder rootFolder = vComponent.getRootFolder();
- return rootFolder.getFile(new Path(uri)).exists();
- }
-
- protected void initializeResourceSet() {
- resourceSet = WorkbenchResourceHelperBase.getResourceSet(vComponent.getProject());
- }
-
- protected boolean primContains(String uri) {
- return false;
- }
-
- public List getFiles() {
- aggregateSourceFiles();
- aggregateClassFiles();
- addUtilities();
- return filesHolder.getFiles();
- }
-
- /**
- * Adds library cp entries that point to class folders and have been tagged with the publish/export attribute.
- */
- protected void addMappedClassFolders(final IPath targetRuntimePath) {
- // retrieve all mapped class folders
- if (vComponent instanceof J2EEModuleVirtualComponent) {
- try {
- final J2EEModuleVirtualComponent j2eeComponent = (J2EEModuleVirtualComponent) vComponent;
- final IVirtualReference[] cpRefs = j2eeComponent.getJavaClasspathReferences();
- for (int j = 0; j < cpRefs.length; j++) {
- final IVirtualReference ref = cpRefs[j];
- final IPath runtimePath = ref.getRuntimePath();
- // only process mappings with the specified runtime path
- if (ref.getReferencedComponent() instanceof ClasspathDependencyVirtualComponent
- && runtimePath.equals(targetRuntimePath)) {
- final ClasspathDependencyVirtualComponent comp = (ClasspathDependencyVirtualComponent) ref.getReferencedComponent();
- if (comp.isClassFolder()) {
- final IContainer classFolder = comp.getClassFolder();
- if (classFolder != null && classFolder.exists()) {
- aggregateOutputFiles(new IResource[]{classFolder}, runtimePath.makeRelative(), classFolder.getProjectRelativePath().segmentCount());
- }
- }
- }
- }
- } catch (CoreException e) {
- Logger.getLogger().logError(e);
- }
- }
- }
-
- protected void saveJavaClasspathReferences() {
- if (vComponent instanceof J2EEModuleVirtualComponent) {
- final J2EEModuleVirtualComponent j2eeComp = (J2EEModuleVirtualComponent) vComponent;
- final IVirtualReference[] refs = j2eeComp.getJavaClasspathReferences();
- if (refs == null) {
- return;
- }
- for (int i = 0; i < refs.length; i++) {
- if (refs[i].getRuntimePath().equals(IClasspathDependencyConstants.RUNTIME_MAPPING_INTO_CONTAINER_PATH)) {
- javaClasspathURIs.add(refs[i].getArchiveName());
- }
- }
- }
- }
-
- protected void addUtilities() {
- IVirtualReference[] components = vComponent.getReferences();
- for (int i = 0; i < components.length; i++) {
- IVirtualReference reference = components[i];
- IVirtualComponent referencedComponent = reference.getReferencedComponent();
- if (referencedComponent.isBinary() && reference.getDependencyType() == DependencyType.CONSUMES) {
- java.io.File diskFile = ((VirtualArchiveComponent) referencedComponent).getUnderlyingDiskFile();
- ZipFile zipFile;
- IPath path = reference.getRuntimePath();
- try {
- zipFile = org.eclipse.jst.jee.archive.internal.ArchiveUtil.newZipFile(diskFile);
- zipFiles.add(zipFile);
- Enumeration enumeration = zipFile.entries();
- while (enumeration.hasMoreElements()) {
- ZipEntry entry = (ZipEntry) enumeration.nextElement();
- filesHolder.addEntry(entry, zipFile, path);
- }
- } catch (ZipException e) {
- Logger.getLogger().logError(e);
- } catch (IOException e) {
- Logger.getLogger().logError(e);
- }
- }
- }
- }
-
- /**
- * This is a cache of the IResource roots for all java source folders and is used by
- * {@link #inJavaSrc(IVirtualResource)}.
- */
- private IResource[] sourceRoots = null;
-
- protected void aggregateSourceFiles() {
- try {
- IVirtualFolder rootFolder = vComponent.getRootFolder();
- IVirtualResource[] members = rootFolder.members();
- IPackageFragmentRoot[] srcPkgs = J2EEProjectUtilities.getSourceContainers(vComponent.getProject());
- sourceRoots = new IResource[srcPkgs.length];
- for (int i = 0; i < srcPkgs.length; i++) {
- sourceRoots[i] = srcPkgs[i].getCorrespondingResource();
- }
- inJavaSrc = false;
- aggregateFiles(members);
- } catch (CoreException e) {
- Logger.getLogger().logError(e);
- }
- }
-
- protected void aggregateClassFiles() {
- StructureEdit se = null;
- try {
- IPackageFragmentRoot[] sourceRoots = J2EEProjectUtilities.getSourceContainers(vComponent.getProject());
- se = StructureEdit.getStructureEditForRead(vComponent.getProject());
- for (int i = 0; i < sourceRoots.length; i++) {
- IPath outputPath = sourceRoots[i].getRawClasspathEntry().getOutputLocation();
- if (outputPath == null) {
- IProject project = vComponent.getProject();
- if (project.hasNature(JavaCore.NATURE_ID)) {
- IJavaProject javaProject = JavaCore.create(project);
- outputPath = javaProject.getOutputLocation();
- }
- }
- if (outputPath != null) {
- IContainer javaOutputContainer = outputPath.segmentCount() > 1 ? (IContainer) ResourcesPlugin.getWorkspace().getRoot().getFolder(outputPath) : (IContainer) ResourcesPlugin.getWorkspace().getRoot().getProject(outputPath.lastSegment());
- IPath runtimePath = null;
- try {
- ComponentResource[] componentResources = se.findResourcesBySourcePath(sourceRoots[i].getResource().getProjectRelativePath());
- if (componentResources.length > 0) {
- IPath tmpRuntimePath = componentResources[0].getRuntimePath();
- IPath tmpSourcePath = componentResources[0].getSourcePath();
- if (!tmpRuntimePath.equals(tmpSourcePath)) {
- while (tmpSourcePath.segmentCount() > 0 && tmpRuntimePath.segmentCount() > 0 && tmpRuntimePath.lastSegment().equals(tmpSourcePath.lastSegment())) {
- tmpRuntimePath = tmpRuntimePath.removeLastSegments(1);
- tmpSourcePath = tmpSourcePath.removeLastSegments(1);
- }
- if (tmpRuntimePath.segmentCount() != 0) {
- runtimePath = tmpRuntimePath.makeRelative();
- }
- }
- }
- } catch (UnresolveableURIException e) {
- Logger.getLogger().logError(e);
- }
- if (null == runtimePath) {
- runtimePath = new Path(""); //$NON-NLS-1$
- }
- aggregateOutputFiles(new IResource[]{javaOutputContainer}, runtimePath, javaOutputContainer.getProjectRelativePath().segmentCount());
- }
- }
- } catch (CoreException e) {
- Logger.getLogger().logError(e);
- } finally {
- if (se != null) {
- se.dispose();
- }
- }
- }
-
- protected boolean aggregateOutputFiles(IResource[] resources, final IPath runtimePathPrefix, int outputFolderSegmentCount) throws CoreException {
- boolean fileAdded = false;
- for (int i = 0; i < resources.length; i++) {
- File cFile = null;
- if (!resources[i].exists()) {
- continue;
- }
- // We have to avoid duplicates between the source and output folders (non-java
- // resources)
- IPath runtimePath = runtimePathPrefix.append(resources[i].getProjectRelativePath().removeFirstSegments(outputFolderSegmentCount));
- String uri = runtimePath == null ? null : runtimePath.toString();
- if (uri == null)
- continue;
- if (resources[i].getType() == IResource.FILE) {
- if (!shouldInclude(uri))
- continue;
- cFile = createFile(uri);
- cFile.setLastModified(getLastModified(resources[i]));
- filesHolder.addFile(cFile, resources[i]);
- fileAdded = true;
- } else if (shouldInclude((IContainer) resources[i])) {
- IResource[] nestedResources = ((IContainer) resources[i]).members();
- aggregateOutputFiles(nestedResources, runtimePathPrefix, outputFolderSegmentCount);
- if(!filesHolder.contains(uri)){
- if (!shouldInclude(uri))
- continue;
- cFile = createDirectory(uri);
- cFile.setLastModified(getLastModified(resources[i]));
- filesHolder.addDirectory(cFile);
- fileAdded = true;
- }
- }
- }
- return fileAdded;
- }
-
- /**
- * This is used to track whether {@link #aggregateFiles(IVirtualResource[])} is currently within a Java Source folder.
- */
- private boolean inJavaSrc = false;
-
- protected boolean aggregateFiles(IVirtualResource[] virtualResources) throws CoreException {
- boolean fileAdded = false;
- for (int i = 0; i < virtualResources.length; i++) {
- File cFile = null;
- if (!virtualResources[i].exists()) {
- continue;
- }
- // We have to avoid duplicates between the source and output folders (non-java
- // resources)
- IPath runtimePath = virtualResources[i].getRuntimePath();
- String uri = runtimePath == null ? null : runtimePath.toString();
- if (uri == null)
- continue;
- if (uri.charAt(0) == IPath.SEPARATOR) {
- uri = uri.substring(1);
- }
- if (filesHolder.contains(uri))
- continue;
-
- if (virtualResources[i].getType() == IVirtualResource.FILE) {
- if (!shouldInclude(uri))
- continue;
- IResource resource = virtualResources[i].getUnderlyingResource();
- // want to ignore derived resources nested within Java src directories; this covers the case where
- // a user has nested a Java output directory within a Java src directory (note: should ideally be
- // respecting Java src path exclusion filters)
- if (inJavaSrc && resource.isDerived()) {
- continue;
- }
- cFile = createFile(uri);
- cFile.setLastModified(getLastModified(resource));
- filesHolder.addFile(cFile, resource);
- fileAdded = true;
- } else if (shouldInclude((IVirtualContainer) virtualResources[i])) {
- boolean inJavaSrcAtThisLevel = inJavaSrc;
- try {
- if (!inJavaSrc) {
- // if not already inside a Java src dir, check again
- inJavaSrc = inJavaSrc(virtualResources[i]);
- }
- IVirtualResource[] nestedVirtualResources = ((IVirtualContainer) virtualResources[i]).members();
- aggregateFiles(nestedVirtualResources);
- if(!filesHolder.contains(uri)){
- if (!shouldInclude(uri))
- continue;
- IResource resource = virtualResources[i].getUnderlyingResource();
- if (inJavaSrc && resource.isDerived()) {
- continue;
- }
- cFile = createDirectory(uri);
- cFile.setLastModified(getLastModified(resource));
- filesHolder.addDirectory(cFile);
- fileAdded = true;
- }
- } finally {
- inJavaSrc = inJavaSrcAtThisLevel;
- }
- }
- }
- return fileAdded;
- }
-
- /**
- * Determines if the specified IVirtualResource maps to a IResource that is contained within a Java src root.
- * @param virtualResource IVirtualResource to check.
- * @param sourceRoots Current Java src roots.
- * @return True if contained in a Java src root, false otherwise.
- */
- protected boolean inJavaSrc(final IVirtualResource virtualResource) {
- if (sourceRoots.length == 0) {
- return false;
- }
- // all mapped resources must be associated with Java src for the resource to be considered in Java src
- final IResource[] resources = virtualResource.getUnderlyingResources();
- boolean inJavaSrc = false;
- for (int i = 0; i < resources.length; i++) {
- inJavaSrc = false;
- for (int j = 0; j < sourceRoots.length; j++) {
- if (sourceRoots[j].getFullPath().isPrefixOf(resources[i].getFullPath())) {
- inJavaSrc = true;
- break;
- }
- }
- // if this one was not in Java src, can break
- if (!inJavaSrc) {
- break;
- }
- }
-
- return inJavaSrc;
- }
-
- protected long getLastModified(IResource aResource) {
- return aResource.getLocation().toFile().lastModified();
- }
-
- public void setExportSource(boolean newExportSource) {
- exportSource = newExportSource;
- }
-
- public boolean isExportSource() {
- return exportSource;
- }
-
- protected boolean shouldInclude(IContainer aContainer) {
- return true;
- }
-
- protected boolean shouldInclude(IVirtualContainer vContainer) {
- IContainer iContainer = (IContainer) vContainer.getUnderlyingResource();
- return shouldInclude(iContainer);
- }
-
- protected boolean shouldInclude(String uri) {
- if (uri.length() == 0 || DOT_PROJECT.equals(uri) || DOT_CLASSPATH.equals(uri) || uri.endsWith(DOT_CVS_IGORE) || uri.startsWith(DOT_SETTINGS)){
- return false;
- }
- return isExportSource() || !isSource(uri);
- }
-
- protected boolean isSource(String uri) {
- if (uri == null)
- return false;
- return uri.endsWith(ArchiveUtil.DOT_JAVA) || uri.endsWith(ArchiveUtil.DOT_SQLJ);
- }
-
- protected void addExternalFile(String uri, java.io.File externalDiskFile) {
- File aFile = createFile(uri);
- filesHolder.addFile(aFile, externalDiskFile);
- }
-
- public InputStream getInputStream(String uri) throws IOException, FileNotFoundException {
- // If the MANIFEST.MF of a module component is being requested and that module component references
- // Java build path-based components, need to dynamically update the manifest classpath to reflect the resolved
- // contributions from the build path
- if (includeClasspathComponents &&
- uri.equals(J2EEConstants.MANIFEST_URI) && !javaClasspathURIs.isEmpty() &&
- manifestFile != null && manifestFile.getUnderlyingFile() != null &&
- manifestFile.getUnderlyingFile().exists()) {
- //update the manifest classpath for the component
- ByteArrayOutputStream baos = new ByteArrayOutputStream();
- ClasspathDependencyManifestUtil.updateManifestClasspath(manifestFile.getUnderlyingFile(), javaClasspathURIs, baos);
- return new ByteArrayInputStream(baos.toByteArray());
- }
-
- if (filesHolder.contains(uri)) {
- return filesHolder.getInputStream(uri);
- }
- IVirtualFolder rootFolder = vComponent.getRootFolder();
- IVirtualResource vResource = rootFolder.findMember(uri);
- String filePath = null;
- if (null != vResource && vResource.exists()) {
- filePath = vResource.getUnderlyingResource().getLocation().toOSString();
- java.io.File file = new java.io.File(filePath);
- return new FileInputStream(file);
- }
- String eString = EARArchiveOpsResourceHandler.ARCHIVE_OPERATION_FileNotFound;
- throw new FileNotFoundException(eString);
- }
-
- public Collection getLoadedMofResources() {
- Collection resources = super.getLoadedMofResources();
- Collection resourcesToRemove = new ArrayList();
- Iterator iterator = resources.iterator();
- while (iterator.hasNext()) {
- Resource res = (Resource) iterator.next();
- //only remove component files that are in the settings directory
- if (res.getURI().toString().endsWith(IModuleConstants.COMPONENT_FILE_NAME) && res.getURI().segmentsList().contains(IModuleConstants.DOT_SETTINGS))
- resourcesToRemove.add(res);
- }
- if (null != resourcesToRemove) {
- resources.removeAll(resourcesToRemove);
- }
-
- return resources;
- }
-
- protected synchronized ArtifactEdit getArtifactEditForRead() {
- if(artifactEdit == null){
- artifactEdit = ArtifactEdit.getArtifactEditForRead(vComponent);
- }
- return artifactEdit;
- }
-
- public Resource getMofResource(String uri) throws FileNotFoundException, ResourceLoadException {
- return getArtifactEditForRead().getResource(URI.createURI(uri));
- }
-
- public boolean isClassLoaderNeeded() {
- return false;
- }
-
- public IVirtualComponent getComponent() {
- return vComponent;
- }
-
- protected IProgressMonitor monitor = null;
-
- public void setProgressMonitor(IProgressMonitor monitor){
- this.monitor = monitor;
- }
-
- protected final int FILE_SAVE_WORK = 100;
-
- public FileIterator getFileIterator() throws IOException {
- return new FileIteratorImpl(getContainer().getFiles()){
- protected SubProgressMonitor lastSubMon = null;
- boolean firstVisit = true;
-
- public File next() {
- if(firstVisit){
- firstVisit = false;
- if(monitor != null){
- monitor.beginTask(ProjectSupportResourceHandler.getString(ProjectSupportResourceHandler.Exporting_archive, new Object [] { getContainer().getURI() }), files.size() * FILE_SAVE_WORK);
- }
- }
- if(lastSubMon != null){
- lastSubMon.done();
- lastSubMon = null;
- } else if(monitor != null){
- monitor.worked(FILE_SAVE_WORK);
- }
- File file = super.next();
- if(monitor != null){
- if(file.isContainer() && ComponentLoadStrategyImpl.class.isInstance(((ContainerImpl)file).getLoadStrategy())){
- ComponentLoadStrategyImpl ls = (ComponentLoadStrategyImpl)((ContainerImpl)file).getLoadStrategy();
- lastSubMon = new SubProgressMonitor(monitor, FILE_SAVE_WORK, SubProgressMonitor.PREPEND_MAIN_LABEL_TO_SUBTASK);
- ls.setProgressMonitor(lastSubMon);
- } else {
- monitor.subTask(file.getURI());
- }
- }
- return file;
- }
- };
-
- }
-
- public void close() {
- if(Thread.currentThread().toString().toLowerCase().indexOf("finalizer") != -1){
- System.err.println("Opener of Archive didn't close! "+this);
- exception.printStackTrace(System.err);
- }
-
- try{
- Iterator it = zipFiles.iterator();
- while (it.hasNext()) {
- ZipFile file = (ZipFile) it.next();
- try {
- file.close();
- } catch (IOException e) {
- Logger.getLogger().logError(e);
- }
- }
- } finally{
- try{
- synchronized(this) {
- if(artifactEdit != null){
- ArtifactEditModel editModel = (ArtifactEditModel)artifactEdit.getAdapter(ArtifactEditModel.class);
- if(editModel != null && !editModel.isDisposed()){
- artifactEdit.dispose();
- }
- artifactEdit = null;
- }
- }
- } finally {
- super.close();
- }
- }
-
- }
-}
diff --git a/plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/internal/archive/operations/ComponentSaveStrategyImpl.java b/plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/internal/archive/operations/ComponentSaveStrategyImpl.java
deleted file mode 100644
index 117c4d673..000000000
--- a/plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/internal/archive/operations/ComponentSaveStrategyImpl.java
+++ /dev/null
@@ -1,283 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jst.j2ee.internal.archive.operations;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.core.resources.IContainer;
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IFolder;
-import org.eclipse.core.resources.IWorkspaceRoot;
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.Path;
-import org.eclipse.emf.ecore.resource.Resource;
-import org.eclipse.jst.j2ee.commonarchivecore.internal.Archive;
-import org.eclipse.jst.j2ee.commonarchivecore.internal.File;
-import org.eclipse.jst.j2ee.commonarchivecore.internal.exception.SaveFailureException;
-import org.eclipse.jst.j2ee.commonarchivecore.internal.helpers.ArchiveManifest;
-import org.eclipse.jst.j2ee.commonarchivecore.internal.strategy.SaveStrategy;
-import org.eclipse.jst.j2ee.commonarchivecore.internal.strategy.SaveStrategyImpl;
-import org.eclipse.wst.common.componentcore.ComponentCore;
-import org.eclipse.wst.common.componentcore.datamodel.properties.ICreateReferenceComponentsDataModelProperties;
-import org.eclipse.wst.common.componentcore.internal.operation.CreateReferenceComponentsDataModelProvider;
-import org.eclipse.wst.common.componentcore.internal.resources.VirtualArchiveComponent;
-import org.eclipse.wst.common.componentcore.internal.util.IModuleConstants;
-import org.eclipse.wst.common.componentcore.resources.IVirtualComponent;
-import org.eclipse.wst.common.componentcore.resources.IVirtualFile;
-import org.eclipse.wst.common.componentcore.resources.IVirtualFolder;
-import org.eclipse.wst.common.frameworks.datamodel.DataModelFactory;
-import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
-import org.eclipse.wst.common.frameworks.internal.DoNotUseMeThisWillBeDeletedPost15;
-
-public abstract class ComponentSaveStrategyImpl extends SaveStrategyImpl {
-
- protected IDataModel dataModel;
- protected IVirtualComponent vComponent;
- protected IOverwriteHandler overwriteHandler;
- protected IProgressMonitor progressMonitor;
-
- private String archiveComponentsDeployPath;
- private List archiveComponents;
- private Map archiveComponentURIMap;
- private Map archiveComponentDeployPathMap;
-
- public ComponentSaveStrategyImpl(IVirtualComponent vComponent) {
- super();
- if (null == vComponent) {
- throw new NullPointerException();
- }
- this.vComponent = vComponent;
- }
-
- public void setDataModel(IDataModel dataModel) {
- this.dataModel = dataModel;
- }
-
- public void setOverwriteHandler(IOverwriteHandler newOverwriteHandler) {
- overwriteHandler = newOverwriteHandler;
- }
-
- public void setProgressMonitor(IProgressMonitor newProgressMonitor) {
- progressMonitor = newProgressMonitor;
- }
-
- protected void validateEdit(IFile aFile) {
- if (overwriteHandler == null)
- return;
- if (!(aFile.exists() && aFile.isReadOnly()))
- return;
-
- overwriteHandler.validateEdit(aFile);
- }
-
- protected boolean shouldOverwrite(String uri) {
- if (overwriteHandler.isOverwriteNone())
- return false;
- return (overwriteHandler.isOverwriteResources() || overwriteHandler.isOverwriteAll() || overwriteHandler.shouldOverwrite(uri));
- }
-
- protected SaveStrategy createNestedSaveStrategy(Archive anArchive) throws IOException {
- return null;
- }
-
- protected OutputStream getOutputStreamForResource(Resource aResource) throws IOException {
- // this method has no references in the hirarchy
- return null;
- }
-
- protected void saveFiles() throws SaveFailureException {
- super.saveFiles();
- linkArchiveComponents();
- }
-
- public void save(File aFile, InputStream in) throws SaveFailureException {
- try {
- progressMonitor.subTask(aFile.getURI());
-
- IPath projectRelativePath = getOutputPathForFile(aFile);
- if (aFile.isArchive()) {
- saveAsArchiveComponent((Archive) aFile, projectRelativePath, in);
- } else if (!aFile.isDirectoryEntry()) {
- saveToOutputPath(projectRelativePath, in);
- } else {
- createDirectory(projectRelativePath);
- }
- } catch (OverwriteHandlerException ohe) {
- throw ohe;
- } catch (Exception e) {
- String errorString = EJBArchiveOpsResourceHandler.ARCHIVE_OPERATION_SaveFile + aFile.getName();
- throw new SaveFailureException(errorString, e);
- } finally {
- progressMonitor.worked(1);
- }
- }
-
- //TODO this should be renamed to getProjectRelativePath
- /**
- * Returns the project relative path for where the specified file should be
- * saved.
- *
- * @param aFile
- * @return
- */
- protected IPath getOutputPathForFile(File aFile) {
- String uri = aFile.getURI();
- IFile iFile = null;
- if(uri.startsWith(IModuleConstants.DOT_SETTINGS)){
- iFile = vComponent.getProject().getFile(new Path(uri));
- }else {
- IVirtualFolder rootFolder = vComponent.getRootFolder();
- IVirtualFile vFile = rootFolder.getFile(aFile.getURI());
- iFile = vFile.getUnderlyingFile();
- }
- return iFile.getProjectRelativePath();
- }
-
- //TODO This isn't referenced in WTP it should be deleted.
- /**
- * @deprecated
- */
- protected void saveToWorkbenchPath(IPath workbenchPath, InputStream in) throws Exception {
- IFile iFile = ResourcesPlugin.getWorkspace().getRoot().getFile(workbenchPath);
- saveToIFile(iFile, in);
- }
-
- /**
- * Creates the IFolder specified by the project relative path.
- *
- * @param projectRelativePath
- * @throws CoreException
- */
- protected void createDirectory(IPath projectRelativePath) throws CoreException {
- IFolder iFolder = vComponent.getProject().getFolder(projectRelativePath);
- if (!iFolder.exists()) {
- mkdirs(iFolder);
- }
- }
-
- /**
- * Creates the specified IFolder
- *
- * @param folder
- * @throws CoreException
- */
- protected void mkdirs(IFolder folder) throws CoreException {
- IContainer container = folder.getParent();
- if (!container.exists()) {
- mkdirs((IFolder) container);
- }
- folder.create(true, true, null);
- }
-
- /**
- * Save the specified Archive to the specified project relative path
- * using the passed input stream.
- *
- * @param archive
- * @param projectRelativePath
- * @param in
- * @throws Exception
- */
- protected void saveAsArchiveComponent(Archive archive, IPath projectRelativePath, InputStream in) throws Exception {
- IFile iFile = saveToOutputPathIFile(projectRelativePath, in);
- //TODO investigate removing this block and related variables and linkArchiveComponents(); see bugzilla 159160
- if (shouldLinkAsComponentRef(archive)) {
- IVirtualComponent archiveComponent = ComponentCore.createArchiveComponent(vComponent.getProject(), VirtualArchiveComponent.LIBARCHIVETYPE + iFile.getFullPath().toString());
- if (archiveComponents == null) {
- archiveComponents = new ArrayList();
- archiveComponentURIMap = new HashMap();
- archiveComponentDeployPathMap = new HashMap();
- archiveComponentsDeployPath = IPath.SEPARATOR + (new Path(archive.getURI())).removeLastSegments(1).toString();
- }
- archiveComponents.add(archiveComponent);
- archiveComponentURIMap.put(archiveComponent, iFile.getName());
- archiveComponentDeployPathMap.put(archiveComponent, IPath.SEPARATOR + (new Path(archive.getURI())).removeLastSegments(1).toString());
- }
- }
-
- protected boolean shouldLinkAsComponentRef(Archive archive) {
- return false;
- }
-
- protected void linkArchiveComponents() {
- if (archiveComponents != null && archiveComponents.size() > 0) {
- IDataModel createReferencesDataModel = DataModelFactory.createDataModel(new CreateReferenceComponentsDataModelProvider());
- createReferencesDataModel.setProperty(ICreateReferenceComponentsDataModelProperties.SOURCE_COMPONENT, vComponent);
- createReferencesDataModel.setProperty(ICreateReferenceComponentsDataModelProperties.TARGET_COMPONENTS_DEPLOY_PATH, archiveComponentsDeployPath);
- createReferencesDataModel.setProperty(ICreateReferenceComponentsDataModelProperties.TARGET_COMPONENTS_DEPLOY_PATH_MAP, archiveComponentDeployPathMap);
- createReferencesDataModel.setProperty(ICreateReferenceComponentsDataModelProperties.TARGET_COMPONENT_LIST, archiveComponents);
- createReferencesDataModel.setProperty(ICreateReferenceComponentsDataModelProperties.TARGET_COMPONENTS_TO_URI_MAP, archiveComponentURIMap);
- try {
- createReferencesDataModel.getDefaultOperation().execute(null, null);
- } catch (ExecutionException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- }
- }
-
- /**
- * Saves to the specified project relative output path. Warning this method
- * will be changed post 1.5 to return an IFile
- *
- * @param projectRelativePath
- * @param in
- * @throws Exception
- */
- protected void saveToOutputPath(IPath projectRelativePath, InputStream in) throws Exception {
- saveToOutputPathIFile(projectRelativePath, in);
- }
-
- /**
- * TODO refactor change the method above to return IFile
- * {@link DoNotUseMeThisWillBeDeletedPost15}
- */
- protected IFile saveToOutputPathIFile(IPath projectRelativePath, InputStream in) throws Exception {
- IFile iFile = vComponent.getProject().getFile(projectRelativePath);
- saveToIFile(iFile, in);
- return iFile;
- }
-
-
- protected void saveToIFile(IFile iFile, InputStream in) throws Exception {
- validateEdit(iFile);
- if (iFile.exists())
- iFile.setContents(in, true, true, null);
- else {
- mkdirs(iFile.getFullPath().removeLastSegments(1), ResourcesPlugin.getWorkspace().getRoot());
- iFile.create(in, true, null);
- }
- }
-
-
- protected void mkdirs(IPath path, IWorkspaceRoot root) throws CoreException {
- if (path.segmentCount() <= 1)
- return;
- IFolder folder = root.getFolder(path);
- if (!folder.exists()) {
- mkdirs(path.removeLastSegments(1), root);
- folder.create(true, true, null);
- }
- }
-
- public void save(ArchiveManifest aManifest) throws SaveFailureException {
- }
-}
diff --git a/plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/internal/archive/operations/ConnectorComponentSaveStrategyImpl.java b/plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/internal/archive/operations/ConnectorComponentSaveStrategyImpl.java
deleted file mode 100644
index f0c4e7ae0..000000000
--- a/plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/internal/archive/operations/ConnectorComponentSaveStrategyImpl.java
+++ /dev/null
@@ -1,21 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jst.j2ee.internal.archive.operations;
-
-import org.eclipse.wst.common.componentcore.resources.IVirtualComponent;
-
-public class ConnectorComponentSaveStrategyImpl extends J2EEComponentSaveStrategyImpl {
-
- public ConnectorComponentSaveStrategyImpl(IVirtualComponent vComponent) {
- super(vComponent);
- }
-
-}
diff --git a/plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/internal/archive/operations/DependentJarExportMerger.java b/plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/internal/archive/operations/DependentJarExportMerger.java
deleted file mode 100644
index 6c5e888eb..000000000
--- a/plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/internal/archive/operations/DependentJarExportMerger.java
+++ /dev/null
@@ -1,129 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jst.j2ee.internal.archive.operations;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.jar.Attributes;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.jst.j2ee.commonarchivecore.internal.Archive;
-import org.eclipse.jst.j2ee.commonarchivecore.internal.CommonarchiveFactory;
-import org.eclipse.jst.j2ee.commonarchivecore.internal.CommonarchivePackage;
-import org.eclipse.jst.j2ee.commonarchivecore.internal.File;
-import org.eclipse.jst.j2ee.commonarchivecore.internal.exception.DuplicateObjectException;
-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;
-
-public class DependentJarExportMerger {
- protected Archive outgoingArchive;
- protected IProject project;
- protected List dependentArchives;
- protected boolean includeSource;
-
- /**
- * DependentJarExportMerger constructor comment.
- */
- public DependentJarExportMerger(Archive archive, IProject aProject, boolean includeSourceFiles) {
- super();
- outgoingArchive = archive;
- project = aProject;
- includeSource = includeSourceFiles;
- }
-
- protected void finalize() throws Throwable {
- release();
- }
-
- public CommonarchiveFactory getArchiveFactory() {
- return CommonarchivePackage.eINSTANCE.getCommonarchiveFactory();
- }
-
- public void merge() {
- String[] cp = outgoingArchive.getManifest().getClassPathTokenized();
- dependentArchives = new ArrayList(cp.length);
- List keepClassPaths = new ArrayList();
- for (int i = 0; i < cp.length; i++) {
- Archive dependentJar = null;
- IFile file = null;
- try {
- file = project.getFile(cp[i]);
- } catch (IllegalArgumentException e) {
- continue;
- }
- if (file.exists() && cp[i].endsWith(J2EEImportConstants.IMPORTED_JAR_SUFFIX)) {
- try {
- dependentJar = getArchiveFactory().primOpenArchive(file.getLocation().toOSString());
- } catch (OpenFailureException ex) {
- // Need to write this to the log file
- org.eclipse.jem.util.logger.proxy.Logger.getLogger().logError(ex);
- continue;
- }
- dependentArchives.add(dependentJar);
- mergeFiles(dependentJar);
- } else
- keepClassPaths.add(cp[i]);
- }
- resetClassPath(keepClassPaths);
- }
-
- protected void mergeFiles(Archive dependentJar) {
- List files = dependentJar.getFiles();
- List filesToAdd = new java.util.ArrayList();
- for (int i = 0; i < files.size(); i++) {
- File aFile = (File) files.get(i);
- if (shouldMerge(aFile))
- filesToAdd.add(aFile);
- }
- try {
- outgoingArchive.addCopyFiles(filesToAdd);
- } catch (DuplicateObjectException ignore) {
- // Shouldn't happen because we just checked for dups
- }
- }
-
- /**
- * Clients must call this when done to close the archives
- */
- public void release() {
- if (dependentArchives == null)
- return;
- for (int i = 0; i < dependentArchives.size(); i++) {
- Archive anArchive = (Archive) dependentArchives.get(i);
- if (anArchive.isOpen())
- anArchive.close();
- }
- }
-
- protected void resetClassPath(List cp) {
- ArchiveManifest mf = outgoingArchive.getManifest();
- if (cp.isEmpty())
- mf.getMainAttributes().remove(Attributes.Name.CLASS_PATH);
- else {
- mf.setClassPath("");//$NON-NLS-1$
- for (int i = 0; i < cp.size(); i++) {
- mf.appendClassPath((String) cp.get(i));
- }
- }
- }
-
- protected boolean shouldMerge(File aFile) {
-
- String uri = aFile.getURI();
- if (!(uri.endsWith(".java") || uri.endsWith(".class")))//$NON-NLS-2$//$NON-NLS-1$
- return false;
- if (!includeSource && uri.endsWith(".java"))//$NON-NLS-1$
- return false;
- return !outgoingArchive.containsFile(uri) && !ArchiveConstants.MANIFEST_URI.equals(uri);
- }
-}
diff --git a/plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/internal/archive/operations/EARArchiveOpsResourceHandler.java b/plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/internal/archive/operations/EARArchiveOpsResourceHandler.java
deleted file mode 100644
index e7403e03a..000000000
--- a/plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/internal/archive/operations/EARArchiveOpsResourceHandler.java
+++ /dev/null
@@ -1,49 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 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.archive.operations;
-
-import org.eclipse.osgi.util.NLS;
-
-public final class EARArchiveOpsResourceHandler extends NLS {
-
- private static final String BUNDLE_NAME = "eararchiveops";//$NON-NLS-1$
-
- private EARArchiveOpsResourceHandler() {
- // Do not instantiate
- }
-
- public static String ARCHIVE_OPERATION_SaveMofResources;
- public static String ARCHIVE_OPERATION_SaveFile;
- public static String ARCHIVE_OPERATION_ProjectNature;
- public static String ARCHIVE_OPERATION_SaveManifest;
- public static String ARCHIVE_OPERATION_FileNotFound;
- public static String ARCHIVE_OPERATION_FileContents;
- public static String ARCHIVE_OPERATION_ErroOccured;
- public static String ARCHIVE_OPERATION_FilesFromProject;
- public static String ARCHIVE_OPERATION_OpeningArchive;
- public static String ARCHIVE_OPERATION_ImportOperation;
- public static String IMPORT_MOFRESOURCE_STRING;
- public static String EAR_IMPORT_FILE_STRING;
- public static String ERROR_IMPORTING_EAR_FILE;
- public static String ERROR_EXPORTING_EAR_FILE;
- public static String IMPORTING_EAR_FILE_UI_;
- public static String Updating_project_classpath_UI_;
- public static String UNABLE_TO_LOAD_MODULE_ERROR_;
- public static String _jar_UI_;
- public static String Updating_manifest_Class_Path__attributes_UI_;
- public static String _preDeploy_ERROR_;
- public static String noRuntimeSelectedLabel;
- public static String MISSING_CLIENT_JAR;
-
- static {
- NLS.initializeMessages(BUNDLE_NAME, EARArchiveOpsResourceHandler.class);
- }
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/internal/archive/operations/EARComponentExportOperation.java b/plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/internal/archive/operations/EARComponentExportOperation.java
deleted file mode 100644
index 2a1bd2290..000000000
--- a/plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/internal/archive/operations/EARComponentExportOperation.java
+++ /dev/null
@@ -1,93 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jst.j2ee.internal.archive.operations;
-
-import java.lang.reflect.InvocationTargetException;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.SubProgressMonitor;
-import org.eclipse.jst.j2ee.commonarchivecore.internal.EARFile;
-import org.eclipse.jst.j2ee.commonarchivecore.internal.exception.SaveFailureException;
-import org.eclipse.jst.j2ee.componentcore.EnterpriseArtifactEdit;
-import org.eclipse.jst.j2ee.internal.J2EEVersionConstants;
-import org.eclipse.jst.j2ee.internal.archive.JavaEEArchiveUtilities;
-import org.eclipse.jst.j2ee.internal.project.J2EEProjectUtilities;
-import org.eclipse.jst.jee.archive.IArchive;
-import org.eclipse.wst.common.componentcore.internal.util.ComponentUtilities;
-import org.eclipse.wst.common.componentcore.resources.IVirtualComponent;
-import org.eclipse.wst.common.componentcore.resources.IVirtualReference;
-import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
-
-public class EARComponentExportOperation extends J2EEArtifactExportOperation {
-
- public EARComponentExportOperation(IDataModel model) {
- super(model);
- }
-
- protected void export() throws SaveFailureException, CoreException, InvocationTargetException, InterruptedException {
- IProgressMonitor subMonitor = new SubProgressMonitor(progressMonitor, EXPORT_WORK);
- IArchive archiveFromComponent = null;
- try {
- //[Bug 244049] need to use ProjectFacet version to determine how to export the EAR
- String versionStr = J2EEProjectUtilities.getJ2EEProjectVersion(getComponent().getProject());
- if (versionStr.equals(J2EEVersionConstants.VERSION_5_0_TEXT)) {
- archiveFromComponent = JavaEEArchiveUtilities.INSTANCE.openArchive(getComponent());
- saveArchive(archiveFromComponent, getDestinationPath().toOSString(), subMonitor);
- } else {
- EnterpriseArtifactEdit artifactEdit = null;
- try {
- artifactEdit = (EnterpriseArtifactEdit) ComponentUtilities.getArtifactEditForRead(getComponent());
- EARFile archive = (EARFile) artifactEdit.asArchive(isExportSource());
- String destination = getDestinationPath().toOSString();
- archive.setURI(destination);
- setModuleFile(archive);
- ComponentLoadStrategyImpl ls = (ComponentLoadStrategyImpl) archive.getLoadStrategy();
- ls.setProgressMonitor(subMonitor);
- archive.saveAsNoReopen(destination);
- } catch (SaveFailureException ex) {
- throw ex;
- } catch (Exception e) {
- throw new SaveFailureException(AppClientArchiveOpsResourceHandler.ARCHIVE_OPERATION_OpeningArchive, e);
- } finally {
- if (null != artifactEdit) {
- artifactEdit.dispose();
- }
- }
- }
- } catch (Exception e) {
- throw new SaveFailureException(AppClientArchiveOpsResourceHandler.ARCHIVE_OPERATION_OpeningArchive, e);
- } finally {
- if (archiveFromComponent != null)
- JavaEEArchiveUtilities.INSTANCE.closeArchive(archiveFromComponent);
- subMonitor.done();
- }
- }
-
- protected void runNecessaryBuilders(IVirtualComponent component, IProgressMonitor monitor) throws CoreException {
- try {
- IVirtualReference[] refs = component.getReferences();
- int work = (JAVA_BUILDER_WORK + LIB_BUILDER_WORK) / (refs.length + 1);
- super.runNecessaryBuilders(component, new SubProgressMonitor(monitor, work));
- for (int i = 0; i < refs.length; i++) {
- IVirtualComponent refComp = refs[i].getReferencedComponent();
- super.runNecessaryBuilders(refComp, new SubProgressMonitor(monitor, work));
- }
- } finally {
- monitor.done();
- }
- }
-
- protected String archiveString() {
- return "EAR";
- }
-
-}
diff --git a/plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/internal/archive/operations/EARComponentImportOperation.java b/plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/internal/archive/operations/EARComponentImportOperation.java
deleted file mode 100644
index 81ed616dc..000000000
--- a/plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/internal/archive/operations/EARComponentImportOperation.java
+++ /dev/null
@@ -1,216 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jst.j2ee.internal.archive.operations;
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.SubProgressMonitor;
-import org.eclipse.jem.util.logger.proxy.Logger;
-import org.eclipse.jst.j2ee.application.internal.operations.AddComponentToEnterpriseApplicationDataModelProvider;
-import org.eclipse.jst.j2ee.commonarchivecore.internal.EARFile;
-import org.eclipse.jst.j2ee.commonarchivecore.internal.helpers.ArchiveConstants;
-import org.eclipse.jst.j2ee.commonarchivecore.internal.strategy.SaveStrategy;
-import org.eclipse.jst.j2ee.componentcore.EnterpriseArtifactEdit;
-import org.eclipse.jst.j2ee.datamodel.properties.IEARComponentImportDataModelProperties;
-import org.eclipse.jst.j2ee.datamodel.properties.IJ2EEComponentImportDataModelProperties;
-import org.eclipse.jst.j2ee.internal.archive.ArchiveWrapper;
-import org.eclipse.jst.j2ee.internal.archive.ComponentArchiveSaveAdapter;
-import org.eclipse.jst.j2ee.internal.archive.EARComponentArchiveSaveAdapter;
-import org.eclipse.jst.j2ee.project.facet.IJ2EEFacetProjectCreationDataModelProperties;
-import org.eclipse.wst.common.componentcore.datamodel.properties.ICreateReferenceComponentsDataModelProperties;
-import org.eclipse.wst.common.componentcore.datamodel.properties.IFacetProjectCreationDataModelProperties;
-import org.eclipse.wst.common.componentcore.internal.operation.CreateReferenceComponentsDataModelProvider;
-import org.eclipse.wst.common.componentcore.resources.IVirtualComponent;
-import org.eclipse.wst.common.frameworks.datamodel.DataModelFactory;
-import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
-
-public class EARComponentImportOperation extends J2EEArtifactImportOperation {
-
- protected EnterpriseArtifactEdit artifactEdit = null;
-
- protected final int LINK_COMPONENTS_WORK = 10;
- protected final int WEB_LIB_WORK = 10;
- protected final int DISPOSE_WORK = 10;
-
- public EARComponentImportOperation(IDataModel model) {
- super(model);
- }
-
-
- protected ComponentArchiveSaveAdapter getArchiveSaveAdapter(IVirtualComponent virtualComponent){
- return new EARComponentArchiveSaveAdapter(virtualComponent);
- }
-
- protected int computeTotalWork() {
- int baseWork = super.computeTotalWork() + WEB_LIB_WORK + DISPOSE_WORK;
- List modelsToImport = (List) model.getProperty(IEARComponentImportDataModelProperties.HANDLED_PROJECT_MODELS_LIST);
- IDataModel importModel = null;
- for (int i = 0; i < modelsToImport.size(); i++) {
- importModel = (IDataModel) modelsToImport.get(i);
- ArchiveWrapper nestedArchive = (ArchiveWrapper) importModel.getProperty(IEARComponentImportDataModelProperties.ARCHIVE_WRAPPER);
- baseWork += LINK_COMPONENTS_WORK + PROJECT_CREATION_WORK + nestedArchive.getSize();
- }
- return baseWork;
- }
-
- /**
- * Subclasses must override to performs the workbench modification steps
- * that are to be contained within a single logical workbench change.
- *
- * @param monitor
- * the progress monitor to use to display progress
- */
- protected void doExecute(IProgressMonitor monitor) throws ExecutionException {
- super.doExecute(monitor);
- ExecutionException firstNestedException = null;
- List modelsToImport = (List) model.getProperty(IEARComponentImportDataModelProperties.HANDLED_PROJECT_MODELS_LIST);
- try {
- IDataModel importModel = null;
- // make sure the wars handle importing their own web libs
- for (int i = modelsToImport.size() - 1; i > 0; i--) {
- importModel = (IDataModel) modelsToImport.get(i);
- ArchiveWrapper nestedArchive = (ArchiveWrapper) importModel.getProperty(IEARComponentImportDataModelProperties.ARCHIVE_WRAPPER);
- if (nestedArchive.getPath().toString().startsWith(ArchiveConstants.WEBAPP_LIB_URI)) {
- ArchiveWrapper owningWar = (ArchiveWrapper) nestedArchive.getParent();
- modelsToImport.remove(importModel);
- for (int j = 0; j < modelsToImport.size(); j++) {
- IDataModel warModel = (IDataModel) modelsToImport.get(j);
- if (((ArchiveWrapper) (warModel.getProperty(IEARComponentImportDataModelProperties.ARCHIVE_WRAPPER))).getUnderLyingArchive() == owningWar.getUnderLyingArchive()) {
- // TODO this is bad, but don't have access to the
- // plugin where these
- // constants are defined.
- String archivesSelected = "WARImportDataModel.WEB_LIB_ARCHIVES_SELECTED"; //$NON-NLS-1$
- String libModels = "WARImportDataModel.WEB_LIB_MODELS"; //$NON-NLS-1$
- List warHandledArchives = (List) warModel.getProperty(archivesSelected);
- if (warHandledArchives == Collections.EMPTY_LIST) {
- warHandledArchives = new ArrayList();
- warModel.setProperty(archivesSelected, warHandledArchives);
- }
- warHandledArchives.add(nestedArchive);
- List warLibModels = (List) warModel.getProperty(libModels);
- for (int k = 0; k < warLibModels.size(); k++) {
- IDataModel libModel = (IDataModel) warLibModels.get(k);
- if (((ArchiveWrapper)libModel.getProperty(IJ2EEComponentImportDataModelProperties.ARCHIVE_WRAPPER)).getUnderLyingArchive() == nestedArchive.getUnderLyingArchive()) {
- libModel.setProperty(IJ2EEComponentImportDataModelProperties.PROJECT_NAME, importModel.getProperty(IJ2EEComponentImportDataModelProperties.PROJECT_NAME));
- libModel.setProperty(IFacetProjectCreationDataModelProperties.FACET_RUNTIME, importModel.getProperty(IFacetProjectCreationDataModelProperties.FACET_RUNTIME));
- }
- }
- }
- }
- }
- }
- monitor.worked(WEB_LIB_WORK);
-
- List <String> ddSpecifiedURIs = ((ArchiveWrapper) model.getProperty(IEARComponentImportDataModelProperties.ARCHIVE_WRAPPER)).getDDMappedModuleURIs();
- List componentToAddAsModules = new ArrayList();
- Map componentToURIMapAsModules = new HashMap();
- List componentToAddAsComponents = new ArrayList();
- Map componentToURIMapAsComponents = new HashMap();
-
- for (int i = 0; i < modelsToImport.size(); i++) {
- importModel = (IDataModel) modelsToImport.get(i);
- ArchiveWrapper nestedArchive = (ArchiveWrapper) importModel.getProperty(IEARComponentImportDataModelProperties.ARCHIVE_WRAPPER);
- importModel.setProperty(IJ2EEComponentImportDataModelProperties.CLOSE_ARCHIVE_ON_DISPOSE, Boolean.FALSE);
- IDataModel compCreationModel = importModel.getNestedModel(IJ2EEComponentImportDataModelProperties.NESTED_MODEL_J2EE_COMPONENT_CREATION);
- if (compCreationModel.isProperty(IJ2EEFacetProjectCreationDataModelProperties.MODULE_URI)){
- compCreationModel.setProperty(IJ2EEFacetProjectCreationDataModelProperties.MODULE_URI, nestedArchive.getPath().toString());
- }
- compCreationModel.setBooleanProperty(IJ2EEFacetProjectCreationDataModelProperties.ADD_TO_EAR, false);
- try {
- IStatus nestedImportStatus = importModel.getDefaultOperation().execute(new SubProgressMonitor(monitor, PROJECT_CREATION_WORK + nestedArchive.getSize()), info);
- if (!nestedImportStatus.isOK() && nestedImportStatus.getSeverity() == IStatus.ERROR) {
- throw new ExecutionException(nestedImportStatus.getMessage(), nestedImportStatus.getException());
- }
- } catch (ExecutionException e) {
- if (firstNestedException == null) {
- firstNestedException = e;
- }
- Logger.getLogger().logError(e);
- }
- IVirtualComponent component = (IVirtualComponent) importModel.getProperty(IJ2EEComponentImportDataModelProperties.COMPONENT);
- String uri = nestedArchive.getPath().toString();
- if(ddSpecifiedURIs.contains(uri)){
- componentToAddAsModules.add(component);
- componentToURIMapAsModules.put(component, uri);
- } else {
- componentToAddAsComponents.add(component);
- componentToURIMapAsComponents.put(component, uri);
- }
- }
-
- if (componentToAddAsModules.size() > 0) {
- //this block adds the component references to the component file and the EAR DD
- //this should only be called if the EAR DD already contains the module
- //and is necessary to update the id attribute (for the dependency object)
- IDataModel addComponentsDM = DataModelFactory.createDataModel(new AddComponentToEnterpriseApplicationDataModelProvider());
- addComponentsDM.setProperty(ICreateReferenceComponentsDataModelProperties.SOURCE_COMPONENT, virtualComponent);
- addComponentsDM.setProperty(ICreateReferenceComponentsDataModelProperties.TARGET_COMPONENT_LIST, componentToAddAsModules);
- addComponentsDM.setProperty(ICreateReferenceComponentsDataModelProperties.TARGET_COMPONENTS_TO_URI_MAP, componentToURIMapAsModules);
- addComponentsDM.getDefaultOperation().execute(new SubProgressMonitor(monitor, LINK_COMPONENTS_WORK/2), info);
- }
- if (componentToAddAsComponents.size() > 0){
- //this block only adds the component references to the component file
- //this should only be called when they are not already linked into the EAR DD
- IDataModel addComponentsDM = DataModelFactory.createDataModel(new CreateReferenceComponentsDataModelProvider());
- addComponentsDM.setProperty(ICreateReferenceComponentsDataModelProperties.SOURCE_COMPONENT, virtualComponent);
- addComponentsDM.setProperty(ICreateReferenceComponentsDataModelProperties.TARGET_COMPONENT_LIST, componentToAddAsComponents);
- addComponentsDM.setProperty(ICreateReferenceComponentsDataModelProperties.TARGET_COMPONENTS_TO_URI_MAP, componentToURIMapAsComponents);
- addComponentsDM.getDefaultOperation().execute(new SubProgressMonitor(monitor, LINK_COMPONENTS_WORK/2), info);
- }
-
- } finally {
- if (null != artifactEdit) {
- artifactEdit.dispose();
- artifactEdit = null;
- }
- resetDisposeImportModels();
- monitor.worked(DISPOSE_WORK);
- }
- if (firstNestedException != null) {
- throw firstNestedException;
- }
- }
-
- /**
- * @param modelsToImport
- */
- private void resetDisposeImportModels() {
- resetDisposeImportModels((List) model.getProperty(IEARComponentImportDataModelProperties.ALL_PROJECT_MODELS_LIST));
- }
-
- private void resetDisposeImportModels(List models) {
- IDataModel model;
- for (int i = 0; i < models.size(); i++) {
- model = (IDataModel) models.get(i);
- model.setProperty(IJ2EEComponentImportDataModelProperties.CLOSE_ARCHIVE_ON_DISPOSE, Boolean.TRUE);
- }
- }
-
- protected SaveStrategy createSaveStrategy(IProject project) { // NOOP
- return null;
- }
-
- protected SaveStrategy createSaveStrategy(IVirtualComponent virtualComponent) {
- return new EARComponentSaveStrategyImpl(virtualComponent);
- }
-
- protected EARFile getEarFile() {
- return (EARFile) model.getProperty(IEARComponentImportDataModelProperties.FILE);
- }
-}
diff --git a/plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/internal/archive/operations/EARComponentLoadStrategyImpl.java b/plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/internal/archive/operations/EARComponentLoadStrategyImpl.java
deleted file mode 100644
index 03d1791bb..000000000
--- a/plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/internal/archive/operations/EARComponentLoadStrategyImpl.java
+++ /dev/null
@@ -1,215 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jst.j2ee.internal.archive.operations;
-
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileNotFoundException;
-import java.io.IOException;
-import java.io.InputStream;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-
-import org.eclipse.core.resources.IFile;
-
-import org.eclipse.jst.j2ee.applicationclient.componentcore.util.AppClientArtifactEdit;
-import org.eclipse.jst.j2ee.classpathdep.IClasspathDependencyConstants;
-import org.eclipse.jst.j2ee.commonarchivecore.internal.Archive;
-import org.eclipse.jst.j2ee.commonarchivecore.internal.CommonArchiveResourceHandler;
-import org.eclipse.jst.j2ee.commonarchivecore.internal.exception.OpenFailureException;
-import org.eclipse.jst.j2ee.commonarchivecore.internal.strategy.ZipFileLoadStrategyImpl;
-import org.eclipse.jst.j2ee.componentcore.EnterpriseArtifactEdit;
-import org.eclipse.jst.j2ee.componentcore.J2EEModuleVirtualComponent;
-import org.eclipse.jst.j2ee.componentcore.util.EARArtifactEdit;
-import org.eclipse.jst.j2ee.internal.J2EEVersionConstants;
-import org.eclipse.jst.j2ee.internal.classpathdep.ClasspathDependencyVirtualComponent;
-import org.eclipse.jst.j2ee.internal.componentcore.JavaEEBinaryComponentHelper;
-import org.eclipse.jst.j2ee.internal.plugin.J2EEPlugin;
-import org.eclipse.jst.j2ee.internal.project.J2EEProjectUtilities;
-import org.eclipse.jst.jee.util.internal.JavaEEQuickPeek;
-import org.eclipse.wst.common.componentcore.ArtifactEdit;
-import org.eclipse.wst.common.componentcore.internal.resources.VirtualArchiveComponent;
-import org.eclipse.wst.common.componentcore.internal.util.ArtifactEditRegistryReader;
-import org.eclipse.wst.common.componentcore.resources.IVirtualComponent;
-import org.eclipse.wst.common.componentcore.resources.IVirtualReference;
-
-public class EARComponentLoadStrategyImpl extends ComponentLoadStrategyImpl {
-
- private List artifactEditsToDispose = new ArrayList();
- private Map binaryComponentURIsToDiskFileMap = new HashMap();
-
- public EARComponentLoadStrategyImpl(IVirtualComponent vComponent) {
- super(vComponent);
- }
-
- public EARComponentLoadStrategyImpl(IVirtualComponent vComponent, boolean includeClasspathComponents) {
- super(vComponent, includeClasspathComponents);
- }
-
- public List getFiles() {
- aggregateSourceFiles();
- addModulesAndUtilities();
- return filesHolder.getFiles();
- }
- protected synchronized ArtifactEdit getArtifactEditForRead() {
- if(artifactEdit == null){
- artifactEdit = EARArtifactEdit.getEARArtifactEditForRead(vComponent);
- }
- return artifactEdit;
- }
-
- public InputStream getInputStream(String uri) throws IOException, FileNotFoundException {
- if (binaryComponentURIsToDiskFileMap.containsKey(uri)) {
- java.io.File diskFile = (java.io.File) binaryComponentURIsToDiskFileMap.get(uri);
- return new FileInputStream(diskFile);
- }
- return super.getInputStream(uri);
- }
-
- public void addModulesAndUtilities() {
- EARArtifactEdit earArtifactEdit = null;
- try {
- earArtifactEdit = EARArtifactEdit.getEARArtifactEditForRead(vComponent);
- IVirtualReference[] components = earArtifactEdit.getComponentReferences();
- for (int i = 0; i < components.length; i++) {
- IVirtualReference reference = components[i];
- IVirtualComponent referencedComponent = reference.getReferencedComponent();
-
- java.io.File diskFile = null;
- boolean forceUtility = false;
- if (referencedComponent.isBinary()) {
- JavaEEQuickPeek qp = JavaEEBinaryComponentHelper.getJavaEEQuickPeek(referencedComponent);
- int jeeVersion = qp.getJavaEEVersion();
- if(jeeVersion == J2EEVersionConstants.JEE_5_0_ID){
- forceUtility = true;
- }
- diskFile = ((VirtualArchiveComponent) referencedComponent).getUnderlyingDiskFile();
- if (!diskFile.exists()) {
- IFile wbFile = ((VirtualArchiveComponent) referencedComponent).getUnderlyingWorkbenchFile();
- diskFile = new File(wbFile.getLocation().toOSString());
- }
- }
- boolean isModule = false;
- if(!forceUtility){
- boolean addClasspathComponentDependencies = false;
- ArtifactEdit componentArtifactEdit = null;
- try {
- if (J2EEProjectUtilities.isApplicationClientComponent(referencedComponent)) {
- componentArtifactEdit = AppClientArtifactEdit.getAppClientArtifactEditForRead(referencedComponent);
- } else if (J2EEProjectUtilities.isEJBComponent(referencedComponent)) {
- addClasspathComponentDependencies = true;
- componentArtifactEdit = ArtifactEditRegistryReader.instance().getArtifactEdit(J2EEProjectUtilities.EJB).createArtifactEditForRead(referencedComponent);
- } else if (J2EEProjectUtilities.isDynamicWebComponent(referencedComponent)) {
- addClasspathComponentDependencies = true;
- componentArtifactEdit = ArtifactEditRegistryReader.instance().getArtifactEdit(J2EEProjectUtilities.DYNAMIC_WEB).createArtifactEditForRead(referencedComponent);
- } else if (J2EEProjectUtilities.isJCAComponent(referencedComponent)) {
- addClasspathComponentDependencies = true;
- componentArtifactEdit = ArtifactEditRegistryReader.instance().getArtifactEdit(J2EEProjectUtilities.JCA).createArtifactEditForRead(referencedComponent);
- }
- if (null != componentArtifactEdit) {
- Archive archive = ((EnterpriseArtifactEdit) componentArtifactEdit).asArchive(exportSource, includeClasspathComponents);
- if (referencedComponent.isBinary()) {
- artifactEditsToDispose.add(componentArtifactEdit);
- archive.setLoadingContainer(getContainer());
- binaryComponentURIsToDiskFileMap.put(archive.getOriginalURI(), diskFile);
- }
- archive.setURI(earArtifactEdit.getModuleURI(referencedComponent));
- filesHolder.addFile(archive);
- isModule = true;
- if (addClasspathComponentDependencies) {
- addClasspathComponentDependencies(referencedComponent);
- }
- }
- } catch (OpenFailureException oe) {
- J2EEPlugin.logError(oe);
- } finally {
- if (!referencedComponent.isBinary() && componentArtifactEdit != null) {
- componentArtifactEdit.dispose();
- }
- }
- }
- if (!isModule) {
- if (referencedComponent.isBinary()) {
- String uri = reference.getArchiveName();
- addExternalFile(uri, diskFile);
- } else if (J2EEProjectUtilities.isUtilityProject(referencedComponent.getProject())) {
- try {
- if (!referencedComponent.isBinary()) {
- String uri = earArtifactEdit.getModuleURI(referencedComponent);
- Archive archive = J2EEProjectUtilities.asArchive(uri, referencedComponent.getProject(), exportSource, includeClasspathComponents);
- archive.setURI(uri);
- filesHolder.addFile(archive);
- addClasspathComponentDependencies(referencedComponent);
- } else {
-
-
- }
- } catch (OpenFailureException e) {
- J2EEPlugin.logError(e);
- }
- }
- }
- }
-
- } finally {
- if (null != earArtifactEdit) {
- earArtifactEdit.dispose();
- }
- }
- }
-
- private void addClasspathComponentDependencies(final IVirtualComponent referencedComponent) {
- // retrieve all Java classpath component dependencies
- if (includeClasspathComponents && referencedComponent instanceof J2EEModuleVirtualComponent) {
- final IVirtualReference[] cpRefs = ((J2EEModuleVirtualComponent) referencedComponent).getJavaClasspathReferences();
- for (int j = 0; j < cpRefs.length; j++) {
- final IVirtualReference ref = cpRefs[j];
- // only ../ runtime paths contribute to the EAR
- if (ref.getRuntimePath().equals(IClasspathDependencyConstants.RUNTIME_MAPPING_INTO_CONTAINER_PATH)) {
- if (ref.getReferencedComponent() instanceof ClasspathDependencyVirtualComponent) {
- final ClasspathDependencyVirtualComponent comp = (ClasspathDependencyVirtualComponent) ref.getReferencedComponent();
- File cpEntryFile = comp.getUnderlyingDiskFile();
- if (!cpEntryFile.exists()) {
- final IFile wbFile = comp.getUnderlyingWorkbenchFile();
- cpEntryFile = new File(wbFile.getLocation().toOSString());
- }
- addExternalFile(ref.getArchiveName(), cpEntryFile);
- }
- }
- }
- }
- }
-
- public void close() {
- super.close();
- Iterator it = artifactEditsToDispose.iterator();
- while (it.hasNext()) {
- ArtifactEdit edit = (ArtifactEdit) it.next();
- edit.dispose();
- }
- artifactEditsToDispose.clear();
- }
-
- public ZipFileLoadStrategyImpl createLoadStrategy(String uri) throws FileNotFoundException, IOException {
- String filename = uri.replace('/', java.io.File.separatorChar);
- java.io.File file = new java.io.File(filename);
- if (!file.exists()) {
- throw new FileNotFoundException(CommonArchiveResourceHandler.getString(CommonArchiveResourceHandler.file_not_found_EXC_, (new Object[]{uri, file.getAbsolutePath()}))); // =
- }
- if (file.isDirectory()) {
- throw new FileNotFoundException(CommonArchiveResourceHandler.getString(CommonArchiveResourceHandler.file_not_found_EXC_, (new Object[]{uri, file.getAbsolutePath()}))); // =
- }
- return new org.eclipse.jst.j2ee.commonarchivecore.internal.strategy.ZipFileLoadStrategyImpl(file);
- }
-}
diff --git a/plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/internal/archive/operations/EARComponentSaveStrategyImpl.java b/plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/internal/archive/operations/EARComponentSaveStrategyImpl.java
deleted file mode 100644
index 786a5f71c..000000000
--- a/plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/internal/archive/operations/EARComponentSaveStrategyImpl.java
+++ /dev/null
@@ -1,248 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jst.j2ee.internal.archive.operations;
-
-import java.io.IOException;
-import java.io.OutputStream;
-import java.util.List;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.runtime.Path;
-import org.eclipse.core.runtime.SubProgressMonitor;
-import org.eclipse.jem.util.emf.workbench.WorkbenchByteArrayOutputStream;
-import org.eclipse.jem.util.logger.proxy.Logger;
-import org.eclipse.jst.j2ee.commonarchivecore.internal.Archive;
-import org.eclipse.jst.j2ee.commonarchivecore.internal.EARFile;
-import org.eclipse.jst.j2ee.commonarchivecore.internal.File;
-import org.eclipse.jst.j2ee.commonarchivecore.internal.exception.SaveFailureException;
-import org.eclipse.jst.j2ee.commonarchivecore.internal.helpers.ArchiveManifest;
-import org.eclipse.jst.j2ee.datamodel.properties.IEARComponentImportDataModelProperties;
-import org.eclipse.jst.j2ee.internal.J2EEConstants;
-import org.eclipse.wst.common.componentcore.resources.IVirtualComponent;
-import org.eclipse.wst.common.componentcore.resources.IVirtualFile;
-import org.eclipse.wst.common.componentcore.resources.IVirtualFolder;
-import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
-
-public class EARComponentSaveStrategyImpl extends ComponentSaveStrategyImpl {
-
-// protected Map createdComponentsMap;
-
- public EARComponentSaveStrategyImpl(IVirtualComponent component) {
- super(component);
- }
-
- public void setDataModel(IDataModel dataModel) {
- super.setDataModel(dataModel);
-
- setArchive((Archive) dataModel.getProperty(IEARComponentImportDataModelProperties.FILE));
- overwriteHandler = (IOverwriteHandler) dataModel.getProperty(IEARComponentImportDataModelProperties.OVERWRITE_HANDLER);
- if (null != overwriteHandler) {
- overwriteHandler.setEarSaveStrategy(this);
- }
-// buildProjectsMap();
- }
-
-
-
-// /**
-// * Creates a Map mapping archive uris to projects for all archives in the ear that imported as
-// * projects.
-// */
-// private void buildProjectsMap() {
-// createdComponentsMap = new HashMap();
-// List createdProjectsList = (List) dataModel.getProperty(IEARComponentImportDataModelProperties.ALL_PROJECT_MODELS_LIST);
-// IDataModel importDM = null;
-// Archive anArchive = null;
-// for (int i = 0; i < createdProjectsList.size(); i++) {
-// importDM = (IDataModel) createdProjectsList.get(i);
-// anArchive = (Archive) importDM.getProperty(IJ2EEComponentImportDataModelProperties.FILE);
-// createdComponentsMap.put(anArchive.getURI(), importDM.getProperty(IJ2EEComponentImportDataModelProperties.COMPONENT));
-// }
-// }
-
-// protected void addFileToClasspath(IProject p, IFile file, List cp) {
-// if (!file.exists())
-// return;
-//
-// // Assume the file also contains the source
-// IPath path = file.getFullPath();
-// IClasspathEntry entry = JavaCore.newLibraryEntry(path, path, null, true);
-// if (!cp.contains(entry))
-// cp.add(entry);
-// }
-
-// protected void addProjectToClasspath(IProject dependent, IProject prereq, List cp) {
-// IClasspathEntry entry = JavaCore.newProjectEntry(prereq.getFullPath(), true);
-// if (!cp.contains(entry))
-// cp.add(entry);
-// }
-
- protected EARFile getEARFile() {
- return (EARFile) getArchive();
- }
-
-
- protected java.io.OutputStream getOutputStreamForResource(org.eclipse.emf.ecore.resource.Resource aResource) throws java.io.IOException {
- return null;
- }
-
- public void save() throws SaveFailureException {
-
- saveFiles();
- saveManifest();
- saveMofResources();
- progressMonitor.subTask(EARArchiveOpsResourceHandler.Updating_project_classpath_UI_);
- //updateComponentClasspaths();
-
- }
-
- public void save(Archive anArchive) throws SaveFailureException {
- progressMonitor.subTask(anArchive.getURI());
- saveArchiveAsJARInEAR(anArchive);
- }
-
- protected void saveArchiveAsJARInEAR(Archive anArchive) throws SaveFailureException {
- try {
- anArchive.save(createNestedSaveStrategy(anArchive));
- progressMonitor.worked(1);
- } catch (IOException e) {
- throw new SaveFailureException(anArchive.getURI(), e);
- }
- }
-
- protected SubProgressMonitor subMonitor() {
- return new SubProgressMonitor(progressMonitor, 10);
- }
-
- public void setMonitor(org.eclipse.core.runtime.IProgressMonitor newMonitor) {
- progressMonitor = newMonitor;
- }
-
- protected boolean shouldSave(File aFile) {
- if (aFile.isArchive()) {
- return getFilter().shouldSave(aFile.getURI(), getArchive());
- }
- return super.shouldSave(aFile);
- }
-
- protected boolean shouldLinkAsComponentRef(Archive archive) {
- if (null != dataModel) {
- List list = (List) dataModel.getProperty(IEARComponentImportDataModelProperties.HANDLED_PROJECT_MODELS_LIST);
- for (int i = 0; i < list.size(); i++) {
- if (archive == ((IDataModel) list.get(i)).getProperty(IEARComponentImportDataModelProperties.FILE)) {
- return false;
- }
- }
- }
- return true;
- }
-
- protected boolean shouldSave(String uri) {
- if (overwriteHandler != null) {
- if (overwriteHandler.isOverwriteNone())
- return false;
- return ((super.shouldSave(uri)) && (overwriteHandler.isOverwriteAll() || overwriteHandler.isOverwriteResources() || overwriteHandler.shouldOverwrite(uri)));
- }
- return true;
- }
-
- public void save(ArchiveManifest aManifest) throws SaveFailureException {
- IVirtualFolder rootFolder = vComponent.getRootFolder();
- IVirtualFile vFile = rootFolder.getFile(new Path(J2EEConstants.MANIFEST_URI));
- IFile iFile = vFile.getUnderlyingFile();
- validateEdit(iFile);
- OutputStream out = new WorkbenchByteArrayOutputStream(iFile);
- try {
- aManifest.write(out);
- } catch (IOException e) {
- Logger.getLogger().logError(e);
- } finally {
- try {
- out.close();
- } catch (IOException e) {
- Logger.getLogger().logError(e);
- }
- }
- }
-
-
-// /*
-// * Parse the manifest of the module file; for each cp entry 1) cananonicalize to a uri that
-// * looks like the entry in the ear 2) If the ear contains a file with that uri (the entry is
-// * valid) a) If the file is another was blown out to a project, add a cp entry for a referenced
-// * project b) otherwise, add a cp entry that points to the file in the ear project, and cp
-// * entries for all prereqs
-// */
-// protected void updateProjectClasspath(Archive anArchive, IVirtualComponent component) {
-//
-// String message = EARArchiveOpsResourceHandler.Updating_project_classpath_UI_ + component.getName();
-// progressMonitor.subTask(message);
-// List projectCpEntries = new ArrayList();
-// Set visited = new HashSet();
-// traverseClasspaths(component.getProject(), anArchive, projectCpEntries, visited);
-//
-// try {
-// if (!projectCpEntries.isEmpty())
-// JemProjectUtilities.appendJavaClassPath(component.getProject(), projectCpEntries);
-// JemProjectUtilities.forceClasspathReload(component.getProject());
-// } catch (JavaModelException ex) {
-// org.eclipse.jem.util.logger.proxy.Logger.getLogger().logError(ex);
-// }
-//
-// }
-
-// /*
-// * If you have a dependency to a JAR in the EAR project, and the JAR depends on another JAR in
-// * the EAR; you want to compile cleanly after import, so you need both those JARs on your build
-// * path
-// */
-// protected void traverseClasspaths(IProject p, Archive anArchive, List projectCpEntries, Set visitedArchives) {
-// visitedArchives.add(anArchive);
-// String[] manifestCpEntries = anArchive.getManifest().getClassPathTokenized();
-// EARFile earFile = (EARFile) dataModel.getProperty(IJ2EEComponentImportDataModelProperties.FILE);
-// for (int i = 0; i < manifestCpEntries.length; i++) {
-// String uri = ArchiveUtil.deriveEARRelativeURI(manifestCpEntries[i], anArchive);
-// // ensure the entry is valid or skip to the next
-// if (uri == null)
-// continue;
-// File aFile = null;
-// try {
-// aFile = earFile.getFile(uri);
-// } catch (FileNotFoundException notThere) {
-// }
-// if (aFile == null || !aFile.isArchive() || visitedArchives.contains(aFile))
-// continue;
-// Archive depArchive = (Archive) aFile;
-// IProject prereq = null;
-// IVirtualComponent depComponent = (IVirtualComponent) createdComponentsMap.get(uri);
-// if (depComponent != null)
-// prereq = depComponent.getProject();
-//
-// if (prereq != null) {
-// addProjectToClasspath(p, prereq, projectCpEntries);
-// } else {
-// addFileToClasspath(p, vComponent.getRootFolder().getFile(uri).getUnderlyingFile(), projectCpEntries);
-// traverseClasspaths(p, depArchive, projectCpEntries, visitedArchives);
-// }
-// }
-// }
-
-// protected void updateComponentClasspaths() {
-// List jarFiles = getEARFile().getArchiveFiles();
-// for (int i = 0; i < jarFiles.size(); i++) {
-// Archive anArchive = (Archive) jarFiles.get(i);
-// IVirtualComponent component = (IVirtualComponent) createdComponentsMap.get(anArchive.getURI());
-// if (component != null)
-// updateProjectClasspath(anArchive, component);
-// }
-// }
-
-}
diff --git a/plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/internal/archive/operations/EJBArchiveOpsResourceHandler.java b/plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/internal/archive/operations/EJBArchiveOpsResourceHandler.java
deleted file mode 100644
index 8f0f800a0..000000000
--- a/plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/internal/archive/operations/EJBArchiveOpsResourceHandler.java
+++ /dev/null
@@ -1,52 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 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.archive.operations;
-
-import org.eclipse.osgi.util.NLS;
-
-public final class EJBArchiveOpsResourceHandler extends NLS {
-
- private static final String BUNDLE_NAME = "ejbarchiveops";//$NON-NLS-1$
-
- private EJBArchiveOpsResourceHandler() {
- // Do not instantiate
- }
-
- public static String ARCHIVE_OPERATION_SaveMofResources;
- public static String ARCHIVE_OPERATION_SaveFile;
- public static String ARCHIVE_OPERATION_ProjectNature;
- public static String ARCHIVE_OPERATION_SaveManifest;
- public static String ARCHIVE_OPERATION_FileNotFound;
- public static String ARCHIVE_OPERATION_FileContents;
- public static String ARCHIVE_OPERATION_ErroOccured;
- public static String ARCHIVE_OPERATION_FilesFromProject;
- public static String ARCHIVE_OPERATION_OpeningArchive;
- public static String ARCHIVE_OPERATION_InvalidEJBJar;
- public static String ARCHIVE_OPERATION_InvalidImportEJBJar;
- public static String ARCHIVE_OPERATION_ImportOperation;
- public static String EJB_IMPORT_OPERATION_STRING;
- public static String EJB_IMPORT_FILE_STRING;
- public static String IMPORT_MOFRESOURCE_STRING;
- public static String IMPORT_OPERATION_STRING;
- public static String ERROR_COPYING_FILES_FROM_ORIGINAL_JAR;
- public static String ERROR_IMPORTING_MODULE_FILE;
- public static String Yes_UI;
- public static String No_UI;
- public static String Yes_To_All_UI;
- public static String Cancel_UI_;
- public static String Error_exporting__UI_;
- public static String EJB_Jar_File_UI_;
- public static String Copy_Dep_JARS_UI;
-
- static {
- NLS.initializeMessages(BUNDLE_NAME, EJBArchiveOpsResourceHandler.class);
- }
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/internal/archive/operations/EJBComponentSaveStrategyImpl.java b/plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/internal/archive/operations/EJBComponentSaveStrategyImpl.java
deleted file mode 100644
index 0b1b3a1fa..000000000
--- a/plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/internal/archive/operations/EJBComponentSaveStrategyImpl.java
+++ /dev/null
@@ -1,21 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jst.j2ee.internal.archive.operations;
-
-import org.eclipse.wst.common.componentcore.resources.IVirtualComponent;
-
-public class EJBComponentSaveStrategyImpl extends J2EEComponentSaveStrategyImpl {
-
- public EJBComponentSaveStrategyImpl(IVirtualComponent vComponent) {
- super(vComponent);
- }
-
-}
diff --git a/plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/internal/archive/operations/IOverwriteHandler.java b/plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/internal/archive/operations/IOverwriteHandler.java
deleted file mode 100644
index b47b26e16..000000000
--- a/plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/internal/archive/operations/IOverwriteHandler.java
+++ /dev/null
@@ -1,142 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jst.j2ee.internal.archive.operations;
-
-
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.wst.common.internal.emfworkbench.validateedit.ResourceStateValidator;
-
-
-/**
- * Insert the type's description here. Creation date: (4/16/2001 3:12:41 PM)
- *
- * @author: Administrator
- */
-public interface IOverwriteHandler {
- public static final String NO = EJBArchiveOpsResourceHandler.No_UI;
- public static final String YES = EJBArchiveOpsResourceHandler.Yes_UI;
- public static final String ALL = EJBArchiveOpsResourceHandler.Yes_To_All_UI;
- public static final String NONE = EJBArchiveOpsResourceHandler.Cancel_UI_;
-
- /**
- * Insert the method's description here. Creation date: (4/16/2001 3:13:38 PM)
- *
- * @return boolean
- */
- org.eclipse.core.resources.IProject getProject();
-
- /**
- * Insert the method's description here. Creation date: (4/16/2001 3:13:38 PM)
- *
- * @return boolean
- */
- boolean isOverwriteAll();
-
- /**
- * Insert the method's description here. Creation date: (4/16/2001 3:13:38 PM)
- *
- * @return boolean
- */
- boolean isOverwriteNone();
-
- /**
- * Insert the method's description here. Creation date: (4/16/2001 3:13:38 PM)
- *
- * @return boolean
- */
- boolean isOverwriteResources();
-
- /**
- * Insert the method's description here. Creation date: (4/16/2001 3:13:38 PM)
- *
- * @return boolean
- */
- String queryOverwrite(String resourcePath);
-
- /**
- * Insert the method's description here. Creation date: (4/16/2001 3:13:38 PM)
- *
- * @return boolean
- */
- void setEarSaveStrategy(EARComponentSaveStrategyImpl newEarSaveStrategy);
-
- /**
- * Insert the method's description here. Creation date: (4/16/2001 3:13:38 PM)
- *
- * @return boolean
- */
- void setEjbSaveStrategy(J2EEComponentSaveStrategyImpl newEjbSaveStrategy);
-
- /**
- * Sets the RAR SaveStrategy.
- *
- * @param RARProjectSaveStrategyImpl
- * rarSaveStrategy - The rar save strategy to set.
- */
- void setRARSaveStrategy(J2EEComponentSaveStrategyImpl newRARSaveStrategy);
-
- void setOverwriteAll(boolean newAllTrue);
-
- void setOverwriteNone(boolean newNoneTrue);
-
- /**
- * Insert the method's description here. Creation date: (4/16/2001 3:13:38 PM)
- *
- * @return boolean
- */
- void setOverwriteResources(boolean newOverwriteResources);
-
- /**
- * Insert the method's description here. Creation date: (4/16/2001 3:13:38 PM)
- *
- * @return boolean
- */
- void setProject(org.eclipse.core.resources.IProject newProject);
-
- /**
- * Insert the method's description here. Creation date: (4/16/2001 3:13:38 PM)
- *
- * @return boolean
- */
- void setWarSaveStrategy(J2EEComponentSaveStrategyImpl newWarSaveStrategy);
-
- /**
- * Insert the method's description here. Creation date: (4/16/2001 3:13:38 PM)
- *
- * @return boolean
- */
- boolean shouldOverwrite(String uri);
-
- /**
- * Check to see if the file can be checked out.
- *
- * @throws OverwriteHandlerException
- * if the validate fails
- */
- void validateEdit(IFile aFile) throws OverwriteHandlerException;
-
- /**
- * Check to see if the files can be checked out.
- *
- * @throws OverwriteHandlerException
- * if the validate fails
- */
- void validateState(ResourceStateValidator resourceStateValidator);
-
- /**
- * Insert the method's description here. Creation date: (4/16/2001 3:13:38 PM)
- *
- * @return boolean
- */
- boolean shouldOverwriteWLProject(IProject fProject, java.lang.String uri);
-}
diff --git a/plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/internal/archive/operations/ImportOption.java b/plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/internal/archive/operations/ImportOption.java
deleted file mode 100644
index b41f7b8b2..000000000
--- a/plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/internal/archive/operations/ImportOption.java
+++ /dev/null
@@ -1,90 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jst.j2ee.internal.archive.operations;
-
-
-import org.eclipse.jst.j2ee.internal.project.IJ2EEProjectTypes;
-import org.eclipse.wst.common.componentcore.datamodel.properties.IFacetDataModelProperties;
-import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
-
-
-/**
- * This class defines the rules for importing an individual nested JAR in an EAR project
- */
-public class ImportOption implements IJ2EEProjectTypes {
- /**
- * Project info for the individual module/JAR, or null if the file should be placed in the
- * application
- */
- protected IDataModel model;
-
- /**
- * Valid only if the project info is not null
- *
- * @see IJ2EEProjectTypes
- */
- protected int projectType = IJ2EEProjectTypes.DEFAULT;
-
- /**
- * @see IJ2EEProjectTypes#MODULE
- * @see IJ2EEProjectTypes#UTIL
- */
- protected int archiveType = IJ2EEProjectTypes.MODULE;
-
- /**
- * Constructor for ImportOption.
- */
- public ImportOption(IDataModel model) {
- super();
- this.model = model;
- }
-
- public ImportOption(IDataModel model, int type) {
- this(model);
- projectType = type;
- }
-
- public IDataModel getModel() {
- return model;
- }
-
- public int getProjectType() {
- return projectType;
- }
-
- public String getProjectName() {
- return model.getStringProperty(IFacetDataModelProperties.FACET_PROJECT_NAME);
- }
-
- /**
- * @return Returns the archiveType.
- */
- public int getArchiveType() {
- return archiveType;
- }
-
- /**
- * @param archiveType
- * The archiveType to set.
- */
- public void setArchiveType(int archiveType) {
- this.archiveType = archiveType;
- }
-
- /**
- * @param projectType
- * The projectType to set.
- */
- public void setProjectType(int projectType) {
- this.projectType = projectType;
- }
-
-}
diff --git a/plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/internal/archive/operations/J2EEArtifactExportOperation.java b/plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/internal/archive/operations/J2EEArtifactExportOperation.java
deleted file mode 100644
index 8c0e3ac96..000000000
--- a/plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/internal/archive/operations/J2EEArtifactExportOperation.java
+++ /dev/null
@@ -1,295 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jst.j2ee.internal.archive.operations;
-
-import static org.eclipse.jst.j2ee.datamodel.properties.IJ2EEComponentExportDataModelProperties.ARCHIVE_DESTINATION;
-import static org.eclipse.jst.j2ee.datamodel.properties.IJ2EEComponentExportDataModelProperties.COMPONENT;
-import static org.eclipse.jst.j2ee.datamodel.properties.IJ2EEComponentExportDataModelProperties.EXPORT_SOURCE_FILES;
-import static org.eclipse.jst.j2ee.datamodel.properties.IJ2EEComponentExportDataModelProperties.OPTIMIZE_FOR_SPECIFIC_RUNTIME;
-import static org.eclipse.jst.j2ee.datamodel.properties.IJ2EEComponentExportDataModelProperties.RUNTIME_SPECIFIC_PARTICIPANTS;
-import static org.eclipse.jst.j2ee.datamodel.properties.IJ2EEComponentExportDataModelProperties.RUN_BUILD;
-
-import java.io.File;
-import java.lang.reflect.InvocationTargetException;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Set;
-
-import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.core.resources.ICommand;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IProjectDescription;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.resources.IResourceRuleFactory;
-import org.eclipse.core.resources.IncrementalProjectBuilder;
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Path;
-import org.eclipse.core.runtime.SubProgressMonitor;
-import org.eclipse.core.runtime.jobs.ISchedulingRule;
-import org.eclipse.core.runtime.jobs.MultiRule;
-import org.eclipse.jdt.core.JavaCore;
-import org.eclipse.jst.j2ee.commonarchivecore.internal.ModuleFile;
-import org.eclipse.jst.j2ee.commonarchivecore.internal.exception.SaveFailureException;
-import org.eclipse.jst.j2ee.datamodel.properties.IJ2EEComponentExportDataModelProperties.IArchiveExportParticipantData;
-import org.eclipse.jst.j2ee.internal.archive.ComponentArchiveLoadAdapter;
-import org.eclipse.jst.j2ee.internal.plugin.LibCopyBuilder;
-import org.eclipse.jst.j2ee.internal.project.ProjectSupportResourceHandler;
-import org.eclipse.jst.jee.archive.ArchiveSaveFailureException;
-import org.eclipse.jst.jee.archive.IArchive;
-import org.eclipse.jst.jee.archive.IArchiveFactory;
-import org.eclipse.jst.jee.archive.IArchiveLoadAdapter;
-import org.eclipse.wst.common.componentcore.resources.IVirtualComponent;
-import org.eclipse.wst.common.componentcore.resources.IVirtualReference;
-import org.eclipse.wst.common.frameworks.datamodel.AbstractDataModelOperation;
-import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
-import org.eclipse.wst.common.frameworks.datamodel.IDataModelOperation;
-
-public abstract class J2EEArtifactExportOperation extends AbstractDataModelOperation {
-
- protected IProgressMonitor progressMonitor;
- private IVirtualComponent component;
- private IPath destinationPath;
- private ModuleFile moduleFile;
- private boolean exportSource = false;
-
- public J2EEArtifactExportOperation() {
- super();
- }
-
- public J2EEArtifactExportOperation(IDataModel model) {
- super(model);
- }
-
- protected final int REFRESH_WORK = 100;
- protected final int JAVA_BUILDER_WORK = 100;
- protected final int LIB_BUILDER_WORK = 100;
- protected final int EXPORT_WORK = 1000;
- protected final int CLOSE_WORK = 10;
- protected final int SINGLE_PARTICIPANT_WORK = 200;
-
- protected int computeTotalWork() {
- int totalWork = REFRESH_WORK;
- if (model.getBooleanProperty(RUN_BUILD)) {
- totalWork += JAVA_BUILDER_WORK + LIB_BUILDER_WORK;
- }
- totalWork += EXPORT_WORK + CLOSE_WORK;
-
- final IDataModel dm = getDataModel();
-
- if( dm.getProperty( OPTIMIZE_FOR_SPECIFIC_RUNTIME ) == Boolean.TRUE )
- {
- final List<IArchiveExportParticipantData> extensions
- = (List<IArchiveExportParticipantData>) dm.getProperty( RUNTIME_SPECIFIC_PARTICIPANTS );
-
- totalWork += extensions.size() * SINGLE_PARTICIPANT_WORK;
- }
-
- return totalWork;
- }
-
- public IStatus execute(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
- setComponent((IVirtualComponent) model.getProperty(COMPONENT));
- setDestinationPath(new Path(model.getStringProperty(ARCHIVE_DESTINATION)));
- setExportSource(model.getBooleanProperty(EXPORT_SOURCE_FILES));
-
- try
- {
- monitor.beginTask(ProjectSupportResourceHandler.getString(ProjectSupportResourceHandler.Exporting_archive, new Object [] { getDestinationPath().lastSegment() }), computeTotalWork());
- setProgressMonitor(monitor);
-
- try {
- // defect 240999
- component.getProject().refreshLocal(IResource.DEPTH_INFINITE, new SubProgressMonitor(monitor, REFRESH_WORK));
- if (model.getBooleanProperty(RUN_BUILD)) {
- runNecessaryBuilders(component, new SubProgressMonitor(monitor, JAVA_BUILDER_WORK + LIB_BUILDER_WORK));
- }
- export();
- } catch (Exception e) {
- if(moduleFile != null){
- //The module fil will be closed if the export succeeds
- //Need to be careful not to close the archive twice because of ReferenceCounted Archives
- moduleFile.close();
- monitor.worked(CLOSE_WORK);
- }
- throw new ExecutionException(EJBArchiveOpsResourceHandler.Error_exporting__UI_ + archiveString(), e);
- }
-
- final IDataModel dm = getDataModel();
-
- if( dm.getProperty( OPTIMIZE_FOR_SPECIFIC_RUNTIME ) == Boolean.TRUE )
- {
- for( IArchiveExportParticipantData extData
- : (List<IArchiveExportParticipantData>) dm.getProperty( RUNTIME_SPECIFIC_PARTICIPANTS ) )
- {
- final IDataModelOperation op
- = extData.getParticipant().createOperation( extData.getDataModel() );
-
- op.execute( null, null );
- monitor.worked( SINGLE_PARTICIPANT_WORK );
- }
- }
- }
- finally
- {
- monitor.done();
- }
-
- return OK_STATUS;
- }
-
- protected abstract void export() throws SaveFailureException, CoreException, InvocationTargetException, InterruptedException;
-
- protected abstract String archiveString();
-
- protected void setProgressMonitor(IProgressMonitor newProgressMonitor) {
- progressMonitor = newProgressMonitor;
- }
-
- protected IProgressMonitor getProgressMonitor() {
- return progressMonitor;
- }
-
- private void setComponent(IVirtualComponent newComponent) {
- component = newComponent;
- }
-
- protected IVirtualComponent getComponent() {
- if (component == null)
- component = (IVirtualComponent) model.getProperty(COMPONENT);
- return component;
- }
-
- protected IPath getDestinationPath() {
- return destinationPath;
- }
-
- protected void setDestinationPath(IPath newDestinationPath) {
- destinationPath = newDestinationPath;
- }
-
- protected boolean isExportSource() {
- return exportSource;
- }
-
- protected void setExportSource(boolean newExportSource) {
- exportSource = newExportSource;
- }
-
- protected ModuleFile getModuleFile() {
- return moduleFile;
- }
-
- protected void setModuleFile(ModuleFile newModuleFile) {
- moduleFile = newModuleFile;
- }
-
- protected void runNecessaryBuilders(IVirtualComponent component, IProgressMonitor monitor) throws CoreException {
- try{
- monitor.beginTask(null, JAVA_BUILDER_WORK + LIB_BUILDER_WORK);
- if(!component.isBinary()){
- IProject project = component.getProject();
- IProjectDescription description = project.getDescription();
- ICommand javaBuilder = getJavaCommand(description);
- if (javaBuilder != null) {
- project.build(IncrementalProjectBuilder.INCREMENTAL_BUILD, JavaCore.BUILDER_ID, javaBuilder.getArguments(), new SubProgressMonitor(monitor, JAVA_BUILDER_WORK));
- }
- ICommand libCopyBuilder = getLibCopyBuilder(description);
- if (null != libCopyBuilder) {
- project.build(IncrementalProjectBuilder.INCREMENTAL_BUILD, LibCopyBuilder.BUILDER_ID, libCopyBuilder.getArguments(), new SubProgressMonitor(monitor, LIB_BUILDER_WORK));
- }
- }
- } finally {
- monitor.done();
- }
- }
-
- /**
- * Find the specific Java command amongst the build spec of a given description
- */
- protected ICommand getJavaCommand(IProjectDescription description) throws CoreException {
- if (description == null) {
- return null;
- }
-
- ICommand[] commands = description.getBuildSpec();
- for (int i = 0; i < commands.length; ++i) {
- if (commands[i].getBuilderName().equals(JavaCore.BUILDER_ID)) {
- return commands[i];
- }
- }
- return null;
- }
-
- protected ICommand getLibCopyBuilder(IProjectDescription description) throws CoreException {
- if (description == null) {
- return null;
- }
-
- ICommand[] commands = description.getBuildSpec();
- for (int i = 0; i < commands.length; ++i) {
- if (commands[i].getBuilderName().equals(LibCopyBuilder.BUILDER_ID)) {
- return commands[i];
- }
- }
- return null;
-
- }
-
- public ISchedulingRule getSchedulingRule() {
- Set projs = gatherDependentProjects(getComponent(), new HashSet());
- ISchedulingRule combinedRule = null;
- IResourceRuleFactory ruleFactory = ResourcesPlugin.getWorkspace().getRuleFactory();
- for (Iterator iter = projs.iterator(); iter.hasNext();) {
- IProject proj = (IProject) iter.next();
- ISchedulingRule rule = ruleFactory.createRule(proj);
- combinedRule = MultiRule.combine(rule, combinedRule);
- }
- combinedRule = MultiRule.combine(ruleFactory.buildRule(), combinedRule);
-
- return combinedRule;
- }
-
- private Set gatherDependentProjects(IVirtualComponent comp, Set projs) {
- if (!projs.contains(comp.getProject())) {
- projs.add(comp.getProject());
- IVirtualReference[] refs = comp.getReferences();
- for (int i = 0; i < refs.length; i++) {
- IVirtualReference refComp = refs[i];
- projs.addAll(gatherDependentProjects(refComp.getReferencedComponent(), projs));
- }
- }
- return projs;
- }
-
- protected void saveArchive(IArchive archiveToSave, String fileName, IProgressMonitor monitor) throws ArchiveSaveFailureException {
- String writeFileName = fileName;
- File writeFile = new File(writeFileName);
- if (writeFile.exists()) {
- writeFile.delete();
- }
- IPath outputPath = new Path(writeFileName);
- IArchiveLoadAdapter loadAdapter = archiveToSave.getLoadAdapter();
- if(loadAdapter instanceof ComponentArchiveLoadAdapter){
- ComponentArchiveLoadAdapter cLoadAdapter = (ComponentArchiveLoadAdapter)loadAdapter;
- cLoadAdapter.setExportSource(getDataModel().getBooleanProperty(EXPORT_SOURCE_FILES));
-
- }
- IArchiveFactory.INSTANCE.saveArchive(archiveToSave, outputPath, monitor);
- }
-
-
-}
diff --git a/plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/internal/archive/operations/J2EEArtifactImportOperation.java b/plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/internal/archive/operations/J2EEArtifactImportOperation.java
deleted file mode 100644
index f78aae018..000000000
--- a/plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/internal/archive/operations/J2EEArtifactImportOperation.java
+++ /dev/null
@@ -1,158 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jst.j2ee.internal.archive.operations;
-
-import java.lang.reflect.InvocationTargetException;
-
-import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.SubProgressMonitor;
-import org.eclipse.jem.util.emf.workbench.ProjectUtilities;
-import org.eclipse.jst.j2ee.commonarchivecore.internal.Archive;
-import org.eclipse.jst.j2ee.commonarchivecore.internal.strategy.SaveStrategy;
-import org.eclipse.jst.j2ee.datamodel.properties.IJ2EEComponentImportDataModelProperties;
-import org.eclipse.jst.j2ee.internal.archive.ArchiveWrapper;
-import org.eclipse.jst.j2ee.internal.archive.ComponentArchiveSaveAdapter;
-import org.eclipse.jst.j2ee.internal.common.classpath.J2EEComponentClasspathUpdater;
-import org.eclipse.jst.j2ee.internal.project.ProjectSupportResourceHandler;
-import org.eclipse.jst.jee.archive.ArchiveOptions;
-import org.eclipse.jst.jee.archive.IArchive;
-import org.eclipse.jst.jee.archive.IArchiveFactory;
-import org.eclipse.wst.common.componentcore.ComponentCore;
-import org.eclipse.wst.common.componentcore.datamodel.properties.IFacetProjectCreationDataModelProperties;
-import org.eclipse.wst.common.componentcore.resources.IVirtualComponent;
-import org.eclipse.wst.common.frameworks.datamodel.AbstractDataModelOperation;
-import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
-import org.eclipse.wst.common.frameworks.internal.enablement.nonui.WFTWrappedException;
-
-public abstract class J2EEArtifactImportOperation extends AbstractDataModelOperation {
-
- /**
- * @deprecated use {@link #archiveWrapper}
- */
- protected Archive moduleFile;
- protected ArchiveWrapper archiveWrapper;
- protected IVirtualComponent virtualComponent;
- protected IAdaptable info;
- protected final int PROJECT_CREATION_WORK = 30;
-
- private static IArchiveFactory archiveFactory = IArchiveFactory.INSTANCE;
-
- public J2EEArtifactImportOperation(IDataModel model) {
- super(model);
- }
-
- public IStatus execute(IProgressMonitor monitor, IAdaptable anInfo) throws ExecutionException {
- try {
- J2EEComponentClasspathUpdater.getInstance().pauseUpdates();
- this.info = anInfo;
- moduleFile = (Archive) model.getProperty(IJ2EEComponentImportDataModelProperties.FILE);
- archiveWrapper = (ArchiveWrapper)model.getProperty(IJ2EEComponentImportDataModelProperties.ARCHIVE_WRAPPER);
- monitor.beginTask(ProjectSupportResourceHandler.getString(ProjectSupportResourceHandler.Importing_archive, new Object [] { archiveWrapper.getPath() }), computeTotalWork());
- doExecute(monitor);
- return OK_STATUS;
- } finally {
- try {
- if (virtualComponent != null) {
- J2EEComponentClasspathUpdater.getInstance().queueUpdate(virtualComponent.getProject());
- }
- } finally {
- J2EEComponentClasspathUpdater.getInstance().resumeUpdates();
- model.dispose();
- monitor.done();
- }
- }
- }
-
- protected int computeTotalWork() {
- return PROJECT_CREATION_WORK + archiveWrapper.getSize();
- }
-
- /**
- * Subclasses overriding this method should also override {@link #computeTotalWork()}
- * @param monitor
- * @throws ExecutionException
- */
- protected void doExecute(IProgressMonitor monitor) throws ExecutionException {
- IDataModel nestedModel = model.getNestedModel(IJ2EEComponentImportDataModelProperties.NESTED_MODEL_J2EE_COMPONENT_CREATION);
- IProgressMonitor subMonitor = new SubProgressMonitor(monitor, PROJECT_CREATION_WORK);
- virtualComponent = createVirtualComponent(nestedModel, subMonitor);
-
- try {
- importModuleFile(new SubProgressMonitor(monitor, archiveWrapper.getSize()));
- } catch (InvocationTargetException e) {
- throw new ExecutionException(e.getMessage(), e);
- } catch (InterruptedException e) {
- throw new ExecutionException(e.getMessage(), e);
- }
- }
-
- protected IVirtualComponent createVirtualComponent(IDataModel aModel, IProgressMonitor monitor) throws ExecutionException {
- try {
- aModel.getDefaultOperation().execute(monitor, info);
- String projectName = aModel.getStringProperty(IFacetProjectCreationDataModelProperties.FACET_PROJECT_NAME);
- IProject project = ProjectUtilities.getProject(projectName);
- return ComponentCore.createComponent(project);
- } finally {
- monitor.done();
- }
- }
-
- /**
- * Creates the appropriate save strategy. Subclases should overwrite this method to create the
- * appropriate save startegy for the kind of J2EE module project to import the archive
- */
- protected abstract SaveStrategy createSaveStrategy(IVirtualComponent vc);
-
- protected void modifyStrategy(SaveStrategy saveStrat) {
- }
-
- protected ComponentArchiveSaveAdapter getArchiveSaveAdapter(IVirtualComponent virtualComponent){
- return new ComponentArchiveSaveAdapter(virtualComponent);
- }
-
- /**
- * perform the archive import operation
- *
- * @throws java.lang.reflect.InvocationTargetException
- * @throws java.lang.InterruptedException
- */
- protected void importModuleFile(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
- try {
- monitor.beginTask(null, archiveWrapper.getSize());
- if(archiveWrapper.getIArchive() != null){
- IArchive archive = archiveWrapper.getIArchive();
- ComponentArchiveSaveAdapter adap = getArchiveSaveAdapter(virtualComponent);
- ArchiveOptions saveOptions = new ArchiveOptions();
- saveOptions.setOption(ArchiveOptions.SAVE_ADAPTER, adap);
- archiveFactory.saveArchive(archive, saveOptions,monitor);
- }else{
- ComponentSaveStrategyImpl aStrategy = (ComponentSaveStrategyImpl) createSaveStrategy(virtualComponent);
- aStrategy.setProgressMonitor(monitor);
- aStrategy.setOverwriteHandler((IOverwriteHandler) model.getProperty(IJ2EEComponentImportDataModelProperties.OVERWRITE_HANDLER));
- aStrategy.setDataModel(model);
- modifyStrategy(aStrategy);
- archiveWrapper.getCommonArchive().save(aStrategy);
- }
-
- } catch (OverwriteHandlerException oe) {
- throw new InterruptedException();
- } catch (Exception ex) {
- throw new WFTWrappedException(ex, EJBArchiveOpsResourceHandler.ERROR_IMPORTING_MODULE_FILE);
- } finally {
- monitor.done();
- }
- }
-
-}
diff --git a/plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/internal/archive/operations/J2EEComponentLoadStrategyImpl.java b/plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/internal/archive/operations/J2EEComponentLoadStrategyImpl.java
deleted file mode 100644
index e3e603e39..000000000
--- a/plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/internal/archive/operations/J2EEComponentLoadStrategyImpl.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jst.j2ee.internal.archive.operations;
-
-import java.util.List;
-
-import org.eclipse.jst.j2ee.classpathdep.IClasspathDependencyConstants;
-import org.eclipse.wst.common.componentcore.resources.IVirtualComponent;
-
-public class J2EEComponentLoadStrategyImpl extends ComponentLoadStrategyImpl{
-
- public J2EEComponentLoadStrategyImpl(IVirtualComponent component) {
- super(component);
- }
-
- public J2EEComponentLoadStrategyImpl(IVirtualComponent component, boolean includeClasspathComponents) {
- super(component, includeClasspathComponents);
- }
-
- public List getFiles() {
- super.getFiles();
- if (includeClasspathComponents) {
- addMappedClassFolders(IClasspathDependencyConstants.RUNTIME_MAPPING_INTO_COMPONENT_PATH);
- }
- return filesHolder.getFiles();
- }
-}
diff --git a/plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/internal/archive/operations/J2EEComponentSaveStrategyImpl.java b/plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/internal/archive/operations/J2EEComponentSaveStrategyImpl.java
deleted file mode 100644
index eef7d5f55..000000000
--- a/plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/internal/archive/operations/J2EEComponentSaveStrategyImpl.java
+++ /dev/null
@@ -1,153 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jst.j2ee.internal.archive.operations;
-
-import java.io.IOException;
-import java.io.OutputStream;
-
-import org.eclipse.core.resources.IContainer;
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IFolder;
-import org.eclipse.core.resources.IResource;
-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.jdt.core.IClasspathEntry;
-import org.eclipse.jdt.core.IJavaProject;
-import org.eclipse.jdt.core.JavaCore;
-import org.eclipse.jem.util.emf.workbench.WorkbenchByteArrayOutputStream;
-import org.eclipse.jem.util.logger.proxy.Logger;
-import org.eclipse.jem.workbench.utility.JemProjectUtilities;
-import org.eclipse.jst.j2ee.commonarchivecore.internal.File;
-import org.eclipse.jst.j2ee.commonarchivecore.internal.exception.SaveFailureException;
-import org.eclipse.jst.j2ee.commonarchivecore.internal.helpers.ArchiveManifest;
-import org.eclipse.jst.j2ee.commonarchivecore.internal.util.ArchiveUtil;
-import org.eclipse.jst.j2ee.internal.J2EEConstants;
-import org.eclipse.wst.common.componentcore.resources.IVirtualComponent;
-import org.eclipse.wst.common.componentcore.resources.IVirtualFile;
-import org.eclipse.wst.common.componentcore.resources.IVirtualFolder;
-
-public abstract class J2EEComponentSaveStrategyImpl extends ComponentSaveStrategyImpl {
-
- protected final String DOT_CLASS = ".class"; //$NON-NLS-1$
- protected final String IMPORTED_CLASSES = "ImportedClasses"; //$NON-NLS-1$
-
- public J2EEComponentSaveStrategyImpl(IVirtualComponent vComponent) {
- super(vComponent);
- }
-
- protected void saveFiles() throws SaveFailureException {
- super.saveFiles();
- linkImportedClassesFolderIfNecessary();
- try {
- vComponent.getProject().refreshLocal(IResource.DEPTH_INFINITE, null);
- } catch (CoreException ex) {
- Logger.getLogger().logError(ex);
- }
- }
-
- public boolean endsWithClassType(String aFileName) {
- if (aFileName.endsWith(DOT_CLASS))
- return true;
- return false;
- }
-
- protected boolean shouldSave(File aFile) {
- if (endsWithClassType(aFile.getURI())){
- boolean shouldSave = isClassWithoutSource(aFile);
- if(shouldSave && !importedClassesFolderCreated){
- createImportedClassesFolder();
- }
- return shouldSave;
- }
- return super.shouldSave(aFile);
- }
-
- public void save(ArchiveManifest aManifest) throws SaveFailureException {
- IVirtualFolder rootFolder = vComponent.getRootFolder();
- IVirtualFile vFile = rootFolder.getFile(new Path(J2EEConstants.MANIFEST_URI));
- IFile iFile = vFile.getUnderlyingFile();
- validateEdit(iFile);
- OutputStream out = new WorkbenchByteArrayOutputStream(iFile);
- try {
- aManifest.write(out);
- } catch (IOException e) {
- Logger.getLogger().logError(e);
- } finally {
- try {
- out.close();
- } catch (IOException e) {
- Logger.getLogger().logError(e);
- }
- }
- }
-
- protected boolean importedClassesFolderCreated = false;
- protected IFolder importedClassesFolder;
-
- protected void createImportedClassesFolder() {
- importedClassesFolderCreated = true;
- IContainer jarParent = vComponent.getRootFolder().getUnderlyingFolder().getParent();
- importedClassesFolder = jarParent.getFolder(new Path(IMPORTED_CLASSES));
- try {
- importedClassesFolder.create(true, true, null);
- } catch (CoreException e1) {
- Logger.getLogger().logError(e1);
- }
- }
-
- protected void linkImportedClassesFolderIfNecessary() {
- if (importedClassesFolder != null) {
- try {
- vComponent.getRootFolder().getFolder(getImportedClassesRuntimePath()).createLink(importedClassesFolder.getProjectRelativePath(), 0, null);
- if (shouldAddImportedClassesToClasspath()) {
- if (JemProjectUtilities.getJavaProject(vComponent.getProject()) != null) {
- IJavaProject javaProject = JavaCore.create(vComponent.getProject());
- IClasspathEntry[] javaClasspath = javaProject.getRawClasspath();
- IClasspathEntry[] newJavaClasspath = new IClasspathEntry[javaClasspath.length + 1];
- System.arraycopy(javaClasspath, 0, newJavaClasspath, 0, javaClasspath.length);
- newJavaClasspath[newJavaClasspath.length - 1] = JavaCore.newLibraryEntry(importedClassesFolder.getFullPath(), null, null, true);
- javaProject.setRawClasspath(newJavaClasspath, new NullProgressMonitor());
- }
- }
- } catch (CoreException e) {
- Logger.getLogger().logError(e);
- }
- }
- }
-
- protected boolean shouldAddImportedClassesToClasspath() {
- return true;
- }
-
- protected IPath getImportedClassesRuntimePath() {
- return new Path("/");
- }
-
- protected IPath getOutputPathForFile(File aFile) {
- if(endsWithClassType(aFile.getURI())){
- return importedClassesFolder.getFile(getImportedClassesURI(aFile)).getProjectRelativePath();
- }
- return super.getOutputPathForFile(aFile);
- }
-
- protected String getImportedClassesURI(File aFile) {
- return aFile.getURI();
- }
-
- protected boolean isClassWithoutSource(File aFile) {
- String javaUri = ArchiveUtil.classUriToJavaUri(aFile.getURI());
- if (javaUri == null)
- return false;
- return !archive.containsFile(javaUri);
- }
-}
diff --git a/plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/internal/archive/operations/J2EEImportConstants.java b/plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/internal/archive/operations/J2EEImportConstants.java
deleted file mode 100644
index 9bf8af510..000000000
--- a/plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/internal/archive/operations/J2EEImportConstants.java
+++ /dev/null
@@ -1,27 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-/*
- * Created on Dec 18, 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.archive.operations;
-
-/**
- * @author jsholl
- *
- * To change the template for this generated type comment go to Window - Preferences - Java - Code
- * Generation - Code and Comments
- */
-public class J2EEImportConstants {
- public static final String IMPORTED_JAR_SUFFIX = ".imported_classes.jar"; //$NON-NLS-1$
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/internal/archive/operations/J2EEJavaComponentSaveStrategyImpl.java b/plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/internal/archive/operations/J2EEJavaComponentSaveStrategyImpl.java
deleted file mode 100644
index 1c929b5d9..000000000
--- a/plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/internal/archive/operations/J2EEJavaComponentSaveStrategyImpl.java
+++ /dev/null
@@ -1,20 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jst.j2ee.internal.archive.operations;
-
-import org.eclipse.wst.common.componentcore.resources.IVirtualComponent;
-
-public class J2EEJavaComponentSaveStrategyImpl extends J2EEComponentSaveStrategyImpl {
-
- public J2EEJavaComponentSaveStrategyImpl(IVirtualComponent vComponent) {
- super(vComponent);
- }
-}
diff --git a/plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/internal/archive/operations/JavaComponentLoadStrategyImpl.java b/plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/internal/archive/operations/JavaComponentLoadStrategyImpl.java
deleted file mode 100644
index 938da024c..000000000
--- a/plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/internal/archive/operations/JavaComponentLoadStrategyImpl.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jst.j2ee.internal.archive.operations;
-
-import java.util.List;
-
-import org.eclipse.jst.j2ee.classpathdep.IClasspathDependencyConstants;
-import org.eclipse.wst.common.componentcore.resources.IVirtualComponent;
-
-public class JavaComponentLoadStrategyImpl extends ComponentLoadStrategyImpl {
-
- public JavaComponentLoadStrategyImpl(IVirtualComponent vComponent) {
- super(vComponent);
- }
-
- public JavaComponentLoadStrategyImpl(IVirtualComponent vComponent, boolean includeClasspathComponents) {
- super(vComponent, includeClasspathComponents);
- }
-
- public List getFiles() {
- super.getFiles();
- if (includeClasspathComponents) {
- addMappedClassFolders(IClasspathDependencyConstants.RUNTIME_MAPPING_INTO_COMPONENT_PATH);
- }
- return filesHolder.getFiles();
- }
-}
diff --git a/plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/internal/archive/operations/JavaComponentSaveStrategyImpl.java b/plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/internal/archive/operations/JavaComponentSaveStrategyImpl.java
deleted file mode 100644
index 2269718c4..000000000
--- a/plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/internal/archive/operations/JavaComponentSaveStrategyImpl.java
+++ /dev/null
@@ -1,21 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jst.j2ee.internal.archive.operations;
-
-import org.eclipse.wst.common.componentcore.resources.IVirtualComponent;
-
-public class JavaComponentSaveStrategyImpl extends ComponentSaveStrategyImpl {
-
- public JavaComponentSaveStrategyImpl(IVirtualComponent vComponent) {
- super(vComponent);
- }
-
-}
diff --git a/plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/internal/archive/operations/OverwriteHandlerException.java b/plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/internal/archive/operations/OverwriteHandlerException.java
deleted file mode 100644
index 7caf4b114..000000000
--- a/plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/internal/archive/operations/OverwriteHandlerException.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jst.j2ee.internal.archive.operations;
-
-
-
-/**
- * Insert the type's description here. Creation date: (8/16/2001 6:07:35 PM)
- *
- * @author: Administrator
- */
-public class OverwriteHandlerException extends RuntimeException {
- /**
- * Warning clean-up 12/05/2005
- */
- private static final long serialVersionUID = 1651836694391641930L;
-
- /**
- * OverwriteHandlerException constructor comment.
- */
- public OverwriteHandlerException() {
- super();
- }
-
- /**
- * OverwriteHandlerException constructor comment.
- *
- * @param s
- * java.lang.String
- */
- public OverwriteHandlerException(String s) {
- super(s);
- }
-}

Back to the top