Ejemplo n.º 1
0
        public static void lazyDefinePackages(global::java.lang.ClassLoader _this)
        {
#if !FIRST_PASS
            AssemblyClassLoader_             wrapper  = (AssemblyClassLoader_)ClassLoaderWrapper.GetClassLoaderWrapper(_this);
            global::java.net.URL             sealBase = GetCodeBase(wrapper.MainAssembly);
            global::java.util.jar.Manifest   manifest = GetManifest(_this);
            global::java.util.jar.Attributes attr     = null;
            if (manifest != null)
            {
                attr = manifest.getMainAttributes();
            }
            string[] packages = wrapper.GetPackages();
            for (int i = 0; i < packages.Length; i++)
            {
                string name = packages[i];
                if (_this.getPackage(name) == null)
                {
                    global::java.util.jar.Attributes entryAttr = null;
                    if (manifest != null)
                    {
                        entryAttr = manifest.getAttributes(name.Replace('.', '/') + '/');
                    }
                    _this.definePackage(name,
                                        GetAttributeValue(global::java.util.jar.Attributes.Name.SPECIFICATION_TITLE, entryAttr, attr),
                                        GetAttributeValue(global::java.util.jar.Attributes.Name.SPECIFICATION_VERSION, entryAttr, attr),
                                        GetAttributeValue(global::java.util.jar.Attributes.Name.SPECIFICATION_VENDOR, entryAttr, attr),
                                        GetAttributeValue(global::java.util.jar.Attributes.Name.IMPLEMENTATION_TITLE, entryAttr, attr),
                                        GetAttributeValue(global::java.util.jar.Attributes.Name.IMPLEMENTATION_VERSION, entryAttr, attr),
                                        GetAttributeValue(global::java.util.jar.Attributes.Name.IMPLEMENTATION_VENDOR, entryAttr, attr),
                                        "true".Equals(GetAttributeValue(global::java.util.jar.Attributes.Name.SEALED, entryAttr, attr), StringComparison.OrdinalIgnoreCase) ? sealBase : null);
                }
            }
#endif
        }
Ejemplo n.º 2
0
        public static void lazyDefinePackages(global::java.lang.ClassLoader _this)
        {
#if !FIRST_PASS
            AssemblyClassLoader_ wrapper  = (AssemblyClassLoader_)ClassLoaderWrapper.GetClassLoaderWrapper(_this);
            global::java.net.URL sealBase = GetCodeBase(wrapper.MainAssembly);
            foreach (KeyValuePair <string, string[]> packages in wrapper.GetPackageInfo())
            {
                global::java.util.jar.Manifest   manifest = null;
                global::java.util.jar.Attributes attr     = null;
                if (packages.Key != null)
                {
                    global::java.util.jar.JarFile jarFile = new global::java.util.jar.JarFile(VirtualFileSystem.GetAssemblyResourcesPath(wrapper.MainAssembly) + packages.Key);
                    manifest = jarFile.getManifest();
                }
                if (manifest != null)
                {
                    attr = manifest.getMainAttributes();
                }
                foreach (string name in packages.Value)
                {
                    if (_this.getPackage(name) == null)
                    {
                        global::java.util.jar.Attributes entryAttr = null;
                        if (manifest != null)
                        {
                            entryAttr = manifest.getAttributes(name.Replace('.', '/') + '/');
                        }
                        _this.definePackage(name,
                                            GetAttributeValue(global::java.util.jar.Attributes.Name.SPECIFICATION_TITLE, entryAttr, attr),
                                            GetAttributeValue(global::java.util.jar.Attributes.Name.SPECIFICATION_VERSION, entryAttr, attr),
                                            GetAttributeValue(global::java.util.jar.Attributes.Name.SPECIFICATION_VENDOR, entryAttr, attr),
                                            GetAttributeValue(global::java.util.jar.Attributes.Name.IMPLEMENTATION_TITLE, entryAttr, attr),
                                            GetAttributeValue(global::java.util.jar.Attributes.Name.IMPLEMENTATION_VERSION, entryAttr, attr),
                                            GetAttributeValue(global::java.util.jar.Attributes.Name.IMPLEMENTATION_VENDOR, entryAttr, attr),
                                            "true".Equals(GetAttributeValue(global::java.util.jar.Attributes.Name.SEALED, entryAttr, attr), StringComparison.OrdinalIgnoreCase) ? sealBase : null);
                    }
                }
            }
#endif
        }