当前位置: 首页>>代码示例>>Java>>正文


Java ServiceBuilder.addDependency方法代码示例

本文整理汇总了Java中org.jboss.msc.service.ServiceBuilder.addDependency方法的典型用法代码示例。如果您正苦于以下问题:Java ServiceBuilder.addDependency方法的具体用法?Java ServiceBuilder.addDependency怎么用?Java ServiceBuilder.addDependency使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.jboss.msc.service.ServiceBuilder的用法示例。


在下文中一共展示了ServiceBuilder.addDependency方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: performRuntime

import org.jboss.msc.service.ServiceBuilder; //导入方法依赖的package包/类
@Override
protected void performRuntime(OperationContext context, ModelNode operation, ModelNode model,
                              ServiceVerificationHandler verificationHandler, List<ServiceController<?>> newControllers) throws OperationFailedException {
    final String moduleId = PathAddress.pathAddress(operation.get(ModelDescriptionConstants.ADDRESS)).getLastElement().getValue();
    _componentNames.add(moduleId);

    context.addStep(new AbstractDeploymentChainStep() {
        protected void execute(DeploymentProcessorTarget processorTarget) {
            processorTarget.addDeploymentProcessor(SwitchYardExtension.SUBSYSTEM_NAME, Phase.DEPENDENCIES, _priority++, new SwitchYardModuleDependencyProcessor(moduleId));
        }
    }, OperationContext.Stage.RUNTIME);

    final SwitchYardComponentService componentService = new SwitchYardComponentService(moduleId, model);
    final ServiceBuilder<Component> componentServiceBuilder = context.getServiceTarget().addService(SwitchYardComponentService.SERVICE_NAME.append(moduleId), componentService);
    componentServiceBuilder.addDependency(SwitchYardInjectorService.SERVICE_NAME, Map.class, componentService.getInjectedValues())
            .addDependency(RA_REPOSITORY_SERVICE_NAME, ResourceAdapterRepository.class, componentService.getResourceAdapterRepository());
    componentServiceBuilder.addDependency(WebSubsystemServices.JBOSS_WEB);
    componentServiceBuilder.setInitialMode(Mode.ACTIVE);
    newControllers.add(componentServiceBuilder.install());
}
 
开发者ID:jboss-switchyard,项目名称:switchyard,代码行数:21,代码来源:SwitchYardModuleAdd.java

示例2: startNeo4jDriverService

import org.jboss.msc.service.ServiceBuilder; //导入方法依赖的package包/类
private void startNeo4jDriverService(OperationContext context, ConfigurationBuilder builder, final Set<String> outboundSocketBindings) throws OperationFailedException {
    if (builder.getJNDIName() != null && builder.getJNDIName().length() > 0) {
        final Neo4jClientConnectionService neo4jClientConnectionService = new Neo4jClientConnectionService(builder);
        final ServiceName serviceName = ConnectionServiceAccess.serviceName(builder.getDescription());
        final ContextNames.BindInfo bindingInfo = ContextNames.bindInfoFor(builder.getJNDIName());

        final BinderService binderService = new BinderService(bindingInfo.getBindName());
        context.getServiceTarget().addService(bindingInfo.getBinderServiceName(), binderService)
                .addDependency(Neo4jSubsystemService.serviceName())
                .addDependency(bindingInfo.getParentContextServiceName(), ServiceBasedNamingStore.class, binderService.getNamingStoreInjector())
                .addDependency(serviceName, Neo4jClientConnectionService.class, new Injector<Neo4jClientConnectionService>() {
                    @Override
                    public void inject(final Neo4jClientConnectionService value) throws
                            InjectionException {
                        binderService.getManagedObjectInjector().inject(new ValueManagedReferenceFactory(new ImmediateValue<>(value.getDriver())));
                    }

                    @Override
                    public void uninject() {
                        binderService.getNamingStoreInjector().uninject();
                    }
                }).install();

        final ServiceBuilder<Neo4jClientConnectionService> serviceBuilder = context.getServiceTarget().addService(serviceName, neo4jClientConnectionService);
        serviceBuilder.addDependency(Neo4jSubsystemService.serviceName(), new CastingInjector<>(neo4jClientConnectionService.getNeo4jSubsystemServiceInjectedValue(), Neo4jSubsystemService.class));
        // add service dependency on each separate hostname/port reference in standalone*.xml referenced from this driver profile definition.
        for (final String outboundSocketBinding : outboundSocketBindings) {
            final ServiceName outboundSocketBindingDependency = context.getCapabilityServiceName(Neo4jDriverDefinition.OUTBOUND_SOCKET_BINDING_CAPABILITY_NAME, outboundSocketBinding, OutboundSocketBinding.class);
            serviceBuilder.addDependency(ServiceBuilder.DependencyType.REQUIRED, outboundSocketBindingDependency, OutboundSocketBinding.class, neo4jClientConnectionService.getOutboundSocketBindingInjector(outboundSocketBinding));
        }
        if (builder.getSecurityDomain() != null) {
            serviceBuilder.addDependency(SubjectFactoryService.SERVICE_NAME, SubjectFactory.class,
                    neo4jClientConnectionService.getSubjectFactoryInjector());
        }

        serviceBuilder.setInitialMode(ServiceController.Mode.ACTIVE).install();
    }
}
 
