當前位置: 首頁>>代碼示例>>Java>>正文


Java BundleWiring.getProvidedWires方法代碼示例

本文整理匯總了Java中org.osgi.framework.wiring.BundleWiring.getProvidedWires方法的典型用法代碼示例。如果您正苦於以下問題:Java BundleWiring.getProvidedWires方法的具體用法?Java BundleWiring.getProvidedWires怎麽用?Java BundleWiring.getProvidedWires使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.osgi.framework.wiring.BundleWiring的用法示例。


在下文中一共展示了BundleWiring.getProvidedWires方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: getJPAPackages

import org.osgi.framework.wiring.BundleWiring; //導入方法依賴的package包/類
/**
 * Get all the relevant packages that the EclipseLink JPA provider exports or persistence packages it uses itself. These are needed
 * so that the woven proxy (for runtime enhancement) can be used later on :)
 * 
 * Note that differently to OpenJPA the relevant classes are actually in more than just one bundle (org.eclipse.persistence.jpa and org.eclipse.persistence.core
 * at the time of this writing). Hence, we have to take more than just the packages of the JPA provider bundle into account ...
 * 
 * @param jpaBundle
 * @return
 */
private String[] getJPAPackages(Bundle jpaBundle) {
    Set<String> result = new HashSet<String>();

    for (Bundle b : context.getBundles()) {
        BundleWiring bw = b.adapt(BundleWiring.class);
        if (bw == null) {
            continue;
        }
        boolean isJpaBundle = b.equals(jpaBundle);
        List<BundleWire> wires = bw.getProvidedWires(BundleRevision.PACKAGE_NAMESPACE);
        for (BundleWire w : wires) {
            String pkgName = (String)w.getCapability().getAttributes().get(BundleRevision.PACKAGE_NAMESPACE);
            boolean add = isJpaBundle || pkgName.startsWith("org.eclipse.persistence");
            if (add) {
                result.add(getPkg(b, pkgName));
            }
        }
    }
    
    result.add(getPkg(context.getBundle(), "org.apache.aries.jpa.eclipselink.adapter.platform"));
    LOG.debug("Found JPA packages {}", result);
    return result.toArray(new String[0]);
}
 
開發者ID:apache,項目名稱:aries-jpa,代碼行數:34,代碼來源:Activator.java

示例2: getInUseBundleWirings

import org.osgi.framework.wiring.BundleWiring; //導入方法依賴的package包/類
private Set<BundleWiring> getInUseBundleWirings() {
	Set<BundleWiring> wirings = new HashSet<>();
	Collection<BundleCapability> bundles = fwkWiring.findProviders(ALL_BUNDLES_REQUIREMENT);
	for (BundleCapability bundleCap : bundles) {
		// Only pay attention to non JPMS boot modules.
		// NOTE this means we will not create a real JPMS Module or Layer for this bundle
		if (bundleCap.getAttributes().get(BOOT_JPMS_MODULE) == null) {
			BundleRevision revision = bundleCap.getRevision();
			BundleWiring wiring = revision.getWiring();
			if (wiring != null && wiring.isInUse()) {
				wirings.add(wiring);
			}
			if (revision.getBundle().getBundleId() == 0) {
				// also store the system.bundle fragments because they may have exports unknown to JPMS
				List<BundleWire> hostWires = wiring.getProvidedWires(HostNamespace.HOST_NAMESPACE);
				for (BundleWire hostWire : hostWires) {
					wirings.add(hostWire.getRequirerWiring());
				}
			}
		}
	}
	return wirings;
}
 
開發者ID:tjwatson,項目名稱:osgi-jpms-layer,代碼行數:24,代碼來源:LayerFactoryImpl.java

示例3: calculateImporters

import org.osgi.framework.wiring.BundleWiring; //導入方法依賴的package包/類
private void calculateImporters() {
    importers.clear();
    synchronized (importers) {
        // calculate importers
        Bundle bundle = m_bundleCapability.getRevision().getBundle();
        if (bundle != null) {
            BundleWiring wiring = bundle.adapt(BundleWiring.class);
            if (wiring != null) {
                List<BundleWire> wires = wiring.getProvidedWires(PACKAGE_NAMESPACE);
                if (wires != null) {
                    for (BundleWire wire : wires) {
                        if (wire.getCapability().equals(m_bundleCapability)) {
                            Bundle requirerBundle = wire.getRequirerWiring().getBundle();
                            importers.add(requirerBundle);
                        }
                    }
                }
            }
        }
    }
}
 
