diff options
Diffstat (limited to 'plugins/org.eclipse.jst.j2ee/archiveops/org')
49 files changed, 0 insertions, 5005 deletions
diff --git a/plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/datamodel/properties/IAppClientComponentCreationDataModelProperties.java b/plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/datamodel/properties/IAppClientComponentCreationDataModelProperties.java deleted file mode 100644 index d9ee1d746..000000000 --- a/plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/datamodel/properties/IAppClientComponentCreationDataModelProperties.java +++ /dev/null @@ -1,40 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2003, 2004, 2005 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.j2ee.datamodel.properties; - -/** - * <p> - * IAppClientComponentCreationDataModelProperties provides properties to the - * AppClientComponentCreationDataModelProvider as well as all extending interfaces extending - * IEjbComponentCreationDataModelProperties - * @see org.eclipse.jst.j2ee.applicationclient.internal.creation.AppClientComponentCreationDataModelProvider - * </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 - * @see org.eclipse.jst.j2ee.datamodel.properties.IJ2EEComponentCreationDataModelProperties - * @since 1.0 - */ - - -public interface IAppClientComponentCreationDataModelProperties extends IJ2EEComponentCreationDataModelProperties { - /** - * Optional, type Boolean. the default value is <code>Boolean.TRUE</code>.If this is true and CREATE_DEFAULT_FILES is true, then a default main - * class will be generated during component creation. - */ - public static final String CREATE_DEFAULT_MAIN_CLASS = "IAppClientComponentCreationDataModelProperties.CREATE_DEFAULT_MAIN_CLASS"; //$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 6f6356981..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, 2004, 2005 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.j2ee.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 - * - * @since 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 111775837..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, 2004, 2005 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.j2ee.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 - * - * @since 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 6c4ef4b50..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, 2004, 2005 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.j2ee.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 - * - * @since 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 b6331d464..000000000 --- a/plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/datamodel/properties/IEARComponentImportDataModelProperties.java +++ /dev/null @@ -1,66 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2003, 2004, 2005 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.j2ee.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 - * - * @since 1.0 - */ -public interface IEARComponentImportDataModelProperties extends IJ2EEComponentImportDataModelProperties { - /** - * Optional, type Boolean, default true, This flag is set to allow the EAR project to be - * imported or not. If it is not imported, it is still possible for the nested projects (moduel & - * utility projects) to be imported. - */ - public static final String IMPORT_EAR_PROJECT = "IEnterpriseApplicationImportDataModelProperties.IMPORT_EAR_PROJECT"; //$NON-NLS-1$ - - /** - * 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; - */ - 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$ - -} diff --git a/plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/datamodel/properties/IEarComponentCreationDataModelProperties.java b/plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/datamodel/properties/IEarComponentCreationDataModelProperties.java deleted file mode 100644 index 571e71e23..000000000 --- a/plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/datamodel/properties/IEarComponentCreationDataModelProperties.java +++ /dev/null @@ -1,38 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2003, 2004, 2005 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ - -package org.eclipse.jst.j2ee.datamodel.properties; -/** - * <p> - * IEarComponentCreationDataModelProperties provides properties to the - * EarComponentCreationDataModelProvider as well as all extending interfaces extending - * IEarComponentCreationDataModelProperties - * @see org.eclipse.jst.j2ee.internal.earcreation.EarComponentCreationDataModelProvider - * </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 - * @see org.eclipse.jst.j2ee.datamodel.properties.IJ2EEComponentCreationDataModelProperties - * @since 1.0 - */ - -public interface IEarComponentCreationDataModelProperties extends IJ2EEComponentCreationDataModelProperties { - /** - * Required, type List, the list of j2EE modules which are contained in the EAR. - */ - public static final String J2EE_COMPONENT_LIST = "IEarComponentCreationDataModel.J2EE_COMPONENT_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 1485a065d..000000000 --- a/plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/datamodel/properties/IJ2EEComponentCreationDataModelProperties.java +++ /dev/null @@ -1,81 +0,0 @@ -package org.eclipse.jst.j2ee.datamodel.properties; - - - -/** - * <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 - * @since 1.0 - */ -public interface IJ2EEComponentCreationDataModelProperties extends IJavaComponentCreationDataModelProperties{ - - /** - * 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$ - /** - * 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 URI, 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_HANDLE = "IJ2EEComponentCreationDataModelProperties.EAR_COMPONENT_HANDLE"; //$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 9d98efe0b..000000000 --- a/plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/datamodel/properties/IJ2EEComponentExportDataModelProperties.java +++ /dev/null @@ -1,58 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2003, 2004, 2005 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.j2ee.datamodel.properties; - -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 - * - * @since 1.0 - */ -public interface IJ2EEComponentExportDataModelProperties extends IDataModelProperties { - - /** - * Required, type String. The user defined name of the component to be exported. - */ - public static final String COMPONENT_NAME = "J2EEExportDataModel.COMPONENT_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 = "J2EEExportDataModel.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 = "J2EEExportDataModel.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 = "J2EEExportDataModel.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 = "J2EEExportDataModel.RUN_BUILD"; //$NON-NLS-1$} -} 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 9170ef0f3..000000000 --- a/plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/datamodel/properties/IJ2EEComponentImportDataModelProperties.java +++ /dev/null @@ -1,85 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2003, 2004, 2005 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.j2ee.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 - * - * @since 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). - */ - 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 = "IJ2EEArtifactImportDataModelProperties.PROJECT_NAME"; //$NON-NLS-1$ - /** - * Required, type String, name of the Component which will be created to house the Archive - */ - public static final String COMPONENT_NAME = "IJ2EEArtifactImportDataModelProperties.COMPONENT_NAME"; //$NON-NLS-1$ - - /** - * Unsettable property used to retreive the component after the operation has executed. - */ - public static final String COMPONENT = "IJ2EEArtifactImportDataModelProperties.COMPONENT"; //$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 - */ - 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 38704a182..000000000 --- a/plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/datamodel/properties/IJ2EEModuleImportDataModelProperties.java +++ /dev/null @@ -1,44 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2003, 2004, 2005 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.j2ee.datamodel.properties; - -import org.eclipse.jst.j2ee.application.internal.operations.J2EEComponentCreationDataModel; -/** - * <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 - * - * @since 1.0 - */ -public interface IJ2EEModuleImportDataModelProperties extends IJ2EEComponentImportDataModelProperties { - /** - * Optional, type String. This property is nested from the J2EEComponentCreationDataModel and set only if user is attempting to add the component to an EAR. - * Some J2EE components such as Web do not require an EAR. - */ - public static final String EAR_NAME = J2EEComponentCreationDataModel.EAR_MODULE_NAME; - /** - * Optional, type Boolean. This property defaults to True, but changes if user wishs to import a component - * without adding it to an EAR. - */ - public static final String ADD_TO_EAR = J2EEComponentCreationDataModel.ADD_TO_EAR; - -} 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 0b1a3b727..000000000 --- a/plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/datamodel/properties/IJavaComponentCreationDataModelProperties.java +++ /dev/null @@ -1,54 +0,0 @@ -/*************************************************************************************************** - * Copyright (c) 2003, 2004 IBM Corporation and others. All rights reserved. This program and the - * accompanying materials are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: IBM Corporation - initial API and implementation - **************************************************************************************************/ -package org.eclipse.jst.j2ee.datamodel.properties; - -import org.eclipse.jst.j2ee.project.datamodel.properties.IJ2EEProjectServerTargetDataModelProperties; -import org.eclipse.wst.common.componentcore.datamodel.properties.IComponentCreationDataModelProperties; - -/** - * <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 - * - * @since 1.0 - */ -public interface IJavaComponentCreationDataModelProperties extends IComponentCreationDataModelProperties { - /** - * 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"; - - /** - * Optional, type String. This is used to specify the server target and is required if - * the <code>ADD_SERVER_TARGET</code> property is set to <code>Boolean.TRUE</code>. - * - * @see org.eclipse.jst.j2ee.internal.servertarget.ServerTargetDataModel - */ - public static final String SERVER_TARGET_ID = "IJavaComponentCreationDataModelProperties.SERVER_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 b74220a46..000000000 --- a/plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/datamodel/properties/IJavaUtilityJarImportDataModelProperties.java +++ /dev/null @@ -1,40 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2003, 2004, 2005 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.j2ee.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 - * - * @since 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$ - /** - * Required, type String. Represents the name of the EAR component which the utility jar will be added. - */ - public static final String EAR_COMPONENT_NAME = "J2EEUtilityJarImportDataModel.EAR_PROJECT"; //$NON-NLS-1$ - -} 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 b60a93985..000000000 --- a/plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/internal/archive/operations/AppClientArchiveOpsResourceHandler.java +++ /dev/null @@ -1,53 +0,0 @@ -/*************************************************************************************************** - * Copyright (c) 2003, 2004 IBM Corporation and others. All rights reserved. This program and the - * accompanying materials are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: IBM Corporation - initial API and implementation - **************************************************************************************************/ -package org.eclipse.jst.j2ee.internal.archive.operations; - - - -import java.util.MissingResourceException; -import java.util.ResourceBundle; - -public class AppClientArchiveOpsResourceHandler { - - private static ResourceBundle fgResourceBundle; - - /** - * Returns the resource bundle used by all classes in this Project - */ - public static ResourceBundle getResourceBundle() { - try { - return ResourceBundle.getBundle("appclientarchiveops");//$NON-NLS-1$ - } catch (MissingResourceException e) { - // does nothing - this method will return null and - // getString(String, String) will return the key - // it was called with - } - return null; - } - - public static String getString(String key) { - if (fgResourceBundle == null) { - fgResourceBundle = getResourceBundle(); - } - - if (fgResourceBundle != null) { - try { - return fgResourceBundle.getString(key); - } catch (MissingResourceException e) { - return "!" + key + "!";//$NON-NLS-2$//$NON-NLS-1$ - } - } - return "!" + key + "!";//$NON-NLS-2$//$NON-NLS-1$ - } - - public static void nlsConcatenationFinder() { - // used to tag methods which have concatenated strings - } - -}
\ No newline at end of file diff --git a/plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/internal/archive/operations/AppClientModuleExportOperation.java b/plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/internal/archive/operations/AppClientModuleExportOperation.java deleted file mode 100644 index 6cd0ad426..000000000 --- a/plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/internal/archive/operations/AppClientModuleExportOperation.java +++ /dev/null @@ -1,83 +0,0 @@ -/*************************************************************************************************** - * Copyright (c) 2003, 2004 IBM Corporation and others. All rights reserved. This program and the - * accompanying materials are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: IBM Corporation - initial API and implementation - **************************************************************************************************/ -package org.eclipse.jst.j2ee.internal.archive.operations; - -import java.lang.reflect.InvocationTargetException; - -import org.eclipse.core.runtime.CoreException; -import org.eclipse.emf.ecore.EPackage; -import org.eclipse.jst.j2ee.application.internal.operations.AppClientModuleExportDataModel; -import org.eclipse.jst.j2ee.commonarchivecore.internal.ApplicationClientFile; -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; - - -public final class AppClientModuleExportOperation extends J2EEArtifactExportOperation { - /** - * @param model - */ - public AppClientModuleExportOperation(AppClientModuleExportDataModel model) { - super(model); - } - - /* - * (non-Javadoc) - * - * @see com.ibm.etools.archive.j2ee.operations.J2EEExportOperationNEW#export() - */ - public void export() throws SaveFailureException, CoreException, InvocationTargetException, InterruptedException { - exportApplicationClientProject(); - } - - public void exportApplicationClientProject() throws SaveFailureException { - - try { - createModuleFile(); - getApplicationClientFile().saveAsNoReopen(getDestinationPath().toOSString()); - } catch (SaveFailureException ex) { - throw ex; - } catch (Exception e) { - throw new SaveFailureException(AppClientArchiveOpsResourceHandler.getString("ARCHIVE_OPERATION_OpeningArchive"), e);//$NON-NLS-1$ - } - - } - - public ApplicationClientFile getApplicationClientFile() { - return (ApplicationClientFile) moduleFile; - } - - /* - * (non-Javadoc) - * - * @see com.ibm.etools.archive.j2ee.operations.J2EEExportOperationNEW#archiveString() - */ - protected String archiveString() { - return AppClientArchiveOpsResourceHandler.getString("Application_Client_File_UI_"); //$NON-NLS-1$ = "Application Client File" - } - - /* - * (non-Javadoc) - * - * @see com.ibm.etools.archive.j2ee.operations.J2EEExportOperationNEW#createModuleFile() - */ - public void createModuleFile() throws SaveFailureException { - - try { - CommonarchiveFactory caf = ((CommonarchivePackage) EPackage.Registry.INSTANCE.getEPackage(CommonarchivePackage.eNS_URI)).getCommonarchiveFactory(); - ApplicationClientProjectLoadStrategyImpl ls = new ApplicationClientProjectLoadStrategyImpl(project); - if (isExportSource()) - ls.setExportSource(true); - moduleFile = caf.openApplicationClientFile(ls, getDestinationPath().toOSString()); - } catch (Exception e) { - throw new SaveFailureException(AppClientArchiveOpsResourceHandler.getString("ARCHIVE_OPERATION_OpeningArchive"), e); //$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/AppClientModuleImportOperation.java b/plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/internal/archive/operations/AppClientModuleImportOperation.java deleted file mode 100644 index 1306bf63a..000000000 --- a/plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/internal/archive/operations/AppClientModuleImportOperation.java +++ /dev/null @@ -1,50 +0,0 @@ -/*************************************************************************************************** - * Copyright (c) 2003, 2004 IBM Corporation and others. All rights reserved. This program and the - * accompanying materials are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: IBM Corporation - initial API and implementation - **************************************************************************************************/ -/* - * Created on Dec 4, 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; - -import java.lang.reflect.InvocationTargetException; - -import org.eclipse.core.resources.IProject; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.jst.j2ee.application.internal.operations.J2EEComponentCreationDataModel; -import org.eclipse.jst.j2ee.application.internal.operations.J2EEComponentCreationOperation; -import org.eclipse.jst.j2ee.applicationclient.internal.creation.AppClientModuleImportDataModel; -import org.eclipse.jst.j2ee.commonarchivecore.internal.strategy.SaveStrategy; - -public class AppClientModuleImportOperation extends J2EEArtifactImportOperation { - - public AppClientModuleImportOperation(AppClientModuleImportDataModel model) { - super(model); - } - - protected SaveStrategy createSaveStrategy(IProject project) { - ApplicationClientProjectSaveStrategyImpl saveStrat = new ApplicationClientProjectSaveStrategyImpl(project); - return saveStrat; - } - - protected void modifyStrategy(SaveStrategy saveStrat) { - ApplicationClientProjectSaveStrategyImpl strategy = (ApplicationClientProjectSaveStrategyImpl) saveStrat; - if (null != strategy.getOverwriteHandler()) { - strategy.getOverwriteHandler().setAppClientSaveStrategy(strategy); - } - } - - protected void createModuleProject(J2EEComponentCreationDataModel model, IProgressMonitor monitor) throws CoreException, InvocationTargetException, InterruptedException { - J2EEComponentCreationOperation op = (J2EEComponentCreationOperation)model.getDefaultOperation(); - op.run(monitor); - } - -}
\ No newline at end of file diff --git a/plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/internal/archive/operations/AppClientModuleImportOperationNew.java b/plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/internal/archive/operations/AppClientModuleImportOperationNew.java deleted file mode 100644 index e2d0384e1..000000000 --- a/plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/internal/archive/operations/AppClientModuleImportOperationNew.java +++ /dev/null @@ -1,43 +0,0 @@ -/*************************************************************************************************** - * Copyright (c) 2003, 2004 IBM Corporation and others. All rights reserved. This program and the - * accompanying materials are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: IBM Corporation - initial API and implementation - **************************************************************************************************/ -/* - * Created on Dec 4, 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; - -import java.lang.reflect.InvocationTargetException; - -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.jst.j2ee.application.internal.operations.J2EEComponentCreationDataModel; -import org.eclipse.jst.j2ee.application.internal.operations.J2EEComponentCreationOperation; -import org.eclipse.jst.j2ee.commonarchivecore.internal.strategy.SaveStrategy; -import org.eclipse.wst.common.componentcore.resources.IVirtualComponent; -import org.eclipse.wst.common.frameworks.datamodel.IDataModel; - -public class AppClientModuleImportOperationNew extends J2EEArtifactImportOperationNew { - - public AppClientModuleImportOperationNew(IDataModel model) { - super(model); - } - - protected SaveStrategy createSaveStrategy(IVirtualComponent virtualComponent) { - FlexibleJ2EEAppClientSaveStrategyImpl saveStrat = new FlexibleJ2EEAppClientSaveStrategyImpl(virtualComponent); - return saveStrat; - } - - protected void createModuleProject(J2EEComponentCreationDataModel model, IProgressMonitor monitor) throws CoreException, InvocationTargetException, InterruptedException { - J2EEComponentCreationOperation op = (J2EEComponentCreationOperation)model.getDefaultOperation(); - op.run(monitor); - } - -}
\ No newline at end of file diff --git a/plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/internal/archive/operations/ApplicationClientProjectLoadStrategy.java b/plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/internal/archive/operations/ApplicationClientProjectLoadStrategy.java deleted file mode 100644 index ab155cd3a..000000000 --- a/plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/internal/archive/operations/ApplicationClientProjectLoadStrategy.java +++ /dev/null @@ -1,14 +0,0 @@ -/*************************************************************************************************** - * Copyright (c) 2003, 2004 IBM Corporation and others. All rights reserved. This program and the - * accompanying materials are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: IBM Corporation - initial API and implementation - **************************************************************************************************/ -package org.eclipse.jst.j2ee.internal.archive.operations; - - - -public interface ApplicationClientProjectLoadStrategy extends J2EELoadStrategy { -}
\ No newline at end of file diff --git a/plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/internal/archive/operations/ApplicationClientProjectLoadStrategyImpl.java b/plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/internal/archive/operations/ApplicationClientProjectLoadStrategyImpl.java deleted file mode 100644 index 379cb1286..000000000 --- a/plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/internal/archive/operations/ApplicationClientProjectLoadStrategyImpl.java +++ /dev/null @@ -1,102 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2003, 2004 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.j2ee.internal.archive.operations; - - - -import java.util.ArrayList; -import java.util.List; - -import org.eclipse.core.resources.IContainer; -import org.eclipse.core.resources.IFolder; -import org.eclipse.core.resources.IProject; -import org.eclipse.jem.util.emf.workbench.JavaProjectUtilities; -import org.eclipse.jem.util.emf.workbench.WorkbenchURIConverter; -import org.eclipse.jem.util.emf.workbench.WorkbenchURIConverterImpl; -import org.eclipse.jst.j2ee.applicationclient.internal.creation.ApplicationClientNatureRuntime; -import org.eclipse.jst.j2ee.commonarchivecore.internal.exception.ArchiveRuntimeException; -import org.eclipse.jst.j2ee.commonarchivecore.internal.exception.SaveFailureException; - -/** - * Insert the type's description here. Creation date: (4/4/2001 11:12:19 AM) - * - * @author: Administrator - */ -public class ApplicationClientProjectLoadStrategyImpl extends org.eclipse.jst.j2ee.internal.archive.operations.J2EELoadStrategyImpl { - /** - * EARProjectSaveStrategyImpl constructor comment. - */ - public ApplicationClientProjectLoadStrategyImpl(IProject aProject) { - super(); - project = aProject; - filesList = new ArrayList(); - } - - /** - * getModuleFolderName method comment. - */ - public IContainer getModuleContainer() { - try { - ApplicationClientNatureRuntime enr = ApplicationClientNatureRuntime.getRuntime(project); - return enr.getModuleServerRoot(); - } catch (Exception e) { - throw new ArchiveRuntimeException(e.getMessage(), e); - } - } - - /** - * getProjectURIConverter method comment. - */ - public WorkbenchURIConverter getProjectURIConverter() { - - ApplicationClientNatureRuntime anr = ApplicationClientNatureRuntime.getRuntime(project); - projectURIConverter = new WorkbenchURIConverterImpl(anr.getModuleServerRoot()); - if (isExportSource()) { - List localSourceFolders = JavaProjectUtilities.getSourceContainers(anr.getProject()); - for (int i = 0; i < localSourceFolders.size(); i++) { - projectURIConverter.addInputContainer((IFolder) localSourceFolders.get(i)); - } - return projectURIConverter; - } - return projectURIConverter; - } - - /** - * getSourceFolderName method comment. - */ - public java.lang.String getSourceFolderName() throws java.lang.Exception { - try { - ApplicationClientNatureRuntime anr = ApplicationClientNatureRuntime.getRuntime(project); - return anr.getSourceFolder().getName(); - } catch (Exception e) { - throw new SaveFailureException(AppClientArchiveOpsResourceHandler.getString("ARCHIVE_OPERATION_ProjectNature"), e);//$NON-NLS-1$ - } - } - - /** - * save method comment. - */ - public List getSourceFoldersNames() throws Exception { - try { - ApplicationClientNatureRuntime anr = ApplicationClientNatureRuntime.getRuntime(project); - List sourceFolderNames = new ArrayList(); - List localSourceFolders = JavaProjectUtilities.getSourceContainers(anr.getProject()); - for (int i = 0; i < localSourceFolders.size(); i++) { - sourceFolderNames.add(((org.eclipse.core.resources.IFolder) localSourceFolders.get(i)).getName()); - } - return sourceFolderNames; - - } catch (Exception e) { - throw new SaveFailureException(AppClientArchiveOpsResourceHandler.getString("ARCHIVE_OPERATION_ProjectNature"), e); //$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/ApplicationClientProjectSaveStrategyImpl.java b/plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/internal/archive/operations/ApplicationClientProjectSaveStrategyImpl.java deleted file mode 100644 index 549d2300e..000000000 --- a/plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/internal/archive/operations/ApplicationClientProjectSaveStrategyImpl.java +++ /dev/null @@ -1,76 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2003, 2004 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.j2ee.internal.archive.operations; - - -import java.util.ArrayList; - -import org.eclipse.core.resources.IProject; -import org.eclipse.jst.j2ee.applicationclient.internal.creation.ApplicationClientNatureRuntime; -import org.eclipse.jst.j2ee.commonarchivecore.internal.Archive; -import org.eclipse.jst.j2ee.commonarchivecore.internal.helpers.ArchiveConstants; - -import org.eclipse.jem.util.emf.workbench.WorkbenchURIConverter; -import org.eclipse.jem.util.emf.workbench.WorkbenchURIConverterImpl; - -/** - * Insert the type's description here. Creation date: (4/4/2001 11:14:29 AM) - * - * @author: Administrator - */ -public class ApplicationClientProjectSaveStrategyImpl extends J2EESaveStrategyImpl { - /** - * ApplicationClientProjectSaveStrategyImpl constructor comment. - */ - public ApplicationClientProjectSaveStrategyImpl(IProject aProject) { - super(aProject); - initializeMofResourceURIList(); - } - - /** - * save method comment. - */ - public String getProjectName(Archive anArchive) { - return anArchive.getName().substring(0, anArchive.getName().indexOf(".")); //$NON-NLS-1$ - - } - - /** - * getSourceURIConverter method comment. - */ - public WorkbenchURIConverter getSourceURIConverter() { - if (sourceURIConverter == null) { - ApplicationClientNatureRuntime enr = ApplicationClientNatureRuntime.getRuntime(project); - sourceURIConverter = new WorkbenchURIConverterImpl(enr.getSourceFolder()); - sourceURIConverter.setForceSaveRelative(true); - } - return sourceURIConverter; - } - - protected boolean shouldOverwrite(String uri) { - if (mofResourceURIList != null && mofResourceURIList.contains(uri)) - return true; - return super.shouldOverwrite(uri); - } - - /** - * save method comment. - */ - public void initializeMofResourceURIList() { - - if (mofResourceURIList == null) { - mofResourceURIList = new ArrayList(); - mofResourceURIList.add(ArchiveConstants.APP_CLIENT_DD_URI); - - } - } - -}
\ No newline at end of file diff --git a/plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/internal/archive/operations/BinaryProjectHelper.java b/plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/internal/archive/operations/BinaryProjectHelper.java deleted file mode 100644 index 7d7abb04d..000000000 --- a/plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/internal/archive/operations/BinaryProjectHelper.java +++ /dev/null @@ -1,148 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2003, 2004 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -/* - * Created on Jan 12, 2004 - * - * To change the template for this generated file go to Window - Preferences - - * Java - Code Generation - Code and Comments - */ -package org.eclipse.jst.j2ee.internal.archive.operations; - -import java.io.FileNotFoundException; -import java.io.IOException; -import java.util.ArrayList; -import java.util.List; - -import org.eclipse.core.resources.IFile; -import org.eclipse.core.resources.IProject; -import org.eclipse.core.runtime.IPath; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.NullProgressMonitor; -import org.eclipse.jdt.core.IClasspathEntry; -import org.eclipse.jdt.core.IJavaProject; -import org.eclipse.jdt.core.JavaCore; -import org.eclipse.jdt.core.JavaModelException; -import org.eclipse.jem.util.emf.workbench.JavaProjectUtilities; -import org.eclipse.jem.util.emf.workbench.ProjectUtilities; -import org.eclipse.jem.util.emf.workbench.WorkbenchByteArrayOutputStream; -import org.eclipse.jst.j2ee.commonarchivecore.internal.Archive; -import org.eclipse.jst.j2ee.commonarchivecore.internal.File; -import org.eclipse.jst.j2ee.commonarchivecore.internal.util.ArchiveUtil; - -/** - * @author jsholl - * - * To change the template for this generated type comment go to Window - Preferences - Java - Code - * Generation - Code and Comments - */ -public class BinaryProjectHelper { - - public void importArchiveAsBinary(Archive archive, IProject project, IProgressMonitor monitor) { - try { - IFile savedModuleFile = null; - savedModuleFile = saveFile(archive, project); - saveEnclosedFile(archive, project, ProjectUtilities.DOT_CLASSPATH); - saveEnclosedFile(archive, project, ProjectUtilities.DOT_PROJECT); - removeImportedClassesFromClasspathIfNecessary(project); - JavaProjectUtilities.forceClasspathReload(project); - ensureBinary(project); - IPath path = savedModuleFile.getFullPath(); - IClasspathEntry newEntry = JavaCore.newLibraryEntry(path, path, null, true); - JavaProjectUtilities.appendJavaClassPath(project, newEntry); - } catch (FileNotFoundException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } catch (IOException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } catch (JavaModelException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - //TODO - // IJ2EENature nature = - // (IJ2EENature)J2EENature.getRegisteredRuntime(aProject); - // if (nature != null) - // nature.recomputeBinaryProject(); - - } - - /** - * - */ - public static void removeImportedClassesFromClasspathIfNecessary(IProject project) { - IJavaProject javaProj = JavaProjectUtilities.getJavaProject(project); - if (javaProj != null) { - IClasspathEntry[] entries = javaProj.readRawClasspath(); - if (entries != null) { - IClasspathEntry entryToRemove = null; - for (int i = 0; i < entries.length; i++) { - if (entries[i].getEntryKind() == IClasspathEntry.CPE_LIBRARY && entries[i].getPath().toString().endsWith("imported_classes") && !project.getFolder("imported_classes").exists()) { //$NON-NLS-1$ //$NON-NLS-2$ - entryToRemove = entries[i]; - break; - } - } - if (null != entryToRemove) { - IClasspathEntry[] newEntries = new IClasspathEntry[entries.length - 1]; - for (int i = 0, j = 0; i < newEntries.length && j < entries.length; j++) { - if (entryToRemove != entries[j]) { - newEntries[i] = entries[j]; - i++; - } - } - entries = newEntries; - IPath output = javaProj.readOutputLocation(); - if (output != null) - try { - javaProj.setRawClasspath(entries, output, null); - } catch (JavaModelException e) { - } - } - - } - } - } - - protected IFile saveFile(File aFile, IProject p) throws IOException { - IFile iFile = p.getFile(aFile.getURI()); - WorkbenchByteArrayOutputStream out = new WorkbenchByteArrayOutputStream(iFile); - ArchiveUtil.copy(aFile.getInputStream(), out); - return iFile; - } - - protected void saveEnclosedFile(Archive anArchive, IProject p, String uri) throws IOException { - try { - File aFile = anArchive.getFile(uri); - saveFile(aFile, p); - } catch (FileNotFoundException ignore) { - } - } - - protected void ensureBinary(IProject p) { - IJavaProject javaP = JavaProjectUtilities.getJavaProject(p); - if (javaP == null) - return; - List newCp = new ArrayList(); - try { - IClasspathEntry[] entries = javaP.getRawClasspath(); - for (int i = 0; i < entries.length; i++) { - IClasspathEntry entry = entries[i]; - if (entry.getEntryKind() != IClasspathEntry.CPE_SOURCE) - newCp.add(entry); - } - entries = (IClasspathEntry[]) newCp.toArray(new IClasspathEntry[newCp.size()]); - javaP.setRawClasspath(entries, new NullProgressMonitor()); - } catch (JavaModelException ex) { - ex.printStackTrace(); - } - } - -}
\ No newline at end of file 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 bb9a55335..000000000 --- a/plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/internal/archive/operations/DependentJarExportMerger.java +++ /dev/null @@ -1,131 +0,0 @@ -/*************************************************************************************************** - * Copyright (c) 2003, 2004 IBM Corporation and others. All rights reserved. This program and the - * accompanying materials are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: IBM Corporation - initial API and implementation - **************************************************************************************************/ -package org.eclipse.jst.j2ee.internal.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; - - -//TODO shoudln't this be moved out of the core plugins? -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); - } -}
\ No newline at end of file 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 87289bf0b..000000000 --- a/plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/internal/archive/operations/EARArchiveOpsResourceHandler.java +++ /dev/null @@ -1,63 +0,0 @@ -/*************************************************************************************************** - * Copyright (c) 2003, 2004 IBM Corporation and others. All rights reserved. This program and the - * accompanying materials are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: IBM Corporation - initial API and implementation - **************************************************************************************************/ -package org.eclipse.jst.j2ee.internal.archive.operations; - - -import java.text.MessageFormat; -import java.util.MissingResourceException; -import java.util.ResourceBundle; - -public class EARArchiveOpsResourceHandler { - - private static ResourceBundle fgResourceBundle; - - /** - * Returns the resource bundle used by all classes in this Project - */ - public static ResourceBundle getResourceBundle() { - try { - return ResourceBundle.getBundle("eararchiveops");//$NON-NLS-1$ - } catch (MissingResourceException e) { - // does nothing - this method will return null and - // getString(String, String) will return the key - // it was called with - } - return null; - } - - public static String getString(String key) { - if (fgResourceBundle == null) { - fgResourceBundle = getResourceBundle(); - } - - if (fgResourceBundle != null) { - try { - return fgResourceBundle.getString(key); - } catch (MissingResourceException e) { - return "!" + key + "!";//$NON-NLS-2$//$NON-NLS-1$ - } - } - return "!" + key + "!";//$NON-NLS-2$//$NON-NLS-1$ - } - - public static String getString(String key, Object[] args) { - - try { - return MessageFormat.format(getString(key), args); - } catch (IllegalArgumentException e) { - return getString(key); - } - - } - - public static void nlsConcatenationFinder() { - // used to tag methods which have concatenated strings - } - -}
\ No newline at end of file diff --git a/plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/internal/archive/operations/EARProjectLoadStrategy.java b/plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/internal/archive/operations/EARProjectLoadStrategy.java deleted file mode 100644 index 59119a687..000000000 --- a/plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/internal/archive/operations/EARProjectLoadStrategy.java +++ /dev/null @@ -1,23 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2003, 2004 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.j2ee.internal.archive.operations; - -import org.eclipse.jst.j2ee.commonarchivecore.internal.strategy.LoadStrategy; - - - -/** - * Insert the type's description here. Creation date: (2/20/2001 1:02:01 PM) - * - * @author: Administrator - */ -public interface EARProjectLoadStrategy extends LoadStrategy { -}
\ No newline at end of file diff --git a/plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/internal/archive/operations/EARProjectLoadStrategyImpl.java b/plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/internal/archive/operations/EARProjectLoadStrategyImpl.java deleted file mode 100644 index 7170bffc4..000000000 --- a/plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/internal/archive/operations/EARProjectLoadStrategyImpl.java +++ /dev/null @@ -1,440 +0,0 @@ -/*************************************************************************************************** - * Copyright (c) 2003, 2004 IBM Corporation and others. All rights reserved. This program and the - * accompanying materials are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: IBM Corporation - initial API and implementation - **************************************************************************************************/ -package org.eclipse.jst.j2ee.internal.archive.operations; - - - -import java.io.FileNotFoundException; -import java.io.IOException; -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.IContainer; -import org.eclipse.core.resources.IFile; -import org.eclipse.core.resources.IProject; -import org.eclipse.core.resources.IResource; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.emf.ecore.EPackage; -import org.eclipse.emf.ecore.resource.Resource.Factory.Registry; -import org.eclipse.jst.j2ee.commonarchivecore.internal.Archive; -import org.eclipse.jst.j2ee.commonarchivecore.internal.CommonarchivePackage; -import org.eclipse.jst.j2ee.commonarchivecore.internal.EARFile; -import org.eclipse.jst.j2ee.commonarchivecore.internal.File; -import org.eclipse.jst.j2ee.commonarchivecore.internal.exception.ArchiveRuntimeException; -import org.eclipse.jst.j2ee.commonarchivecore.internal.exception.OpenFailureException; -import org.eclipse.jst.j2ee.commonarchivecore.internal.helpers.ArchiveOptions; -import org.eclipse.jst.j2ee.commonarchivecore.internal.strategy.LoadStrategy; -import org.eclipse.jst.j2ee.commonarchivecore.internal.strategy.LoadStrategyImpl; -import org.eclipse.jst.j2ee.internal.common.impl.J2EEResourceFactoryRegistry; -import org.eclipse.jst.j2ee.internal.earcreation.EAREditModel; -import org.eclipse.jst.j2ee.internal.earcreation.EARNatureRuntime; -import org.eclipse.jst.j2ee.internal.earcreation.modulemap.UtilityJARMapping; -import org.eclipse.jst.j2ee.internal.project.J2EEModuleNature; -import org.eclipse.jst.j2ee.internal.project.J2EENature; -import org.eclipse.jst.j2ee.internal.project.J2EEProjectUtilities; -import org.eclipse.jst.j2ee.internal.servertarget.IServerTargetConstants; -import org.eclipse.wst.common.internal.emfworkbench.WorkbenchResourceHelper; - -import org.eclipse.jem.util.logger.proxy.Logger; -import org.eclipse.jem.util.emf.workbench.WorkbenchURIConverter; - -public class EARProjectLoadStrategyImpl extends LoadStrategyImpl implements IJ2EEImportExportConstants { - protected ArrayList filesList; - protected IProject project; - protected EARFile earFile; - protected boolean exportSource = false; - protected WorkbenchURIConverter earURIConverter; - protected List jarMergers; - protected boolean mergeDependentJars = true; - protected boolean includeProjectMetaFiles = false; - - /** - * EARProjectSaveStrategyImpl constructor comment. - */ - public EARProjectLoadStrategyImpl(IProject aProject) { - super(); - project = aProject; - filesList = new ArrayList(); - } - - /** - * For each module project in this ear project, add a module file the list of files in the EAR - */ - public void addModulesToFiles() { - Map moduleProjects = getEARNature().getModuleProjects(); - //Next get all the absolute paths of the modules - - //Make a set of all the files collected thus far; if the uri of a module collides with an - // existing file, - //Then remove that file and give the ModuleFile precedence - - //ensure there is a workbench validation that checks for this collision - //TODO - Map existingFiles = getFilesListMapped(); - - Iterator it = moduleProjects.entrySet().iterator(); - while (it.hasNext()) { - Map.Entry entry = (Map.Entry) it.next(); - String uri = (String) entry.getKey(); - J2EENature nature = (J2EENature) entry.getValue(); - if (nature == null) - continue; - try { - Archive moduleFile = ((J2EEModuleNature) nature).asArchive(exportSource); - if( moduleFile == null ) - continue; - moduleFile.setURI(uri); - setIncludeProjectMetaFiles(moduleFile); - if (existingFiles.containsKey(uri)) - filesList.remove(existingFiles.get(uri)); - filesList.add(moduleFile); - if ((moduleFile.isEJBJarFile() || moduleFile.isApplicationClientFile()) && isMergeDependentJars()) - mergeDependentJars(moduleFile, nature.getProject()); - } catch (OpenFailureException oe) { - //this was causing problems in import when a project - //does not have a dd - //String message = ResourceHandler.getString("UNABLE_TO_LOAD_MODULE_ERROR_",new - // Object[] {uri,getProject().getName(),oe.getConcatenatedMessages()}); - // //$NON-NLS-1$ - //throw new ArchiveRuntimeException(message, oe); - } catch (RuntimeException runtime) { - String message = EARArchiveOpsResourceHandler.getString("UNABLE_TO_LOAD_MODULE_ERROR_", new Object[]{uri, getProject().getName(), runtime.toString()}); //$NON-NLS-1$ - throw new ArchiveRuntimeException(message, runtime); - } - } - } - - protected void setIncludeProjectMetaFiles(Archive anArchive) { - LoadStrategy strategy = anArchive.getLoadStrategy(); - if (strategy instanceof J2EELoadStrategyImpl) - ((J2EELoadStrategyImpl) strategy).setIncludeProjectMetaFiles(includeProjectMetaFiles); - } - - /** - * For each loose utility JAR project in this ear project, add an Archive to the list of files - * in the EAR - */ - public void addLooseUtilityJARsToFiles() { - EAREditModel editModel = null; - try { - editModel = getEARNature().getEarEditModelForRead(this); - List utilMaps = editModel.getUtilityJARMappings(); - - Map existingFiles = getFilesListMapped(); - for (int i = 0; i < utilMaps.size(); i++) { - UtilityJARMapping map = (UtilityJARMapping) utilMaps.get(i); - String uri = map.getUri(); - String projectName = map.getProjectName(); - try { - Archive utilJAR = J2EEProjectUtilities.asArchive(uri, projectName, exportSource); - if (utilJAR == null) - continue; - setIncludeProjectMetaFiles(utilJAR); - if (existingFiles.containsKey(uri)) - filesList.remove(existingFiles.get(uri)); - filesList.add(utilJAR); - } catch (OpenFailureException oe) { - String message = EARArchiveOpsResourceHandler.getString("UNABLE_TO_LOAD_MODULE_ERROR_", new Object[]{uri, getProject().getName(), oe.getConcatenatedMessages()}); //$NON-NLS-1$ - org.eclipse.jem.util.logger.proxy.Logger.getLogger().logTrace(message); - } - } - } finally { - if (editModel != null) - editModel.releaseAccess(this); - } - } - - public void close() { - super.close(); - if (jarMergers == null) - return; - - for (int i = 0; i < jarMergers.size(); i++) { - ((DependentJarExportMerger) jarMergers.get(i)).release(); - } - } - - /** - * @see com.ibm.etools.archive.LoadStrategy - */ - public boolean contains(String uri) { - - try { - EARNatureRuntime.getRuntime(project); - return project.getFile(uri).exists(); //$NON-NLS-1$ - } catch (Exception e) { - throw new ArchiveRuntimeException(e.getMessage(), e); - } - } - - /* should never get called outside of runtime */ - protected boolean primContains(String uri) { - return false; - } - - public EARFile getEARFile() { - return (EARFile) getContainer(); - } - - protected EARNatureRuntime getEARNature() { - return EARNatureRuntime.getRuntime(project); - } - - /** - * save method comment. - */ - public WorkbenchURIConverter getEARURIConverter() { - EARNatureRuntime enr = EARNatureRuntime.getRuntime(project); - if (enr == null) - return null; - earURIConverter = (WorkbenchURIConverter) (enr.getResourceSet().getURIConverter()); - return earURIConverter; - } - - /** - * @see com.ibm.etools.archive.LoadStrategy - */ - public IFile getFileForURI(String uri) throws FileNotFoundException { - - try { - if (earURIConverter == null) - getEARURIConverter(); - IResource rfile = earURIConverter.getInputContainer().findMember(uri); - return (IFile) rfile; - } catch (Exception e) { - - String errorString = EARArchiveOpsResourceHandler.getString("ARCHIVE_OPERATION_FileNotFound") + uri; //$NON-NLS-1$ - throw new FileNotFoundException(errorString); - } - } - - /** - * @see com.ibm.etools.archive.LoadStrategy - */ - public java.util.List getFiles() { - - filesList.clear(); - try { - filesList = getFiles(java.util.Arrays.asList(project.members())); - addModulesToFiles(); - addLooseUtilityJARsToFiles(); - } catch (Exception exc) { - throw new ArchiveRuntimeException(EARArchiveOpsResourceHandler.getString("ARCHIVE_OPERATION_FilesFromProject"), exc); //$NON-NLS-1$ - } - return filesList; - } - - protected long getLastModified(IResource aResource) { - return aResource.getLocation().toFile().lastModified(); - } - - /** - * @see com.ibm.etools.archive.LoadStrategy - */ - private java.util.ArrayList getFiles(List projectResources) throws Exception { - if (projectResources.isEmpty()) { - return filesList; - } - Iterator iterator = projectResources.iterator(); - while (iterator.hasNext()) { - IResource res = (IResource) (iterator.next()); - if ((res.getType() == IResource.FILE)) { - if (isServerTargetFile(res)) - continue; - if (isProjectMetaFile(res) && !includeProjectMetaFiles) - continue; - if (isProjectSupportFile(res)) - continue; - File cFile = createFile(res.getProjectRelativePath().toString()); - cFile.setLastModified(getLastModified(res)); - if (cFile.isArchive()) - ((Archive) cFile).getOptions().setIsReadOnly(true); - - filesList.add(cFile); - } else { - getFiles(java.util.Arrays.asList(((IContainer) res).members())); - } - } - return filesList; - } - - protected boolean isProjectSupportFile(IResource res) { - //return (res.getProjectRelativePath().toString().equals(PROJECT_RUNTIME_URI) || res.getProjectRelativePath().toString().equals(J2EE_SETTING_URI)); - return (res.getProjectRelativePath().toString().equals(PROJECT_RUNTIME_URI)); - } - - protected boolean isProjectMetaFile(IResource res) { - return (res.getProjectRelativePath().toString().equals(EAREditModel.MODULE_MAP_URI) || res.getProjectRelativePath().toString().equals(PROJECT_FILE_URI)); - } - - protected boolean isServerTargetFile(IResource res) { - return res.getProjectRelativePath().toString().endsWith(IServerTargetConstants.SERVER_FILE_NAME); - } - - protected Map getFilesListMapped() { - Map existingFiles = new HashMap(); - for (int i = 0; i < filesList.size(); i++) { - existingFiles.put(((File) filesList.get(i)).getURI(), filesList.get(i)); - } - return existingFiles; - } - - /** - * @see com.ibm.etools.archive.LoadStrategy - */ - public java.io.InputStream getInputStream(String uri) throws java.io.IOException, java.io.FileNotFoundException { - - IFile file = getFileForURI(uri); - if (!(file == null) && (file.exists())) { - try { - return file.getContents(true); - } catch (CoreException e) { - String errorString = EARArchiveOpsResourceHandler.getString("ARCHIVE_OPERATION_FileContents");//$NON-NLS-1$ - throw new IOException(errorString); - } - - } - String eString = EARArchiveOpsResourceHandler.getString("ARCHIVE_OPERATION_FileNotFound");//$NON-NLS-1$ - throw new FileNotFoundException(eString); - } - - protected List getJarMergers() { - if (jarMergers == null) - jarMergers = new ArrayList(); - - return jarMergers; - } - - /** - * Insert the method's description here. Creation date: (8/28/2001 5:02:59 PM) - * - * @return org.eclipse.core.resources.IProject - */ - public org.eclipse.core.resources.IProject getProject() { - return project; - } - - public boolean isClassLoaderNeeded() { - return false; - } - - /** - * Insert the method's description here. Creation date: (6/29/2001 12:51:40 PM) - * - * @return boolean - */ - public boolean isExportSource() { - return exportSource; - } - - /** - * Insert the method's description here. Creation date: (8/28/2001 5:50:40 PM) - * - * @return boolean - */ - public boolean isMergeDependentJars() { - return mergeDependentJars; - } - - protected void mergeDependentJars(Archive moduleFile, IProject aProject) { - DependentJarExportMerger merger = new DependentJarExportMerger(moduleFile, aProject, isExportSource()); - getJarMergers().add(merger); - merger.merge(); - } - - /** - * Insert the method's description here. Creation date: (6/29/2001 12:51:40 PM) - * - * @param newExportSource - * boolean - */ - public void setExportSource(boolean newExportSource) { - exportSource = newExportSource; - } - - /** - * Insert the method's description here. Creation date: (8/28/2001 5:50:40 PM) - * - * @param newMergeDependentJars - * boolean - */ - public void setMergeDependentJars(boolean newMergeDependentJars) { - mergeDependentJars = newMergeDependentJars; - } - - /** - * Insert the method's description here. Creation date: (11/08/00 5:20:53 PM) - * - * @param newProject - * com.ibm.itp.core.api.resources.IProject - */ - public void setProject(IProject newProject) { - project = newProject; - } - - /** - * Returns the includeProjectMetaFiles. - * - * @return boolean - */ - public boolean shouldIncludeProjectMetaFiles() { - return includeProjectMetaFiles; - } - - - /** - * Sets the includeProjectMetaFiles. - * - * @param includeProjectMetaFiles - * The includeProjectMetaFiles to set - */ - public void setIncludeProjectMetaFiles(boolean includeProjectMetaFiles) { - this.includeProjectMetaFiles = includeProjectMetaFiles; - } - - /** - * @see com.ibm.etools.archive.impl.LoadStrategyImpl#openNestedArchive(String) - */ - protected Archive openNestedArchive(String uri) { - IFile aFile = project.getFile(uri); - if (aFile == null || !aFile.exists()) - return null; - java.io.File ioFile = aFile.getLocation().toFile(); - Archive result = null; - try { - LoadStrategy lStrat = getArchiveFactory().createLoadStrategy(ioFile.getAbsolutePath()); - ArchiveOptions opts = getEARFile().getOptions().cloneWith(lStrat); - result = ((CommonarchivePackage) EPackage.Registry.INSTANCE.getEPackage(CommonarchivePackage.eNS_URI)).getCommonarchiveFactory().openArchive(opts, uri); - } catch (OpenFailureException ex) { - Logger.getLogger().logError(ex); - } catch (IOException ex) { - Logger.getLogger().logError(ex); - } - return result; - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.jst.j2ee.internal.internal.commonarchivecore.strategy.LoadStrategyImpl#initializeResourceSet() - */ - protected void initializeResourceSet() { - resourceSet = WorkbenchResourceHelper.getResourceSet(project); - } - - /* - * Overrode from super to bypass SAX - */ - protected Registry createResourceFactoryRegistry() { - return new J2EEResourceFactoryRegistry(); - } - -}
\ No newline at end of file diff --git a/plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/internal/archive/operations/EARProjectSaveStrategyImpl.java b/plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/internal/archive/operations/EARProjectSaveStrategyImpl.java deleted file mode 100644 index d03927f3a..000000000 --- a/plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/internal/archive/operations/EARProjectSaveStrategyImpl.java +++ /dev/null @@ -1,374 +0,0 @@ -/*************************************************************************************************** - * Copyright (c) 2003, 2004 IBM Corporation and others. All rights reserved. This program and the - * accompanying materials are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: IBM Corporation - initial API and implementation - **************************************************************************************************/ -package org.eclipse.jst.j2ee.internal.archive.operations; - - -import java.io.FileNotFoundException; -import java.io.IOException; -import java.io.OutputStream; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Set; - -import org.eclipse.core.resources.IFile; -import org.eclipse.core.resources.IFolder; -import org.eclipse.core.resources.IProject; -import org.eclipse.core.resources.IWorkspaceRoot; -import org.eclipse.core.resources.ResourcesPlugin; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IPath; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.SubProgressMonitor; -import org.eclipse.emf.common.util.URI; -import org.eclipse.emf.ecore.resource.URIConverter; -import org.eclipse.jdt.core.IClasspathEntry; -import org.eclipse.jdt.core.IJavaProject; -import org.eclipse.jdt.core.JavaCore; -import org.eclipse.jdt.core.JavaModelException; -import org.eclipse.jem.util.emf.workbench.JavaProjectUtilities; -import org.eclipse.jem.util.emf.workbench.WorkbenchURIConverter; -import org.eclipse.jem.util.logger.proxy.Logger; -import org.eclipse.jst.j2ee.application.internal.operations.EnterpriseApplicationImportDataModel; -import org.eclipse.jst.j2ee.application.internal.operations.J2EEArtifactImportDataModel; -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.ArchiveConstants; -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.jst.j2ee.commonarchivecore.internal.strategy.ZipStreamSaveStrategyImpl; -import org.eclipse.jst.j2ee.commonarchivecore.internal.util.ArchiveUtil; -import org.eclipse.jst.j2ee.internal.earcreation.EAREditModel; -import org.eclipse.jst.j2ee.internal.earcreation.EARNatureRuntime; -import org.eclipse.jst.j2ee.internal.project.J2EEModuleNature; -import org.eclipse.jst.j2ee.internal.project.J2EENature; - -public class EARProjectSaveStrategyImpl extends SaveStrategyImpl implements IJ2EEImportExportConstants { - protected IProject project; - protected URIConverter earURIConverter; - protected EnterpriseApplicationImportDataModel dataModel; - protected IOverwriteHandler overwriteHandler; - protected IProgressMonitor monitor; - protected boolean includeProjectMetaFiles = false; - /** - * Used to store the actual project names used to create projects for the modules; needed for - * updating project class paths after all the projects have been saved - */ - protected Map createdProjectsMap; - - public EARProjectSaveStrategyImpl(EnterpriseApplicationImportDataModel model) { - super(); - this.dataModel = model; - project = dataModel.getProject(); - setArchive(model.getEARFile()); - includeProjectMetaFiles = model.getBooleanProperty(EnterpriseApplicationImportDataModel.PRESERVE_PROJECT_METADATA); - overwriteHandler = (IOverwriteHandler) model.getProperty(EnterpriseApplicationImportDataModel.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() { - createdProjectsMap = new HashMap(); - List createdProjectsList = dataModel.getProjectModels(); - J2EEArtifactImportDataModel importDM = null; - Archive anArchive = null; - for (int i = 0; i < createdProjectsList.size(); i++) { - importDM = (J2EEArtifactImportDataModel) createdProjectsList.get(i); - anArchive = importDM.getArchiveFile(); - createdProjectsMap.put(anArchive.getURI(), importDM.getProject()); - } - } - - 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 SaveStrategy createNestedSaveStrategy(Archive anArchive) throws java.io.IOException { - try { - if (earURIConverter == null) - getEARURIConverter(); - OutputStream out = earURIConverter.createOutputStream(URI.createURI(anArchive.getURI())); - return new ZipStreamSaveStrategyImpl(out); - } catch (Exception ex) { - throw new IOException(ex.getLocalizedMessage()); - } - } - - protected EARFile getEARFile() { - return (EARFile) getArchive(); - } - - public org.eclipse.emf.ecore.resource.URIConverter getEARURIConverter() { - - EARNatureRuntime ear = EARNatureRuntime.getRuntime(project); - earURIConverter = ear.getResourceSet().getURIConverter(); - return earURIConverter; - } - - 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(); - monitor.subTask(EARArchiveOpsResourceHandler.getString("Updating_project_classpath_UI_")); //$NON-NLS-1$ = "Updating project classpaths..." - updateProjectClasspaths(); - - } - - public void save(ArchiveManifest aManifest) throws SaveFailureException { - try { - EARNatureRuntime ear = EARNatureRuntime.getRuntime(project); - if (ear == null) - throw new SaveFailureException(EARArchiveOpsResourceHandler.getString("ARCHIVE_OPERATION_ProjectNature")); //$NON-NLS-1$ - URIConverter wuc = ear.getResourceSet().getURIConverter(); - OutputStream out = wuc.createOutputStream(URI.createURI(ArchiveConstants.MANIFEST_URI)); - aManifest.write(out); - out.close(); - } catch (IOException ioe) { - throw new SaveFailureException(EARArchiveOpsResourceHandler.getString("ARCHIVE_OPERATION_SaveManifest")); //$NON-NLS-1$ - } - } - - public void save(Archive anArchive) throws SaveFailureException { - monitor.subTask(anArchive.getURI()); - saveArchiveAsJARInEAR(anArchive); - } - - protected void saveArchiveAsJARInEAR(Archive anArchive) throws SaveFailureException { - - try { - anArchive.save(createNestedSaveStrategy(anArchive)); - monitor.worked(1); - } catch (IOException e) { - throw new SaveFailureException(anArchive.getURI(), e); - } - } - - public void save(File aFile, java.io.InputStream in) throws SaveFailureException { - monitor.subTask(aFile.getURI()); - try { - if (earURIConverter == null) - getEARURIConverter(); - IFile iFile = ((WorkbenchURIConverter) earURIConverter).getOutputFileWithMappingApplied(aFile.getURI()); - mkdirs(iFile.getFullPath(), ResourcesPlugin.getWorkspace().getRoot()); - if (iFile.exists()) - iFile.setContents(in, true, true, null); - else - iFile.create(in, true, null); - //OutputStream out = earURIConverter.createOutputStream(URI.createURI(aFile.getURI())); - //ArchiveUtil.copy(in, out); - } catch (Exception iox) { - throw new SaveFailureException(aFile.getURI(), iox); - } - monitor.worked(1); - - } - - protected void mkdirs(IPath newPath, IWorkspaceRoot root) throws CoreException { - if (newPath.segmentCount() <= 2) - return; - IPath parentPath = newPath.removeLastSegments(1); - IFolder folder = root.getFolder(parentPath); - if (!folder.exists()) { - mkdirs(parentPath, root); - folder.create(true, true, null); - } - } - - protected SubProgressMonitor subMonitor() { - return new SubProgressMonitor(monitor, 10); - } - - public void saveMofResource(org.eclipse.emf.ecore.resource.Resource aResource) throws SaveFailureException { - setEncoding(aResource); - try { - if (earURIConverter == null) - getEARURIConverter(); - OutputStream out = null; - out = earURIConverter.createOutputStream(aResource.getURI()); - aResource.save(out, new HashMap()); - out.close(); - - } catch (Exception e) { - String errorString = EARArchiveOpsResourceHandler.getString("ARCHIVE_OPERATION_SaveMofResources"); //$NON-NLS-1$ - throw new SaveFailureException(errorString, e); - } - } - - public void setMonitor(org.eclipse.core.runtime.IProgressMonitor newMonitor) { - monitor = newMonitor; - } - - public void setProject(org.eclipse.core.resources.IProject newProject) { - project = newProject; - } - - protected boolean shouldSave(File aFile) { - if (aFile.isArchive()) { - if (dataModel.handlesArchive((Archive) aFile)) { - return false; - } - return getFilter().shouldSave(aFile.getURI(), getArchive()); - } - return super.shouldSave(aFile); - } - - protected boolean isProjectMetaFile(String uri) { - return PROJECT_FILE_URI.equals(uri) || EAREditModel.MODULE_MAP_URI.equals(uri); - } - - protected boolean shouldSave(String uri) { - if (isProjectMetaFile(uri)) - return includeProjectMetaFiles; - if (shouldAlwaysExclude(uri)) { - return false; - } - - if (overwriteHandler != null) { - if (overwriteHandler.isOverwriteNone()) - return false; - return ((super.shouldSave(uri)) && (!overwriteHandler.isOverwriteResources()) && (!overwriteHandler.isOverwriteAll()) && (overwriteHandler.shouldOverwrite(uri))); - } - return true; - } - - //TODO move up and use correct Strings - private boolean shouldAlwaysExclude(String uri) { - if (uri.equals(".runtime")) { //$NON-NLS-1$ - return true; - } - return false; - } - - /* - * 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, IProject p) { - - String message = EARArchiveOpsResourceHandler.getString("Updating_project_classpath_UI_") + p.getName(); //$NON-NLS-1$ = "Updating project classpaths..." - monitor.subTask(message); - List projectCpEntries = new ArrayList(); - Set visited = new HashSet(); - traverseClasspaths(p, anArchive, projectCpEntries, visited); - - try { - if (!projectCpEntries.isEmpty()) - JavaProjectUtilities.appendJavaClassPath(p, projectCpEntries); - JavaProjectUtilities.forceClasspathReload(p); - } 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(); - 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 = dataModel.getEARFile().getFile(uri); - } catch (FileNotFoundException notThere) { - } - if (aFile == null || !aFile.isArchive() || visitedArchives.contains(aFile)) - continue; - Archive depArchive = (Archive) aFile; - - IProject prereq = (IProject) createdProjectsMap.get(uri); - - if (prereq != null) { - addProjectToClasspath(p, prereq, projectCpEntries); - } else { - addFileToClasspath(p, project.getFile(uri), projectCpEntries); - traverseClasspaths(p, depArchive, projectCpEntries, visitedArchives); - } - } - } - - protected void updateProjectClasspaths() { - //We're preserving the original classpath - if (includeProjectMetaFiles) - return; - List jarFiles = getEARFile().getArchiveFiles(); - for (int i = 0; i < jarFiles.size(); i++) { - Archive anArchive = (Archive) jarFiles.get(i); - IProject p = (IProject) createdProjectsMap.get(anArchive.getURI()); - if (p != null) - updateProjectClasspath(anArchive, p); - } - } - - protected void ensureBinary(Archive anArchive, IProject p) { - //TODO - // if (!getImportConfiguration().isBinary(anArchive)) - // return; - J2EEModuleNature nature = (J2EEModuleNature) J2EENature.getRegisteredRuntime(p); - //Right now WARs are not optimized - if (nature != null && !nature.canBeBinary()) - return; - IJavaProject javaP = JavaProjectUtilities.getJavaProject(p); - if (javaP == null) - return; - List newCp = new ArrayList(); - try { - IClasspathEntry[] entries = javaP.getRawClasspath(); - for (int i = 0; i < entries.length; i++) { - IClasspathEntry entry = entries[i]; - if (entry.getEntryKind() != IClasspathEntry.CPE_SOURCE) - newCp.add(entry); - } - entries = (IClasspathEntry[]) newCp.toArray(new IClasspathEntry[newCp.size()]); - javaP.setRawClasspath(entries, new SubProgressMonitor(monitor, 1)); - } catch (JavaModelException ex) { - Logger.getLogger().logError(ex); - } - } -}
\ No newline at end of file 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 f7b9cf6dd..000000000 --- a/plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/internal/archive/operations/EJBArchiveOpsResourceHandler.java +++ /dev/null @@ -1,53 +0,0 @@ -/*************************************************************************************************** - * Copyright (c) 2003, 2004 IBM Corporation and others. All rights reserved. This program and the - * accompanying materials are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: IBM Corporation - initial API and implementation - **************************************************************************************************/ -package org.eclipse.jst.j2ee.internal.archive.operations; - - - -import java.util.MissingResourceException; -import java.util.ResourceBundle; - -public class EJBArchiveOpsResourceHandler { - - private static ResourceBundle fgResourceBundle; - - /** - * Returns the resource bundle used by all classes in this Project - */ - public static ResourceBundle getResourceBundle() { - try { - return ResourceBundle.getBundle("ejbarchiveops");//$NON-NLS-1$ - } catch (MissingResourceException e) { - // does nothing - this method will return null and - // getString(String, String) will return the key - // it was called with - } - return null; - } - - public static String getString(String key) { - if (fgResourceBundle == null) { - fgResourceBundle = getResourceBundle(); - } - - if (fgResourceBundle != null) { - try { - return fgResourceBundle.getString(key); - } catch (MissingResourceException e) { - return "!" + key + "!";//$NON-NLS-2$//$NON-NLS-1$ - } - } - return "!" + key + "!";//$NON-NLS-2$//$NON-NLS-1$ - } - - public static void nlsConcatenationFinder() { - // used to tag methods which have concatenated strings - } - -}
\ No newline at end of file diff --git a/plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/internal/archive/operations/EnterpriseApplicationExportOperation.java b/plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/internal/archive/operations/EnterpriseApplicationExportOperation.java deleted file mode 100644 index 207525bf3..000000000 --- a/plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/internal/archive/operations/EnterpriseApplicationExportOperation.java +++ /dev/null @@ -1,244 +0,0 @@ -/*************************************************************************************************** - * Copyright (c) 2003, 2004 IBM Corporation and others. All rights reserved. This program and the - * accompanying materials are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: IBM Corporation - initial API and implementation - **************************************************************************************************/ -package org.eclipse.jst.j2ee.internal.archive.operations; - -import java.lang.reflect.InvocationTargetException; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.HashSet; -import java.util.Iterator; -import java.util.List; -import java.util.Set; - -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.IncrementalProjectBuilder; -import org.eclipse.core.resources.ResourcesPlugin; -import org.eclipse.core.resources.IWorkspace.ProjectOrder; -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.jdt.core.JavaCore; -import org.eclipse.jst.j2ee.application.internal.operations.EnterpriseApplicationExportDataModel; -import org.eclipse.jst.j2ee.application.internal.operations.J2EEArtifactExportDataModel; -import org.eclipse.jst.j2ee.commonarchivecore.internal.CommonarchiveFactory; -import org.eclipse.jst.j2ee.commonarchivecore.internal.EARFile; -import org.eclipse.jst.j2ee.commonarchivecore.internal.exception.OpenFailureException; -import org.eclipse.jst.j2ee.commonarchivecore.internal.exception.SaveFailureException; -import org.eclipse.jst.j2ee.internal.earcreation.EAREditModel; -import org.eclipse.jst.j2ee.internal.earcreation.EARNatureRuntime; -import org.eclipse.jst.j2ee.internal.moduleextension.EarModuleManager; -import org.eclipse.jst.j2ee.internal.moduleextension.WebModuleExtension; -import org.eclipse.jst.j2ee.internal.plugin.LibCopyBuilder; -import org.eclipse.jst.j2ee.internal.project.IWebNatureConstants; -import org.eclipse.jst.j2ee.internal.project.J2EENature; -import org.eclipse.wst.common.frameworks.internal.enablement.nonui.WFTWrappedException; -import org.eclipse.wst.common.frameworks.internal.operations.WTPOperation; - - -public final class EnterpriseApplicationExportOperation extends WTPOperation { - protected IProgressMonitor monitor; - protected IProject project; - protected IPath destinationPath; - protected EARFile earFile; - protected boolean exportSource = false; - protected boolean includeProjectMetaFiles = false; - /** - * flag which indicates whether nested projects should be incrementally built as part of export - */ - protected boolean buildIncremental = true; - - /** - * @param operationDataModel - */ - public EnterpriseApplicationExportOperation(EnterpriseApplicationExportDataModel model) { - super(model); - project = ResourcesPlugin.getWorkspace().getRoot().getProject(model.getStringProperty(J2EEArtifactExportDataModel.PROJECT_NAME)); - destinationPath = new Path((model.getStringProperty(J2EEArtifactExportDataModel.ARCHIVE_DESTINATION))); - exportSource = model.getBooleanProperty(J2EEArtifactExportDataModel.EXPORT_SOURCE_FILES); - includeProjectMetaFiles = model.getBooleanProperty(EnterpriseApplicationExportDataModel.INCLUDE_BUILD_PATH_AND_META_FILES); - } - - public void createEARFile() throws OpenFailureException { - - CommonarchiveFactory caf = CommonarchiveFactory.eINSTANCE; - /* - * ((CommonarchivePackage) - * EPackage.Registry.INSTANCE.getEPackage(CommonarchivePackage.eNS_URI)).getCommonarchiveFactory(); - */ - EARProjectLoadStrategyImpl ls = new EARProjectLoadStrategyImpl(project); - ls.setExportSource(exportSource); - ls.setIncludeProjectMetaFiles(includeProjectMetaFiles); - earFile = caf.openEARFile(ls, destinationPath.toOSString()); - - } - - protected void execute(IProgressMonitor localMonitor) throws CoreException, InvocationTargetException, InterruptedException { - try { - setProgressMonitor(localMonitor); - startProgressMonitor(); - buildProjectsIfNecessary(localMonitor); - exportEARProject(); - } catch (SaveFailureException e) { - String errorString = EARArchiveOpsResourceHandler.getString("ERROR_EXPORTING_EAR_FILE"); //$NON-NLS-1$ - throw new WFTWrappedException(e, errorString); - } finally { - if (earFile != null) - earFile.close(); - localMonitor.done(); - } - } - - protected void buildProjectsIfNecessary(IProgressMonitor localMonitor) throws CoreException { - if (!buildIncremental || !operationDataModel.getBooleanProperty(J2EEArtifactExportDataModel.RUN_BUILD)) { - return; - } - EAREditModel earEditModel = null; - SubProgressMonitor subMonitor = new SubProgressMonitor(localMonitor, 1); - try { - EARNatureRuntime nature = EARNatureRuntime.getRuntime(project); - earEditModel = nature.getEarEditModelForRead(this); - Set projectsToBuild = new HashSet(); - Set mappedProjects = earEditModel.getModuleMappedProjects(); - addAccessibleProjects(projectsToBuild, mappedProjects); - - Iterator iter = mappedProjects.iterator(); - while (iter.hasNext()) { - IProject aProject = (IProject) iter.next(); - if (J2EENature.hasRuntime(aProject, IWebNatureConstants.J2EE_NATURE_ID)) { - WebModuleExtension webExt = EarModuleManager.getWebModuleExtension(); - webExt.addWLPProjects(aProject, projectsToBuild); - } - } - - List inOrderProjects = getProjectsInOrder(projectsToBuild); - subMonitor.beginTask("", inOrderProjects.size()); //$NON-NLS-1$ - for (int i = 0; i < inOrderProjects.size(); i++) { - IProject moduleProject = (IProject) inOrderProjects.get(i); - if (moduleProject.isAccessible()) { - // reflesh. Defect 240999 - moduleProject.refreshLocal(IResource.DEPTH_INFINITE, null); - javac(moduleProject, subMonitor); - } - } - } finally { - earEditModel.releaseAccess(this); - subMonitor.done(); - } - } - - - private static 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; - - } - - /** - * Find the specific Java command amongst the build spec of a given description - */ - private static 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; - } - - public static void javac(IProject project, IProgressMonitor monitor) throws CoreException { - IProjectDescription description = project.getDescription(); - ICommand javaBuilder = getJavaCommand(description); - if (javaBuilder != null) { - project.build(IncrementalProjectBuilder.INCREMENTAL_BUILD, JavaCore.BUILDER_ID, javaBuilder.getArguments(), monitor); - } - ICommand libCopyBuilder = getLibCopyBuilder(description); - if (null != libCopyBuilder) { - project.build(IncrementalProjectBuilder.INCREMENTAL_BUILD, LibCopyBuilder.BUILDER_ID, libCopyBuilder.getArguments(), monitor); - } - } - - - private void addAccessibleProjects(Set projectsToBuild, Set mappedProjects) { - Iterator iter = mappedProjects.iterator(); - while (iter.hasNext()) { - IProject p = (IProject) iter.next(); - if (p.isAccessible()) - projectsToBuild.add(p); - } - } - - private List getProjectsInOrder(Set projectsToBuild) { - List result = new ArrayList(); - IProject[] projects = (IProject[]) projectsToBuild.toArray(new IProject[projectsToBuild.size()]); - ProjectOrder projectOrder = ResourcesPlugin.getWorkspace().computeProjectOrder(projects); - result.addAll(Arrays.asList(projectOrder.projects)); - if (projectOrder.hasCycles) { - for (int i = 0; i < projectOrder.knots.length; i++) { - result.addAll(Arrays.asList(projectOrder.knots[i])); - } - } - return result; - } - - public void exportEARProject() throws SaveFailureException, CoreException, InvocationTargetException, InterruptedException { - - try { - worked(1); - createEARFile(); - worked(1); - earFile.saveAsNoReopen(destinationPath.toOSString()); - worked(1); - } catch (SaveFailureException ex) { - throw ex; - } catch (Exception e) { - String errorString = EARArchiveOpsResourceHandler.getString("ARCHIVE_OPERATION_OpeningArchive"); //$NON-NLS-1$ - throw new WFTWrappedException(e, errorString); //$NON-NLS-1$ - } finally { - } - - } - - public void setProgressMonitor(IProgressMonitor newProgressMonitor) { - monitor = newProgressMonitor; - } - - private IProgressMonitor getProgressMonitor() { - return monitor; - } - - protected void startProgressMonitor() { - if (getProgressMonitor() != null) { - getProgressMonitor().beginTask(null, 4); - } - } - - public void worked(int units) { - if (getProgressMonitor() != null) - getProgressMonitor().worked(units); - } -}
\ No newline at end of file diff --git a/plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/internal/archive/operations/EnterpriseApplicationImportOperation.java b/plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/internal/archive/operations/EnterpriseApplicationImportOperation.java deleted file mode 100644 index 6971ccb37..000000000 --- a/plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/internal/archive/operations/EnterpriseApplicationImportOperation.java +++ /dev/null @@ -1,261 +0,0 @@ -/*************************************************************************************************** - * Copyright (c) 2003, 2004 IBM Corporation and others. All rights reserved. This program and the - * accompanying materials are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: IBM Corporation - initial API and implementation - **************************************************************************************************/ -package org.eclipse.jst.j2ee.internal.archive.operations; - -import java.io.FileNotFoundException; -import java.lang.reflect.InvocationTargetException; -import java.util.ArrayList; -import java.util.List; - -import org.eclipse.core.resources.IFile; -import org.eclipse.core.resources.IProject; -import org.eclipse.core.resources.ResourcesPlugin; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.NullProgressMonitor; -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.application.internal.operations.AddArchiveToEARDataModel; -import org.eclipse.jst.j2ee.application.internal.operations.AddModuleToEARDataModel; -import org.eclipse.jst.j2ee.application.internal.operations.AddUtilityProjectToEARDataModel; -import org.eclipse.jst.j2ee.application.internal.operations.AddWebModuleToEARDataModel; -import org.eclipse.jst.j2ee.application.internal.operations.EARComponentCreationOperation; -import org.eclipse.jst.j2ee.application.internal.operations.EnterpriseApplicationImportDataModel; -import org.eclipse.jst.j2ee.application.internal.operations.J2EEArtifactImportDataModel; -import org.eclipse.jst.j2ee.application.internal.operations.J2EEComponentCreationDataModel; -import org.eclipse.jst.j2ee.application.internal.operations.J2EEModuleImportDataModel; -import org.eclipse.jst.j2ee.application.internal.operations.J2EEUtilityJarImportDataModel; -import org.eclipse.jst.j2ee.commonarchivecore.internal.Archive; -import org.eclipse.jst.j2ee.commonarchivecore.internal.EARFile; -import org.eclipse.jst.j2ee.commonarchivecore.internal.strategy.SaveStrategy; -import org.eclipse.jst.j2ee.commonarchivecore.internal.util.ArchiveUtil; -import org.eclipse.jst.j2ee.internal.common.XMLResource; -import org.eclipse.jst.j2ee.internal.earcreation.EARComponentCreationDataModel; -import org.eclipse.jst.j2ee.internal.earcreation.EAREditModel; -import org.eclipse.jst.j2ee.internal.earcreation.EARNatureRuntime; -import org.eclipse.jst.j2ee.internal.earcreation.modulemap.UtilityJARMapping; -import org.eclipse.jst.j2ee.internal.servertarget.ServerTargetDataModel; -import org.eclipse.wst.common.frameworks.internal.enablement.nonui.WFTWrappedException; -import org.eclipse.wst.common.frameworks.internal.operations.WTPOperation; - -public class EnterpriseApplicationImportOperation extends J2EEArtifactImportOperation { - public EnterpriseApplicationImportOperation(EnterpriseApplicationImportDataModel dataModel) { - super(dataModel); - } - - private EnterpriseApplicationImportDataModel getEARImportDataModel() { - return (EnterpriseApplicationImportDataModel) operationDataModel; - } - - /** - * 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 CoreException, InvocationTargetException, InterruptedException { - //FileSet.printState(); - EnterpriseApplicationImportDataModel model = getEARImportDataModel(); - monitor.beginTask(null, model.getModuleFile().getFiles().size()); - boolean earImported = model.getBooleanProperty(EnterpriseApplicationImportDataModel.IMPORT_EAR_PROJECT); - if (earImported) { - IProject project = model.getProject(); - if (model.getBooleanProperty(J2EEArtifactImportDataModel.OVERWRITE_PROJECT) && model.getBooleanProperty(J2EEArtifactImportDataModel.DELETE_BEFORE_OVERWRITE_PROJECT)) { - if (project.exists()) { - project.delete(true, true, new NullProgressMonitor()); - } - } - if (!project.exists()) { - createModuleProject(model.getJ2eeArtifactCreationDataModel(), monitor); - } - try { - monitor.beginTask(EARArchiveOpsResourceHandler.getString("IMPORTING_EAR_FILE_UI_"), model.getEARFile().getFiles().size()); //$NON-NLS-1$ - importEARProject(monitor); - } finally { - releaseDeploymentDescriptor(); - } - } - List modelsNotToAddToEAR = model.getUnhandledProjectModels(); - List modelsToImport = model.getHandledSelectedModels(); - try { - J2EEArtifactImportDataModel importModel = null; - WTPOperation importOp = null; - List allModels = model.getProjectModels(); - IProject earProject = model.getProject(); - IProject archiveProject = null; - AddArchiveToEARDataModel addArchiveProjectToEARDataModel = null; - boolean synchServerTarget = model.getBooleanProperty(EnterpriseApplicationImportDataModel.SYNC_SERVER_TARGETS_WITH_EAR); - boolean moduleImported = false; - for (int i = 0; i < allModels.size(); i++) { - moduleImported = false; - importModel = (J2EEArtifactImportDataModel) allModels.get(i); - if (modelsToImport.contains(importModel)) { - moduleImported = true; - importOp = importModel.getDefaultOperation(); - importModel.setProperty(J2EEArtifactImportDataModel.CLOSE_ARCHIVE_ON_DISPOSE, Boolean.FALSE); - importOp.run(monitor); - } - if (earProject.exists() && (earImported || moduleImported) && !modelsNotToAddToEAR.contains(importModel)) { - archiveProject = importModel.getProject(); - if (archiveProject.exists()) { - if (importModel instanceof J2EEModuleImportDataModel) { - //TODO initialize data model - //addArchiveProjectToEARDataModel = AddModuleToEARDataModel.createAddToEARDataModel(earProject.getName(), archiveProject).getAppropriateDataModel(); - addArchiveProjectToEARDataModel.setProperty(AddModuleToEARDataModel.ARCHIVE_URI, importModel.getStringProperty(J2EEArtifactImportDataModel.URI_FOR_MODULE_MAPPING)); - addArchiveProjectToEARDataModel.setBooleanProperty(AddArchiveToEARDataModel.SYNC_TARGET_RUNTIME, synchServerTarget); - if (addArchiveProjectToEARDataModel.isProperty(AddWebModuleToEARDataModel.CONTEXT_ROOT) && importModel.isProperty(AddWebModuleToEARDataModel.CONTEXT_ROOT)) { - addArchiveProjectToEARDataModel.setProperty(AddWebModuleToEARDataModel.CONTEXT_ROOT, importModel.getProperty(AddWebModuleToEARDataModel.CONTEXT_ROOT)); - } - addArchiveProjectToEARDataModel.getDefaultOperation().run(monitor); - if (synchServerTarget && importModel.isProperty("WARImportDataModel.HANDLED_ARCHIVES")) { //$NON-NLS-1$ - List weblibs = (List) importModel.getProperty("WARImportDataModel.HANDLED_ARCHIVES"); //$NON-NLS-1$ - for (int j = 0; null != weblibs && j < weblibs.size(); j++) { - IProject webLibProject = ((J2EEUtilityJarImportDataModel) weblibs.get(j)).getProject(); - ServerTargetDataModel sModel = new ServerTargetDataModel(); - sModel.setProperty(ServerTargetDataModel.RUNTIME_TARGET_ID, model.getProperty(EnterpriseApplicationImportDataModel.SERVER_TARGET_ID)); - sModel.setProperty(ServerTargetDataModel.PROJECT_NAME, webLibProject.getName()); - sModel.getDefaultOperation().run(monitor); - } - } - } else if (importModel instanceof J2EEUtilityJarImportDataModel) { - addArchiveProjectToEARDataModel = AddUtilityProjectToEARDataModel.createAddToEARDataModel(earProject.getName(), archiveProject); - addArchiveProjectToEARDataModel.setProperty(AddModuleToEARDataModel.ARCHIVE_URI, importModel.getStringProperty(J2EEArtifactImportDataModel.URI_FOR_MODULE_MAPPING)); - addArchiveProjectToEARDataModel.setBooleanProperty(AddArchiveToEARDataModel.SYNC_TARGET_RUNTIME, synchServerTarget); - addArchiveProjectToEARDataModel.getDefaultOperation().run(monitor); - } - } - } - } - if (!model.getBooleanProperty(EnterpriseApplicationImportDataModel.PRESERVE_PROJECT_METADATA) && earProject.exists()) { - modelsToImport.removeAll(modelsNotToAddToEAR); - fixupClasspaths(modelsToImport, earProject); - } - } finally { - resetDisposeImportModels(); - //FileSet.printState(); - } - } - - /** - * @param modelsToImport - */ - private void resetDisposeImportModels() { - resetDisposeImportModels(getEARImportDataModel().getProjectModels()); - } - - private void resetDisposeImportModels(List models) { - J2EEArtifactImportDataModel model; - for (int i = 0; i < models.size(); i++) { - model = (J2EEArtifactImportDataModel) models.get(i); - model.setProperty(J2EEArtifactImportDataModel.CLOSE_ARCHIVE_ON_DISPOSE, Boolean.TRUE); - } - } - - - private void fixupClasspaths(List selectedModels, IProject earProject) throws JavaModelException { - J2EEArtifactImportDataModel importModel; - for (int i = 0; i < selectedModels.size(); i++) { - importModel = (J2EEArtifactImportDataModel) selectedModels.get(i); - Archive archive = importModel.getArchiveFile(); - String[] manifestClasspath = archive.getManifest().getClassPathTokenized(); - if (manifestClasspath.length > 0) { - List extraEntries = fixupClasspath(earProject, manifestClasspath, new ArrayList(), archive, importModel.getProject()); - addToClasspath(importModel, extraEntries); - } - } - } - - private List fixupClasspath(IProject earProject, String[] manifestClasspath, List computedFiles, Archive anArchive, IProject aProject) throws JavaModelException { - List extraEntries = new ArrayList(); - for (int j = 0; j < manifestClasspath.length; j++) { - String manifestURI = ArchiveUtil.deriveEARRelativeURI(manifestClasspath[j], anArchive); - if (null == manifestURI) { - continue; - } - IFile file = earProject.getFile(manifestURI); - if (!computedFiles.contains(file)) { - computedFiles.add(file); - if (null != file && file.exists()) { - extraEntries.add(JavaCore.newLibraryEntry(file.getFullPath(), file.getFullPath(), null, true)); - Archive archive = null; - try { - archive = (Archive) getEARImportDataModel().getEARFile().getFile(file.getProjectRelativePath().toString()); - String[] nestedManifestClasspath = archive.getManifest().getClassPathTokenized(); - extraEntries.addAll(fixupClasspath(earProject, nestedManifestClasspath, computedFiles, archive, aProject)); - } catch (FileNotFoundException e) { - Logger.getLogger().logError(e); - } finally { - if (null != archive) { - archive.close(); - } - } - } else { - Object key = new Object(); - EAREditModel editModel = null; - try { - editModel = (EAREditModel) EARNatureRuntime.getEditModelForProject(earProject, key); - UtilityJARMapping mapping = editModel.getUtilityJARMapping(manifestURI); - if (null != mapping) { - IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(mapping.getProjectName()); - if (aProject != project) { - extraEntries.add(JavaCore.newProjectEntry(project.getFullPath(), true)); - } - } else { - IProject project = editModel.getMappedProject(manifestURI); - if (null != project && project.exists() && aProject != project) { - extraEntries.add(JavaCore.newProjectEntry(project.getFullPath())); - } - } - } finally { - if (null != editModel) { - editModel.releaseAccess(key); - } - } - } - } - } - return extraEntries; - } - - protected void importEARProject(IProgressMonitor monitor) throws InvocationTargetException { - EARFile earFile = getEARImportDataModel().getEARFile(); - try { - EARProjectSaveStrategyImpl saveStrat = new EARProjectSaveStrategyImpl(getEARImportDataModel()); - saveStrat.setMonitor(monitor); - earFile.save(saveStrat); - } catch (Exception ex) { - String errorString = EARArchiveOpsResourceHandler.getString("ERROR_IMPORTING_EAR_FILE"); //$NON-NLS-1$ - throw new WFTWrappedException(ex, errorString); - } - } - - private void releaseDeploymentDescriptor() { - EARFile earFile = getEARImportDataModel().getEARFile(); - try { - if (earFile != null && earFile.isDeploymentDescriptorSet()) { - XMLResource res = (XMLResource) earFile.getDeploymentDescriptor().eResource(); - if (res != null) - res.releaseFromRead(); - } - } catch (Exception suppress) { - org.eclipse.jem.util.logger.proxy.Logger.getLogger().logError(suppress); - } - } - - protected void createModuleProject(J2EEComponentCreationDataModel model, IProgressMonitor monitor) throws CoreException, InvocationTargetException, InterruptedException { - EARComponentCreationOperation earProjectOp = new EARComponentCreationOperation((EARComponentCreationDataModel) model); - earProjectOp.run(monitor); - } - - protected SaveStrategy createSaveStrategy(IProject project) { //NOOP - return null; - } -}
\ No newline at end of file diff --git a/plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/internal/archive/operations/FlexibleJ2EEAppClientSaveStrategyImpl.java b/plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/internal/archive/operations/FlexibleJ2EEAppClientSaveStrategyImpl.java deleted file mode 100644 index a44adda23..000000000 --- a/plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/internal/archive/operations/FlexibleJ2EEAppClientSaveStrategyImpl.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 FlexibleJ2EEAppClientSaveStrategyImpl extends FlexibleJ2EESaveStrategyImpl { - - public FlexibleJ2EEAppClientSaveStrategyImpl(IVirtualComponent vComponent) { - super(vComponent); - } - -} diff --git a/plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/internal/archive/operations/FlexibleJ2EEConnectorSaveStrategyImpl.java b/plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/internal/archive/operations/FlexibleJ2EEConnectorSaveStrategyImpl.java deleted file mode 100644 index 865d264c7..000000000 --- a/plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/internal/archive/operations/FlexibleJ2EEConnectorSaveStrategyImpl.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 FlexibleJ2EEConnectorSaveStrategyImpl extends FlexibleJ2EESaveStrategyImpl { - - public FlexibleJ2EEConnectorSaveStrategyImpl(IVirtualComponent vComponent) { - super(vComponent); - } - -} diff --git a/plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/internal/archive/operations/FlexibleJ2EEEJBSaveStrategyImpl.java b/plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/internal/archive/operations/FlexibleJ2EEEJBSaveStrategyImpl.java deleted file mode 100644 index 55e347947..000000000 --- a/plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/internal/archive/operations/FlexibleJ2EEEJBSaveStrategyImpl.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 FlexibleJ2EEEJBSaveStrategyImpl extends FlexibleJ2EESaveStrategyImpl { - - public FlexibleJ2EEEJBSaveStrategyImpl(IVirtualComponent vComponent) { - super(vComponent); - } - -} diff --git a/plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/internal/archive/operations/FlexibleJ2EEJavaSaveStrategyImpl.java b/plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/internal/archive/operations/FlexibleJ2EEJavaSaveStrategyImpl.java deleted file mode 100644 index 9fe3fbbc2..000000000 --- a/plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/internal/archive/operations/FlexibleJ2EEJavaSaveStrategyImpl.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 FlexibleJ2EEJavaSaveStrategyImpl extends FlexibleJ2EESaveStrategyImpl { - - public FlexibleJ2EEJavaSaveStrategyImpl(IVirtualComponent vComponent) { - super(vComponent); - } - -} diff --git a/plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/internal/archive/operations/FlexibleJ2EESaveStrategyImpl.java b/plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/internal/archive/operations/FlexibleJ2EESaveStrategyImpl.java deleted file mode 100644 index dae9a4504..000000000 --- a/plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/internal/archive/operations/FlexibleJ2EESaveStrategyImpl.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 abstract class FlexibleJ2EESaveStrategyImpl extends FlexibleSaveStrategyImpl { - - public FlexibleJ2EESaveStrategyImpl(IVirtualComponent vComponent) { - super(vComponent); - } - -} diff --git a/plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/internal/archive/operations/FlexibleSaveStrategyImpl.java b/plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/internal/archive/operations/FlexibleSaveStrategyImpl.java deleted file mode 100644 index 3447075b2..000000000 --- a/plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/internal/archive/operations/FlexibleSaveStrategyImpl.java +++ /dev/null @@ -1,137 +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.io.IOException; -import java.io.InputStream; -import java.io.OutputStream; - -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.resources.IVirtualComponent; -import org.eclipse.wst.common.componentcore.resources.IVirtualFile; - -public abstract class FlexibleSaveStrategyImpl extends SaveStrategyImpl { - - protected IVirtualComponent vComponent; - protected IOverwriteHandler overwriteHandler; - protected IProgressMonitor progressMonitor; - - public FlexibleSaveStrategyImpl(IVirtualComponent vComponent) { - super(); - if(null == vComponent){ - throw new NullPointerException(); - } - this.vComponent = vComponent; - } - - 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; - } - - public void save(File aFile, InputStream in) throws SaveFailureException { - try { - String displayString = EJBArchiveOpsResourceHandler.getString("IMPORT_OPERATION_STRING"); //$NON-NLS-1$ - progressMonitor.subTask(displayString + aFile.getURI()); - IPath path = new Path(aFile.getURI().toString()); - saveToOutputPath(path, in); - } catch (OverwriteHandlerException ohe) { - throw ohe; - } catch (Exception e) { - String errorString = EJBArchiveOpsResourceHandler.getString("ARCHIVE_OPERATION_SaveFile") + aFile.getName(); //$NON-NLS-1$ - throw new SaveFailureException(errorString, e); - } - } - - protected void saveToWorkbenchPath(IPath workbenchPath, InputStream in) throws Exception { - IFile iFile = vComponent.getProject().getFile(workbenchPath); - saveToIFile(iFile, in); - - } - - /** - * Saves to the specified output path. The workbench path is computed from the output path. - * - * @param outputPath - * @param in - * @throws Exception - */ - protected void saveToOutputPath(IPath outputPath, InputStream in) throws Exception { - IVirtualFile vFile = vComponent.getFile(outputPath); - IFile iFile = vFile.getUnderlyingFile(); - saveToIFile(iFile, in); - } - - 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/IJ2EEImportExportConstants.java b/plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/internal/archive/operations/IJ2EEImportExportConstants.java deleted file mode 100644 index 5636b432f..000000000 --- a/plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/internal/archive/operations/IJ2EEImportExportConstants.java +++ /dev/null @@ -1,23 +0,0 @@ -/*************************************************************************************************** - * Copyright (c) 2003, 2004 IBM Corporation and others. All rights reserved. This program and the - * accompanying materials are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: IBM Corporation - initial API and implementation - **************************************************************************************************/ -package org.eclipse.jst.j2ee.internal.archive.operations; - - -//import org.eclipse.jst.j2ee.internal.project.J2EESettings; - -import org.eclipse.jem.util.emf.workbench.ProjectUtilities; - -public interface IJ2EEImportExportConstants { - - public String CLASSPATH_FILE_URI = ProjectUtilities.DOT_CLASSPATH; - public String PROJECT_FILE_URI = ProjectUtilities.DOT_PROJECT; -// public String J2EE_SETTING_URI = J2EESettings.J2EE_SETTINGS_FILE_NAME; - public String PROJECT_RUNTIME_URI = ".runtime"; //$NON-NLS-1$ - -} 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 e4461cfb1..000000000 --- a/plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/internal/archive/operations/IOverwriteHandler.java +++ /dev/null @@ -1,149 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2003, 2004 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.j2ee.internal.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.getString("No_UI"); //$NON-NLS-1$ - public static final String YES = EJBArchiveOpsResourceHandler.getString("Yes_UI"); //$NON-NLS-1$ - public static final String ALL = EJBArchiveOpsResourceHandler.getString("Yes_To_All_UI"); //$NON-NLS-1$ - public static final String NONE = EJBArchiveOpsResourceHandler.getString("Cancel_UI_"); //$NON-NLS-1$ - - /** - * 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 setAppClientSaveStrategy(org.eclipse.jst.j2ee.internal.archive.operations.ApplicationClientProjectSaveStrategyImpl newAppClientSaveStrategy); - - /** - * Insert the method's description here. Creation date: (4/16/2001 3:13:38 PM) - * - * @return boolean - */ - void setEarSaveStrategy(org.eclipse.jst.j2ee.internal.archive.operations.EARProjectSaveStrategyImpl newEarSaveStrategy); - - /** - * Insert the method's description here. Creation date: (4/16/2001 3:13:38 PM) - * - * @return boolean - */ - void setEjbSaveStrategy(J2EESaveStrategyImpl newEjbSaveStrategy); - - /** - * Sets the RAR SaveStrategy. - * - * @param RARProjectSaveStrategyImpl - * rarSaveStrategy - The rar save strategy to set. - */ - void setRARSaveStrategy(J2EESaveStrategyImpl 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(J2EESaveStrategyImpl 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); -}
\ No newline at end of file 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 905d9c292..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, 2004 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.j2ee.internal.archive.operations; - - -import org.eclipse.jst.j2ee.application.internal.operations.J2EEComponentCreationDataModel; -import org.eclipse.jst.j2ee.internal.project.IJ2EEProjectTypes; -import org.eclipse.wst.common.frameworks.internal.operations.WTPOperationDataModel; - - -/** - * 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 WTPOperationDataModel 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(WTPOperationDataModel model) { - super(); - this.model = model; - } - - public ImportOption(WTPOperationDataModel model, int type) { - this(model); - projectType = type; - } - - public WTPOperationDataModel getModel() { - return model; - } - - public int getProjectType() { - return projectType; - } - - public String getProjectName() { - return model.getStringProperty(J2EEComponentCreationDataModel.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; - } - -}
\ No newline at end of file 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 6f2d123ce..000000000 --- a/plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/internal/archive/operations/J2EEArtifactExportOperation.java +++ /dev/null @@ -1,228 +0,0 @@ -/*************************************************************************************************** - * Copyright (c) 2003, 2004 IBM Corporation and others. All rights reserved. This program and the - * accompanying materials are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: IBM Corporation - initial API and implementation - **************************************************************************************************/ -package org.eclipse.jst.j2ee.internal.archive.operations; - - - -import java.lang.reflect.InvocationTargetException; - -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.IncrementalProjectBuilder; -import org.eclipse.core.resources.ResourcesPlugin; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IPath; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.Path; -import org.eclipse.jdt.core.IJavaProject; -import org.eclipse.jdt.core.JavaCore; -import org.eclipse.jem.util.emf.workbench.JavaProjectUtilities; -import org.eclipse.jst.j2ee.application.internal.operations.J2EEArtifactExportDataModel; -import org.eclipse.jst.j2ee.commonarchivecore.internal.ModuleFile; -import org.eclipse.jst.j2ee.commonarchivecore.internal.exception.SaveFailureException; -import org.eclipse.jst.j2ee.internal.plugin.LibCopyBuilder; -import org.eclipse.wst.common.frameworks.internal.enablement.nonui.WFTWrappedException; -import org.eclipse.wst.common.frameworks.internal.operations.WTPOperation; - -public abstract class J2EEArtifactExportOperation extends WTPOperation { - protected IProgressMonitor progressMonitor; - protected IProject project; - protected IPath destinationPath; - protected ModuleFile moduleFile; - protected boolean exportSource = false; - protected boolean buildIncremental = true; - - /** - * Assumptions: aProject is a valid project with an J2EENatureRuntime, and the destination path - * is the fully qualified path where a new jar will be created, and the client code has already - * confirmed overwrite if the file already exists - */ - public J2EEArtifactExportOperation(J2EEArtifactExportDataModel model) { - super(model); - setProject(ResourcesPlugin.getWorkspace().getRoot().getProject(model.getStringProperty(J2EEArtifactExportDataModel.PROJECT_NAME))); - setDestinationPath(new Path(model.getStringProperty(J2EEArtifactExportDataModel.ARCHIVE_DESTINATION))); - setExportSource(model.getBooleanProperty(J2EEArtifactExportDataModel.EXPORT_SOURCE_FILES)); - } - - protected abstract String archiveString(); - - public abstract void createModuleFile() throws SaveFailureException; - - protected void execute(IProgressMonitor monitor) throws CoreException, InvocationTargetException, InterruptedException { - try { - setProgressMonitor(monitor); - //defect 240999 - project.refreshLocal(IResource.DEPTH_INFINITE, null); - if (buildIncremental && operationDataModel.getBooleanProperty(J2EEArtifactExportDataModel.RUN_BUILD)) { - javac(project, monitor); - } - export(); - } catch (SaveFailureException e) { - throw new WFTWrappedException(e, EJBArchiveOpsResourceHandler.getString("Error_exporting__UI_") + archiveString()); //$NON-NLS-1$ = "Error exporting " - } finally { - monitor.done(); - } - } - - public abstract void export() throws SaveFailureException, CoreException, InvocationTargetException, InterruptedException; - - /** - * Insert the method's description here. Creation date: (11/08/00 5:23:49 PM) - * - * @return com.ibm.itp.common.IPath - */ - public IPath getDestinationPath() { - return destinationPath; - } - - protected IJavaProject getJavaProject() { - return JavaProjectUtilities.getJavaProject(getProject()); - } - - protected ModuleFile getModuleFile() { - return moduleFile; - } - - /** - * Insert the method's description here. Creation date: (10/13/00 2:12:50 PM) - * - * @return com.ibm.itp.common.IProgressMonitor - */ - protected IProgressMonitor getProgressMonitor() { - return progressMonitor; - } - - /** - * Insert the method's description here. Creation date: (11/08/00 5:20:53 PM) - * - * @return com.ibm.itp.core.api.resources.IProject - */ - protected IProject getProject() { - return project; - } - - /** - * Insert the method's description here. Creation date: (4/19/2001 6:02:06 PM) - * - * @return boolean - */ - protected boolean isExportSource() { - return exportSource; - } - - /** - * Insert the method's description here. Creation date: (11/08/00 5:23:49 PM) - * - * @param newDestinationPath - * com.ibm.itp.common.IPath - */ - protected void setDestinationPath(IPath newDestinationPath) { - destinationPath = newDestinationPath; - } - - /** - * Insert the method's description here. Creation date: (4/19/2001 6:02:06 PM) - * - * @param newExportSource - * boolean - */ - protected void setExportSource(boolean newExportSource) { - exportSource = newExportSource; - } - - protected void setModuleFile(ModuleFile newModuleFile) { - moduleFile = newModuleFile; - } - - /** - * Insert the method's description here. Creation date: (10/13/00 2:12:50 PM) - * - * @param newProgressMonitor - * com.ibm.itp.common.IProgressMonitor - */ - protected void setProgressMonitor(IProgressMonitor newProgressMonitor) { - progressMonitor = newProgressMonitor; - } - - /** - * Insert the method's description here. Creation date: (11/08/00 5:20:53 PM) - * - * @param newProject - * com.ibm.itp.core.api.resources.IProject - */ - protected void setProject(IProject newProject) { - project = newProject; - } - - /** - * Indicates whether an incremental build should be invoked before export - * - * @return Returns a boolean - */ - public boolean shouldBuildIncremental() { - return buildIncremental; - } - - /** - * Indicates whether an incremental build should be invoked before export - * - * @param buildIncremental - * The buildIncremental to set - */ - protected void setBuildIncremental(boolean buildIncremental) { - this.buildIncremental = buildIncremental; - } - - /** - * Find the specific Java command amongst the build spec of a given description - */ - private static 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; - } - - private static 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 static void javac(IProject project, IProgressMonitor monitor) throws CoreException { - IProjectDescription description = project.getDescription(); - ICommand javaBuilder = getJavaCommand(description); - if (javaBuilder != null) { - project.build(IncrementalProjectBuilder.INCREMENTAL_BUILD, JavaCore.BUILDER_ID, javaBuilder.getArguments(), monitor); - } - ICommand libCopyBuilder = getLibCopyBuilder(description); - if (null != libCopyBuilder) { - project.build(IncrementalProjectBuilder.INCREMENTAL_BUILD, LibCopyBuilder.BUILDER_ID, libCopyBuilder.getArguments(), monitor); - } - } - -}
\ No newline at end of file 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 b914125e3..000000000 --- a/plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/internal/archive/operations/J2EEArtifactImportOperation.java +++ /dev/null @@ -1,166 +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 3, 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; - -import java.lang.reflect.InvocationTargetException; -import java.util.ArrayList; -import java.util.List; - -import org.eclipse.core.resources.IProject; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.NullProgressMonitor; -import org.eclipse.jdt.core.IClasspathEntry; -import org.eclipse.jdt.core.IJavaProject; -import org.eclipse.jdt.core.JavaCore; -import org.eclipse.jdt.core.JavaModelException; -import org.eclipse.jem.util.emf.workbench.JavaProjectUtilities; -import org.eclipse.jst.j2ee.application.internal.operations.J2EEArtifactImportDataModel; -import org.eclipse.jst.j2ee.application.internal.operations.J2EEComponentCreationDataModel; -import org.eclipse.jst.j2ee.commonarchivecore.internal.ModuleFile; -import org.eclipse.jst.j2ee.commonarchivecore.internal.helpers.SaveFilter; -import org.eclipse.jst.j2ee.commonarchivecore.internal.strategy.SaveStrategy; -import org.eclipse.wst.common.frameworks.internal.enablement.nonui.WFTWrappedException; -import org.eclipse.wst.common.frameworks.internal.operations.WTPOperation; - -//TODO delete this -public abstract class J2EEArtifactImportOperation extends WTPOperation { - public J2EEArtifactImportOperation(J2EEArtifactImportDataModel model) { - super(model); - } - - protected final void execute(IProgressMonitor monitor) throws CoreException, InvocationTargetException, InterruptedException { - try { - doExecute(monitor); - } finally { - operationDataModel.dispose(); - } - } - - protected void doExecute(IProgressMonitor monitor) throws CoreException, InvocationTargetException, InterruptedException { - J2EEArtifactImportDataModel model = (J2EEArtifactImportDataModel) operationDataModel; - monitor.beginTask(null, model.getModuleFile().getFiles().size()); - if (model.getBooleanProperty(J2EEArtifactImportDataModel.OVERWRITE_PROJECT) && model.getBooleanProperty(J2EEArtifactImportDataModel.DELETE_BEFORE_OVERWRITE_PROJECT)) { - IProject project = model.getProject(); - if (project.exists()) { - project.delete(true, true, new NullProgressMonitor()); - } - } - if (!model.getJ2eeArtifactCreationDataModel().getTargetProject().exists()) { - createModuleProject(model.getJ2eeArtifactCreationDataModel(), monitor); - } - if (model.getBooleanProperty(J2EEArtifactImportDataModel.BINARY)) { - BinaryProjectHelper binaryHelper = new BinaryProjectHelper(); - binaryHelper.importArchiveAsBinary(model.getModuleFile(), model.getProject(), monitor); - } else { - importModuleFile(monitor); - } - - } - - protected void addServerTarget(IProgressMonitor monitor) throws CoreException, InvocationTargetException, InterruptedException { - //J2EEComponentCreationDataModel projModel = ((J2EEArtifactImportDataModel) operationDataModel).getJ2eeArtifactCreationDataModel(); -// ServerTargetDataModel servModel = projModel.getServerTargetDataModel(); -// ServerTargetOperation serverTargetOperation = new ServerTargetOperation(servModel); -// serverTargetOperation.doRun(monitor); - } - - protected abstract void createModuleProject(J2EEComponentCreationDataModel model, IProgressMonitor monitor) throws CoreException, InvocationTargetException, InterruptedException; - - /** - * 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(IProject project); - - protected void modifyStrategy(SaveStrategy saveStrat) { - //Default - } - - /** - * perform the archive import operation - * - * @throws java.lang.reflect.InvocationTargetException - * @throws java.lang.InterruptedException - */ - protected void importModuleFile(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException { - J2EEArtifactImportDataModel model = (J2EEArtifactImportDataModel) operationDataModel; - ModuleFile moduleFile = ((J2EEArtifactImportDataModel) operationDataModel).getModuleFile(); - try { - monitor.worked(1); - if (model.isSet(J2EEArtifactImportDataModel.SAVE_FILTER)) { - moduleFile.setSaveFilter((SaveFilter) model.getProperty(J2EEArtifactImportDataModel.SAVE_FILTER)); - } - J2EESaveStrategyImpl aStrategy = (J2EESaveStrategyImpl) createSaveStrategy(model.getJ2eeArtifactCreationDataModel().getTargetProject()); - aStrategy.setProgressMonitor(monitor); - //aStrategy.setIncludeProjectMetaFiles(model.getBooleanProperty(J2EEArtifactImportDataModel.PRESERVE_PROJECT_METADATA)); - //aStrategy.setShouldIncludeImportedClasses(!model.getBooleanProperty(J2EEArtifactImportDataModel.PRESERVE_PROJECT_METADATA)); - //aStrategy.setIsBinary(model.getBooleanProperty(J2EEArtifactImportDataModel.PRESERVE_PROJECT_METADATA)); - aStrategy.setOverwriteHandler((IOverwriteHandler) model.getProperty(J2EEArtifactImportDataModel.OVERWRITE_HANDLER)); - modifyStrategy(aStrategy); - moduleFile.save(aStrategy); - if (model.getBooleanProperty(J2EEArtifactImportDataModel.PRESERVE_PROJECT_METADATA)) { - JavaProjectUtilities.forceClasspathReload(model.getJ2eeArtifactCreationDataModel().getTargetProject()); - } - } catch (OverwriteHandlerException oe) { - throw new InterruptedException(); - } catch (Exception ex) { - throw new WFTWrappedException(ex, EJBArchiveOpsResourceHandler.getString("ERROR_IMPORTING_MODULE_FILE")); //$NON-NLS-1$ - } - } - - protected static void addToClasspath(J2EEArtifactImportDataModel importModel, List extraEntries) throws JavaModelException { - if (extraEntries.size() > 0) { - IJavaProject javaProject = JavaCore.create(importModel.getProject()); - IClasspathEntry[] javaClasspath = javaProject.getRawClasspath(); - List nonDuplicateList = new ArrayList(); - for (int i = 0; i < extraEntries.size(); i++) { - IClasspathEntry extraEntry = (IClasspathEntry) extraEntries.get(i); - boolean include = true; - for (int j = 0; include && j < javaClasspath.length; j++) { - if (extraEntry.equals(javaClasspath[j])) { - include = false; - } - } - if (include) { - nonDuplicateList.add(extraEntry); - } - } - if (nonDuplicateList.size() > 0) { - IClasspathEntry[] newJavaClasspath = new IClasspathEntry[javaClasspath.length + nonDuplicateList.size()]; - System.arraycopy(javaClasspath, 0, newJavaClasspath, 0, javaClasspath.length); - for (int j = 0; j < nonDuplicateList.size(); j++) { - newJavaClasspath[javaClasspath.length + j] = (IClasspathEntry) nonDuplicateList.get(j); - } - javaProject.setRawClasspath(newJavaClasspath, new NullProgressMonitor()); - } - } - } - - - /* - * (non-Javadoc) - * - * @see org.eclipse.wst.common.frameworks.internal.operation.WTPOperation#dispose(org.eclipse.core.runtime.IProgressMonitor) - */ - protected void dispose(IProgressMonitor pm) { - try { - getOperationDataModel().dispose(); - super.dispose(pm); - } catch (RuntimeException re) { - //Ignore - } - } -}
\ No newline at end of file diff --git a/plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/internal/archive/operations/J2EEArtifactImportOperationNew.java b/plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/internal/archive/operations/J2EEArtifactImportOperationNew.java deleted file mode 100644 index 145f31146..000000000 --- a/plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/internal/archive/operations/J2EEArtifactImportOperationNew.java +++ /dev/null @@ -1,142 +0,0 @@ -/*************************************************************************************************** - * Copyright (c) 2003, 2004 IBM Corporation and others. All rights reserved. This program and the - * accompanying materials are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: IBM Corporation - initial API and implementation - **************************************************************************************************/ -package org.eclipse.jst.j2ee.internal.archive.operations; - -import java.lang.reflect.InvocationTargetException; -import java.util.ArrayList; -import java.util.List; - -import org.eclipse.core.commands.ExecutionException; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IAdaptable; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.NullProgressMonitor; -import org.eclipse.jdt.core.IClasspathEntry; -import org.eclipse.jdt.core.IJavaProject; -import org.eclipse.jdt.core.JavaCore; -import org.eclipse.jdt.core.JavaModelException; -import org.eclipse.jst.j2ee.application.internal.operations.J2EEArtifactImportDataModel; -import org.eclipse.jst.j2ee.commonarchivecore.internal.ModuleFile; -import org.eclipse.jst.j2ee.commonarchivecore.internal.strategy.SaveStrategy; -import org.eclipse.jst.j2ee.datamodel.properties.IJ2EEComponentImportDataModelProperties; -import org.eclipse.wst.common.componentcore.datamodel.properties.IComponentCreationDataModelProperties; -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 J2EEArtifactImportOperationNew extends AbstractDataModelOperation { - - protected ModuleFile moduleFile; - protected IVirtualComponent virtualComponent; - protected IAdaptable info; - - public J2EEArtifactImportOperationNew(IDataModel model) { - super(model); - } - - public IStatus execute(IProgressMonitor monitor, IAdaptable info) throws ExecutionException { - try { - this.info = info; - doExecute(monitor); - return OK_STATUS; - } finally { - model.dispose(); - } - } - - protected void doExecute(IProgressMonitor monitor) throws ExecutionException { - moduleFile = (ModuleFile) model.getProperty(IJ2EEComponentImportDataModelProperties.FILE); - monitor.beginTask(null, moduleFile.getFiles().size()); - - virtualComponent = createVirtualComponent(model.getNestedModel(IJ2EEComponentImportDataModelProperties.NESTED_MODEL_J2EE_COMPONENT_CREATION), monitor); - - try { - importModuleFile(monitor); - } catch (InvocationTargetException e) { - throw new ExecutionException(e.getMessage(), e); - } catch (InterruptedException e) { - throw new ExecutionException(e.getMessage(), e); - } - } - - protected IVirtualComponent createVirtualComponent(IDataModel model, IProgressMonitor monitor) throws ExecutionException { - model.getDefaultOperation().execute(monitor, info); - return (IVirtualComponent) model.getProperty(IComponentCreationDataModelProperties.COMPONENT); - } - - /** - * 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 virtualComponent); - - protected void modifyStrategy(SaveStrategy saveStrat) { - } - - /** - * perform the archive import operation - * - * @throws java.lang.reflect.InvocationTargetException - * @throws java.lang.InterruptedException - */ - protected void importModuleFile(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException { - try { - monitor.worked(1); - FlexibleJ2EESaveStrategyImpl aStrategy = (FlexibleJ2EESaveStrategyImpl) createSaveStrategy(virtualComponent); - aStrategy.setProgressMonitor(monitor); - aStrategy.setOverwriteHandler((IOverwriteHandler) model.getProperty(IJ2EEComponentImportDataModelProperties.OVERWRITE_HANDLER)); - modifyStrategy(aStrategy); - moduleFile.save(aStrategy); - } catch (OverwriteHandlerException oe) { - throw new InterruptedException(); - } catch (Exception ex) { - throw new WFTWrappedException(ex, EJBArchiveOpsResourceHandler.getString("ERROR_IMPORTING_MODULE_FILE")); //$NON-NLS-1$ - } - } - - protected static void addToClasspath(J2EEArtifactImportDataModel importModel, List extraEntries) throws JavaModelException { - if (extraEntries.size() > 0) { - IJavaProject javaProject = JavaCore.create(importModel.getProject()); - IClasspathEntry[] javaClasspath = javaProject.getRawClasspath(); - List nonDuplicateList = new ArrayList(); - for (int i = 0; i < extraEntries.size(); i++) { - IClasspathEntry extraEntry = (IClasspathEntry) extraEntries.get(i); - boolean include = true; - for (int j = 0; include && j < javaClasspath.length; j++) { - if (extraEntry.equals(javaClasspath[j])) { - include = false; - } - } - if (include) { - nonDuplicateList.add(extraEntry); - } - } - if (nonDuplicateList.size() > 0) { - IClasspathEntry[] newJavaClasspath = new IClasspathEntry[javaClasspath.length + nonDuplicateList.size()]; - System.arraycopy(javaClasspath, 0, newJavaClasspath, 0, javaClasspath.length); - for (int j = 0; j < nonDuplicateList.size(); j++) { - newJavaClasspath[javaClasspath.length + j] = (IClasspathEntry) nonDuplicateList.get(j); - } - javaProject.setRawClasspath(newJavaClasspath, new NullProgressMonitor()); - } - } - } - - public IStatus redo(IProgressMonitor monitor, IAdaptable info) throws ExecutionException { - return null; - } - - public IStatus undo(IProgressMonitor monitor, IAdaptable info) throws ExecutionException { - return null; - } - - -}
\ No newline at end of file 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/J2EELoadStrategy.java b/plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/internal/archive/operations/J2EELoadStrategy.java deleted file mode 100644 index 314ee1f99..000000000 --- a/plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/internal/archive/operations/J2EELoadStrategy.java +++ /dev/null @@ -1,23 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2003, 2004 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.j2ee.internal.archive.operations; - -import org.eclipse.jst.j2ee.commonarchivecore.internal.strategy.LoadStrategy; - - - -/** - * Insert the type's description here. Creation date: (5/10/2001 3:53:38 PM) - * - * @author: Administrator - */ -public interface J2EELoadStrategy extends LoadStrategy { -}
\ No newline at end of file diff --git a/plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/internal/archive/operations/J2EELoadStrategyImpl.java b/plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/internal/archive/operations/J2EELoadStrategyImpl.java deleted file mode 100644 index 83eda0ad1..000000000 --- a/plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/internal/archive/operations/J2EELoadStrategyImpl.java +++ /dev/null @@ -1,393 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2003, 2004 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.j2ee.internal.archive.operations; - - - -import java.io.FileNotFoundException; -import java.io.IOException; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.HashSet; -import java.util.Iterator; -import java.util.List; -import java.util.Set; - -import org.eclipse.core.internal.resources.ProjectDescription; -import org.eclipse.core.resources.IContainer; -import org.eclipse.core.resources.IFolder; -import org.eclipse.core.resources.IProject; -import org.eclipse.core.resources.IResource; -import org.eclipse.core.runtime.IPath; -import org.eclipse.emf.common.util.URI; -import org.eclipse.emf.ecore.resource.URIConverter; -import org.eclipse.emf.ecore.resource.Resource.Factory.Registry; -import org.eclipse.jem.util.emf.workbench.JavaProjectUtilities; -import org.eclipse.jem.util.emf.workbench.WorkbenchURIConverter; -import org.eclipse.jem.util.emf.workbench.WorkbenchURIConverterImpl; -import org.eclipse.jst.j2ee.commonarchivecore.internal.File; -import org.eclipse.jst.j2ee.commonarchivecore.internal.exception.ArchiveRuntimeException; -import org.eclipse.jst.j2ee.commonarchivecore.internal.exception.SaveFailureException; -import org.eclipse.jst.j2ee.commonarchivecore.internal.strategy.LoadStrategyImpl; -import org.eclipse.jst.j2ee.commonarchivecore.internal.util.ArchiveUtil; -import org.eclipse.jst.j2ee.internal.common.impl.J2EEResourceFactoryRegistry; -import org.eclipse.wst.common.internal.emfworkbench.WorkbenchResourceHelper; - -/** - * Insert the type's description here. Creation date: (5/10/2001 3:54:51 PM) - * - * @author: Administrator - */ -public abstract class J2EELoadStrategyImpl extends LoadStrategyImpl implements IJ2EEImportExportConstants { - protected IProject project; - protected ArrayList filesList; - //This one is used for the dot files in the project - protected WorkbenchURIConverter projectMetaURIConverter; - protected WorkbenchURIConverter projectURIConverter; - protected Set visitedURIs; - private boolean exportSource = false; - private boolean includeProjectMetaFiles = false; - protected List sourceFolders; - - /** - * J2EELoadStrategyImpl constructor comment. - */ - public J2EELoadStrategyImpl() { - super(); - } - - /** - * @see com.ibm.etools.archive.LoadStrategy - */ - public boolean contains(String uri) { - - if (projectURIConverter == null) - getProjectURIConverter(); - return projectURIConverter.getFile(uri).exists(); - - } - - /* should never get called outside of runtime */ - protected boolean primContains(String uri) { - return false; - } - - protected long getLastModified(IResource aResource) { - return aResource.getLocation().toFile().lastModified(); - } - - /** - * @see com.ibm.etools.archive.LoadStrategy - */ - public java.util.List getFiles() { - - filesList.clear(); - try { - - List projMembers = Arrays.asList(project.members()); - List exopProjMembers = new ArrayList(); - Iterator iterator = projMembers.iterator(); - while (iterator.hasNext()) { - exopProjMembers.add(iterator.next()); - } - - filesList = getFiles(exopProjMembers); - - } catch (Exception exc) { - throw new ArchiveRuntimeException(EJBArchiveOpsResourceHandler.getString("ARCHIVE_OPERATION_FilesFromProject"), exc); //$NON-NLS-1$ - //$NON-NLS-1$ - } - return filesList; - } - - protected java.util.ArrayList getFiles(List projectResources) throws Exception { - if (projectResources.isEmpty()) { - return filesList; - } - - IContainer outputFolder = JavaProjectUtilities.getJavaProjectOutputContainer(getProject()); - - Iterator iterator = projectResources.iterator(); - while (iterator.hasNext()) { - File cFile = null; - IResource res = (IResource) (iterator.next()); - if ((res.getType() == IResource.FILE)) { - - //We have to avoid duplicates between the source and output folders (non-java - // resources) - IPath path = getOutputPathForFile(res.getProjectRelativePath()); - String uri = path == null ? null : path.toString(); - - //Avoid adding files in source folder which are not in output folder. - //unless they are .java or .sqlj (source) - if (outputFolder != null && !outputFolder.exists(path)) { - if (uri != null && !isSource(uri) && !uri.equals(ProjectDescription.DESCRIPTION_FILE_NAME) && !uri.equals(".classpath")) //$NON-NLS-1$ - continue; - } - - if (uri == null) - continue; - if (!shouldInclude(uri)) //$NON-NLS-1$ - continue; - if (getVisitedURIs().contains(uri)) - continue; - cFile = createFile(uri); - cFile.setLastModified(getLastModified(res)); - getVisitedURIs().add(uri); - filesList.add(cFile); - } else { - if (shouldInclude((IContainer) res)) - getFiles(Arrays.asList(((IContainer) res).members())); - } - } - return filesList; - } - - protected boolean isSource(String uri) { - if (uri == null) - return false; - return uri.endsWith(ArchiveUtil.DOT_JAVA) || uri.endsWith(ArchiveUtil.DOT_SQLJ);// || - // uri.equals(ProjectDescription.DESCRIPTION_FILE_NAME) - // || - // uri.equals(".classpath"); - } - - protected boolean shouldInclude(IContainer iContainer) { - return true; - } - - protected boolean shouldInclude(String uri) { - return isExportSource() || !isSource(uri); - } - - /** - * @see com.ibm.etools.archive.LoadStrategy - */ - public java.io.InputStream getInputStream(String uri) throws IOException, FileNotFoundException { - - try { - if (projectURIConverter == null) - getProjectURIConverter(); - if (isProjectMetaFile(uri)) - return getProjectMetaURIConverter().createInputStream(URI.createURI(uri)); - return projectURIConverter.createInputStream(URI.createURI(uri)); - } catch (IOException e) { - throw e; - } catch (Exception e) { - throw new ArchiveRuntimeException(e); - } - } - - protected boolean isProjectMetaFile(String uri) { - return PROJECT_FILE_URI.equals(uri) || CLASSPATH_FILE_URI.equals(uri); - } - - public abstract IContainer getModuleContainer(); - - protected IPath getOutputPathForFile(IPath aPath) throws Exception { - if (isProjectMetaFile(aPath.toString())) { - if (includeProjectMetaFiles) - return aPath; - return null; - } - IContainer moduleContainer = getModuleContainer(); - IPath moduleContainerPath = moduleContainer.getProjectRelativePath(); - //check if the file is an output folder file - if (aPath.segmentCount() > moduleContainerPath.segmentCount() && aPath.removeLastSegments(aPath.segmentCount() - moduleContainerPath.segmentCount()).equals(moduleContainerPath)) { - IPath tempPath = aPath.removeFirstSegments(moduleContainerPath.segmentCount()); - if (moduleContainer.exists(tempPath)) { - return tempPath; - } - } - //if this file is in a source folder, find the source folder - //and remove the source folder portion from the path - List lSourceFolders = getSourceFolders(); - for (int i = 0; i < lSourceFolders.size(); i++) { - IPath folderPath = ((IFolder) lSourceFolders.get(i)).getProjectRelativePath(); - if (aPath.segmentCount() > folderPath.segmentCount() && aPath.removeLastSegments(aPath.segmentCount() - folderPath.segmentCount()).equals(folderPath)) { - return aPath.removeFirstSegments(folderPath.segmentCount()); - } - } - return null; - } - - // int charIndex = 0; - - // ArrayList tokens = new ArrayList(); - // String pathString = aPath.toString(); - // - // for (int i = 0; i < pathString.length(); i++) { - // if (pathString.charAt(i) == '/') { - // tokens.add(pathString.substring(charIndex, i)); - // charIndex = ++i; - // } - // } - - // int indexOfModule = -1; - // IContainer outputFolder = ProjectUtilities.getJavaProjectOutputContainer(getProject()); - // check if file is an output folder file - - // if (tokens.contains(getModuleFolderName())) { - // indexOfModule = tokens.indexOf(getModuleFolderName()); - // // make sure the path exists, if not, we should check source folders - // if (!outputFolder.exists(aPath.removeFirstSegments(indexOfModule + 1))) - // indexOfModule = -1; - // } - // check if file is a source folder file - // if (indexOfModule == -1) { - // List localSourceFolders = getSourceFoldersNames(); - // if (localSourceFolders != null) { - // for (int j = 0; j < localSourceFolders.size(); j++) { - // if (!tokens.isEmpty()) { - // if (((String) tokens.get(0)).equals(localSourceFolders.get(j))) { - // indexOfModule = tokens.indexOf(localSourceFolders.get(j)); - // break; - // } - // continue; - // } - // } - // } - // } - // if (indexOfModule > -1) - // return aPath.removeFirstSegments(indexOfModule + 1); - // return null; - // } - /** - * Insert the method's description here. Creation date: (7/19/2001 3:58:31 PM) - * - * @return org.eclipse.core.resources.IProject - */ - public org.eclipse.core.resources.IProject getProject() { - return project; - } - - public abstract WorkbenchURIConverter getProjectURIConverter(); - - public String getSourceFolderName() throws Exception { - try { - return JavaProjectUtilities.getSourceFolderOrFirst(project, null).getName(); - } catch (Exception e) { - throw new SaveFailureException(EJBArchiveOpsResourceHandler.getString("ARCHIVE_OPERATION_ProjectNature"), e);//$NON-NLS-1$ - } - - } - - public List getSourceFoldersNames() throws Exception { - try { - List sourceFolderNames = new ArrayList(); - List localSourceFolders = getSourceFolders(); - for (int i = 0; i < localSourceFolders.size(); i++) { - sourceFolderNames.add(((org.eclipse.core.resources.IFolder) localSourceFolders.get(i)).getName()); - } - return sourceFolderNames; - - } catch (Exception e) { - throw new SaveFailureException(EJBArchiveOpsResourceHandler.getString("ARCHIVE_OPERATION_ProjectNature"), e); //$NON-NLS-1$ - } - } - - - protected List getSourceFolders() { - if (sourceFolders == null) { - sourceFolders = JavaProjectUtilities.getSourceContainers(project); - } - return sourceFolders; - } - - public Set getVisitedURIs() { - if (visitedURIs == null) - visitedURIs = new HashSet(); - return visitedURIs; - } - - public boolean isClassLoaderNeeded() { - return false; - } - - /** - * Insert the method's description here. Creation date: (4/19/2001 6:07:54 PM) - * - * @return boolean - */ - public boolean isExportSource() { - return exportSource; - } - - /** - * Insert the method's description here. Creation date: (4/19/2001 6:07:54 PM) - * - * @param newExportSource - * boolean - */ - public void setExportSource(boolean newExportSource) { - exportSource = newExportSource; - } - - /** - * Returns the includeProjectMetaFiles. - * - * @return boolean - */ - public boolean shouldIncludeProjectMetaFiles() { - return includeProjectMetaFiles; - } - - - /** - * Sets the includeProjectMetaFiles. - * - * @param includeProjectMetaFiles - * The includeProjectMetaFiles to set - */ - public void setIncludeProjectMetaFiles(boolean includeProjectMetaFiles) { - this.includeProjectMetaFiles = includeProjectMetaFiles; - } - - protected URIConverter getProjectMetaURIConverter() { - if (projectMetaURIConverter == null) - projectMetaURIConverter = new WorkbenchURIConverterImpl(getProject()); - return projectMetaURIConverter; - } - - /* - * (non-Javadoc) - * - * @see com.ibm.etools.archive.impl.LoadStrategyImpl#requiresIterationOnSave() - */ - public boolean requiresIterationOnSave() { - return true; - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.jst.j2ee.internal.internal.commonarchivecore.strategy.LoadStrategyImpl#initializeResourceSet() - */ - protected void initializeResourceSet() { - resourceSet = WorkbenchResourceHelper.getResourceSet(project); - } - - /* - * Overrode from super to bypass SAX - */ - protected Registry createResourceFactoryRegistry() { - return new J2EEResourceFactoryRegistry(); - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.jst.j2ee.internal.internal.commonarchivecore.strategy.LoadStrategyImpl#getAbsolutePath() - */ - public String getAbsolutePath() throws FileNotFoundException { - return project.getLocation().toOSString(); - } -}
\ No newline at end of file diff --git a/plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/internal/archive/operations/J2EESaveStrategyImpl.java b/plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/internal/archive/operations/J2EESaveStrategyImpl.java deleted file mode 100644 index a2d3c5713..000000000 --- a/plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/internal/archive/operations/J2EESaveStrategyImpl.java +++ /dev/null @@ -1,297 +0,0 @@ -/*************************************************************************************************** - * Copyright (c) 2003, 2004 IBM Corporation and others. All rights reserved. This program and the - * accompanying materials are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: IBM Corporation - initial API and implementation - **************************************************************************************************/ -package org.eclipse.jst.j2ee.internal.archive.operations; - - -import java.io.IOException; -import java.io.OutputStream; -import java.util.Collections; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import org.eclipse.core.resources.IFile; -import org.eclipse.core.resources.IFolder; -import org.eclipse.core.resources.IProject; -import org.eclipse.core.resources.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.emf.common.util.URI; -import org.eclipse.emf.ecore.resource.Resource; -import org.eclipse.jdt.core.JavaCore; -import org.eclipse.jem.util.emf.workbench.JavaProjectUtilities; -import org.eclipse.jem.util.emf.workbench.ProjectUtilities; -import org.eclipse.jem.util.emf.workbench.WorkbenchByteArrayOutputStream; -import org.eclipse.jem.util.emf.workbench.WorkbenchURIConverter; -import org.eclipse.jem.util.emf.workbench.WorkbenchURIConverterImpl; -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.ArchiveConstants; -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.jst.j2ee.commonarchivecore.internal.strategy.ZipStreamSaveStrategyImpl; -import org.eclipse.jst.j2ee.commonarchivecore.internal.util.ArchiveUtil; -import org.eclipse.jst.j2ee.internal.plugin.J2EEPlugin; -import org.eclipse.jst.j2ee.internal.plugin.LibCopyBuilder; -import org.eclipse.jst.j2ee.internal.project.J2EENature; -import org.eclipse.jst.j2ee.internal.project.J2EEProjectUtilities; - -public abstract class J2EESaveStrategyImpl extends SaveStrategyImpl implements IJ2EEImportExportConstants { - protected WorkbenchURIConverter sourceURIConverter; - // This one is used for the imported_classes - protected WorkbenchURIConverter importedClassesURIConverter; - protected IProject project; - protected IOverwriteHandler overwriteHandler; - protected IProgressMonitor progressMonitor; - // protected boolean includeProjectMetaFiles = false; - protected Map importedClassFiles; - // protected boolean shouldIncludeImportedClasses; - protected List mofResourceURIList; - - public J2EESaveStrategyImpl(IProject p) { - super(); - project = p; - } - - protected SaveStrategy createNestedSaveStrategy(Archive anArchive) throws java.io.IOException { - try { - OutputStream out = getSourceURIConverter().createOutputStream(URI.createURI(anArchive.getURI())); - return new ZipStreamSaveStrategyImpl(out); - } catch (Exception ex) { - throw new IOException(ex.getLocalizedMessage()); - } - } - - public boolean endsWithClassType(String aFileName) { - if (aFileName.endsWith(".class")) //$NON-NLS-1$ - return true; - return false; - } - - protected boolean shouldSaveClass(String aFileName) { - return importedClassFiles != null && importedClassFiles.containsKey(aFileName); - } - - protected OutputStream getOutputStreamForResource(Resource aResource) throws java.io.IOException { - // this method has no references in the hirarchy - return null; - } - - public IOverwriteHandler getOverwriteHandler() { - return overwriteHandler; - } - - public IProgressMonitor getProgressMonitor() { - return progressMonitor; - } - - public IProject getProject() { - return project; - } - - public abstract WorkbenchURIConverter getSourceURIConverter(); - - public void save(ArchiveManifest aManifest) throws SaveFailureException { - try { - J2EENature nature = J2EENature.getRegisteredRuntime(project); - if (nature == null) - throw new SaveFailureException(EJBArchiveOpsResourceHandler.getString("ARCHIVE_OPERATION_SaveManifest")); //$NON-NLS-1$ - WorkbenchURIConverter conv = (WorkbenchURIConverter) nature.getResourceSet().getURIConverter(); - IFile iFile = conv.getOutputFileWithMappingApplied(ArchiveConstants.MANIFEST_URI); - validateEdit(iFile); - OutputStream out = new WorkbenchByteArrayOutputStream(iFile); - aManifest.write(out); - out.close(); - } catch (IOException ioe) { - throw new SaveFailureException(EJBArchiveOpsResourceHandler.getString("ARCHIVE_OPERATION_SaveManifest"), ioe); //$NON-NLS-1$ - } - } - - public void save(File aFile, java.io.InputStream in) throws SaveFailureException { - try { - String displayString = EJBArchiveOpsResourceHandler.getString("IMPORT_OPERATION_STRING"); //$NON-NLS-1$ - progressMonitor.subTask(displayString + aFile.getURI()); - WorkbenchURIConverter conv = null; - if (endsWithClassType(aFile.getURI())) - conv = importedClassesURIConverter; - else - conv = getSourceURIConverter(); - - IFile iFile = conv.getOutputFileWithMappingApplied(aFile.getURI()); - validateEdit(iFile); - mkdirs(iFile.getFullPath(), ResourcesPlugin.getWorkspace().getRoot()); - if (iFile.exists()) - iFile.setContents(in, true, true, null); - else - iFile.create(in, true, null); - // OutputStream out = new WorkbenchByteArrayOutputStream(iFile); - // ArchiveUtil.copy(in, out); - // worked(1); - } catch (OverwriteHandlerException ohe) { - throw ohe; - } catch (Exception e) { - String errorString = EJBArchiveOpsResourceHandler.getString("ARCHIVE_OPERATION_SaveFile") + aFile.getName(); //$NON-NLS-1$ - throw new SaveFailureException(errorString, e); - } - - } - - protected void mkdirs(IPath newPath, IWorkspaceRoot root) throws CoreException { - if (newPath.segmentCount() <= 2) - return; - IPath parentPath = newPath.removeLastSegments(1); - IFolder folder = root.getFolder(parentPath); - if (!folder.exists()) { - mkdirs(parentPath, root); - folder.create(true, true, null); - } - } - - protected void validateEdit(IFile aFile) { - if (overwriteHandler == null) - return; - if (!(aFile.exists() && aFile.isReadOnly())) - return; - - overwriteHandler.validateEdit(aFile); - } - - public void saveMofResource(Resource aResource) throws SaveFailureException { - setEncoding(aResource); - try { - String displayString = EJBArchiveOpsResourceHandler.getString("IMPORT_MOFRESOURCE_STRING"); //$NON-NLS-1$ - progressMonitor.subTask(displayString); - IFile iFile = getSourceURIConverter().getOutputFileWithMappingApplied(aResource.getURI().toString()); - validateEdit(iFile); - OutputStream out = new WorkbenchByteArrayOutputStream(iFile); - aResource.save(out, Collections.EMPTY_MAP); - out.close(); - worked(1); - } catch (OverwriteHandlerException ohe) { - throw ohe; - } catch (Exception e) { - String errorString = EJBArchiveOpsResourceHandler.getString("ARCHIVE_OPERATION_SaveMofResources") + aResource.getURI().toString(); //$NON-NLS-1$ - throw new SaveFailureException(errorString, e); - } - } - - public void setOverwriteHandler(IOverwriteHandler newOverwriteHandler) { - overwriteHandler = newOverwriteHandler; - } - - public void setProgressMonitor(IProgressMonitor newProgressMonitor) { - progressMonitor = newProgressMonitor; - } - - public void setProject(IProject newProject) { - project = newProject; - } - - protected boolean shouldOverwrite(String uri) { - if (overwriteHandler.isOverwriteNone()) - return false; - return (overwriteHandler.isOverwriteResources() || overwriteHandler.isOverwriteAll() || overwriteHandler.shouldOverwrite(uri)); - } - - protected boolean shouldSave(String uri) { - if (endsWithClassType(uri) && !shouldSaveClass(uri)) - return false; - if (ArchiveConstants.MANIFEST_URI.equals(uri) && !shouldReplaceManifest()) - return false; - - if (overwriteHandler != null) { - return (super.shouldSave(uri) && shouldOverwrite(uri)); - } - return super.shouldSave(uri); - } - - /** - * @return - */ - private boolean shouldReplaceManifest() { - ArchiveManifest mf = J2EEProjectUtilities.readManifest(getProject()); - if (mf == null) - return true; - String cp = mf.getClassPath(); - return cp != null && cp.trim().length() <= 0; - } - - /** - * Set the number of units worked with the ProgressMonitor. - */ - public void worked(int units) { - if (getProgressMonitor() != null) - getProgressMonitor().worked(units); - } - - - public IFile getSaveFile(String aURI) { - return sourceURIConverter.getFile(aURI); - } - - /** - * Import class files into the project. - */ - protected void setImportedClassFilesIfNecessary() throws SaveFailureException { - Map classFiles = getClassFilesWithoutSource(); - - if (classFiles == null || classFiles.isEmpty()) - return; - - importedClassFiles = classFiles; - /* - * Add the imported classes folder to the build path. - */ - IFolder classesFolder = getProject().getFolder(LibCopyBuilder.IMPORTED_CLASSES_PATH); - try { - if (!classesFolder.exists()) { - classesFolder.create(true, true, new NullProgressMonitor()); - } - - JavaProjectUtilities.appendJavaClassPath(getProject(), JavaCore.newLibraryEntry(classesFolder.getFullPath(), null, null, true)); - // In case this is a Java project, or a non-migrated 4.0 project, - // add the builder - // that's a no-op if the builder is already added - ProjectUtilities.addToBuildSpec(J2EEPlugin.LIBCOPY_BUILDER_ID, getProject()); - } catch (CoreException ex) { - throw new SaveFailureException(ex); - } - importedClassesURIConverter = new WorkbenchURIConverterImpl(classesFolder); - importedClassesURIConverter.setForceSaveRelative(true); - } - - protected Map getClassFilesWithoutSource() { - List files = archive.getFiles(); - Map result = new HashMap(); - for (int i = 0; i < files.size(); i++) { - File aFile = (File) files.get(i); - if (isClassWithoutSource(aFile)) - result.put(aFile.getURI(), aFile); - } - return result; - } - - protected boolean isClassWithoutSource(File aFile) { - String javaUri = ArchiveUtil.classUriToJavaUri(aFile.getURI()); - if (javaUri == null) - return false; - return !archive.containsFile(javaUri); - } - - protected void saveFiles() throws SaveFailureException { - setImportedClassFilesIfNecessary(); - super.saveFiles(); - } - -}
\ No newline at end of file diff --git a/plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/internal/archive/operations/JavaComponentCreationDataModel.java b/plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/internal/archive/operations/JavaComponentCreationDataModel.java deleted file mode 100644 index 9e7d6c7ca..000000000 --- a/plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/internal/archive/operations/JavaComponentCreationDataModel.java +++ /dev/null @@ -1,99 +0,0 @@ -package org.eclipse.jst.j2ee.internal.archive.operations; - -import java.util.List; - -import org.eclipse.emf.ecore.EClass; -import org.eclipse.jst.j2ee.application.internal.operations.JavaUtilityComponentCreationOperation; -import org.eclipse.jst.j2ee.commonarchivecore.internal.CommonarchivePackage; -import org.eclipse.jst.j2ee.internal.J2EEConstants; -import org.eclipse.wst.common.componentcore.internal.operation.ComponentCreationDataModel; -import org.eclipse.wst.common.componentcore.internal.util.IModuleConstants; -import org.eclipse.wst.common.frameworks.internal.operations.WTPOperation; -import org.eclipse.wst.common.frameworks.internal.operations.WTPPropertyDescriptor; - -public class JavaComponentCreationDataModel extends ComponentCreationDataModel { - - /** - * type String - */ - public static final String JAVASOURCE_FOLDER = "J2EEComponentCreationDataModel.JAVASOURCE_FOLDER"; - /** - * type String - */ - public static final String MANIFEST_FOLDER = "J2EEComponentCreationDataModel.MANIFEST_FOLDER"; - - - protected void initValidBaseProperties() { - super.initValidBaseProperties(); - addValidBaseProperty(JAVASOURCE_FOLDER); - addValidBaseProperty(MANIFEST_FOLDER); - } - - - public JavaComponentCreationDataModel() { - super(); - } - - protected EClass getComponentType() { - return CommonarchivePackage.eINSTANCE.getModuleFile(); - } - - protected Integer getDefaultComponentVersion() { - // TODO Auto-generated method stub - return null; - } - - /* (non-Javadoc) - * @see org.eclipse.jst.j2ee.application.operations.FlexibleJ2EECreationDataModel#getModuleID() - */ - protected String getComponentID() { - return IModuleConstants.JST_UTILITY_MODULE; - } - - public WTPOperation getDefaultOperation() { - return new JavaUtilityComponentCreationOperation(this); - } - - protected String getComponentExtension() { - return ".jar"; //$NON-NLS-1$ - } - - /* (non-Javadoc) - * @see org.eclipse.wst.common.modulecore.internal.operation.ComponentCreationDataModel#getValidComponentVersionDescriptors() - */ - protected WTPPropertyDescriptor[] getValidComponentVersionDescriptors() { - // TODO Auto-generated method stub - return null; - } - - /* (non-Javadoc) - * @see org.eclipse.wst.common.modulecore.internal.operation.ComponentCreationDataModel#getVersion() - */ - protected String getVersion() { - // TODO Auto-generated method stub - return null; - } - - /* (non-Javadoc) - * @see org.eclipse.wst.common.modulecore.internal.operation.ComponentCreationDataModel#getProperties() - */ - protected List getProperties() { - // TODO Auto-generated method stub - return null; - } - public String getJavaSourceFolder() { - return getStringProperty(JAVASOURCE_FOLDER); - } - public String getManifestFolder() { - return getStringProperty(MANIFEST_FOLDER); - } - - protected Object getDefaultProperty(String propertyName) { - if (propertyName.equals(JAVASOURCE_FOLDER)) { - return getComponentName(); - }else if (propertyName.equals(MANIFEST_FOLDER)) { - return getComponentName() + "/" + J2EEConstants.META_INF; //$NON-NLS-1$ - } - return super.getDefaultProperty(propertyName); - } -} diff --git a/plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/internal/archive/operations/JavaComponentCreationDataModelProvider.java b/plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/internal/archive/operations/JavaComponentCreationDataModelProvider.java deleted file mode 100644 index d0b8dcbea..000000000 --- a/plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/internal/archive/operations/JavaComponentCreationDataModelProvider.java +++ /dev/null @@ -1,133 +0,0 @@ -/*************************************************************************************************** - * Copyright (c) 2003, 2004 IBM Corporation and others. All rights reserved. This program and the - * accompanying materials are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: IBM Corporation - initial API and implementation - **************************************************************************************************/ -package org.eclipse.jst.j2ee.internal.archive.operations; - -import java.util.List; - -import org.eclipse.core.runtime.IStatus; -import org.eclipse.emf.ecore.EClass; -import org.eclipse.jst.j2ee.application.internal.operations.FlexibleJavaProjectCreationDataModelProvider; -import org.eclipse.jst.j2ee.application.internal.operations.JavaUtilityComponentCreationOperationEx; -import org.eclipse.jst.j2ee.commonarchivecore.internal.CommonarchivePackage; -import org.eclipse.jst.j2ee.datamodel.properties.IJavaComponentCreationDataModelProperties; -import org.eclipse.jst.j2ee.internal.J2EEConstants; -import org.eclipse.jst.j2ee.project.datamodel.properties.IFlexibleJavaProjectCreationDataModelProperties; -import org.eclipse.wst.common.componentcore.internal.operation.ComponentCreationDataModelProvider; -import org.eclipse.wst.common.componentcore.internal.util.IModuleConstants; -import org.eclipse.wst.common.frameworks.datamodel.DataModelFactory; -import org.eclipse.wst.common.frameworks.datamodel.DataModelPropertyDescriptor; -import org.eclipse.wst.common.frameworks.datamodel.IDataModel; -import org.eclipse.wst.common.frameworks.datamodel.IDataModelOperation; -import org.eclipse.wst.common.frameworks.datamodel.properties.IFlexibleProjectCreationDataModelProperties; -import org.eclipse.wst.common.frameworks.internal.plugin.WTPCommonMessages; -import org.eclipse.wst.common.frameworks.internal.plugin.WTPCommonPlugin; - -public class JavaComponentCreationDataModelProvider extends ComponentCreationDataModelProvider implements IJavaComponentCreationDataModelProperties { - - - public String[] getPropertyNames() { - String[] props = new String[]{JAVASOURCE_FOLDER, MANIFEST_FOLDER, SERVER_TARGET_ID}; - return combineProperties(super.getPropertyNames(), props); - } - - public Object getDefaultProperty(String propertyName) { - if (propertyName.equals(JAVASOURCE_FOLDER)) { - return getComponentName(); - }else if (propertyName.equals(MANIFEST_FOLDER)) { - return getComponentName() + "/" + J2EEConstants.META_INF; //$NON-NLS-1$ - } - return super.getDefaultProperty(propertyName); - } - - public void init() { - super.init(); - } - - public boolean propertySet(String propertyName, Object propertyValue) { - boolean status = super.propertySet(propertyName, propertyValue); - if (PROJECT_NAME.equals(propertyName)) { - IDataModel dm = (IDataModel)model.getNestedModel(NESTED_PROJECT_CREATION_DM); - dm.setProperty(IFlexibleProjectCreationDataModelProperties.PROJECT_NAME, propertyValue); - } else if(LOCATION.equals(propertyName)) { - IDataModel dm = (IDataModel)model.getNestedModel(NESTED_PROJECT_CREATION_DM); - dm.setProperty(IFlexibleProjectCreationDataModelProperties.PROJECT_LOCATION, propertyValue); - } else if(SERVER_TARGET_ID.equals(propertyName)) { - IDataModel dm = (IDataModel)model.getNestedModel(NESTED_PROJECT_CREATION_DM); - dm.setProperty(IFlexibleJavaProjectCreationDataModelProperties.SERVER_TARGET_ID, propertyValue); - } - return status; - } - - public IStatus validate(String propertyName) { - if (propertyName.equals(JAVASOURCE_FOLDER)) { - IStatus status = OK_STATUS; - String srcFolderName = model.getStringProperty(JAVASOURCE_FOLDER); - if (srcFolderName == null || srcFolderName.length()==0) { - String errorMessage = WTPCommonPlugin.getResourceString(WTPCommonMessages.PROJECT_NAME_EMPTY); - status = WTPCommonPlugin.createErrorStatus(errorMessage); - } - return status; - - } else if (propertyName.equals(MANIFEST_FOLDER)) { - IStatus status = OK_STATUS; - String srcFolderName = model.getStringProperty(MANIFEST_FOLDER); - if (srcFolderName == null || srcFolderName.length()==0) { - String errorMessage = WTPCommonPlugin.getResourceString(WTPCommonMessages.PROJECT_NAME_EMPTY); - status = WTPCommonPlugin.createErrorStatus(errorMessage); - } - return status; - } - return super.validate(propertyName); - } - - public JavaComponentCreationDataModelProvider() { - super(); - } - - protected EClass getComponentType() { - return CommonarchivePackage.eINSTANCE.getModuleFile(); - } - - protected Integer getDefaultComponentVersion() { - Integer version = new Integer("10"); - return version; - } - - protected String getComponentID() { - return IModuleConstants.JST_UTILITY_MODULE; - } - - protected String getComponentExtension() { - return ".jar"; //$NON-NLS-1$ - } - - protected List getProperties() { - return null; - } - - public IDataModelOperation getDefaultOperation() { - return new JavaUtilityComponentCreationOperationEx(model); - } - - protected void initProjectCreationModel() { - IDataModel dm = DataModelFactory.createDataModel(new FlexibleJavaProjectCreationDataModelProvider()); - model.addNestedModel(NESTED_PROJECT_CREATION_DM, dm); - model.setProperty(LOCATION, dm.getProperty(IFlexibleProjectCreationDataModelProperties.PROJECT_LOCATION)); - - } - - public DataModelPropertyDescriptor[] getValidPropertyDescriptors(String propertyName) { - if (propertyName.equals(SERVER_TARGET_ID)) { - IDataModel projectdm = (IDataModel)model.getNestedModel(NESTED_PROJECT_CREATION_DM); - return projectdm.getValidPropertyDescriptors(IFlexibleJavaProjectCreationDataModelProperties.SERVER_TARGET_ID); - } - return null; - } - -} diff --git a/plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/internal/archive/operations/JavaProjectLoadStrategyImpl.java b/plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/internal/archive/operations/JavaProjectLoadStrategyImpl.java deleted file mode 100644 index aad321800..000000000 --- a/plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/internal/archive/operations/JavaProjectLoadStrategyImpl.java +++ /dev/null @@ -1,143 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2003, 2004 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.j2ee.internal.archive.operations; - - - -import java.util.ArrayList; -import java.util.List; - -import org.eclipse.core.resources.IContainer; -import org.eclipse.core.resources.IProject; -import org.eclipse.core.runtime.IPath; -import org.eclipse.jdt.core.IJavaProject; -import org.eclipse.jdt.internal.core.JavaModel; -import org.eclipse.jem.util.emf.workbench.JavaProjectUtilities; -import org.eclipse.jem.util.emf.workbench.WorkbenchURIConverter; -import org.eclipse.jem.util.emf.workbench.WorkbenchURIConverterImpl; - - -/** - * Create a Java Project Load Strategy based on J2EE Load Strategy which is used by common archive - * operations. - */ -public class JavaProjectLoadStrategyImpl extends J2EELoadStrategyImpl { - - // IProject project; - protected IJavaProject javaProject; - protected List sourceContainers = null; - - public static final String JAVA_EXTENSION = "java"; //$NON-NLS-1$ - public static final String CLASS_EXTENSION = "class"; //$NON-NLS-1$ - - - /** - * Constructor for JavaProjectLoadStrategyImpl. - */ - public JavaProjectLoadStrategyImpl(IProject proj) { - super(); - project = proj; - filesList = new ArrayList(); - JavaModel model = JavaProjectUtilities.getJavaModel(); - javaProject = model.getJavaProject(project.getName()); - - } - - public IContainer getModuleContainer() { - return JavaProjectUtilities.getJavaProjectOutputContainer(getProject()); - } - - /* - * @see J2EELoadStrategyImpl#getProjectURIConverter() - */ - public WorkbenchURIConverter getProjectURIConverter() { - if (projectURIConverter != null) - return projectURIConverter; - - IContainer outputContainer = JavaProjectUtilities.getJavaProjectOutputContainer(getProject()); - List uriContainers = new ArrayList(); - uriContainers.add(outputContainer); - if (isExportSource()) { - List localSourceFolders = getSourceFolders(); - //We always want the output container at the front of the list - //If the output container is also source, then remove it so it's not searched twice - localSourceFolders.remove(outputContainer); - uriContainers.addAll(localSourceFolders); - } - projectURIConverter = new WorkbenchURIConverterImpl(); - for (int i = 0; i < uriContainers.size(); i++) { - projectURIConverter.addInputContainer((IContainer) uriContainers.get(i)); - } - return projectURIConverter; - } - - /* - * Overridden from superclass, V5. For future releases, need to clean up the implementation in - * the superclass, but for now, overriding for minimum disruption. - */ - protected IPath getOutputPathForFile(IPath aPath) throws Exception { - - if (isProjectMetaFile(aPath.toString())) { - if (shouldIncludeProjectMetaFiles()) - return aPath; - return null; - } - if (!checkIfNeeded(aPath)) - return null; - - List containers = getProjectURIConverter().getInputContainers(); - for (int i = 0; i < containers.size(); i++) { - IContainer aContainer = (IContainer) containers.get(i); - IPath containerPath = aContainer.getProjectRelativePath(); - if (aPath.matchingFirstSegments(containerPath) == containerPath.segmentCount()) { - IPath result = aPath.removeFirstSegments(containerPath.segmentCount()); - //The next three lines cover the case where you have the project as source - //and a folder as the output - if (isProjectMetaFile(result.toString()) && !shouldIncludeProjectMetaFiles()) - return null; - return result; - } - } - return null; - } - - - public List getSourceFolders() { - if (sourceContainers == null) - sourceContainers = JavaProjectUtilities.getSourceContainers(project); - return sourceContainers; - } - - - protected boolean checkIfNeeded(IPath path) throws Exception { - if (path == null || path.segmentCount() == 0) - return false; - - String ext = path.getFileExtension(); - - if (isJava(ext)) - return isExportSource(); - return true; - } - - protected boolean isResource(String ext) { - return ext == null || (!isClass(ext) && !isJava(ext)); - } - - protected boolean isClass(String ext) { - return CLASS_EXTENSION.equals(ext); - } - - protected boolean isJava(String ext) { - return JAVA_EXTENSION.equals(ext); - } - -}
\ No newline at end of file diff --git a/plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/internal/archive/operations/JavaProjectSaveStrategyImpl.java b/plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/internal/archive/operations/JavaProjectSaveStrategyImpl.java deleted file mode 100644 index 9d9abe35a..000000000 --- a/plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/internal/archive/operations/JavaProjectSaveStrategyImpl.java +++ /dev/null @@ -1,58 +0,0 @@ -/*************************************************************************************************** - * Copyright (c) 2003, 2004 IBM Corporation and others. All rights reserved. This program and the - * accompanying materials are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: IBM Corporation - initial API and implementation - **************************************************************************************************/ -package org.eclipse.jst.j2ee.internal.archive.operations; - - -import java.io.OutputStream; - -import org.eclipse.core.resources.IContainer; -import org.eclipse.core.resources.IFile; -import org.eclipse.core.resources.IProject; -import org.eclipse.jem.util.emf.workbench.JavaProjectUtilities; -import org.eclipse.jem.util.emf.workbench.WorkbenchByteArrayOutputStream; -import org.eclipse.jem.util.emf.workbench.WorkbenchURIConverter; -import org.eclipse.jem.util.emf.workbench.WorkbenchURIConverterImpl; -import org.eclipse.jst.j2ee.commonarchivecore.internal.exception.SaveFailureException; -import org.eclipse.jst.j2ee.commonarchivecore.internal.helpers.ArchiveConstants; -import org.eclipse.jst.j2ee.commonarchivecore.internal.helpers.ArchiveManifest; - -public class JavaProjectSaveStrategyImpl extends J2EESaveStrategyImpl { - - /** - * Constructor for JavaProjectSaveStrategyImpl. - */ - public JavaProjectSaveStrategyImpl(IProject p) { - super(p); - } - - /** - * @see J2EESaveStrategyImpl#getSourceURIConverter() - */ - public WorkbenchURIConverter getSourceURIConverter() { - if (sourceURIConverter == null) { - IContainer sourceFolder = JavaProjectUtilities.getSourceFolderOrFirst(getProject(), null); - sourceURIConverter = new WorkbenchURIConverterImpl(sourceFolder); - sourceURIConverter.setForceSaveRelative(true); - } - return sourceURIConverter; - } - - public void save(ArchiveManifest aManifest) throws SaveFailureException { - try { - WorkbenchURIConverter conv = getSourceURIConverter(); - IFile iFile = conv.getOutputFileWithMappingApplied(ArchiveConstants.MANIFEST_URI); - validateEdit(iFile); - OutputStream out = new WorkbenchByteArrayOutputStream(iFile); - aManifest.write(out); - out.close(); - } catch (Exception ex) { - throw new SaveFailureException(ex); - } - } -}
\ No newline at end of file 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 5d32ca549..000000000 --- a/plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/internal/archive/operations/OverwriteHandlerException.java +++ /dev/null @@ -1,37 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2003, 2004 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.j2ee.internal.archive.operations; - - - -/** - * Insert the type's description here. Creation date: (8/16/2001 6:07:35 PM) - * - * @author: Administrator - */ -public class OverwriteHandlerException extends RuntimeException { - /** - * OverwriteHandlerException constructor comment. - */ - public OverwriteHandlerException() { - super(); - } - - /** - * OverwriteHandlerException constructor comment. - * - * @param s - * java.lang.String - */ - public OverwriteHandlerException(String s) { - super(s); - } -}
\ No newline at end of file |