geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sppa...@apache.org
Subject svn commit: r320877 - /geronimo/devtools/trunk/modules/eclipse-plugin/plugins/org.apache.geronimo.devtools.eclipse.core/src/org/apache/geronimo/core/operations/
Date Thu, 13 Oct 2005 19:14:13 GMT
Author: sppatel
Date: Thu Oct 13 12:14:08 2005
New Revision: 320877

URL: http://svn.apache.org/viewcvs?rev=320877&view=rev
Log:
refactor duplicate methods

Added:
    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/GeronimoDataModelProperties.java
      - copied, changed from r315011, geronimo/devtools/trunk/modules/eclipse-plugin/plugins/org.apache.geronimo.devtools.eclipse.core/src/org/apache/geronimo/core/operations/IExportDeploymentPlanDataModelProperties.java
Removed:
    geronimo/devtools/trunk/modules/eclipse-plugin/plugins/org.apache.geronimo.devtools.eclipse.core/src/org/apache/geronimo/core/operations/IExportDeploymentPlanDataModelProperties.java
Modified:
    geronimo/devtools/trunk/modules/eclipse-plugin/plugins/org.apache.geronimo.devtools.eclipse.core/src/org/apache/geronimo/core/operations/DeploymentPlanCreationOperation.java
    geronimo/devtools/trunk/modules/eclipse-plugin/plugins/org.apache.geronimo.devtools.eclipse.core/src/org/apache/geronimo/core/operations/ExportDeploymentPlanDataModelProvider.java
    geronimo/devtools/trunk/modules/eclipse-plugin/plugins/org.apache.geronimo.devtools.eclipse.core/src/org/apache/geronimo/core/operations/ExportDeploymentPlanOperation.java
    geronimo/devtools/trunk/modules/eclipse-plugin/plugins/org.apache.geronimo.devtools.eclipse.core/src/org/apache/geronimo/core/operations/ImportDeploymentPlanOperation.java

Added: 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=320877&view=auto
==============================================================================
--- geronimo/devtools/trunk/modules/eclipse-plugin/plugins/org.apache.geronimo.devtools.eclipse.core/src/org/apache/geronimo/core/operations/AbstractGeronimoJ2EEComponentOperation.java
(added)
+++ geronimo/devtools/trunk/modules/eclipse-plugin/plugins/org.apache.geronimo.devtools.eclipse.core/src/org/apache/geronimo/core/operations/AbstractGeronimoJ2EEComponentOperation.java
Thu Oct 13 12:14:08 2005
@@ -0,0 +1,95 @@
+/**
+ * Copyright 2004, 2005 The Apache Software Foundation or its licensors, as applicable
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+package org.apache.geronimo.core.operations;
+
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.wst.common.componentcore.datamodel.properties.IComponentCreationDataModelProperties;
+import org.eclipse.wst.common.frameworks.datamodel.AbstractDataModelOperation;
+import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
+import org.eclipse.wst.common.frameworks.datamodel.properties.IFlexibleProjectCreationDataModelProperties;
+import org.eclipse.wst.server.core.IRuntime;
+import org.eclipse.wst.server.core.ServerCore;
+
+public abstract class AbstractGeronimoJ2EEComponentOperation extends
+        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() {
+
+        IRuntime runtime = ServerCore.getProjectProperties(getProject())
+                .getRuntimeTarget();
+        return runtime.getName().startsWith("Apache Geronimo");
+
+    }
+
+    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;
+    }
+
+}

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=320877&r1=320876&r2=320877&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 Oct 13 12:14:08 2005
@@ -29,8 +29,6 @@
 import org.apache.geronimo.xml.ns.web.WebFactory;
 import org.eclipse.core.commands.ExecutionException;
 import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.ResourcesPlugin;
 import org.eclipse.core.runtime.IAdaptable;
 import org.eclipse.core.runtime.IProgressMonitor;
 import org.eclipse.core.runtime.IStatus;
@@ -41,18 +39,13 @@
 import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl;
 import org.eclipse.emf.ecore.xmi.XMLResource;
 import org.eclipse.wst.common.componentcore.ComponentCore;
-import org.eclipse.wst.common.componentcore.datamodel.properties.IComponentCreationDataModelProperties;
 import org.eclipse.wst.common.componentcore.internal.util.IModuleConstants;
 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.datamodel.properties.IFlexibleProjectCreationDataModelProperties;
-import org.eclipse.wst.server.core.IRuntime;
-import org.eclipse.wst.server.core.ServerCore;
 import org.openejb.xml.ns.openejb.jar.JarFactory;
 import org.openejb.xml.ns.openejb.jar.OpenejbJarType;
 
-public class DeploymentPlanCreationOperation extends AbstractDataModelOperation {
+public class DeploymentPlanCreationOperation extends AbstractGeronimoJ2EEComponentOperation
{
 
     public DeploymentPlanCreationOperation() {
     }
@@ -194,41 +187,6 @@
         doSave(resource);
 
         return root;
-    }
-
-    public boolean isGeronimoRuntimeTarget() {
-
-        IRuntime runtime = ServerCore.getProjectProperties(getProject())
-                .getRuntimeTarget();
-        return runtime.getName().startsWith("Apache Geronimo");
-
-    }
-
-    public IStatus redo(IProgressMonitor monitor, IAdaptable info)
-            throws ExecutionException {
-        return null;
-    }
-
-    public IStatus undo(IProgressMonitor monitor, IAdaptable info)
-            throws ExecutionException {
-        return null;
-    }
-
-    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;
     }
 
     private void doSave(Resource resource) {

Modified: geronimo/devtools/trunk/modules/eclipse-plugin/plugins/org.apache.geronimo.devtools.eclipse.core/src/org/apache/geronimo/core/operations/ExportDeploymentPlanDataModelProvider.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/ExportDeploymentPlanDataModelProvider.java?rev=320877&r1=320876&r2=320877&view=diff
==============================================================================
--- geronimo/devtools/trunk/modules/eclipse-plugin/plugins/org.apache.geronimo.devtools.eclipse.core/src/org/apache/geronimo/core/operations/ExportDeploymentPlanDataModelProvider.java
(original)
+++ geronimo/devtools/trunk/modules/eclipse-plugin/plugins/org.apache.geronimo.devtools.eclipse.core/src/org/apache/geronimo/core/operations/ExportDeploymentPlanDataModelProvider.java
Thu Oct 13 12:14:08 2005
@@ -25,7 +25,7 @@
  */
 public class ExportDeploymentPlanDataModelProvider extends
         AbstractDataModelProvider implements
