• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java RequiredCapabilityListener类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.wso2.carbon.kernel.startupresolver.RequiredCapabilityListener的典型用法代码示例。如果您正苦于以下问题:Java RequiredCapabilityListener类的具体用法?Java RequiredCapabilityListener怎么用?Java RequiredCapabilityListener使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



RequiredCapabilityListener类属于org.wso2.carbon.kernel.startupresolver包,在下文中一共展示了RequiredCapabilityListener类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: addRequiredCapabilityListener

import org.wso2.carbon.kernel.startupresolver.RequiredCapabilityListener; //导入依赖的package包/类
/**
 * Adds the available {@code RequiredCapabilityListener} OSGi service to the specified startup component.
 * <p>
 * This service is required to notify the component when all of its required capabilities are available.
 *
 * @param listener      {@code RequiredCapabilityListener} service object.
 * @param componentName the component name to which this listener is added.
 * @param bundle        the bundle from which this listener service is registered.
 */
void addRequiredCapabilityListener(RequiredCapabilityListener listener, String componentName, Bundle bundle) {
    StartupComponent startupComponent = startupComponentMap.get(componentName);
    if (startupComponent == null) {
        logger.warn("Adding a RequiredCapabilityListener from bundle({}:{}), but specified startup component is " +
                "not available, component-name: {}", bundle.getSymbolicName(), bundle.getVersion(), componentName);
        return;
    }

    if (startupComponent.getListener() != null) {
        logger.warn("Duplicate RequiredCapabilityListener detected. Existing RequiredCapabilityListener for " +
                        "startup component {}. New RequiredCapabilityListener from bundle({}:{}).",
                componentName,
                bundle.getSymbolicName(),
                bundle.getVersion());
        return;
    }

    if (logger.isDebugEnabled()) {
        logger.debug("Adding available RequiredCapabilityListener with the componentName {} from bundle({}:{})",
                componentName, bundle.getSymbolicName(), bundle.getVersion());
    }
    startupComponent.setListener(listener);
}
 
开发者ID:wso2,项目名称:carbon-kernel,代码行数:33,代码来源:StartupComponentManager.java


示例2: notifySatisfiableComponents

import org.wso2.carbon.kernel.startupresolver.RequiredCapabilityListener; //导入依赖的package包/类
void notifySatisfiableComponents() {
    getComponents(StartupComponent::isSatisfiable)
            .forEach(startupComponent -> {

                if (logger.isDebugEnabled()) {
                    logger.debug("Notifying RequiredCapabilityListener of component {} from bundle({}:{}) " +
                                    "since all the required capabilities are available",
                            startupComponent.getName(),
                            startupComponent.getBundle().getSymbolicName(),
                            startupComponent.getBundle().getVersion());
                }

                startupComponent.setSatisfied(true);
                RequiredCapabilityListener capabilityListener = startupComponent.getListener();

                try {
                    capabilityListener.onAllRequiredCapabilitiesAvailable();
                } catch (RuntimeException e) {
                    logger.error("Runtime Exception occurred while calling onAllRequiredCapabilitiesAvailable of "
                            + "component " + startupComponent.getName(), e);
                }
            });
}
 
开发者ID:wso2,项目名称:carbon-kernel,代码行数:24,代码来源:StartupComponentManager.java


示例3: getRequiredServiceList

import org.wso2.carbon.kernel.startupresolver.RequiredCapabilityListener; //导入依赖的package包/类
/**
 * Returns a {@link List} of OSGi service keys required by startup components.
 *
 * @param startupComponentManager instance of the StartupComponentManager
 * @return a {@link List} of OSGi service keys
 */
private List<String> getRequiredServiceList(StartupComponentManager startupComponentManager) {
    List<StartupComponent> pendingComponents = startupComponentManager.getComponents(StartupComponent::isPending);
    List<String> requiredServiceList = pendingComponents
            .stream()
            .flatMap(startupComponent -> startupComponent.getRequiredServices().stream())
            .distinct()
            .collect(Collectors.toList());

    // We need to track RequiredCapabilityListener services as well as CapabilityProvider service.
    requiredServiceList.add(RequiredCapabilityListener.class.getName());
    requiredServiceList.add(CapabilityProvider.class.getName());
    return requiredServiceList;
}
 
