Look for attributes in other manifests, if the first found does not contain them. QBE200501181900-BLD200501211627
authorpflaska@netbeans.org
Thu, 13 Jan 2005 14:50:18 +0000
changeset 16532d58f43d6894
parent 1652 83ad145a4050
child 1654 8e7a1f9943da
Look for attributes in other manifests, if the first found does not contain them.
Used when module jar is not used in the IDE.
mdr/jmiutils/src/org/netbeans/lib/jmi/util/MetamodelManager.java
     1.1 --- a/mdr/jmiutils/src/org/netbeans/lib/jmi/util/MetamodelManager.java	Thu Jan 06 15:19:34 2005 +0000
     1.2 +++ b/mdr/jmiutils/src/org/netbeans/lib/jmi/util/MetamodelManager.java	Thu Jan 13 14:50:18 2005 +0000
     1.3 @@ -12,8 +12,11 @@
     1.4   */
     1.5  package org.netbeans.lib.jmi.util;
     1.6  
     1.7 +import java.io.InputStream;
     1.8 +import java.net.URL;
     1.9  import java.util.Arrays;
    1.10  import java.util.Collection;
    1.11 +import java.util.Enumeration;
    1.12  import java.util.HashMap;
    1.13  import java.util.Iterator;
    1.14  import java.util.Map;
    1.15 @@ -79,6 +82,16 @@
    1.16                  Manifest mf = new Manifest(cls.getResourceAsStream("/META-INF/MANIFEST.MF"));
    1.17                  Attributes attrs = mf.getMainAttributes();
    1.18                  extentName = attrs.getValue("NBMDR-Metamodel");
    1.19 +                if (extentName == null) {
    1.20 +                    Enumeration e = cls.getClassLoader().getResources("META-INF/MANIFEST.MF");
    1.21 +                    while (e.hasMoreElements() && extentName == null) {
    1.22 +                        URL u = (URL) e.nextElement();
    1.23 +                        InputStream is = u.openStream();
    1.24 +                        mf = new Manifest(is);
    1.25 +                        attrs = mf.getMainAttributes();
    1.26 +                        extentName = attrs.getValue("NBMDR-Metamodel");
    1.27 +                    }
    1.28 +                }
    1.29                  fileName = "/" + attrs.getValue("NBMDR-Metamodel-File");
    1.30                  version = attrs.getValue("NBMDR-Metamodel-Version");
    1.31              } catch (java.io.IOException e) {