開發者ID:ow2-chameleon,項目名稱:everest,代碼行數:22,代碼來源:PackageResource.java

示例4: BundleWiringLastModified

import org.osgi.framework.wiring.BundleWiring; //導入方法依賴的package包/類
public BundleWiringLastModified(BundleWiring hostWiring) {
	// get the host last modified
	if (hostWiring.isCurrent()) {
		// use the current bundle id and last modified
		lastModifieds.put(hostWiring.getBundle().getBundleId(), hostWiring.getBundle().getLastModified());
	} else {
		// use a unique negative id to indicate not current
		lastModifieds.put(nextNotCurrentID.getAndDecrement(), hostWiring.getBundle().getLastModified());
	}
	for (BundleWire hostWire : hostWiring.getProvidedWires(HostNamespace.HOST_NAMESPACE)) {
		// Always use the fragment id and last modified.
		// It makes no difference if it is current or not because the host wiring indicates that. 
		lastModifieds.put(hostWire.getRequirer().getBundle().getBundleId(), hostWire.getRequirer().getBundle().getLastModified());
	}
}
 
開發者ID:tjwatson,項目名稱:osgi-jpms-layer,代碼行數:16,代碼來源:BundleWiringLastModified.java

示例5: getChildBundles

import org.osgi.framework.wiring.BundleWiring; //導入方法依賴的package包/類
/**
 * Retrieves the set of bundles dependent of given bundle.
 * 
 * @param bundle
 *            target bundle
 * @return set of child bundles
 */
public static Set<Bundle> getChildBundles(Bundle bundle) {
	BundleWiring wiring = bundle.adapt(BundleWiring.class);

	Set<Bundle> dependencies = new HashSet<Bundle>();

	if (wiring != null) {
		for (BundleWire requiredWire : wiring.getProvidedWires(null)) {
			dependencies.add(requiredWire.getRequirerWiring().getBundle());
		}
	}

	return dependencies;
}
 
開發者ID:dana-i2cat,項目名稱:mqnaas,代碼行數:21,代碼來源:BundleUtils.java

示例6: BundleCapabilityResource

import org.osgi.framework.wiring.BundleWiring; //導入方法依賴的package包/類
/**
 * Constructor for bundle capability resource
 *
 * @param path
 * @param bundleCapability
 */
public BundleCapabilityResource(Path path, BundleWiring hostWiring, BundleCapability bundleCapability) {
    super(path.addElements(uniqueCapabilityId(bundleCapability)));
    m_capability = bundleCapability;
    isPackage = m_capability.getNamespace().equals(OsgiResourceUtils.PackageNamespace.PACKAGE_NAMESPACE);
    List<Relation> relations = new ArrayList<Relation>();
    // calculate wires coming from this capability
    BundleRevision revision = m_capability.getRevision();
    if (revision != null) {
        String bundleId = Long.toString(revision.getBundle().getBundleId());
        //BundleWiring wiring = revision.getWiring();
        BundleWiring wiring = hostWiring;
        if (wiring != null) {
            List<BundleWire> allWires = wiring.getProvidedWires(m_capability.getNamespace());
            for (BundleWire wire : allWires) {
                if (wire.getCapability().equals(m_capability)) {
                    // and add a relation link
                    m_wires.add(wire);
                    String wireId = uniqueWireId(wire);
                    Path wirePath = BundleResourceManager.getInstance().getPath().addElements(Long.toString(hostWiring.getBundle().getBundleId()),
                            BundleResource.WIRES_PATH,
                            wireId
                    );
                    relations.add(new DefaultRelation(wirePath, Action.READ, wireId));
                }
            }
        }

        if (isPackage) {
            // add relation to package
            String packageId = uniqueCapabilityId(m_capability);
            Path packagePath = PackageResourceManager.getInstance().getPath().addElements(packageId);
            relations.add(new DefaultRelation(packagePath, Action.READ, PACKAGE_RELATION));
            // add relation to bundle export package header
            Path exportPackagePath = BundleResourceManager.getInstance().getPath()
                    .addElements(bundleId, BundleHeadersResource.HEADERS_PATH, BundleHeadersResource.EXPORT_PACKAGE, packageId);
            relations.add(new DefaultRelation(exportPackagePath, Action.READ, BundleHeadersResource.EXPORT_PACKAGE));
        }
        setRelations(relations);
    }
}
 
開發者ID:ow2-chameleon,項目名稱:everest,代碼行數:47,代碼來源:BundleCapabilityResource.java


注:本文中的org.osgi.framework.wiring.BundleWiring.getProvidedWires方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。