-        IExportDeploymentPlanDataModelProperties {
+        GeronimoDataModelProperties {
 
     /**
      * 
@@ -39,8 +39,8 @@
      */
     public Set getPropertyNames() {
         Set propertyNames = super.getPropertyNames();
-        propertyNames.add(IExportDeploymentPlanDataModelProperties.COMPONENT_NAME);
-        propertyNames.add(IExportDeploymentPlanDataModelProperties.PROJECT_NAME);
+        propertyNames.add(GeronimoDataModelProperties.COMPONENT_NAME);
+        propertyNames.add(GeronimoDataModelProperties.PROJECT_NAME);
         return propertyNames;
     }
 

Modified: geronimo/devtools/trunk/modules/eclipse-plugin/plugins/org.apache.geronimo.devtools.eclipse.core/src/org/apache/geronimo/core/operations/ExportDeploymentPlanOperation.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/ExportDeploymentPlanOperation.java?rev=320877&r1=320876&r2=320877&view=diff
==============================================================================
--- geronimo/devtools/trunk/modules/eclipse-plugin/plugins/org.apache.geronimo.devtools.eclipse.core/src/org/apache/geronimo/core/operations/ExportDeploymentPlanOperation.java
(original)
+++ geronimo/devtools/trunk/modules/eclipse-plugin/plugins/org.apache.geronimo.devtools.eclipse.core/src/org/apache/geronimo/core/operations/ExportDeploymentPlanOperation.java
Thu Oct 13 12:14:08 2005
@@ -36,8 +36,7 @@
  * 
  * 
  */
-public class ExportDeploymentPlanOperation extends AbstractDataModelOperation
-        implements IExportDeploymentPlanDataModelProperties {
+public class ExportDeploymentPlanOperation extends AbstractDataModelOperation {
 
     /**
      * 
@@ -62,12 +61,11 @@
     public IStatus execute(IProgressMonitor monitor, IAdaptable info)
             throws ExecutionException {
 
-        IProject project = ProjectUtilities
-                .getProject(model
-                        .getStringProperty(IExportDeploymentPlanDataModelProperties.PROJECT_NAME));
+        IProject project = ProjectUtilities.getProject(model
+                .getStringProperty(GeronimoDataModelProperties.PROJECT_NAME));
 
         IVirtualComponent component = ComponentCore.createComponent(project,
-                IExportDeploymentPlanDataModelProperties.COMPONENT_NAME);
+                GeronimoDataModelProperties.COMPONENT_NAME);
 
         if (component.getComponentTypeId().equals(EARArtifactEdit.TYPE_ID)) {
             IVirtualReference[] refs = component.getReferences();
@@ -89,20 +87,20 @@
     }
 
     private EObject getDeploymentPlanForComponent(IVirtualComponent comp) {
-        
+
         if (comp.getComponentTypeId().equals(EARArtifactEdit.TYPE_ID)) {
             return GeronimoUtils.getApplicationDeploymentPlan(comp);
         }
-        
+
         if (comp.getComponentTypeId().equals(WebArtifactEdit.TYPE_ID)) {
             return GeronimoUtils.getWebDeploymentPlan(comp);
         }
-        
+
         if (comp.getComponentTypeId().equals(EJBArtifactEdit.TYPE_ID)) {
             return GeronimoUtils.getOpenEjbDeploymentPlan(comp);
         }
         return null;
-    } 
+    }
 
     /*
      * (non-Javadoc)

Copied: geronimo/devtools/trunk/modules/eclipse-plugin/plugins/org.apache.geronimo.devtools.eclipse.core/src/org/apache/geronimo/core/operations/GeronimoDataModelProperties.java
(from r315011, geronimo/devtools/trunk/modules/eclipse-plugin/plugins/org.apache.geronimo.devtools.eclipse.core/src/org/apache/geronimo/core/operations/IExportDeploymentPlanDataModelProperties.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/GeronimoDataModelProperties.java?p2=geronimo/devtools/trunk/modules/eclipse-plugin/plugins/org.apache.geronimo.devtools.eclipse.core/src/org/apache/geronimo/core/operations/GeronimoDataModelProperties.java&p1=geronimo/devtools/trunk/modules/eclipse-plugin/plugins/org.apache.geronimo.devtools.eclipse.core/src/org/apache/geronimo/core/operations/IExportDeploymentPlanDataModelProperties.java&r1=315011&r2=320877&rev=320877&view=diff
==============================================================================
--- geronimo/devtools/trunk/modules/eclipse-plugin/plugins/org.apache.geronimo.devtools.eclipse.core/src/org/apache/geronimo/core/operations/IExportDeploymentPlanDataModelProperties.java
(original)
+++ geronimo/devtools/trunk/modules/eclipse-plugin/plugins/org.apache.geronimo.devtools.eclipse.core/src/org/apache/geronimo/core/operations/GeronimoDataModelProperties.java
Thu Oct 13 12:14:08 2005
@@ -1,7 +1,7 @@
 package org.apache.geronimo.core.operations;
 
 
-public interface IExportDeploymentPlanDataModelProperties {
+public interface GeronimoDataModelProperties {
 
     public static final String PROJECT_NAME = "IExportDeploymentPlanDataModelProperties.PROJECT_NAME";
 

Modified: geronimo/devtools/trunk/modules/eclipse-plugin/plugins/org.apache.geronimo.devtools.eclipse.core/src/org/apache/geronimo/core/operations/ImportDeploymentPlanOperation.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/ImportDeploymentPlanOperation.java?rev=320877&r1=320876&r2=320877&view=diff
==============================================================================
--- geronimo/devtools/trunk/modules/eclipse-plugin/plugins/org.apache.geronimo.devtools.eclipse.core/src/org/apache/geronimo/core/operations/ImportDeploymentPlanOperation.java
(original)
+++ geronimo/devtools/trunk/modules/eclipse-plugin/plugins/org.apache.geronimo.devtools.eclipse.core/src/org/apache/geronimo/core/operations/ImportDeploymentPlanOperation.java
Thu Oct 13 12:14:08 2005
@@ -26,25 +26,17 @@
 import org.apache.xmlbeans.XmlObject;
 import org.eclipse.core.commands.ExecutionException;
 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.IAdaptable;
 import org.eclipse.core.runtime.IProgressMonitor;
 import org.eclipse.core.runtime.IStatus;
 import org.eclipse.core.runtime.Status;
 import org.eclipse.wst.common.componentcore.ComponentCore;
-import org.eclipse.wst.common.componentcore.datamodel.properties.IComponentCreationDataModelProperties;
 import org.eclipse.wst.common.componentcore.internal.util.IModuleConstants;
 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.datamodel.properties.IFlexibleProjectCreationDataModelProperties;
-import org.eclipse.wst.server.core.IRuntime;
-import org.eclipse.wst.server.core.ServerCore;
 
-public class ImportDeploymentPlanOperation extends AbstractDataModelOperation
-        implements IExportDeploymentPlanDataModelProperties {
+public class ImportDeploymentPlanOperation extends AbstractGeronimoJ2EEComponentOperation
{
 
     /**
      * 
@@ -149,53 +141,6 @@
         } catch (CoreException e) {
             e.printStackTrace();
         }
-    }
-
-    /*
-     * (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() {
-
-        IRuntime runtime = ServerCore.getProjectProperties(getProject())
-                .getRuntimeTarget();
-        return runtime.getName().startsWith("Apache Geronimo");
-
-    }
-
-    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;
     }
 
 }



Mime
View raw message