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


Java BundleWiring.getBundle方法代碼示例

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


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

示例1: weave

import org.osgi.framework.wiring.BundleWiring; //導入方法依賴的package包/類
@Override
public void weave(WovenClass wovenClass) {
    BundleWiring wiring = wovenClass.getBundleWiring();
    Bundle bundle = wiring.getBundle();
    ClassLoader cl = wiring.getClassLoader();
    Collection<ClassTransformer> transformersToTry = getTransformers(bundle);
    for (ClassTransformer transformer : transformersToTry) {
        if (transformClass(wovenClass, cl, transformer)) {
            LOGGER.info("Weaving " + wovenClass.getClassName() + " using " + transformer.getClass().getName());
            break;
        }
    }
    Class<?> dClass = wovenClass.getDefinedClass();
    if (transformersToTry.isEmpty() && dClass != null && dClass.getAnnotation(Entity.class) != null) {
        LOGGER.warn("Loading " + wovenClass.getClassName() + " before transformer is present");
    }
}
 
開發者ID:apache,項目名稱:aries-jpa,代碼行數:18,代碼來源:JPAWeavingHook.java

示例2: weave

import org.osgi.framework.wiring.BundleWiring; //導入方法依賴的package包/類
@Override
public void weave(WovenClass clazz) {
    try {
        if (transformers.isEmpty()) {
            return;
        }

        BundleWiring wiring = clazz.getBundleWiring();
        Bundle b = wiring.getBundle();

        ClassTransformer trfs[];
        synchronized (transformers) {
            Collection<ClassTransformer> list = transformers.get(b);
            if (list == null) {
                return;
            }
            trfs = list.toArray(new ClassTransformer[list.size()]);
        }
        LOGGER.info("Transforming {} with {}", clazz.getClassName(), Arrays.toString(trfs));
        for (ClassTransformer ctf : trfs) {
            if (ctf != null) {
                ctf.transform(wiring.getClassLoader(), clazz.getClassName(), clazz.getDefinedClass(),
                        clazz.getProtectionDomain(), clazz.getBytes());
            }
        }

        if (!imports.isEmpty()) {
            clazz.getDynamicImports().addAll(imports);
        }

    } catch (Exception e) {
        LOGGER.error("Error while weaving class {}", clazz.getClassName(), e);
    }
}
 
開發者ID:wisdom-framework,項目名稱:wisdom-jdbc,代碼行數:35,代碼來源:JPATransformer.java

示例3: weave

import org.osgi.framework.wiring.BundleWiring; //導入方法依賴的package包/類
@Override
public void weave(WovenClass clazz) {
	try {
		if (transformers.isEmpty())
			return;

		BundleWiring wiring = clazz.getBundleWiring();
		Bundle b = wiring.getBundle();

		ClassTransformer trfs[];
		synchronized (transformers) {
			List<ClassTransformer> list = transformers.get(b);
			if (list == null)
				return;
			trfs = list.toArray(empty);
		}
		System.out.println("transforming " + Arrays.toString(trfs) + " " + clazz);
		for (ClassTransformer ctf : trfs) {
			if (ctf != null) {
				ctf.transform(wiring.getClassLoader(), clazz.getClassName(), clazz.getDefinedClass(),
						clazz.getProtectionDomain(), clazz.getBytes());
			}

		}

		if (!imports.isEmpty())
			clazz.getDynamicImports().addAll(imports);

	} catch (Exception e) {
		// TODO Auto-generated catch block
		e.printStackTrace();
	}
}
 
開發者ID:osgi,項目名稱:bundles,代碼行數:34,代碼來源:TransformersHook.java

示例4: weave

import org.osgi.framework.wiring.BundleWiring; //導入方法依賴的package包/類
@Override
public void weave(WovenClass wovenClass) {

	BundleWiring bundleWiring = wovenClass.getBundleWiring();
	Bundle bundle = bundleWiring.getBundle();

	// ASUP project
	// TODO for performances reason, check a single file not directory
	if (bundle.getSymbolicName().startsWith("com.smeup.erp.gen") || bundle.getSymbolicName().startsWith("com.smeup.erp.ovr")) {
		completeClass(wovenClass);
	}
}
 
開發者ID:asupdev,項目名稱:asup,代碼行數:13,代碼來源:ASMProgramLoader.java

示例5: hasFile

import org.osgi.framework.wiring.BundleWiring; //導入方法依賴的package包/類
private boolean hasFile(BundleWiring wiring, String file) {
    Bundle bundle = wiring.getBundle();
    return bundle.getResource(file) != null;
}
 
開發者ID:motech,項目名稱:motech,代碼行數:5,代碼來源:ValidationWeavingHook.java


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