Author: sppatel
Date: Thu Nov 17 10:57:58 2005
New Revision: 345305
URL: http://svn.apache.org/viewcvs?rev=345305&view=rev
Log:
fix install delegate
Modified:
geronimo/devtools/trunk/modules/eclipse-plugin/plugins/org.apache.geronimo.devtools.eclipse.core/src/org/apache/geronimo/core/GeronimoFacetInstallDelegate.java
geronimo/devtools/trunk/modules/eclipse-plugin/plugins/org.apache.geronimo.devtools.eclipse.core/src/org/apache/geronimo/core/operations/AbstractGeronimoJ2EEComponentOperation.java
geronimo/devtools/trunk/modules/eclipse-plugin/plugins/org.apache.geronimo.devtools.eclipse.core/src/org/apache/geronimo/core/operations/DeploymentPlanCreationOperation.java
Modified: geronimo/devtools/trunk/modules/eclipse-plugin/plugins/org.apache.geronimo.devtools.eclipse.core/src/org/apache/geronimo/core/GeronimoFacetInstallDelegate.java
URL: http://svn.apache.org/viewcvs/geronimo/devtools/trunk/modules/eclipse-plugin/plugins/org.apache.geronimo.devtools.eclipse.core/src/org/apache/geronimo/core/GeronimoFacetInstallDelegate.java?rev=345305&r1=345304&r2=345305&view=diff
==============================================================================
--- geronimo/devtools/trunk/modules/eclipse-plugin/plugins/org.apache.geronimo.devtools.eclipse.core/src/org/apache/geronimo/core/GeronimoFacetInstallDelegate.java
(original)
+++ geronimo/devtools/trunk/modules/eclipse-plugin/plugins/org.apache.geronimo.devtools.eclipse.core/src/org/apache/geronimo/core/GeronimoFacetInstallDelegate.java
Thu Nov 17 10:57:58 2005
@@ -15,23 +15,21 @@
*/
package org.apache.geronimo.core;
-import org.apache.geronimo.core.internal.GeronimoUtils;
import org.apache.geronimo.core.operations.DeploymentPlanCreationOperation;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.jst.j2ee.internal.project.J2EEProjectUtilities;
+import org.eclipse.jst.j2ee.internal.archive.operations.JavaComponentCreationDataModelProvider;
import org.eclipse.wst.common.componentcore.ComponentCore;
-import org.eclipse.wst.common.componentcore.internal.util.IModuleConstants;
+import org.eclipse.wst.common.componentcore.datamodel.properties.IComponentCreationDataModelProperties;
import org.eclipse.wst.common.componentcore.resources.IVirtualComponent;
+import org.eclipse.wst.common.frameworks.datamodel.DataModelFactory;
+import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
import org.eclipse.wst.common.project.facet.core.IDelegate;
import org.eclipse.wst.common.project.facet.core.IProjectFacetVersion;
public class GeronimoFacetInstallDelegate implements IDelegate {
- /**
- *
- */
public GeronimoFacetInstallDelegate() {
super();
}
@@ -46,25 +44,13 @@
public void execute(IProject project, IProjectFacetVersion fv,
Object config, IProgressMonitor monitor) throws CoreException {
- DeploymentPlanCreationOperation op = new DeploymentPlanCreationOperation();
-
IVirtualComponent comp = ComponentCore.createComponent(project);
-
- String type = J2EEProjectUtilities.getJ2EEProjectType(project);
-
- if (IModuleConstants.JST_WEB_MODULE.equals(type)) {
- op.createGeronimoWebDeploymentPlan(GeronimoUtils
- .getWebDeploymentPlanFile(comp));
- } else if (IModuleConstants.JST_EJB_MODULE.equals(type)) {
- op.createOpenEjbDeploymentPlan(GeronimoUtils
- .getOpenEjbDeploymentPlanFile(comp));
- } else if (IModuleConstants.JST_EAR_MODULE.equals(type)) {
- op.createGeronimoApplicationDeploymentPlan(GeronimoUtils
- .getApplicationDeploymentPlanFile(comp));
- } else if (IModuleConstants.JST_CONNECTOR_MODULE.equals(type)) {
- op.createConnectorDeploymentPlan(GeronimoUtils
- .getConnectorDeploymentPlanFile(comp));
- }
+
+ IDataModel model = DataModelFactory.createDataModel(new JavaComponentCreationDataModelProvider());
+ model.setStringProperty(IComponentCreationDataModelProperties.COMPONENT_NAME, comp.getName());
+ model.setStringProperty(IComponentCreationDataModelProperties.PROJECT_NAME, project.getName());
+ DeploymentPlanCreationOperation op = new DeploymentPlanCreationOperation(model);
+ op.execute();
}
}
Modified: geronimo/devtools/trunk/modules/eclipse-plugin/plugins/org.apache.geronimo.devtools.eclipse.core/src/org/apache/geronimo/core/operations/AbstractGeronimoJ2EEComponentOperation.java
URL: http://svn.apache.org/viewcvs/geronimo/devtools/trunk/modules/eclipse-plugin/plugins/org.apache.geronimo.devtools.eclipse.core/src/org/apache/geronimo/core/operations/AbstractGeronimoJ2EEComponentOperation.java?rev=345305&r1=345304&r2=345305&view=diff
==============================================================================
--- geronimo/devtools/trunk/modules/eclipse-plugin/plugins/org.apache.geronimo.devtools.eclipse.core/src/org/apache/geronimo/core/operations/AbstractGeronimoJ2EEComponentOperation.java
(original)
+++ geronimo/devtools/trunk/modules/eclipse-plugin/plugins/org.apache.geronimo.devtools.eclipse.core/src/org/apache/geronimo/core/operations/AbstractGeronimoJ2EEComponentOperation.java
Thu Nov 17 10:57:58 2005
@@ -18,81 +18,79 @@
import org.eclipse.core.commands.ExecutionException;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
+import org.eclipse.jst.j2ee.application.internal.operations.J2EEComponentCreationDataModelProvider;
import org.eclipse.wst.common.componentcore.datamodel.properties.IComponentCreationDataModelProperties;
-import org.eclipse.wst.common.componentcore.datamodel.properties.IFlexibleProjectCreationDataModelProperties;
import org.eclipse.wst.common.frameworks.datamodel.AbstractDataModelOperation;
import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
-import org.eclipse.wst.common.project.facet.core.IFacetedProject;
-import org.eclipse.wst.common.project.facet.core.ProjectFacetsManager;
public abstract class AbstractGeronimoJ2EEComponentOperation extends
- AbstractDataModelOperation {
+ AbstractDataModelOperation {
- /**
- *
- */
- public AbstractGeronimoJ2EEComponentOperation() {
- super();
- }
-
- /**
- * @param model
- */
- public AbstractGeronimoJ2EEComponentOperation(IDataModel model) {
- super(model);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.core.commands.operations.AbstractOperation#redo(org.eclipse.core.runtime.IProgressMonitor,
- * org.eclipse.core.runtime.IAdaptable)
- */
- public IStatus redo(IProgressMonitor monitor, IAdaptable info)
- throws ExecutionException {
- return null;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.core.commands.operations.AbstractOperation#undo(org.eclipse.core.runtime.IProgressMonitor,
- * org.eclipse.core.runtime.IAdaptable)
- */
- public IStatus undo(IProgressMonitor monitor, IAdaptable info)
- throws ExecutionException {
- return null;
- }
-
- public boolean isGeronimoRuntimeTarget() {
- try {
- IFacetedProject p = ProjectFacetsManager.create(getProject());
- return p.getRuntime().getName().startsWith("Apache Geronimo");
- } catch (CoreException e) {
- e.printStackTrace();
- }
- return false;
- }
-
- public String getComponentName() {
- return model.getProperty(
- IComponentCreationDataModelProperties.COMPONENT_NAME)
- .toString();
- }
-
- public IProject getProject() {
- String projectName = model.getProperty(
- IFlexibleProjectCreationDataModelProperties.PROJECT_NAME)
- .toString();
- if (projectName != null) {
- return ResourcesPlugin.getWorkspace().getRoot().getProject(
- projectName);
- }
- return null;
- }
+ /**
+ *
+ */
+ public AbstractGeronimoJ2EEComponentOperation() {
+ super();
+ }
+
+ /**
+ * @param model
+ */
+ public AbstractGeronimoJ2EEComponentOperation(IDataModel model) {
+ super(model);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.core.commands.operations.AbstractOperation#redo(org.eclipse.core.runtime.IProgressMonitor,
+ * org.eclipse.core.runtime.IAdaptable)
+ */
+ public IStatus redo(IProgressMonitor monitor, IAdaptable info)
+ throws ExecutionException {
+ return null;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.core.commands.operations.AbstractOperation#undo(org.eclipse.core.runtime.IProgressMonitor,
+ * org.eclipse.core.runtime.IAdaptable)
+ */
+ public IStatus undo(IProgressMonitor monitor, IAdaptable info)
+ throws ExecutionException {
+ return null;
+ }
+
+ public boolean isGeronimoRuntimeTarget() {
+ String runtimeID = model
+ .getStringProperty(J2EEComponentCreationDataModelProvider.RUNTIME_TARGET_ID);
+ return runtimeID != null && runtimeID.startsWith("Apache Geronimo");
+ /*
+ * try { IFacetedProject p = ProjectFacetsManager.create(getProject());
+ * return p.getRuntime().getName().startsWith("Apache Geronimo"); }
+ * catch (CoreException e) { e.printStackTrace(); } return false;
+ */
+ }
+
+ public String getComponentName() {
+ return model.getProperty(
+ IComponentCreationDataModelProperties.COMPONENT_NAME)
+ .toString();
+ }
+
+ public IProject getProject() {
+ String projectName = model.getProperty(
+ IComponentCreationDataModelProperties.PROJECT_NAME)
+ .toString();
+ if (projectName != null) {
+ return ResourcesPlugin.getWorkspace().getRoot().getProject(
+ projectName);
+ }
+ return null;
+ }
}
Modified: geronimo/devtools/trunk/modules/eclipse-plugin/plugins/org.apache.geronimo.devtools.eclipse.core/src/org/apache/geronimo/core/operations/DeploymentPlanCreationOperation.java
URL: http://svn.apache.org/viewcvs/geronimo/devtools/trunk/modules/eclipse-plugin/plugins/org.apache.geronimo.devtools.eclipse.core/src/org/apache/geronimo/core/operations/DeploymentPlanCreationOperation.java?rev=345305&r1=345304&r2=345305&view=diff
==============================================================================
--- geronimo/devtools/trunk/modules/eclipse-plugin/plugins/org.apache.geronimo.devtools.eclipse.core/src/org/apache/geronimo/core/operations/DeploymentPlanCreationOperation.java
(original)
+++ geronimo/devtools/trunk/modules/eclipse-plugin/plugins/org.apache.geronimo.devtools.eclipse.core/src/org/apache/geronimo/core/operations/DeploymentPlanCreationOperation.java
Thu Nov 17 10:57:58 2005
@@ -39,7 +39,6 @@
import org.eclipse.emf.ecore.resource.ResourceSet;
import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl;
import org.eclipse.emf.ecore.xmi.XMLResource;
-import org.eclipse.jst.j2ee.application.internal.operations.J2EEComponentCreationDataModelProvider;
import org.eclipse.jst.j2ee.internal.project.J2EEProjectUtilities;
import org.eclipse.wst.common.componentcore.ComponentCore;
import org.eclipse.wst.common.componentcore.internal.util.IModuleConstants;
@@ -60,39 +59,32 @@
public IStatus execute(IProgressMonitor monitor, IAdaptable info)
throws ExecutionException {
-
- String runtimeID = model.getStringProperty(J2EEComponentCreationDataModelProvider.RUNTIME_TARGET_ID);
-
- boolean isGeronimoRuntime = false;
- if(runtimeID != null && runtimeID.startsWith("Apache Geronimo")) {
- isGeronimoRuntime = true;
+
+ if (isGeronimoRuntimeTarget()) {
+ execute();
}
-
- //isGeronimoRuntime = isGeronimoRuntimeTarget();
- if (isGeronimoRuntime) {
+ return Status.OK_STATUS;
+ }
+
+ public void execute() {
+ IVirtualComponent comp = ComponentCore.createComponent(getProject());
- IVirtualComponent comp = ComponentCore
- .createComponent(getProject());
+ String type = J2EEProjectUtilities.getJ2EEProjectType(getProject());
- String type = J2EEProjectUtilities.getJ2EEProjectType(getProject());
-
- if (IModuleConstants.JST_WEB_MODULE.equals(type)) {
- createGeronimoWebDeploymentPlan(GeronimoUtils
- .getWebDeploymentPlanFile(comp));
- } else if (IModuleConstants.JST_EJB_MODULE.equals(type)) {
- createOpenEjbDeploymentPlan(GeronimoUtils
- .getOpenEjbDeploymentPlanFile(comp));
- } else if (IModuleConstants.JST_EAR_MODULE.equals(type)) {
- createGeronimoApplicationDeploymentPlan(GeronimoUtils
- .getApplicationDeploymentPlanFile(comp));
- } else if (IModuleConstants.JST_CONNECTOR_MODULE.equals(type)) {
- createConnectorDeploymentPlan(GeronimoUtils
- .getConnectorDeploymentPlanFile(comp));
- }
+ if (IModuleConstants.JST_WEB_MODULE.equals(type)) {
+ createGeronimoWebDeploymentPlan(GeronimoUtils
+ .getWebDeploymentPlanFile(comp));
+ } else if (IModuleConstants.JST_EJB_MODULE.equals(type)) {
+ createOpenEjbDeploymentPlan(GeronimoUtils
+ .getOpenEjbDeploymentPlanFile(comp));
+ } else if (IModuleConstants.JST_EAR_MODULE.equals(type)) {
+ createGeronimoApplicationDeploymentPlan(GeronimoUtils
+ .getApplicationDeploymentPlanFile(comp));
+ } else if (IModuleConstants.JST_CONNECTOR_MODULE.equals(type)) {
+ createConnectorDeploymentPlan(GeronimoUtils
+ .getConnectorDeploymentPlanFile(comp));
}
-
- return Status.OK_STATUS;
}
public ApplicationType createGeronimoApplicationDeploymentPlan(IFile dpFile) {
|