private void addDynamicImportPackage(ImportPackageSpecification[] packages) { if (packages == null) return; List<String> dynamicImports = new ArrayList<String>(packages.length); for (int i = 0; i < packages.length; i++) if (ImportPackageSpecification.RESOLUTION_DYNAMIC.equals(packages[i].getDirective(Constants.RESOLUTION_DIRECTIVE))) dynamicImports.add(packages[i].getName()); if (dynamicImports.size() > 0) addDynamicImportPackage(dynamicImports.toArray(new String[dynamicImports.size()])); }
private void addDynamicImportPackage(ImportPackageSpecification[] packages) { if (packages == null) return; List<String> dynamicImports = new ArrayList<String>(packages.length); for (int i = 0; i < packages.length; i++) if (ImportPackageSpecification.RESOLUTION_DYNAMIC.equals(packages[i].getDirective(Constants.RESOLUTION_DIRECTIVE))) dynamicImports.add(packages[i].getName()); if (dynamicImports.size() > 0) addDynamicImportPackage(dynamicImports.toArray(new String[dynamicImports.size()])); }
private void addDynamicImportPackage(List<ModuleRequirement> packageImports) { if (packageImports == null || packageImports.isEmpty()) { return; } List<String> dynamicImports = new ArrayList<>(packageImports.size()); for (ModuleRequirement packageImport : packageImports) { if (PackageNamespace.RESOLUTION_DYNAMIC.equals(packageImport.getDirectives().get(PackageNamespace.REQUIREMENT_RESOLUTION_DIRECTIVE))) { Matcher matcher = PACKAGENAME_FILTER.matcher(packageImport.getDirectives().get(PackageNamespace.REQUIREMENT_FILTER_DIRECTIVE)); if (matcher.find()) { String dynamicName = matcher.group(1); if (dynamicName != null) { dynamicImports.add(dynamicName); } } } } if (dynamicImports.size() > 0) addDynamicImportPackage(dynamicImports.toArray(new String[dynamicImports.size()])); }
private void addDynamicImportPackage(List<ModuleRequirement> packageImports) { if (packageImports == null || packageImports.isEmpty()) { return; } List<String> dynamicImports = new ArrayList<String>(packageImports.size()); for (ModuleRequirement packageImport : packageImports) { if (PackageNamespace.RESOLUTION_DYNAMIC.equals(packageImport.getDirectives().get(PackageNamespace.REQUIREMENT_RESOLUTION_DIRECTIVE))) { Matcher matcher = PACKAGENAME_FILTER.matcher(packageImport.getDirectives().get(PackageNamespace.REQUIREMENT_FILTER_DIRECTIVE)); if (matcher.find()) { String dynamicName = matcher.group(1); if (dynamicName != null) { dynamicImports.add(dynamicName); } } } } if (dynamicImports.size() > 0) addDynamicImportPackage(dynamicImports.toArray(new String[dynamicImports.size()])); }
private void addDynamicImportPackage(List<ModuleRequirement> packageImports) { if (packageImports == null || packageImports.isEmpty()) { return; } List<String> dynamicImports = new ArrayList<>(packageImports.size()); for (ModuleRequirement packageImport : packageImports) { if (PackageNamespace.RESOLUTION_DYNAMIC.equals(packageImport.getDirectives().get(PackageNamespace.REQUIREMENT_RESOLUTION_DIRECTIVE))) { Matcher matcher = PACKAGENAME_FILTER.matcher(packageImport.getDirectives().get(PackageNamespace.REQUIREMENT_FILTER_DIRECTIVE)); if (matcher.find()) { String dynamicName = matcher.group(1); if (dynamicName != null) { dynamicImports.add(dynamicName); } } } } if (dynamicImports.size() > 0) addDynamicImportPackage(dynamicImports.toArray(new String[dynamicImports.size()])); }
private void addDynamicImportPackage(List<ModuleRequirement> packageImports) { if (packageImports == null || packageImports.isEmpty()) { return; } List<String> dynamicImports = new ArrayList<String>(packageImports.size()); for (ModuleRequirement packageImport : packageImports) { if (PackageNamespace.RESOLUTION_DYNAMIC.equals(packageImport.getDirectives().get(PackageNamespace.REQUIREMENT_RESOLUTION_DIRECTIVE))) { Matcher matcher = PACKAGENAME_FILTER.matcher(packageImport.getDirectives().get(PackageNamespace.REQUIREMENT_FILTER_DIRECTIVE)); if (matcher.find()) { String dynamicName = matcher.group(1); if (dynamicName != null) { dynamicImports.add(dynamicName); } } } } if (dynamicImports.size() > 0) addDynamicImportPackage(dynamicImports.toArray(new String[dynamicImports.size()])); }
private void addDynamicImportPackage(List<ModuleRequirement> packageImports) { if (packageImports == null || packageImports.isEmpty()) { return; } List<String> dynamicImports = new ArrayList<String>(packageImports.size()); for (ModuleRequirement packageImport : packageImports) { if (PackageNamespace.RESOLUTION_DYNAMIC.equals(packageImport.getDirectives().get(PackageNamespace.REQUIREMENT_RESOLUTION_DIRECTIVE))) { Matcher matcher = PACKAGENAME_FILTER.matcher(packageImport.getDirectives().get(PackageNamespace.REQUIREMENT_FILTER_DIRECTIVE)); if (matcher.find()) { String dynamicName = matcher.group(1); if (dynamicName != null) { dynamicImports.add(dynamicName); } } } } if (dynamicImports.size() > 0) addDynamicImportPackage(dynamicImports.toArray(new String[dynamicImports.size()])); }
private void addDynamicImportPackage(List<ModuleRequirement> packageImports) { if (packageImports == null || packageImports.isEmpty()) { return; } List<String> dynamicImports = new ArrayList<String>(packageImports.size()); for (ModuleRequirement packageImport : packageImports) { if (PackageNamespace.RESOLUTION_DYNAMIC.equals(packageImport.getDirectives().get(PackageNamespace.REQUIREMENT_RESOLUTION_DIRECTIVE))) { Matcher matcher = PACKAGENAME_FILTER.matcher(packageImport.getDirectives().get(PackageNamespace.REQUIREMENT_FILTER_DIRECTIVE)); if (matcher.find()) { String dynamicName = matcher.group(1); if (dynamicName != null) { dynamicImports.add(dynamicName); } } } } if (dynamicImports.size() > 0) addDynamicImportPackage(dynamicImports.toArray(new String[dynamicImports.size()])); }
addDynamicImportPackage(dynamicImports.toArray(new String[dynamicImports.size()]));
addDynamicImportPackage(dynamicImports.toArray(new String[dynamicImports.size()]));
addDynamicImportPackage(dynamicImports.toArray(new String[dynamicImports.size()]));
addDynamicImportPackage(dynamicImports.toArray(new String[dynamicImports.size()]));
/** * Adds a list of DynamicImport-Package manifest elements to the dynamic * import tables of this BundleLoader. Duplicate packages are checked and * not added again. * @param packages the DynamicImport-Package elements to add. */ public final synchronized void addDynamicImportPackage(ManifestElement[] packages) { if (packages == null) return; List<String> dynamicImports = new ArrayList<String>(packages.length); List<ImportPackageSpecification> dynamicImportSpecs = new ArrayList<ImportPackageSpecification>(packages.length); for (ManifestElement dynamicImportElement : packages) { String[] names = dynamicImportElement.getValueComponents(); for (String name : names) dynamicImports.add(name); StateBuilder.addImportPackages(dynamicImportElement, dynamicImportSpecs, 2, true); } if (dynamicImports.size() > 0) { addDynamicImportPackage(dynamicImports.toArray(new String[dynamicImports.size()])); BundleDescription revision = getLoaderProxy().getBundleDescription(); State state = revision.getContainingState(); state.addDynamicImportPackages(revision, dynamicImportSpecs.toArray(new ImportPackageSpecification[dynamicImportSpecs.size()])); } }
/** * Adds a list of DynamicImport-Package manifest elements to the dynamic * import tables of this BundleLoader. Duplicate packages are checked and * not added again. * @param packages the DynamicImport-Package elements to add. */ public final synchronized void addDynamicImportPackage(ManifestElement[] packages) { if (packages == null) return; List<String> dynamicImports = new ArrayList<String>(packages.length); List<ImportPackageSpecification> dynamicImportSpecs = new ArrayList<ImportPackageSpecification>(packages.length); for (ManifestElement dynamicImportElement : packages) { String[] names = dynamicImportElement.getValueComponents(); for (String name : names) dynamicImports.add(name); StateBuilder.addImportPackages(dynamicImportElement, dynamicImportSpecs, 2, true); } if (dynamicImports.size() > 0) { addDynamicImportPackage(dynamicImports.toArray(new String[dynamicImports.size()])); BundleDescription revision = getLoaderProxy().getBundleDescription(); State state = revision.getContainingState(); state.addDynamicImportPackages(revision, dynamicImportSpecs.toArray(new ImportPackageSpecification[dynamicImportSpecs.size()])); } }
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()); } }
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()); } }
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()); } }
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()); } }
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()); } }
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()); } }