本文整理汇总了Java中org.jboss.msc.service.ServiceRegistryException类的典型用法代码示例。如果您正苦于以下问题:Java ServiceRegistryException类的具体用法?Java ServiceRegistryException怎么用?Java ServiceRegistryException使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ServiceRegistryException类属于org.jboss.msc.service包,在下文中一共展示了ServiceRegistryException类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: activate
import org.jboss.msc.service.ServiceRegistryException; //导入依赖的package包/类
@Override
public void activate(ServiceActivatorContext serviceActivatorContext) throws ServiceRegistryException {
InputStream in = Thread.currentThread().getContextClassLoader().getResourceAsStream(SwaggerArchive.SWAGGER_CONFIGURATION_PATH);
if (in == null) {
// No config available. Print a warning and return
System.err.println("WARN: No swagger configuration found. Swagger not activated.");
return;
}
SwaggerConfig config = new SwaggerConfig(in);
BeanConfig beanConfig = new BeanConfig();
beanConfig.setHost((String) config.get(SwaggerConfig.Key.HOST));
beanConfig.setLicense((String) config.get(SwaggerConfig.Key.LICENSE));
beanConfig.setLicenseUrl((String) config.get(SwaggerConfig.Key.LICENSE_URL));
beanConfig.setTermsOfServiceUrl((String) config.get(SwaggerConfig.Key.TERMS_OF_SERVICE_URL));
beanConfig.setResourcePackage((String) config.get(SwaggerConfig.Key.PACKAGES));
beanConfig.setVersion((String) config.get(SwaggerConfig.Key.VERSION));
beanConfig.setBasePath((String) config.get(SwaggerConfig.Key.ROOT));
beanConfig.setContact((String) config.get(SwaggerConfig.Key.CONTACT));
beanConfig.setDescription((String) config.get(SwaggerConfig.Key.DESCRIPTION));
beanConfig.setTitle((String) config.get(SwaggerConfig.Key.TITLE));
beanConfig.setPrettyPrint((String) config.get(SwaggerConfig.Key.PRETTY_PRINT));
beanConfig.setSchemes((String[]) config.get(SwaggerConfig.Key.SCHEMES));
beanConfig.setScan(true);
}
示例2: activate
import org.jboss.msc.service.ServiceRegistryException; //导入依赖的package包/类
@Override
public void activate(ServiceActivatorContext context) throws ServiceRegistryException {
ServiceTarget target = context.getServiceTarget();
target.addService(TopologyManager.SERVICE_NAME, new ValueService<>(new ImmediateValue<>(TopologyManager.INSTANCE)))
.install();
BinderService binderService = new BinderService(Topology.JNDI_NAME, null, true);
target.addService(ContextNames.buildServiceName(ContextNames.JBOSS_CONTEXT_SERVICE_NAME, Topology.JNDI_NAME), binderService)
.addDependency(ContextNames.JBOSS_CONTEXT_SERVICE_NAME, ServiceBasedNamingStore.class, binderService.getNamingStoreInjector())
.addInjection(binderService.getManagedObjectInjector(), new ImmediateManagedReferenceFactory(TopologyManager.INSTANCE))
.setInitialMode(ServiceController.Mode.ACTIVE)
.install();
}
示例3: activate
import org.jboss.msc.service.ServiceRegistryException; //导入依赖的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();
}
示例4: activate
import org.jboss.msc.service.ServiceRegistryException; //导入依赖的package包/类
@Override
public void activate(ServiceActivatorContext context) throws ServiceRegistryException {
ServiceTarget target = context.getServiceTarget();
forEachLine(TopologyArchive.REGISTRATION_CONF, registrationLine -> {
int separatorIndex = registrationLine.indexOf(TopologyArchive.SERVICE_TAG_SEPARATOR);
String serviceName = registrationLine;
List<String> tags = Collections.emptyList();
if (separatorIndex > 0) {
serviceName = registrationLine.substring(0, separatorIndex);
tags = getTags(registrationLine.substring(separatorIndex + 1));
}
RegistrationAdvertiser.install(target, serviceName, "http", tags);
RegistrationAdvertiser.install(target, serviceName, "https", tags);
});
}
示例5: forEachLine
import org.jboss.msc.service.ServiceRegistryException; //导入依赖的package包/类
private void forEachLine(String resourceName, Consumer<String> consumer) {
InputStream in = Thread.currentThread().getContextClassLoader().getResourceAsStream(resourceName);
if (in == null) {
return;
}
try (BufferedReader reader = new BufferedReader(new InputStreamReader(in))) {
String line;
while ((line = reader.readLine()) != null) {
consumer.accept(line.trim());
}
} catch (IOException e) {
throw new ServiceRegistryException(e);
}
}
示例6: activate
import org.jboss.msc.service.ServiceRegistryException; //导入依赖的package包/类
@Override
public void activate(ServiceActivatorContext context) throws ServiceRegistryException {
ServiceTarget target = context.getServiceTarget();
TopologyManager.INSTANCE.setServiceTarget(target);
target.addService(SERVICE_NAME, new ValueService<>(new ImmediateValue<>(TopologyManager.INSTANCE)))
.install();
BinderService binderService = new BinderService(Topology.JNDI_NAME, null, true);
target.addService(ContextNames.buildServiceName(ContextNames.JBOSS_CONTEXT_SERVICE_NAME, Topology.JNDI_NAME), binderService)
.addDependency(ContextNames.JBOSS_CONTEXT_SERVICE_NAME, ServiceBasedNamingStore.class, binderService.getNamingStoreInjector())
.addInjection(binderService.getManagedObjectInjector(), new ImmediateManagedReferenceFactory(TopologyManager.INSTANCE))
.setInitialMode(ServiceController.Mode.ACTIVE)
.install();
}
示例7: activate
import org.jboss.msc.service.ServiceRegistryException; //导入依赖的package包/类
@Override
public void activate(ServiceActivatorContext serviceActivatorContext) throws ServiceRegistryException {
ServiceTarget target = serviceActivatorContext.getServiceTarget();
MetricsService service = new MetricsService();
ServiceBuilder<MetricsService> metricsServiceBuilder = target.addService(MetricsService.SERVICE_NAME, service);
RegistryFactory factory = new RegistryFactoryImpl();
ServiceBuilder<MetricsService> serviceBuilder = metricsServiceBuilder
.addDependency(ServerEnvironmentService.SERVICE_NAME, ServerEnvironment.class, service.getServerEnvironmentInjector())
.addDependency(ServiceName.parse("jboss.eclipse.microprofile.config.config-provider"))
.addDependency(Services.JBOSS_SERVER_CONTROLLER, ModelController.class, service.getModelControllerInjector());
serviceBuilder.setInitialMode(ServiceController.Mode.ACTIVE)
.install();
BinderService binderService = new BinderService(SWARM_MP_METRICS, null, true);
target.addService(ContextNames.buildServiceName(ContextNames.JBOSS_CONTEXT_SERVICE_NAME, SWARM_MP_METRICS), binderService)
.addDependency(ContextNames.JBOSS_CONTEXT_SERVICE_NAME, ServiceBasedNamingStore.class, binderService.getNamingStoreInjector())
.addInjection(binderService.getManagedObjectInjector(), new ImmediateManagedReferenceFactory(factory))
.setInitialMode(ServiceController.Mode.ACTIVE)
.install();
}
示例8: activate
import org.jboss.msc.service.ServiceRegistryException; //导入依赖的package包/类
@Override
public final void activate(final ServiceActivatorContext serviceActivatorContext) throws ServiceRegistryException {
final String address = getAddress();
assert address != null : "address cannot be null";
final int port = getPort();
assert port > 0 : "port must be greater than 0";
final HttpHandler handler = getHttpHandler();
assert handler != null : "A handler is required";
final UndertowService service = new UndertowService(address, port, handler);
serviceActivatorContext.getServiceTarget().addService(getServiceName(), service).install();
}
示例9: activate
import org.jboss.msc.service.ServiceRegistryException; //导入依赖的package包/类
@Override
public void activate(final ServiceActivatorContext serviceActivatorContext) throws ServiceRegistryException {
final ServiceTarget serviceTarget = serviceActivatorContext.getServiceTarget();
final ServiceName endpointName = managementSubsystemEndpoint ? RemotingServices.SUBSYSTEM_ENDPOINT : ManagementRemotingServices.MANAGEMENT_ENDPOINT;
final EndpointService.EndpointType endpointType = managementSubsystemEndpoint ? EndpointService.EndpointType.SUBSYSTEM : EndpointService.EndpointType.MANAGEMENT;
try {
ManagementWorkerService.installService(serviceTarget);
// TODO see if we can figure out a way to work in the vault resolver instead of having to use ExpressionResolver.SIMPLE
@SuppressWarnings("deprecation")
final OptionMap options = EndpointConfigFactory.create(ExpressionResolver.SIMPLE, endpointConfig, DEFAULTS);
ManagementRemotingServices.installRemotingManagementEndpoint(serviceTarget, endpointName, WildFlySecurityManager.getPropertyPrivileged(ServerEnvironment.NODE_NAME, null), endpointType, options);
// Install the communication services
HostControllerConnectionService service = new HostControllerConnectionService(managementURI, serverName, serverProcessName, authKey, initialOperationID, managementSubsystemEndpoint, sslContextSupplier);
Services.addServerExecutorDependency(serviceTarget.addService(HostControllerConnectionService.SERVICE_NAME, service), service.getExecutorInjector())
.addDependency(ServerService.JBOSS_SERVER_SCHEDULED_EXECUTOR, ScheduledExecutorService.class, service.getScheduledExecutorInjector())
.addDependency(endpointName, Endpoint.class, service.getEndpointInjector())
.addDependency(ControlledProcessStateService.SERVICE_NAME, ControlledProcessStateService.class, service.getProcessStateServiceInjectedValue())
.setInitialMode(ServiceController.Mode.ACTIVE).install();
} catch (OperationFailedException e) {
throw new ServiceRegistryException(e);
}
}
示例10: activate
import org.jboss.msc.service.ServiceRegistryException; //导入依赖的package包/类
@Override
public void activate(ServiceActivatorContext serviceActivatorContext) throws ServiceRegistryException {
Module module = Module.forClass(CoreServiceActivator.class);
String deploymentName = module.getIdentifier().getName();
if (deploymentName.startsWith("deployment.")) {
deploymentName = deploymentName.replace("deployment.", "");
}
Context namingContext;
try {
namingContext = new InitialContext();
} catch (NamingException e) {
throw new ServiceRegistryException(e);
}
WunderBossService service = new WunderBossService(deploymentName,
serviceActivatorContext.getServiceRegistry(),
serviceActivatorContext.getServiceTarget(),
namingContext);
serviceActivatorContext.getServiceTarget()
.addService(WunderBossService.serviceName(deploymentName), service)
.setInitialMode(ServiceController.Mode.ACTIVE)
.install();
}
示例11: activate
import org.jboss.msc.service.ServiceRegistryException; //导入依赖的package包/类
@Override
public void activate(ServiceActivatorContext context) throws ServiceRegistryException {
try {
SingletonPolicy policy = (SingletonPolicy) context.getServiceRegistry()
.getRequiredService(parse(SINGLETON_POLICY.getName())).awaitValue();
InjectedValue<ServerEnvironment> env = new InjectedValue<>();
HAService service = new HAService(env);
policy.createSingletonServiceBuilder(SERVICE_NAME, service).build(context.getServiceTarget())
.addDependency(ServerEnvironmentService.SERVICE_NAME, ServerEnvironment.class, env).install();
} catch (InterruptedException e) {
throw new ServiceRegistryException(e);
}
}
开发者ID:PacktPublishing,项目名称:Mastering-Java-EE-Development-with-WildFly,代码行数:14,代码来源:HAServicePolicyActivator.java
示例12: activate
import org.jboss.msc.service.ServiceRegistryException; //导入依赖的package包/类
@Override
public void activate(ServiceActivatorContext context) {
ServiceTarget target = context.getServiceTarget();
try {
SingletonServiceBuilderFactory factory = (SingletonServiceBuilderFactory) context.getServiceRegistry()
.getRequiredService(BUILDER.getServiceName(CONTAINER_NAME)).awaitValue();
install(target, factory, DEFAULT_SERVICE_NAME, 1);
install(target, factory, QUORUM_SERVICE_NAME, 2);
} catch (InterruptedException e) {
throw new ServiceRegistryException(e);
}
}
开发者ID:PacktPublishing,项目名称:Mastering-Java-EE-Development-with-WildFly,代码行数:13,代码来源:HAServiceActivator.java
示例13: activate
import org.jboss.msc.service.ServiceRegistryException; //导入依赖的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();
}
示例14: activate
import org.jboss.msc.service.ServiceRegistryException; //导入依赖的package包/类
@Override
public void activate(ServiceActivatorContext context) throws ServiceRegistryException {
ServiceTarget target = context.getServiceTarget();
InputStream in = Thread.currentThread().getContextClassLoader().getResourceAsStream(TopologyArchive.REGISTRATION_CONF);
if (in == null) {
return;
}
try (BufferedReader reader = new BufferedReader(new InputStreamReader(in))) {
String serviceName = null;
while ((serviceName = reader.readLine()) != null) {
serviceName = serviceName.trim();
if (!serviceName.isEmpty()) {
installAdvertiser(target, serviceName, "http");
installAdvertiser(target, serviceName, "https");
}
}
} catch (IOException e) {
throw new ServiceRegistryException(e);
}
}
开发者ID:wildfly-swarm-archive,项目名称:wildfly-swarm-topology,代码行数:28,代码来源:RegistrationAdvertiserActivator.java
示例15: getServiceActivators
import org.jboss.msc.service.ServiceRegistryException; //导入依赖的package包/类
@Override
public List<ServiceActivator> getServiceActivators(final CamelCoreFraction fraction) {
List<ServiceActivator> activators = new ArrayList<>(super.getServiceActivators(fraction));
activators.add(new ServiceActivator() {
@Override
public void activate(ServiceActivatorContext context) throws ServiceRegistryException {
BootstrapCamelContextService.addService(context.getServiceTarget(), fraction);
}
});
return activators;
}