geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ga...@apache.org
Subject svn commit: r1325618 - in /geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.core/src/main/java/org/apache/geronimo/st/v30/core: GeronimoUtils.java osgi/AriesHelper.java
Date Fri, 13 Apr 2012 05:50:46 GMT
Author: gawor
Date: Fri Apr 13 05:50:46 2012
New Revision: 1325618

URL: http://svn.apache.org/viewvc?rev=1325618&view=rev
Log:
ensure manfiest.mf is loaded from bundle root path

Modified:
    geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.core/src/main/java/org/apache/geronimo/st/v30/core/GeronimoUtils.java
    geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.core/src/main/java/org/apache/geronimo/st/v30/core/osgi/AriesHelper.java

Modified: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.core/src/main/java/org/apache/geronimo/st/v30/core/GeronimoUtils.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/GeronimoUtils.java?rev=1325618&r1=1325617&r2=1325618&view=diff
==============================================================================
--- geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.core/src/main/java/org/apache/geronimo/st/v30/core/GeronimoUtils.java
(original)
+++ geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.core/src/main/java/org/apache/geronimo/st/v30/core/GeronimoUtils.java
Fri Apr 13 05:50:46 2012
@@ -260,19 +260,19 @@ public class GeronimoUtils {
     }
 
     public static Manifest getBundleManifest(IModule module) {
-        IVirtualComponent component = getVirtualComponent(module);
-        IPath manifestPath = component.getRootFolder().getUnderlyingFolder().getProjectRelativePath().append("META-INF").append("MANIFEST.MF");
-        IFile manifestFile = component.getProject().getFile(manifestPath);
         Manifest manifest = null;
-        InputStream in = null;
-        try {
-            in = manifestFile.getContents();
-            manifest = new Manifest(in);
-        } catch (Exception e) {
-            Trace.trace(Trace.ERROR, "Could load manifest file", e, Activator.logCore);
-        } finally {
-            if (in != null) {
-                try { in.close(); } catch (Exception ee) {}
+        IFile manifestFile = AriesHelper.getManifestFile(module.getProject());
+        if (manifestFile != null) {
+            InputStream in = null;
+            try {
+                in = manifestFile.getContents();
+                manifest = new Manifest(in);
+            } catch (Exception e) {
+                Trace.trace(Trace.ERROR, "Could load manifest file", e, Activator.logCore);
+            } finally {
+                if (in != null) { 
+                    try { in.close(); } catch (Exception ee) {}
+                }
             }
         }
         return manifest;

Modified: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.core/src/main/java/org/apache/geronimo/st/v30/core/osgi/AriesHelper.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/osgi/AriesHelper.java?rev=1325618&r1=1325617&r2=1325618&view=diff
==============================================================================
--- geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.core/src/main/java/org/apache/geronimo/st/v30/core/osgi/AriesHelper.java
(original)
+++ geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.core/src/main/java/org/apache/geronimo/st/v30/core/osgi/AriesHelper.java
Fri Apr 13 05:50:46 2012
@@ -21,6 +21,7 @@ import java.lang.reflect.Method;
 
 import org.apache.geronimo.st.v30.core.Activator;
 import org.apache.geronimo.st.v30.core.internal.Trace;
+import org.eclipse.core.resources.IFile;
 import org.eclipse.core.resources.IProject;
 import org.eclipse.core.runtime.Platform;
 import org.eclipse.wst.server.core.IModule;
@@ -70,7 +71,7 @@ public final class AriesHelper {
                 Object object = constructor.newInstance(ebaModule.getProject());
                 return (IModule[]) method.invoke(object);                
             } catch (Exception e) {
-                e.printStackTrace();
+                Trace.trace(Trace.ERROR, "Could not get child modules", e, Activator.traceOsgi);
             }
         }        
         return new IModule[0];
@@ -83,7 +84,7 @@ public final class AriesHelper {
                 Method method = class1.getMethod("getBundleSymbolicName", IProject.class);
                 return (String) method.invoke(null, bundleModule.getProject());
             } catch (Exception e) {
-                e.printStackTrace();
+                Trace.trace(Trace.ERROR, "Could not get bundle symbolic name", e, Activator.traceOsgi);
             }
         }
         return null;
@@ -102,11 +103,12 @@ public final class AriesHelper {
                 Version version = Version.parseVersion(versionStr);
                 return version;
             } catch (Exception e) {
-                e.printStackTrace();
+                Trace.trace(Trace.ERROR, "Could not get bundle version", e, Activator.traceOsgi);
             }
         }
         return null;
     }
+
     public static BundleInfo getBundleInfo(IProject project) throws Exception {
         if (AriesHelper.isAriesInstalled()) {
             Class<?> ariesUtilsClass = Class.forName("com.ibm.etools.aries.internal.core.utils.AriesUtils");
@@ -148,6 +150,19 @@ public final class AriesHelper {
         }
         return null;
     }
+
+    public static IFile getManifestFile(IProject project) {
+        if (AriesHelper.isAriesInstalled()) {
+            try {
+                Class<?> ariesUtilsClass = Class.forName("com.ibm.etools.aries.internal.core.utils.ManifestUtils");
+                Method method = ariesUtilsClass.getMethod("getManifestFile", IProject.class);
+                return (IFile) method.invoke(null, project);
+            } catch (Exception e) {
+                Trace.trace(Trace.ERROR, "Could not get manifest file", e, Activator.traceOsgi);
+            }
+        }
+        return null;
+    }
     
     // copied from org.apache.geronimo.aries.builder.ApplicationInstaller.getVersion(Version)
     public static String toMvnVersion(Version version) {



Mime
View raw message