Author: michiel
Date: 2009-05-19 00:33:50 +0200 (Tue, 19 May 2009)
New Revision: 35299

Modified:
   mmbase/trunk/src/org/mmbase/framework/BasicComponent.java
Log:
Experiment, return the manifest of the jar of the component

Modified: mmbase/trunk/src/org/mmbase/framework/BasicComponent.java
===================================================================
--- mmbase/trunk/src/org/mmbase/framework/BasicComponent.java   2009-05-18 
21:43:57 UTC (rev 35298)
+++ mmbase/trunk/src/org/mmbase/framework/BasicComponent.java   2009-05-18 
22:33:50 UTC (rev 35299)
@@ -71,6 +71,26 @@
         return description;
     }
 
+    /**
+     * EXPERIMENTAL. The Manifest of the jar in which this component is 
definied.
+     * @since MMBase-1.9.1
+     */
+    public java.util.jar.Manifest getManifest() {
+        if (uri != null) {
+            String[] parts = uri.toString().split("!", 2);
+            if (parts.length == 2) {
+                try {
+                    java.net.URL jarUrl = new java.net.URL(parts[0] + "!/");
+                    java.net.JarURLConnection jarConnection = 
(java.net.JarURLConnection)jarUrl.openConnection();
+                    return  jarConnection.getManifest();
+                } catch (Exception e) {
+                    log.warn(e);
+                }
+            }
+        }
+        return null;
+    }
+
     public void configure(Element el) {
         try {
             uri = new URI(el.getOwnerDocument().getDocumentURI());

_______________________________________________
Cvs mailing list
[email protected]
http://lists.mmbase.org/mailman/listinfo/cvs

Reply via email to