Activator.java 文件源码

java
阅读 29 收藏 0 点赞 0 评论 0

项目:aries-jpa 作者:
/**
 * 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]);
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号