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


Java ServiceBuilder.install方法代码示例

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


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

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

示例2: performRuntime

import org.jboss.msc.service.ServiceBuilder; //导入方法依赖的package包/类
@Override
protected void performRuntime(OperationContext context, ModelNode operation, ModelNode model) 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.setInitialMode(Mode.ACTIVE);
    componentServiceBuilder.install();
}
 
开发者ID:jboss-switchyard,项目名称:switchyard,代码行数:19,代码来源:SwitchYardModuleAdd.java

示例3: addSecretService

import org.jboss.msc.service.ServiceBuilder; //导入方法依赖的package包/类
private void addSecretService(OperationContext context, ModelNode secret, String realmName, ServiceTarget serviceTarget,
                              ServiceBuilder<?> realmBuilder, Injector<CallbackHandlerFactory> injector) throws OperationFailedException {
    ServiceName secretServiceName = SecretIdentityService.ServiceUtil.createServiceName(realmName);

    ModelNode resolvedValueNode = SecretServerIdentityResourceDefinition.VALUE.resolveModelAttribute(context, secret);
    boolean base64 = secret.get(SecretServerIdentityResourceDefinition.VALUE.getName()).getType() != ModelType.EXPRESSION;
    SecretIdentityService sis;
    if (secret.hasDefined(CredentialReference.CREDENTIAL_REFERENCE)) {
        sis = new SecretIdentityService(resolvedValueNode.asString(), false);
    } else {
        sis = new SecretIdentityService(resolvedValueNode.asString(), base64);
    }
    final ServiceBuilder<CallbackHandlerFactory> serviceBuilder = serviceTarget.addService(secretServiceName, sis)
            .setInitialMode(ON_DEMAND);
    if (secret.hasDefined(CredentialReference.CREDENTIAL_REFERENCE)) {
            sis.getCredentialSourceSupplierInjector()
                    .inject(CredentialReference.getCredentialSourceSupplier(context, SecretServerIdentityResourceDefinition.CREDENTIAL_REFERENCE, secret, serviceBuilder));
        }
    serviceBuilder.install();
    CallbackHandlerFactory.ServiceUtil.addDependency(realmBuilder, injector, secretServiceName);
}
 
开发者ID:wildfly,项目名称:wildfly-core,代码行数:22,代码来源:SecurityRealmAddHandler.java

示例4: setupController

import org.jboss.msc.service.ServiceBuilder; //导入方法依赖的package包/类
@Before
public void setupController() throws InterruptedException {

    // restore default
    blockObject = new CountDownLatch(1);
    latch = new CountDownLatch(1);

    System.out.println("=========  New Test \n");
    container = ServiceContainer.Factory.create("test");
    ServiceTarget target = container.subTarget();
    ModelControllerService svc = new ModelControllerService();
    ServiceBuilder<ModelController> builder = target.addService(ServiceName.of("ModelController"), svc);
    builder.install();
    svc.awaitStartup(30, TimeUnit.SECONDS);
    controller = svc.getValue();
    ModelNode setup = Util.getEmptyOperation("setup", new ModelNode());
    controller.execute(setup, null, null, null);

    client = controller.createClient(executor);

    managementControllerResource = svc.managementControllerResource;
}
 
开发者ID:wildfly,项目名称:wildfly-core,代码行数:23,代码来源:OperationCancellationUnitTestCase.java

示例5: install

import org.jboss.msc.service.ServiceBuilder; //导入方法依赖的package包/类
public static ServiceName install(final ServiceTarget target, final ModuleIdentifier identifier, final List<ModuleDependency> dependencies) {
    final ModuleLoadService service = new ModuleLoadService(dependencies);
    final ServiceName serviceName = ServiceModuleLoader.moduleServiceName(identifier);
    final ServiceBuilder<Module> builder = target.addService(serviceName, service);
    builder.addDependency(Services.JBOSS_SERVICE_MODULE_LOADER, ServiceModuleLoader.class, service.getServiceModuleLoader());
    builder.addDependency(ServiceModuleLoader.moduleSpecServiceName(identifier), ModuleDefinition.class, service.getModuleDefinitionInjectedValue());
    builder.addDependency(ServiceModuleLoader.moduleResolvedServiceName(identifier)); //don't attempt to load until all dependent module specs are up, even transitive ones

    for (ModuleDependency dependency : dependencies) {
        final ModuleIdentifier moduleIdentifier = dependency.getIdentifier();
        if (moduleIdentifier.getName().startsWith(ServiceModuleLoader.MODULE_PREFIX)) {
            builder.addDependency(dependency.isOptional() ? OPTIONAL : REQUIRED, ServiceModuleLoader.moduleSpecServiceName(moduleIdentifier));
        }
    }
    builder.setInitialMode(Mode.ON_DEMAND);
    builder.install();
    return serviceName;
}
 
开发者ID:wildfly,项目名称:wildfly-core,代码行数:19,代码来源:ModuleLoadService.java

示例6: setupController

import org.jboss.msc.service.ServiceBuilder; //导入方法依赖的package包/类
@Before
public void setupController() throws InterruptedException {
    container = ServiceContainer.Factory.create("test");
    ServiceTarget target = container.subTarget();
    if (useDelegateRootResourceDefinition) {
        initializer = createInitializer();
        controllerService = new ModelControllerService(getAuditLogger(), rootResourceDefinition);
    } else {
        controllerService = new ModelControllerService(getAuditLogger());
    }
    ServiceBuilder<ModelController> builder = target.addService(ServiceName.of("ModelController"), controllerService);
    builder.install();
    controllerService.awaitStartup(30, TimeUnit.SECONDS);
    controller = controllerService.getValue();
    //ModelNode setup = Util.getEmptyOperation("setup", new ModelNode());
    //controller.execute(setup, null, null, null);
}
 
开发者ID:wildfly,项目名称:wildfly-core,代码行数:18,代码来源:AbstractControllerTestBase.java

示例7: testRemoveExistingResource

import org.jboss.msc.service.ServiceBuilder; //导入方法依赖的package包/类
@Test
public void testRemoveExistingResource() throws Exception {
    container = ServiceContainer.Factory.create("test");
    ServiceTarget target = container.subTarget();
    TestModelControllerService svc = new InterleavedSubsystemModelControllerService();
    ServiceBuilder<ModelController> builder = target.addService(ServiceName.of("ModelController"), svc);
    builder.install();
    svc.awaitStartup(30, TimeUnit.SECONDS);
    ModelController controller = svc.getValue();

    // create child node
    final PathAddress attributePath = PathAddress.pathAddress(PathElement.pathElement("subsystem", "a"))
            .append(PathElement.pathElement(SUBMODEL_NAME, "existing"));
    final ModelNode addChild = Util.createEmptyOperation(ADD, attributePath);
    controller.execute(addChild, null, null, null);

    // should be able to remove it
    final ModelNode op = Util.createEmptyOperation(REMOVE, attributePath);
    ModelNode result = controller.execute(op, null, null, null);

    Assert.assertEquals("success", result.get("outcome").asString());
}
 
开发者ID:wildfly,项目名称:wildfly-core,代码行数:23,代码来源:RemoveNotEsistingResourceTestCase.java

示例8: testRemoveNonExistingResource

import org.jboss.msc.service.ServiceBuilder; //导入方法依赖的package包/类
@Test
public void testRemoveNonExistingResource() throws Exception {
    container = ServiceContainer.Factory.create("test");
    ServiceTarget target = container.subTarget();
    TestModelControllerService svc = new InterleavedSubsystemModelControllerService();
    ServiceBuilder<ModelController> builder = target.addService(ServiceName.of("ModelController"), svc);
    builder.install();
    svc.awaitStartup(30, TimeUnit.SECONDS);
    ModelController controller = svc.getValue();

    final PathAddress attributePath = PathAddress.pathAddress(PathElement.pathElement("subsystem", "a"))
            .append(PathElement.pathElement(SUBMODEL_NAME, "nonExisting"));
    final ModelNode op = Util.createEmptyOperation(REMOVE, attributePath);
    ModelNode result = controller.execute(op, null, null, null);

    Assert.assertEquals("failed", result.get("outcome").asString());
}
 
开发者ID:wildfly,项目名称:wildfly-core,代码行数:18,代码来源:RemoveNotEsistingResourceTestCase.java

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

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

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

示例12: main

import org.jboss.msc.service.ServiceBuilder; //导入方法依赖的package包/类
public static void main(String[] args) throws InterruptedException {
	ServiceContainer container = ServiceContainer.Factory.create("Hierarchy Service"); 
	ServiceBuilder<A> builder = container.addService(A.NAME, new A());
	builder.install();
	Thread.sleep(1000);
	container.dumpServices();
}
 
开发者ID:jbosschina,项目名称:wildfly-dev-cookbook,代码行数:8,代码来源:HierarchyService.java

示例13: main

import org.jboss.msc.service.ServiceBuilder; //导入方法依赖的package包/类
public static void main(String[] args) throws InterruptedException {

		ServiceContainer container = ServiceContainer.Factory.create("ServiceDependency"); 
		A service = new A();
		ServiceBuilder<A> builder = container.addService(A.NAME, service);
		builder.addDependency(B.NAME, B.class, service.b);
		builder.addDependency(C.NAME, C.class, service.c);
		builder.install();
		container.addService(B.NAME, new B()).install();
		container.addService(C.NAME, new C()).install();
		Thread.sleep(1000);
		container.dumpServices();
	}
 
开发者ID:jbosschina,项目名称:wildfly-dev-cookbook,代码行数:14,代码来源:ServiceDependency.java

示例14: main

import org.jboss.msc.service.ServiceBuilder; //导入方法依赖的package包/类
public static void main(String[] args) throws InterruptedException {
	ServiceContainer container = ServiceContainer.Factory.create(); 
	Service<Boolean> service = new MyService("Hello World");
	ServiceBuilder<Boolean> builder = container.addService(MyService.SERVICE, service);
	builder.install();
	Thread.sleep(1000);
	System.out.println("MyService isActive:" + service.getValue());
	container.dumpServices();
}
 
开发者ID:jbosschina,项目名称:wildfly-dev-cookbook,代码行数:10,代码来源:HelloWorld.java

示例15: addService

import org.jboss.msc.service.ServiceBuilder; //导入方法依赖的package包/类
public static void addService(final ServiceTarget serviceTarget) {
    ArquillianService service = new ArquillianService();
    ServiceBuilder<?> builder = serviceTarget.addService(ArquillianService.SERVICE_NAME, service);
    builder.addDependency(MBeanServerService.SERVICE_NAME, MBeanServer.class, service.injectedMBeanServer);
    builder.setInitialMode(ServiceController.Mode.ACTIVE);
    builder.install();
}
 
开发者ID:wildfly,项目名称:wildfly-arquillian,代码行数:8,代码来源:ArquillianService.java


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