开发者ID:wildfly,项目名称:wildfly-nosql,代码行数:39,代码来源:Neo4jDefinition.java

示例3: startServices

import org.jboss.msc.service.ServiceBuilder; //导入方法依赖的package包/类
private void startServices(OperationContext context, Configuration configuration, String outboundSocketBinding) {
    ServiceName connectionsServiceName = ConnectionServiceAccess.serviceName(configuration.getProfileName());
    OrientInteraction orientInteraction = new OrientInteraction(configuration);
    OrientClientConnectionsService connectionsService = new OrientClientConnectionsService(configuration, orientInteraction);
    ServiceBuilder<OrientClientConnectionsService> connectionsServiceBuilder = context.getServiceTarget()
            .addService(connectionsServiceName, connectionsService);

    connectionsServiceBuilder.addDependency(OrientSubsystemService.SERVICE_NAME, new CastingInjector<>(
            connectionsService.getOrientSubsystemServiceInjectedValue(), OrientSubsystemService.class));

    ServiceName outboundSocketBindingServiceName = context.getCapabilityServiceName(
            OrientDriverDefinition.OUTBOUND_SOCKET_BINDING_CAPABILITY_NAME, outboundSocketBinding,
            OutboundSocketBinding.class);
    connectionsServiceBuilder.addDependency(ServiceBuilder.DependencyType.REQUIRED, outboundSocketBindingServiceName,
            new CastingInjector<>(connectionsService.getOutboundSocketBindingInjectedValue(),
                    OutboundSocketBinding.class));
    if (configuration.getSecurityDomain() != null) {
        connectionsServiceBuilder.addDependency(SubjectFactoryService.SERVICE_NAME, SubjectFactory.class,
                connectionsService.getSubjectFactoryInjector());
    }

    connectionsServiceBuilder.setInitialMode(ServiceController.Mode.ACTIVE).install();
    bindJndi(context, connectionsServiceName, configuration.getJndiName(), orientInteraction.getDatabasePoolClass());
}
 
开发者ID:wildfly,项目名称:wildfly-nosql,代码行数:25,代码来源:OrientDefinition.java

示例4: activate