开发者ID:wso2,项目名称:carbon-kernel,代码行数:20,代码来源:OSGiServiceCapabilityTracker.java


示例4: getListener

import org.wso2.carbon.kernel.startupresolver.RequiredCapabilityListener; //导入依赖的package包/类
public RequiredCapabilityListener getListener() {
    return listener;
}
 
开发者ID:wso2,项目名称:carbon-kernel,代码行数:4,代码来源:StartupComponent.java


示例5: setListener

import org.wso2.carbon.kernel.startupresolver.RequiredCapabilityListener; //导入依赖的package包/类
public void setListener(RequiredCapabilityListener listener) {
    this.listener = listener;
}
 
开发者ID:wso2,项目名称:carbon-kernel,代码行数:4,代码来源:StartupComponent.java


示例6: addingService

import org.wso2.carbon.kernel.startupresolver.RequiredCapabilityListener; //导入依赖的package包/类
@Override
public Object addingService(ServiceReference<Object> reference) {
    Object serviceObject = DataHolder.getInstance().getBundleContext().getService(reference);
    String serviceInterfaceClassName = ((String[]) reference.getProperty(OBJECT_CLASS))[0];
    String serviceImplClassName = serviceObject.getClass().getName();
    Bundle bundle = reference.getBundle();

    if (RequiredCapabilityListener.class.getName().equals(serviceInterfaceClassName)) {
        String componentKey = getNonEmptyStringAfterTrim((String) reference.getProperty(COMPONENT_NAME))
                .orElseThrow(() -> new StartOrderResolverException(COMPONENT_NAME + " value is missing in " +
                        "the services registered with the key " + serviceInterfaceClassName + ", " +
                        "implementation class name is " + serviceImplClassName));

        startupComponentManager.addRequiredCapabilityListener(
                (RequiredCapabilityListener) serviceObject, componentKey, reference.getBundle());

    } else if (CapabilityProvider.class.getName().equals(serviceInterfaceClassName)) {
        String capabilityName = getNonEmptyStringAfterTrim((String) reference.getProperty(CAPABILITY_NAME))
                .orElseThrow(() -> new StartOrderResolverException(CAPABILITY_NAME + " value is missing in " +
                        "the services registered with the key " + serviceInterfaceClassName + ", " +
                        "implementation class name is " + serviceImplClassName));

        CapabilityProviderCapability capabilityProvider = new CapabilityProviderCapability(
                CapabilityProvider.class.getName(),
                Capability.CapabilityType.OSGi_SERVICE,
                Capability.CapabilityState.AVAILABLE,
                capabilityName.trim(),
                bundle);

        startupComponentManager.addExpectedOrAvailableCapabilityProvider(capabilityProvider);

        CapabilityProvider provider = (CapabilityProvider) serviceObject;
        IntStream.range(0, provider.getCount())
                .forEach(count -> startupComponentManager.addExpectedCapability(
                        new OSGiServiceCapability(
                                capabilityName.trim(),
                                Capability.CapabilityType.OSGi_SERVICE,
                                Capability.CapabilityState.EXPECTED,
                                bundle,
                                true)));
    } else {
        if (Boolean.TRUE.equals(reference.getProperty(SKIP_CARBON_STARTUP_RESOLVER))) {
            logger.debug("Skipping tracking of service {} which implements {}.", serviceImplClassName,
                         serviceInterfaceClassName);
            return null;
        }

        logger.debug("Updating indirect dependencies in components for interface={} via the implementation={}",
                serviceInterfaceClassName, serviceImplClassName);
        startupComponentManager.updateCapability(new OSGiServiceCapability(
                serviceInterfaceClassName,
                Capability.CapabilityType.OSGi_SERVICE,
                Capability.CapabilityState.AVAILABLE,
                bundle,
                false));
    }

    return serviceObject;
}
 
开发者ID:wso2,项目名称:carbon-kernel,代码行数:60,代码来源:OSGiServiceCapabilityTracker.java



注:本文中的org.wso2.carbon.kernel.startupresolver.RequiredCapabilityListener类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java PriorityPBImpl类代码示例发布时间:2022-05-23
下一篇:
Java XMLReaderComposite类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap