geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ga...@apache.org
Subject svn commit: r1159283 - in /geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.core/src/main/java/org/apache/geronimo/st/v30/core: ./ commands/ internal/
Date Thu, 18 Aug 2011 15:33:13 GMT
Author: gawor
Date: Thu Aug 18 15:33:13 2011
New Revision: 1159283

URL: http://svn.apache.org/viewvc?rev=1159283&view=rev
Log:
improve error handling in module export code so that GEP doesn't pass non-existent files to
server

Modified:
    geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.core/src/main/java/org/apache/geronimo/st/v30/core/DeploymentUtils.java
    geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.core/src/main/java/org/apache/geronimo/st/v30/core/GeronimoServerBehaviourDelegate.java
    geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.core/src/main/java/org/apache/geronimo/st/v30/core/commands/DeployCommand.java
    geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.core/src/main/java/org/apache/geronimo/st/v30/core/internal/Messages.properties

Modified: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.core/src/main/java/org/apache/geronimo/st/v30/core/DeploymentUtils.java
URL: http://svn.apache.org/viewvc/geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.core/src/main/java/org/apache/geronimo/st/v30/core/DeploymentUtils.java?rev=1159283&r1=1159282&r2=1159283&view=diff
==============================================================================
--- geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.core/src/main/java/org/apache/geronimo/st/v30/core/DeploymentUtils.java
(original)
+++ geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.core/src/main/java/org/apache/geronimo/st/v30/core/DeploymentUtils.java
Thu Aug 18 15:33:13 2011
@@ -27,6 +27,7 @@ import javax.enterprise.deploy.spi.excep
 import org.apache.geronimo.kernel.util.SelectorUtils;
 import org.apache.geronimo.st.v30.core.commands.DeploymentCommandFactory;
 import org.apache.geronimo.st.v30.core.commands.TargetModuleIdNotFoundException;
+import org.apache.geronimo.st.v30.core.internal.Messages;
 import org.apache.geronimo.st.v30.core.internal.Trace;
 import org.apache.geronimo.st.v30.core.osgi.AriesHelper;
 import org.apache.geronimo.st.v30.core.osgi.OsgiConstants;
@@ -121,12 +122,13 @@ public class DeploymentUtils {
         return null;
     }
     
-    public static File getTargetFile(IServer server, IModule module) {        
+    public static File getTargetFile(IServer server, IModule module) throws CoreException
{        
         File file = null;
         IGeronimoServer gs = (IGeronimoServer) server.getAdapter(IGeronimoServer.class);
         if (gs.isRunFromWorkspace()) {
             //TODO Re-enable after DeployableModule supported in G
             //file = generateRunFromWorkspaceConfig(getModule());
+            throw new CoreException(new Status(IStatus.ERROR, Activator.PLUGIN_ID, "Run from
workspace is unsupported."));
         } else {
             IPath outputDir = DeploymentUtils.STATE_LOC.append("server_" + server.getId());
             outputDir.toFile().mkdirs();
@@ -177,41 +179,45 @@ public class DeploymentUtils {
     }
 
 
-    public static File createJarFile(IModule module, IPath outputPath) {
+    public static File createJarFile(IModule module, IPath outputPath) throws CoreException
{
         Trace.tracePoint("Entry", Activator.traceCore, "DeploymentUtils.createJarFile", module,
outputPath);
 
         IDataModel model = getExportDataModel(module);
-        File exportedFile = null;
+        if (model == null) {
+            throw new CoreException(new Status(IStatus.ERROR, Activator.PLUGIN_ID, "No export
DataModel for " + module.getName(), null));
+        }
         
-        if (model != null) {
-
-            IVirtualComponent comp = ComponentCore.createComponent(module.getProject());
+        IVirtualComponent comp = ComponentCore.createComponent(module.getProject());
 
-            //Here, specific extension name should be got, in case module has no standard
JEE descriptor file included
-            String extensionName = getModuleExtension(module);
+        //Here, specific extension name should be got, in case module has no standard JEE
descriptor file included
+        String extensionName = getModuleExtension(module);
             
-            // TODO: Need to determine what properties to set for OSGi applications
-            model.setProperty(J2EEComponentExportDataModelProvider.PROJECT_NAME, module.getProject());
-            model.setProperty(J2EEComponentExportDataModelProvider.ARCHIVE_DESTINATION, outputPath.append(module.getName())
-                    + extensionName);
-
-            model.setProperty(J2EEComponentExportDataModelProvider.COMPONENT, comp);
-            model.setBooleanProperty(J2EEComponentExportDataModelProvider.OVERWRITE_EXISTING,
true);
-            model.setBooleanProperty(J2EEComponentExportDataModelProvider.RUN_BUILD, false);
+        // TODO: Need to determine what properties to set for OSGi applications
+        model.setProperty(J2EEComponentExportDataModelProvider.PROJECT_NAME, module.getProject());
+        model.setProperty(J2EEComponentExportDataModelProvider.ARCHIVE_DESTINATION, outputPath.append(module.getName())
+ extensionName);
+
+        model.setProperty(J2EEComponentExportDataModelProvider.COMPONENT, comp);
+        model.setBooleanProperty(J2EEComponentExportDataModelProvider.OVERWRITE_EXISTING,
true);
+        model.setBooleanProperty(J2EEComponentExportDataModelProvider.RUN_BUILD, false);
 
-            try {
-                model.getDefaultOperation().execute(null, null);
-                exportedFile = new File(model.getStringProperty(J2EEComponentExportDataModelProvider.ARCHIVE_DESTINATION));
-            } catch (ExecutionException e) {
-                Trace.trace(Trace.ERROR, "Error exporting module", e, Activator.logCore);
-            }            
+        try {
+            IStatus status = model.getDefaultOperation().execute(null, null);
+            if (status != null && !status.isOK()) {
+                throw new CoreException(status);
+            }
+        } catch (ExecutionException e) {
+            throw new CoreException(new Status(IStatus.ERROR, Activator.PLUGIN_ID, Messages.bind(Messages.moduleExportError,
module.getName()), e)); 
+        } 
+        
+        File exportedFile = new File(model.getStringProperty(J2EEComponentExportDataModelProvider.ARCHIVE_DESTINATION));
+        if (exportedFile == null || !exportedFile.exists()) {
+            throw new CoreException(new Status(IStatus.ERROR, Activator.PLUGIN_ID, Messages.bind(Messages.moduleExportError,
module.getName()))); 
         }
-
+                      
         Trace.tracePoint("Exit ", Activator.traceCore, "DeploymentUtils.createJarFile", exportedFile);
         return exportedFile;
     }
 
-
     public static IDataModel getExportDataModel(IModule module) {
         Trace.tracePoint("Entry", Activator.traceCore, "DeploymentUtils.getExportDataModel",
module);
 

Modified: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.core/src/main/java/org/apache/geronimo/st/v30/core/GeronimoServerBehaviourDelegate.java
URL: http://svn.apache.org/viewvc/geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.core/src/main/java/org/apache/geronimo/st/v30/core/GeronimoServerBehaviourDelegate.java?rev=1159283&r1=1159282&r2=1159283&view=diff
==============================================================================
--- geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.core/src/main/java/org/apache/geronimo/st/v30/core/GeronimoServerBehaviourDelegate.java
(original)
+++ geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.core/src/main/java/org/apache/geronimo/st/v30/core/GeronimoServerBehaviourDelegate.java
Thu Aug 18 15:33:13 2011
@@ -572,7 +572,7 @@ public class GeronimoServerBehaviourDele
                 setStatus(bundleModule, status, multiStatus);
             }
         } catch (Exception e) {
-            multiStatus.add(new Status(IStatus.ERROR, Activator.PLUGIN_ID, 0, Messages.REFRESH_FAIL,
e));
+            multiStatus.add(new Status(IStatus.ERROR, Activator.PLUGIN_ID, Messages.REFRESH_FAIL,
e));
         }
         
         IStatus status;
@@ -592,9 +592,6 @@ public class GeronimoServerBehaviourDele
 
         try {
             File file = DeploymentUtils.getTargetFile(getServer(), bundleModule);
-            if (file == null) {
-                return new Status(IStatus.ERROR, Activator.PLUGIN_ID, Messages.bind(Messages.moduleExportError,
bundleModule.getProject().getName()));
-            }
             
             String symbolicName = AriesHelper.getSymbolicName(bundleModule);
             Long bundleId = bundleMap.get(symbolicName);
@@ -607,7 +604,7 @@ public class GeronimoServerBehaviourDele
             ExtendedDeploymentManager dm = (ExtendedDeploymentManager) DeploymentCommandFactory.getDeploymentManager(getServer());
             dm.updateEBAContent(ebaName, bundleId, file);
         } catch (Exception e) {
-            return new Status(IStatus.ERROR, Activator.PLUGIN_ID, 0, Messages.REFRESH_FAIL,
e);
+            return new Status(IStatus.ERROR, Activator.PLUGIN_ID, Messages.REFRESH_FAIL,
e);
         }
 
         Trace.tracePoint("Exit ", Activator.traceCore, "GeronimoServerBehaviourDelegate.refreshBundle");

Modified: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.core/src/main/java/org/apache/geronimo/st/v30/core/commands/DeployCommand.java
URL: http://svn.apache.org/viewvc/geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.core/src/main/java/org/apache/geronimo/st/v30/core/commands/DeployCommand.java?rev=1159283&r1=1159282&r2=1159283&view=diff
==============================================================================
--- geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.core/src/main/java/org/apache/geronimo/st/v30/core/commands/DeployCommand.java
(original)
+++ geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.core/src/main/java/org/apache/geronimo/st/v30/core/commands/DeployCommand.java
Thu Aug 18 15:33:13 2011
@@ -54,14 +54,8 @@ abstract public class DeployCommand exte
     public File getTargetFile() throws CoreException {
         Trace.tracePoint("Entry", Activator.traceCommands, "DeployCommand.getTargetFile");
 
-        IModule module = getModule();
-        File file = DeploymentUtils.getTargetFile(getServer(), module);
+        File file = DeploymentUtils.getTargetFile(getServer(), getModule());
         
-        if (file == null) {
-            throw new CoreException(new Status(IStatus.ERROR, Activator.PLUGIN_ID, 
-                    Messages.bind(Messages.moduleExportError, module.getProject().getName())));
    
-        }
-
         Trace.tracePoint("Exit ", Activator.traceCommands, "DeployCommand.getTargetFile",
file);
         return file;
     }

Modified: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.core/src/main/java/org/apache/geronimo/st/v30/core/internal/Messages.properties
URL: http://svn.apache.org/viewvc/geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.core/src/main/java/org/apache/geronimo/st/v30/core/internal/Messages.properties?rev=1159283&r1=1159282&r2=1159283&view=diff
==============================================================================
--- geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.core/src/main/java/org/apache/geronimo/st/v30/core/internal/Messages.properties
(original)
+++ geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.core/src/main/java/org/apache/geronimo/st/v30/core/internal/Messages.properties
Thu Aug 18 15:33:13 2011
@@ -32,7 +32,7 @@ target11runtime=Geronimo v1.1 Runtime
 target20runtime=Geronimo v2.0 Runtime
 target21runtime=Geronimo v2.1 Runtime
 target22runtime=Geronimo v2.2 Runtime
-target30Runtime=Geronimo v3.0 Runtime
+target30runtime=Geronimo v3.0 Runtime
 
 incorrectVersion=An incorrect version of {0} was detected.  Version {1} was expected, but
version {2} was found.
 noVersion=A {0} installation was detected, however the version could not be verified.
@@ -47,7 +47,7 @@ errorNoProfiler=Could not launch in prof
 badConfigId=Bad configID; should never happen.
 errorDeletePlugin=Unable to delete old plug-in at {0}.
 errorMovePlugin=Unable to move new plug-in {0} to {1}.
-badadPlugin={0} is not a plug-in.
+badPlugin={0} is not a plug-in.
 errorCreateMetadata=Cannot create plug-in metadata file for {0}.
 errorUpdateMetadata=Unable to update plug-in metadata.
 errorReadConfig=Cannot read configuration {0}.



Mime
View raw message