import org.jboss.msc.service.ServiceBuilder; //导入方法依赖的package包/类
@Override
public void activate(ServiceActivatorContext context) throws ServiceRegistryException {
    ServiceTarget target = context.getServiceTarget();

    if (!topologyWebAppFractionInstance.isUnsatisfied()) {
        serviceNames = topologyWebAppFractionInstance.get().proxiedServiceMappings().keySet();
    }

    TopologyProxyService proxyService = new TopologyProxyService(serviceNames);
    ServiceBuilder<TopologyProxyService> serviceBuilder = target
            .addService(TopologyProxyService.SERVICE_NAME, proxyService)
            .addDependency(DefaultNamespaceContextSelectorService.SERVICE_NAME)
            .addDependency(TopologyManagerActivator.CONNECTOR_SERVICE_NAME)
            .addDependency(NamingService.SERVICE_NAME);

    for (String serviceName : serviceNames) {
        serviceBuilder.addDependency(proxyService.mscServiceNameForServiceProxy(serviceName),
                                     HttpHandler.class, proxyService.getHandlerInjectorFor(serviceName));
    }
    serviceBuilder.install();
}
 
开发者ID:wildfly-swarm,项目名称:wildfly-swarm,代码行数:22,代码来源:TopologyWebAppActivator.java

示例5: performRuntime

import org.jboss.msc.service.ServiceBuilder; //导入方法依赖的package包/类
@Override
protected void performRuntime(OperationContext context, ModelNode operation, ModelNode model)
        throws OperationFailedException {
    ServiceTarget serviceTarget = context.getServiceTarget();
    RuntimeCapability<?> instanceRuntimeCapability = runtimeCapability.fromBaseCapability(context.getCurrentAddressValue());
    ServiceName componentName = instanceRuntimeCapability.getCapabilityServiceName(aggregationType);

    AggregateComponentService<T> aggregateComponentService = new AggregateComponentService<T>(aggregationType, aggregator);

    ServiceBuilder<T> serviceBuilder = serviceTarget.addService(componentName, aggregateComponentService);

    List<String> aggregates = aggregateReferences.unwrap(context, model);

    String baseCapabilityName = runtimeCapability.getName();
    for (String current : aggregates) {
        String runtimeCapabilityName = RuntimeCapability.buildDynamicCapabilityName(baseCapabilityName, current);
        ServiceName realmServiceName = context.getCapabilityServiceName(runtimeCapabilityName, aggregationType);

        serviceBuilder.addDependency(realmServiceName, aggregationType, aggregateComponentService.newInjector());
    }

    commonDependencies(serviceBuilder, true, dependOnProviderRegistration)
        .setInitialMode(Mode.LAZY)
        .install();
}
 
开发者ID:wildfly,项目名称:wildfly-core,代码行数:26,代码来源:AggregateComponentDefinition.java

示例6: installServices

import org.jboss.msc.service.ServiceBuilder; //导入方法依赖的package包/类
public static void installServices(final OperationContext context, final String remotingConnectorName, final String httpConnectorName, final ServiceName endpointName,
        final OptionMap connectorPropertiesOptionMap, final String securityRealm, final String saslAuthenticationFactory) {
    ServiceTarget serviceTarget = context.getServiceTarget();
    final RemotingHttpUpgradeService service = new RemotingHttpUpgradeService(httpConnectorName, endpointName.getSimpleName(), connectorPropertiesOptionMap);

    ServiceBuilder<RemotingHttpUpgradeService> serviceBuilder = serviceTarget.addService(UPGRADE_SERVICE_NAME.append(remotingConnectorName), service)
            .setInitialMode(ServiceController.Mode.PASSIVE)
            .addDependency(HTTP_UPGRADE_REGISTRY.append(httpConnectorName), ChannelUpgradeHandler.class, service.injectedRegistry)
            .addDependency(HttpListenerRegistryService.SERVICE_NAME, ListenerRegistry.class, service.listenerRegistry)
            .addDependency(endpointName, Endpoint.class, service.injectedEndpoint);

    if (securityRealm != null) {
        serviceBuilder.addDependency(
                org.jboss.as.domain.management.SecurityRealm.ServiceUtil.createServiceName(securityRealm),
                org.jboss.as.domain.management.SecurityRealm.class, service.injectedSecurityRealm);
    }

    if (saslAuthenticationFactory != null) {
        serviceBuilder.addDependency(
                context.getCapabilityServiceName(SASL_AUTHENTICATION_FACTORY_CAPABILITY, saslAuthenticationFactory, SaslAuthenticationFactory.class),
                SaslAuthenticationFactory.class, service.injectedSaslAuthenticationFactory);
    }

    serviceBuilder.install();
}
 
开发者ID:wildfly,项目名称:wildfly-core,代码行数:26,代码来源:RemotingHttpUpgradeService.java

示例7: installConnectorServicesForNetworkInterfaceBinding

import org.jboss.msc.service.ServiceBuilder; //导入方法依赖的package包/类
@Deprecated
public static void installConnectorServicesForNetworkInterfaceBinding(ServiceTarget serviceTarget,
                                                                      final ServiceName endpointName,
                                                                      final String connectorName,
                                                                      final ServiceName networkInterfaceBindingName,
                                                                      final int port,
                                                                      final OptionMap connectorPropertiesOptionMap,
                                                                      final ServiceName securityRealm,
                                                                      final ServiceName saslAuthenticationFactory,
                                                                      final ServiceName sslContext,
                                                                      final ServiceName socketBindingManager) {
    final InjectedNetworkBindingStreamServerService streamServerService = new InjectedNetworkBindingStreamServerService(connectorPropertiesOptionMap, port);

    final ServiceBuilder<AcceptingChannel<StreamConnection>> serviceBuilder = serviceTarget.addService(serverServiceName(connectorName), streamServerService)
                .addDependency(networkInterfaceBindingName, NetworkInterfaceBinding.class, streamServerService.getInterfaceBindingInjector());
    if (socketBindingManager != null) {
        serviceBuilder.addDependency(socketBindingManager, SocketBindingManager.class, streamServerService.getSocketBindingManagerInjector());
    }
    installConnectorServices(serviceBuilder, streamServerService, endpointName, securityRealm, saslAuthenticationFactory, sslContext);
}
 
开发者ID:wildfly,项目名称:wildfly-core,代码行数:21,代码来源:RemotingServices.java

示例8: installService

import org.jboss.msc.service.ServiceBuilder; //导入方法依赖的package包/类
private static void installService(final ServiceTarget serviceTarget, final ModuleIdentifier moduleIdentifier, int phaseNumber, final Set<ModuleDependency> nextPhaseIdentifiers, final Set<ModuleIdentifier> nextAlreadySeen) {
    final ModuleResolvePhaseService nextPhaseService = new ModuleResolvePhaseService(moduleIdentifier, nextAlreadySeen, phaseNumber);
    ServiceBuilder<ModuleResolvePhaseService> builder = serviceTarget.addService(moduleSpecServiceName(moduleIdentifier, phaseNumber), nextPhaseService);
    for (ModuleDependency module : nextPhaseIdentifiers) {
        builder.addDependency(module.isOptional() ? OPTIONAL : REQUIRED, ServiceModuleLoader.moduleSpecServiceName(module.getIdentifier()), ModuleDefinition.class, new Injector<ModuleDefinition>() {

            ModuleDefinition definition;

            @Override
            public synchronized void inject(final ModuleDefinition o) throws InjectionException {
                nextPhaseService.getModuleSpecs().add(o);
                this.definition = o;
            }

            @Override
            public synchronized void uninject() {
                nextPhaseService.getModuleSpecs().remove(definition);
                this.definition = null;
            }
        });
    }
    builder.install();
}
 
开发者ID:wildfly,项目名称:wildfly-core,代码行数:24,代码来源:ModuleResolvePhaseService.java

示例9: addPropertiesAuthorizationService

