本文整理匯總了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");
}
}
示例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);
}
}
示例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();
}
}
示例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);
}
}
示例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;
}