private static void initializeExports(List<ModuleCapability> exports, BundleLoaderSources sources, Collection<String> exportNames) { if (exports != null) { for (ModuleCapability export : exports) { String name = (String) export.getAttributes().get(PackageNamespace.PACKAGE_NAMESPACE); if (sources.forceSourceCreation(export)) { if (!exportNames.contains(name)) { // must force filtered and reexport sources to be created early // to prevent lazy normal package source creation. // We only do this for the first export of a package name. sources.createPackageSource(export, true); } } exportNames.add(name); } } }
public final PackageSource getPackageSource(String pkgName) { PackageSource result = findSource(pkgName); if (!isExportedPackage(pkgName)) return result; // if the package is exported then we need to get the local source PackageSource localSource = exportSources.getPackageSource(pkgName); if (result == null) return localSource; if (localSource == null) return result; return createMultiSource(pkgName, new PackageSource[] {result, localSource}); }
final PackageSource createExportPackageSource(ModuleWire importWire, Collection<BundleLoader> visited) { String name = (String) importWire.getCapability().getAttributes().get(PackageNamespace.PACKAGE_NAMESPACE); BundleLoader providerLoader = getProviderLoader(importWire); if (providerLoader == null) { return createMultiSource(name, new PackageSource[0]); } PackageSource requiredSource = providerLoader.findRequiredSource(name, visited); PackageSource exportSource = providerLoader.exportSources.createPackageSource(importWire.getCapability(), false); if (requiredSource == null) return exportSource; return createMultiSource(name, new PackageSource[] {requiredSource, exportSource}); }
public BundleLoader(ModuleWiring wiring, EquinoxContainer container, ClassLoader parent) { this.wiring = wiring; this.container = container; this.debug = container.getConfiguration().getDebug(); this.parent = parent; // init the provided packages set exportSources = new BundleLoaderSources(this); List<ModuleCapability> exports = wiring.getModuleCapabilities(PackageNamespace.PACKAGE_NAMESPACE); exports = exports == null ? new ArrayList<ModuleCapability>(0) : exports; exportedPackages = Collections.synchronizedCollection(exports.size() > 10 ? new HashSet<String>(exports.size()) : new ArrayList<String>(exports.size())); initializeExports(exports, exportSources, exportedPackages); // init the dynamic imports tables addDynamicImportPackage(wiring.getModuleRequirements(PackageNamespace.PACKAGE_NAMESPACE)); // initialize the required bundle wires List<ModuleWire> currentRequireBundleWires = wiring.getRequiredModuleWires(BundleNamespace.BUNDLE_NAMESPACE); requiredBundleWires = currentRequireBundleWires == null || currentRequireBundleWires.isEmpty() ? Collections.<ModuleWire> emptyList() : Collections.unmodifiableList(currentRequireBundleWires); //Initialize the policy handler List<ModuleCapability> moduleDatas = wiring.getRevision().getModuleCapabilities(EquinoxModuleDataNamespace.MODULE_DATA_NAMESPACE); @SuppressWarnings("unchecked") List<String> buddyList = (List<String>) (moduleDatas.isEmpty() ? null : moduleDatas.get(0).getAttributes().get(EquinoxModuleDataNamespace.CAPABILITY_BUDDY_POLICY)); policy = buddyList != null ? new PolicyHandler(this, buddyList, container.getPackageAdmin()) : null; if (policy != null) { Module systemModule = container.getStorage().getModuleContainer().getModule(0); Bundle systemBundle = systemModule.getBundle(); policy.open(systemBundle.getBundleContext()); } }
final PackageSource createExportPackageSource(ModuleWire importWire, Collection<BundleLoader> visited) { String name = (String) importWire.getCapability().getAttributes().get(PackageNamespace.PACKAGE_NAMESPACE); BundleLoader providerLoader = (BundleLoader) importWire.getProviderWiring().getModuleLoader(); if (providerLoader == null) { return createMultiSource(name, new PackageSource[0]); } PackageSource requiredSource = providerLoader.findRequiredSource(name, visited); PackageSource exportSource = providerLoader.exportSources.createPackageSource(importWire.getCapability(), false); if (requiredSource == null) return exportSource; return createMultiSource(name, new PackageSource[] {requiredSource, exportSource}); }
public BundleLoader(ModuleWiring wiring, EquinoxContainer container, ClassLoader parent) { this.wiring = wiring; this.container = container; this.debug = container.getConfiguration().getDebug(); this.parent = parent; // init the provided packages set exportSources = new BundleLoaderSources(this); List<ModuleCapability> exports = wiring.getModuleCapabilities(PackageNamespace.PACKAGE_NAMESPACE); exports = exports == null ? new ArrayList<ModuleCapability>(0) : exports; exportedPackages = Collections.synchronizedCollection(exports.size() > 10 ? new HashSet<String>(exports.size()) : new ArrayList<String>(exports.size())); initializeExports(exports, exportSources, exportedPackages); // init the dynamic imports tables addDynamicImportPackage(wiring.getModuleRequirements(PackageNamespace.PACKAGE_NAMESPACE)); // initialize the required bundle wires List<ModuleWire> currentRequireBundleWires = wiring.getRequiredModuleWires(BundleNamespace.BUNDLE_NAMESPACE); requiredBundleWires = currentRequireBundleWires == null || currentRequireBundleWires.isEmpty() ? Collections.<ModuleWire> emptyList() : Collections.unmodifiableList(currentRequireBundleWires); //Initialize the policy handler List<ModuleCapability> moduleDatas = wiring.getRevision().getModuleCapabilities(EquinoxModuleDataNamespace.MODULE_DATA_NAMESPACE); @SuppressWarnings("unchecked") List<String> buddyList = (List<String>) (moduleDatas.isEmpty() ? null : moduleDatas.get(0).getAttributes().get(EquinoxModuleDataNamespace.CAPABILITY_BUDDY_POLICY)); policy = buddyList != null ? new PolicyHandler(this, buddyList, container.getPackageAdmin()) : null; if (policy != null) { Module systemModule = container.getStorage().getModuleContainer().getModule(0); Bundle systemBundle = systemModule.getBundle(); policy.open(systemBundle.getBundleContext()); } }
private static void initializeExports(List<ModuleCapability> exports, BundleLoaderSources sources, Collection<String> exportNames) { if (exports != null) { for (ModuleCapability export : exports) { String name = (String) export.getAttributes().get(PackageNamespace.PACKAGE_NAMESPACE); if (sources.forceSourceCreation(export)) { if (!exportNames.contains(name)) { // must force filtered and reexport sources to be created early // to prevent lazy normal package source creation. // We only do this for the first export of a package name. sources.createPackageSource(export, true); } } exportNames.add(name); } } }
public final PackageSource getPackageSource(String pkgName) { PackageSource result = findSource(pkgName); if (!isExportedPackage(pkgName)) return result; // if the package is exported then we need to get the local source PackageSource localSource = exportSources.getPackageSource(pkgName); if (result == null) return localSource; if (localSource == null) return result; return createMultiSource(pkgName, new PackageSource[] {result, localSource}); }
final PackageSource createExportPackageSource(ModuleWire importWire, Collection<BundleLoader> visited) { String name = (String) importWire.getCapability().getAttributes().get(PackageNamespace.PACKAGE_NAMESPACE); BundleLoader providerLoader = (BundleLoader) importWire.getProviderWiring().getModuleLoader(); if (providerLoader == null) { return createMultiSource(name, new PackageSource[0]); } PackageSource requiredSource = providerLoader.findRequiredSource(name, visited); PackageSource exportSource = providerLoader.exportSources.createPackageSource(importWire.getCapability(), false); if (requiredSource == null) return exportSource; return createMultiSource(name, new PackageSource[] {requiredSource, exportSource}); }
public BundleLoader(ModuleWiring wiring, EquinoxContainer container, ClassLoader parent) { this.wiring = wiring; this.container = container; this.debug = container.getConfiguration().getDebug(); this.parent = parent; // init the provided packages set exportSources = new BundleLoaderSources(this); List<ModuleCapability> exports = wiring.getModuleCapabilities(PackageNamespace.PACKAGE_NAMESPACE); exports = exports == null ? new ArrayList<ModuleCapability>(0) : exports; exportedPackages = Collections.synchronizedCollection(exports.size() > 10 ? new HashSet<String>(exports.size()) : new ArrayList<String>(exports.size())); initializeExports(exports, exportSources, exportedPackages); // init the dynamic imports tables addDynamicImportPackage(wiring.getModuleRequirements(PackageNamespace.PACKAGE_NAMESPACE)); // initialize the required bundle wires List<ModuleWire> currentRequireBundleWires = wiring.getRequiredModuleWires(BundleNamespace.BUNDLE_NAMESPACE); requiredBundleWires = currentRequireBundleWires == null || currentRequireBundleWires.isEmpty() ? Collections.<ModuleWire> emptyList() : Collections.unmodifiableList(currentRequireBundleWires); //Initialize the policy handler List<ModuleCapability> moduleDatas = wiring.getRevision().getModuleCapabilities(EquinoxModuleDataNamespace.MODULE_DATA_NAMESPACE); @SuppressWarnings("unchecked") List<String> buddyList = (List<String>) (moduleDatas.isEmpty() ? null : moduleDatas.get(0).getAttributes().get(EquinoxModuleDataNamespace.CAPABILITY_BUDDY_POLICY)); policy = buddyList != null ? new PolicyHandler(this, buddyList, container.getPackageAdmin()) : null; if (policy != null) { Module systemModule = container.getStorage().getModuleContainer().getModule(0); Bundle systemBundle = systemModule.getBundle(); policy.open(systemBundle.getBundleContext()); } }
private static void initializeExports(List<ModuleCapability> exports, BundleLoaderSources sources, Collection<String> exportNames) { if (exports != null) { for (ModuleCapability export : exports) { String name = (String) export.getAttributes().get(PackageNamespace.PACKAGE_NAMESPACE); if (sources.forceSourceCreation(export)) { if (!exportNames.contains(name)) { // must force filtered and reexport sources to be created early // to prevent lazy normal package source creation. // We only do this for the first export of a package name. sources.createPackageSource(export, true); } } exportNames.add(name); } } }
public final PackageSource getPackageSource(String pkgName) { PackageSource result = findSource(pkgName); if (!isExportedPackage(pkgName)) return result; // if the package is exported then we need to get the local source PackageSource localSource = exportSources.getPackageSource(pkgName); if (result == null) return localSource; if (localSource == null) return result; return createMultiSource(pkgName, new PackageSource[] {result, localSource}); }
final PackageSource createExportPackageSource(ModuleWire importWire, Collection<BundleLoader> visited) { String name = (String) importWire.getCapability().getAttributes().get(PackageNamespace.PACKAGE_NAMESPACE); BundleLoader providerLoader = (BundleLoader) importWire.getProviderWiring().getModuleLoader(); if (providerLoader == null) { return createMultiSource(name, new PackageSource[0]); } PackageSource requiredSource = providerLoader.findRequiredSource(name, visited); PackageSource exportSource = providerLoader.exportSources.createPackageSource(importWire.getCapability(), false); if (requiredSource == null) return exportSource; return createMultiSource(name, new PackageSource[] {requiredSource, exportSource}); }
public BundleLoader(ModuleWiring wiring, EquinoxContainer container, ClassLoader parent) { this.wiring = wiring; this.container = container; this.debug = container.getConfiguration().getDebug(); this.parent = parent; // init the provided packages set exportSources = new BundleLoaderSources(this); List<ModuleCapability> exports = wiring.getModuleCapabilities(PackageNamespace.PACKAGE_NAMESPACE); exports = exports == null ? new ArrayList<ModuleCapability>(0) : exports; exportedPackages = Collections.synchronizedCollection(exports.size() > 10 ? new HashSet<String>(exports.size()) : new ArrayList<String>(exports.size())); initializeExports(exports, exportSources, exportedPackages); // init the dynamic imports tables addDynamicImportPackage(wiring.getModuleRequirements(PackageNamespace.PACKAGE_NAMESPACE)); // initialize the required bundle wires List<ModuleWire> currentRequireBundleWires = wiring.getRequiredModuleWires(BundleNamespace.BUNDLE_NAMESPACE); requiredBundleWires = currentRequireBundleWires == null || currentRequireBundleWires.isEmpty() ? Collections.<ModuleWire> emptyList() : Collections.unmodifiableList(currentRequireBundleWires); //Initialize the policy handler List<ModuleCapability> moduleDatas = wiring.getRevision().getModuleCapabilities(EquinoxModuleDataNamespace.MODULE_DATA_NAMESPACE); @SuppressWarnings("unchecked") List<String> buddyList = (List<String>) (moduleDatas.isEmpty() ? null : moduleDatas.get(0).getAttributes().get(EquinoxModuleDataNamespace.CAPABILITY_BUDDY_POLICY)); policy = buddyList != null ? new PolicyHandler(this, buddyList, container.getPackageAdmin()) : null; if (policy != null) { Module systemModule = container.getStorage().getModuleContainer().getModule(0); Bundle systemBundle = systemModule.getBundle(); policy.open(systemBundle.getBundleContext()); } }
private static void initializeExports(List<ModuleCapability> exports, BundleLoaderSources sources, Collection<String> exportNames) { if (exports != null) { for (ModuleCapability export : exports) { String name = (String) export.getAttributes().get(PackageNamespace.PACKAGE_NAMESPACE); if (sources.forceSourceCreation(export)) { if (!exportNames.contains(name)) { // must force filtered and reexport sources to be created early // to prevent lazy normal package source creation. // We only do this for the first export of a package name. sources.createPackageSource(export, true); } } exportNames.add(name); } } }
public final PackageSource getPackageSource(String pkgName) { PackageSource result = findSource(pkgName); if (!isExportedPackage(pkgName)) return result; // if the package is exported then we need to get the local source PackageSource localSource = exportSources.getPackageSource(pkgName); if (result == null) return localSource; if (localSource == null) return result; return createMultiSource(pkgName, new PackageSource[] {result, localSource}); }
final PackageSource createExportPackageSource(ModuleWire importWire, Collection<BundleLoader> visited) { String name = (String) importWire.getCapability().getAttributes().get(PackageNamespace.PACKAGE_NAMESPACE); BundleLoader providerLoader = (BundleLoader) importWire.getProviderWiring().getModuleLoader(); if (providerLoader == null) { return createMultiSource(name, new PackageSource[0]); } PackageSource requiredSource = providerLoader.findRequiredSource(name, visited); PackageSource exportSource = providerLoader.exportSources.createPackageSource(importWire.getCapability(), false); if (requiredSource == null) return exportSource; return createMultiSource(name, new PackageSource[] {requiredSource, exportSource}); }
public BundleLoader(ModuleWiring wiring, EquinoxContainer container, ClassLoader parent) { this.wiring = wiring; this.container = container; this.debug = container.getConfiguration().getDebug(); this.parent = parent; // init the provided packages set exportSources = new BundleLoaderSources(this); List<ModuleCapability> exports = wiring.getModuleCapabilities(PackageNamespace.PACKAGE_NAMESPACE); exports = exports == null ? new ArrayList<ModuleCapability>(0) : exports; exportedPackages = Collections.synchronizedCollection(exports.size() > 10 ? new HashSet<String>(exports.size()) : new ArrayList<String>(exports.size())); initializeExports(exports, exportSources, exportedPackages); // init the dynamic imports tables addDynamicImportPackage(wiring.getModuleRequirements(PackageNamespace.PACKAGE_NAMESPACE)); // initialize the required bundle wires List<ModuleWire> currentRequireBundleWires = wiring.getRequiredModuleWires(BundleNamespace.BUNDLE_NAMESPACE); requiredBundleWires = currentRequireBundleWires == null || currentRequireBundleWires.isEmpty() ? Collections.<ModuleWire> emptyList() : Collections.unmodifiableList(currentRequireBundleWires); //Initialize the policy handler List<ModuleCapability> moduleDatas = wiring.getRevision().getModuleCapabilities(EquinoxModuleDataNamespace.MODULE_DATA_NAMESPACE); @SuppressWarnings("unchecked") List<String> buddyList = (List<String>) (moduleDatas.isEmpty() ? null : moduleDatas.get(0).getAttributes().get(EquinoxModuleDataNamespace.CAPABILITY_BUDDY_POLICY)); policy = buddyList != null ? new PolicyHandler(this, buddyList, container.getPackageAdmin()) : null; if (policy != null) { Module systemModule = container.getStorage().getModuleContainer().getModule(0); Bundle systemBundle = systemModule.getBundle(); policy.open(systemBundle.getBundleContext()); } }
private static void initializeExports(List<ModuleCapability> exports, BundleLoaderSources sources, Collection<String> exportNames) { if (exports != null) { for (ModuleCapability export : exports) { String name = (String) export.getAttributes().get(PackageNamespace.PACKAGE_NAMESPACE); if (sources.forceSourceCreation(export)) { if (!exportNames.contains(name)) { // must force filtered and reexport sources to be created early // to prevent lazy normal package source creation. // We only do this for the first export of a package name. sources.createPackageSource(export, true); } } exportNames.add(name); } } }
public final PackageSource getPackageSource(String pkgName) { PackageSource result = findSource(pkgName); if (!isExportedPackage(pkgName)) return result; // if the package is exported then we need to get the local source PackageSource localSource = exportSources.getPackageSource(pkgName); if (result == null) return localSource; if (localSource == null) return result; return createMultiSource(pkgName, new PackageSource[] {result, localSource}); }