import org.jboss.msc.service.ServiceBuilder; //导入方法依赖的package包/类
private void addPropertiesAuthorizationService(OperationContext context, ModelNode properties,
                                               String realmName, ServiceTarget serviceTarget, ServiceBuilder<?> realmBuilder,
                                               InjectedValue<SubjectSupplementalService> injector) throws OperationFailedException {
    ServiceName propsServiceName = PropertiesSubjectSupplemental.ServiceUtil.createServiceName(realmName);

    final String path = PropertiesAuthorizationResourceDefinition.PATH.resolveModelAttribute(context, properties).asString();
    final ModelNode relativeToNode = PropertiesAuthorizationResourceDefinition.RELATIVE_TO.resolveModelAttribute(context, properties);
    String relativeTo = relativeToNode.isDefined() ? relativeToNode.asString() : null;

    PropertiesSubjectSupplemental propsSubjectSupplemental = new PropertiesSubjectSupplemental(realmName, path, relativeTo);

    ServiceBuilder<?> propsBuilder = serviceTarget.addService(propsServiceName, propsSubjectSupplemental);
    if (relativeTo != null) {
        propsBuilder.addDependency(context.getCapabilityServiceName(PATH_MANAGER_CAPABILITY, PathManager.class),
                PathManager.class, propsSubjectSupplemental.getPathManagerInjectorInjector());
        propsBuilder.addDependency(pathName(relativeTo));
    }

    propsBuilder.setInitialMode(ON_DEMAND).install();

    SubjectSupplementalService.ServiceUtil.addDependency(realmBuilder, injector, propsServiceName);
}
 
开发者ID:wildfly,项目名称:wildfly-core,代码行数:23,代码来源:SecurityRealmAddHandler.java

示例10: startCassandraDriverService

import org.jboss.msc.service.ServiceBuilder; //导入方法依赖的package包/类
private void startCassandraDriverService(OperationContext context, ConfigurationBuilder builder, final Set<String> outboundSocketBindings) throws OperationFailedException {
    if (builder.getJNDIName() != null && builder.getJNDIName().length() > 0) {
        final CassandraClientConnectionsService cassandraClientConnectionsService = new CassandraClientConnectionsService(builder);
        final ServiceName serviceName = ConnectionServiceAccess.serviceName(builder.getDescription());
        final ContextNames.BindInfo bindingInfo = ContextNames.bindInfoFor(builder.getJNDIName());

        final BinderService binderService = new BinderService(bindingInfo.getBindName());
        context.getServiceTarget().addService(bindingInfo.getBinderServiceName(), binderService)
                .addDependency(CassandraSubsystemService.serviceName())
                .addDependency(bindingInfo.getParentContextServiceName(), ServiceBasedNamingStore.class, binderService.getNamingStoreInjector())
                .addDependency(serviceName, CassandraClientConnectionsService.class, new Injector<CassandraClientConnectionsService>() {
                    @Override
                    public void inject(final CassandraClientConnectionsService value) throws
                            InjectionException {
                        binderService.getManagedObjectInjector().inject(new ValueManagedReferenceFactory(new ImmediateValue<>(value.getSession() != null ? value.getSession() : value.getCluster())));
                    }

                    @Override
                    public void uninject() {
                        binderService.getNamingStoreInjector().uninject();
                    }
                }).install();

        final ServiceBuilder<CassandraClientConnectionsService> serviceBuilder = context.getServiceTarget().addService(serviceName, cassandraClientConnectionsService);
        serviceBuilder.addDependency(CassandraSubsystemService.serviceName(), new CastingInjector<>(cassandraClientConnectionsService.getCassandraSubsystemServiceInjectedValue(), CassandraSubsystemService.class));
        // add service dependency on each separate hostname/port reference in standalone*.xml referenced from this driver profile definition.
        for (final String outboundSocketBinding : outboundSocketBindings) {
            final ServiceName outboundSocketBindingDependency = context.getCapabilityServiceName(CassandraDriverDefinition.OUTBOUND_SOCKET_BINDING_CAPABILITY_NAME, outboundSocketBinding, OutboundSocketBinding.class);
            serviceBuilder.addDependency(ServiceBuilder.DependencyType.REQUIRED, outboundSocketBindingDependency, OutboundSocketBinding.class, cassandraClientConnectionsService.getOutboundSocketBindingInjector(outboundSocketBinding));
        }

        if (builder.getSecurityDomain() != null) {
            serviceBuilder.addDependency(SubjectFactoryService.SERVICE_NAME, SubjectFactory.class,
                    cassandraClientConnectionsService.getSubjectFactoryInjector());
        }

        serviceBuilder.setInitialMode(ServiceController.Mode.ACTIVE).install();
    }
}
 
