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


Java BundleWiring.getClassLoader方法代碼示例

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


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

示例1: processClass

import org.osgi.framework.wiring.BundleWiring; //導入方法依賴的package包/類
@Override
public byte[] processClass(String className, byte[] bytes, ClasspathEntry ce, BundleEntry be, ClasspathManager cm) {
    final BaseData bd = ce.getBaseData();
    if (bd == null) {
        return bytes;
    }
    final Bundle b = bd.getBundle();
    if (b == null) {
        return bytes;
    }
    BundleWiring w = b.adapt(org.osgi.framework.wiring.BundleWiring.class);
    if (w == null) {
        return bytes;
    }
    ClassLoader loader = w.getClassLoader();
    return archive.patchByteCode(loader, className, ce.getDomain(), bytes);
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:18,代碼來源:NetbinoxHooks.java

示例2: 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

示例3: addingService

import org.osgi.framework.wiring.BundleWiring; //導入方法依賴的package包/類
@Override
public ServiceTracker
	<CXFJaxRsServiceRegistrator, ?>
addingService(ServiceReference<Object> reference) {

	String applicationSelector =
		reference.getProperty("jaxrs.application.select").toString();

	Bundle bundle = reference.getBundle();

	BundleWiring bundleWiring = bundle.adapt(BundleWiring.class);

	ClassLoader classLoader = bundleWiring.getClassLoader();

	Object service = _bundleContext.getService(reference);

	try {
		Filter filter = _bundleContext.createFilter(
			"(&(objectClass=" + CXFJaxRsServiceRegistrator.class.getName() +
				")" + applicationSelector + ")");

		ServiceTracker
			<CXFJaxRsServiceRegistrator, ?>
			serviceTracker = new ServiceTracker<>(
				_bundleContext, filter,
				new AddonsServiceTrackerCustomizer(
					_bundleContext, classLoader, service));

		serviceTracker.open();

		return serviceTracker;
	}
	catch (InvalidSyntaxException ise) {
		_bundleContext.ungetService(reference);

		throw new RuntimeException(ise);
	}
}
 
開發者ID:csierra,項目名稱:osgi-jaxrs-extracted,代碼行數:39,代碼來源:ServicesServiceTrackerCustomizer.java

示例4: createBus

import org.osgi.framework.wiring.BundleWiring; //導入方法依賴的package包/類
private ExtensionManagerBus createBus() {
    BundleWiring wiring = _bundleContext.getBundle().adapt(
        BundleWiring.class);

    @SuppressWarnings("unchecked")
    Map<String, Object> properties = new HashMap<>(_configurationMap);

    ExtensionManagerBus bus = new ExtensionManagerBus(
        null, properties, wiring.getClassLoader());

    bus.initialize();

    return bus;
}
 
開發者ID:apache,項目名稱:aries-jax-rs-whiteboard,代碼行數:15,代碼來源:Whiteboard.java

示例5: unregisterBundleJDOClasses

import org.osgi.framework.wiring.BundleWiring; //導入方法依賴的package包/類
/**
 * Unregisters all entity classes registered to JDO that are accessible from bundle class loader. This method
 * should be called after bundle that registers MDS entities gets unresolved, so that they are removed from
 * JDO cache. Not doing this might produce hard to track exception when refreshing MDS Entities Bundle after
 * bundle removal.
 *
 * @param bundle the bundle for which entity classes are to be unregistered
 */
public static void unregisterBundleJDOClasses(Bundle bundle) {
    BundleWiring bundleWiring = bundle.adapt(BundleWiring.class);
    if (null == bundleWiring) {
        LOGGER.warn("Cannot unregister JDO entity classes: bundle wiring for {} bundle is unavailable.",
                bundle.getSymbolicName());
    } else {
        ClassLoader bundleClassLoader = bundleWiring.getClassLoader();
        getJDOImplHelper().unregisterClasses(bundleClassLoader);
        LOGGER.info("Unregistered JDO entity classes for bundle {}.", bundle.getSymbolicName());
    }
}
 
開發者ID:motech,項目名稱:motech,代碼行數:20,代碼來源:MdsBundleHelper.java

示例6: getClassLoader

import org.osgi.framework.wiring.BundleWiring; //導入方法依賴的package包/類
@Override
public ClassLoader getClassLoader(String componentName, String componentVersion,
                                  ComponentReference componentReference) {
    Bundle bundle = getBundle(componentName, componentVersion, componentReference);
    BundleWiring bundleWiring = bundle.adapt(BundleWiring.class);
    return bundleWiring.getClassLoader();
}
 
開發者ID:wso2-attic,項目名稱:carbon-uuf,代碼行數:8,代碼來源:BundleClassLoaderProvider.java

示例7: getBundleClassLoader

import org.osgi.framework.wiring.BundleWiring; //導入方法依賴的package包/類
private ClassLoader getBundleClassLoader() {
	BundleContext bundleContext = FrameworkUtil.getBundle(Main.class).getBundleContext();
	
	Bundle bundle = bundleContext.getBundle();
	BundleWiring bundleWiring = bundle.adapt(BundleWiring.class);
	ClassLoader classLoader = bundleWiring.getClassLoader();
	
	return classLoader;
}
 
開發者ID:thingtrack,項目名稱:konekti,代碼行數:10,代碼來源:Main.java

示例8: installModule

import org.osgi.framework.wiring.BundleWiring; //導入方法依賴的package包/類
private Module installModule(Bundle bundle) {

        Module module = getModule(bundle.getBundleId());
        if (module != null)
            return module;

        BundleWiring wiring = bundle.adapt(BundleWiring.class);
        ClassLoader classLoader = wiring != null ? wiring.getClassLoader() : null;
        if (classLoader == null)
            return null;

        Resource resource = ThreadResourceAssociation.getResource();
        Dictionary<String, String> headers = bundle.getHeaders();
        if (resource == null) {
            ResourceBuilder builder = new DictionaryResourceBuilder().load(headers);
            if (builder.isValid() == false) {
                String symbolicName = bundle.getSymbolicName();
                String version = bundle.getVersion().toString();
                builder.addIdentityCapability(symbolicName, version);
            }
            resource = builder.getResource();
        }

        try {
            module = installModule(classLoader, resource, headers);
        } catch (ModuleException ex) {
            LOGGER.error("Cannot install module from: " + bundle, ex);
        }

        return module;
    }
 
開發者ID:tdiesler,項目名稱:gravia,代碼行數:32,代碼來源:OSGiRuntime.java

示例9: getBundleLoader

import org.osgi.framework.wiring.BundleWiring; //導入方法依賴的package包/類
private static ClassLoader getBundleLoader(String name) {
Bundle bundle = Platform.getBundle(name);
BundleWiring bundleWiring = bundle.adapt(BundleWiring.class);
return bundleWiring.getClassLoader();
}
 
開發者ID:eclipse,項目名稱:scanning,代碼行數:6,代碼來源:JythonInterpreterManager.java

示例10: toClassLoader

import org.osgi.framework.wiring.BundleWiring; //導入方法依賴的package包/類
@Override
public ClassLoader toClassLoader() {
    final Bundle bundle = this.context.getBundle();
    final BundleWiring bundleWiring = bundle.adapt(BundleWiring.class);
    return bundleWiring.getClassLoader();
}
 
開發者ID:ventilb,項目名稱:stagediver.fx-database,代碼行數:7,代碼來源:BundleResourceAccessorImpl.java


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