开发者ID:wildfly,项目名称:wildfly-nosql,代码行数:40,代码来源:CassandraDefinition.java

示例11: startMongoDriverService

import org.jboss.msc.service.ServiceBuilder; //导入方法依赖的package包/类
private void startMongoDriverService(OperationContext context, ConfigurationBuilder builder, Set<String> outboundSocketBindings) {
    if (builder.getJNDIName() != null && builder.getJNDIName().length() > 0) {
        final MongoClientConnectionsService mongoClientConnectionsService = new MongoClientConnectionsService(builder);
        final ServiceName serviceName = ConnectionServiceAccess.serviceName(builder.getDescription());
        final ContextNames.BindInfo bindingInfo = ContextNames.bindInfoFor(builder.getJNDIName());

        final BinderService binderService = new BinderService(bindingInfo.getBindName());

        context.getServiceTarget().addService(bindingInfo.getBinderServiceName(), binderService)
                .addDependency(MongoSubsystemService.serviceName())
                .addDependency(bindingInfo.getParentContextServiceName(), ServiceBasedNamingStore.class, binderService.getNamingStoreInjector())
                .addDependency(serviceName, MongoClientConnectionsService.class, new Injector<MongoClientConnectionsService>() {
                    @Override
                    public void inject(final MongoClientConnectionsService value) throws
                            InjectionException {
                        binderService.getManagedObjectInjector().inject(new ValueManagedReferenceFactory(new ImmediateValue<>(value.getDatabase() != null ? value.getDatabase() : value.getClient())));
                    }

                    @Override
                    public void uninject() {
                        binderService.getNamingStoreInjector().uninject();
                    }
                }).install();
        final ServiceBuilder<MongoClientConnectionsService> serviceBuilder = context.getServiceTarget().addService(serviceName, mongoClientConnectionsService);
        serviceBuilder.addDependency(MongoSubsystemService.serviceName(), new CastingInjector<>(mongoClientConnectionsService.getMongoSubsystemServiceInjectedValue(), MongoSubsystemService.class));
        // add service dependency on each separate hostname/port reference in standalone*.xml referenced from this driver profile definition.
        for (final String outboundSocketBinding : outboundSocketBindings) {
            final ServiceName outboundSocketBindingDependency = context.getCapabilityServiceName(OUTBOUND_SOCKET_BINDING_CAPABILITY_NAME, outboundSocketBinding, OutboundSocketBinding.class);
            serviceBuilder.addDependency(ServiceBuilder.DependencyType.REQUIRED, outboundSocketBindingDependency, OutboundSocketBinding.class, mongoClientConnectionsService.getOutboundSocketBindingInjector(outboundSocketBinding));
        }
        if (builder.getSecurityDomain() != null) {
            serviceBuilder.addDependency(SubjectFactoryService.SERVICE_NAME, SubjectFactory.class,
                    mongoClientConnectionsService.getSubjectFactoryInjector());
        }
        serviceBuilder.setInitialMode(ServiceController.Mode.ACTIVE).install();
    }
}
 
开发者ID:wildfly,项目名称:wildfly-nosql,代码行数:38,代码来源:MongoDefinition.java

示例12: activate

import org.jboss.msc.service.ServiceBuilder; //导入方法依赖的package包/类
@Override
public void activate(ServiceActivatorContext context) throws ServiceRegistryException {
    ServiceTarget target = context.getServiceTarget();

    TopologyProxyService proxyService = new TopologyProxyService(serviceNames);
    ServiceBuilder<TopologyProxyService> serviceBuilder = target
            .addService(TopologyProxyService.SERVICE_NAME, proxyService)
            .addDependency(TopologyConnector.SERVICE_NAME);
    for (String serviceName : serviceNames) {
        serviceBuilder.addDependency(proxyService.mscServiceNameForServiceProxy(serviceName),
                                     HttpHandler.class, proxyService.getHandlerInjectorFor(serviceName));
    }
    serviceBuilder.install();
}
 
开发者ID:wildfly-swarm-archive,项目名称:wildfly-swarm-topology,代码行数:15,代码来源:TopologyWebAppActivator.java

示例13: addService

import org.jboss.msc.service.ServiceBuilder; //导入方法依赖的package包/类
static ServiceController<Void> addService(ServiceTarget serviceTarget, CamelCoreFraction fraction) {
    BootstrapCamelContextService service = new BootstrapCamelContextService(fraction);
    ServiceName serviceName = SERVICE_NAME;
    ServiceBuilder<Void> builder = serviceTarget.addService(serviceName, service);
    builder.addDependency(CamelConstants.CAMEL_CONTEXT_REGISTRY_SERVICE_NAME, MutableCamelContextRegistry.class, service.injectedContextRegistry);
    return builder.install();
}
 
开发者ID:wildfly-swarm-archive,项目名称:wildfly-swarm-camel,代码行数:8,代码来源:CamelCoreConfiguration.java

示例14: addService

import org.jboss.msc.service.ServiceBuilder; //导入方法依赖的package包/类
static ServiceController<Void> addService(ServiceTarget serviceTarget, CamelFraction fraction) {
    BootstrapCamelContextService service = new BootstrapCamelContextService(fraction);
    ServiceName serviceName = SERVICE_NAME;
    ServiceBuilder<Void> builder = serviceTarget.addService(serviceName, service);
    builder.addDependency(CamelConstants.CAMEL_CONTEXT_REGISTRY_SERVICE_NAME);
    return builder.install();
}
 
开发者ID:wildfly-swarm,项目名称:wildfly-swarm,代码行数:8,代码来源:CamelServiceActivator.java

示例15: activate

import org.jboss.msc.service.ServiceBuilder; //导入方法依赖的package包/类
@Override
public void activate(ServiceActivatorContext context) throws ServiceRegistryException {
    Optional<String> securityRealm = Optional.empty();

    if (!healthFractionInstance.isUnsatisfied()) {
        securityRealm = healthFractionInstance.get().securityRealm();
    }

    ServiceTarget target = context.getServiceTarget();

    MonitorService service = new MonitorService(securityRealm);

    ServiceBuilder<MonitorService> monitorServiceServiceBuilder = target.addService(MonitorService.SERVICE_NAME, service);

    ServiceBuilder<MonitorService> serviceBuilder = monitorServiceServiceBuilder
            .addDependency(ServerEnvironmentService.SERVICE_NAME, ServerEnvironment.class, service.getServerEnvironmentInjector())
            .addDependency(Services.JBOSS_SERVER_CONTROLLER, ModelController.class, service.getModelControllerInjector());

    if (securityRealm.isPresent()) { // configured through the fraction interface
        serviceBuilder.addDependency(
                createRealmName(securityRealm.get()),
                SecurityRealm.class,
                service.getSecurityRealmInjector()
        );
    }

    serviceBuilder.setInitialMode(ServiceController.Mode.ACTIVE)
            .install();

    BinderService binderService = new BinderService(Monitor.JNDI_NAME, null, true);

    target.addService(ContextNames.buildServiceName(ContextNames.JBOSS_CONTEXT_SERVICE_NAME, Monitor.JNDI_NAME), binderService)
            .addDependency(ContextNames.JBOSS_CONTEXT_SERVICE_NAME, ServiceBasedNamingStore.class, binderService.getNamingStoreInjector())
            .addInjection(binderService.getManagedObjectInjector(), new ImmediateManagedReferenceFactory(service))
            .setInitialMode(ServiceController.Mode.ACTIVE)
            .install();

}
 
开发者ID:wildfly-swarm,项目名称:wildfly-swarm,代码行数:39,代码来源:MonitorServiceActivator.java


注:本文中的org.jboss.msc.service.ServiceBuilder.addDependency方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。