本文整理汇总了Java中org.jboss.as.server.ServerEnvironmentService类的典型用法代码示例。如果您正苦于以下问题:Java ServerEnvironmentService类的具体用法?Java ServerEnvironmentService怎么用?Java ServerEnvironmentService使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ServerEnvironmentService类属于org.jboss.as.server包,在下文中一共展示了ServerEnvironmentService类的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: activate
import org.jboss.as.server.ServerEnvironmentService; //导入依赖的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();
}
开发者ID:wildfly-swarm,项目名称:wildfly-swarm,代码行数:27,代码来源:MetricsServiceActivator.java
示例2: createService
import org.jboss.as.server.ServerEnvironmentService; //导入依赖的package包/类
public static ServiceController<RhqMetricsService> createService(final ServiceTarget target,
final ServiceVerificationHandler verificationHandler,
ModelNode config) {
RhqMetricsService service = new RhqMetricsService(config);
return target.addService(SERVICE_NAME, service)
.addDependency(ServerEnvironmentService.SERVICE_NAME, ServerEnvironment.class,
service.serverEnvironmentValue)
.addDependency(Services.JBOSS_SERVER_CONTROLLER, ModelController.class,
service.modelControllerValue)
.addDependency(ControlledProcessStateService.SERVICE_NAME, ControlledProcessStateService.class,
service.processStateValue)
.addListener(verificationHandler)
.setInitialMode(ServiceController.Mode.ACTIVE)
.install();
}
开发者ID:hawkular,项目名称:wildfly-monitor,代码行数:18,代码来源:RhqMetricsService.java
示例3: installWildFlySingleton
import org.jboss.as.server.ServerEnvironmentService; //导入依赖的package包/类
private static void installWildFlySingleton(final ServiceRegistry registry,
final ServiceTarget target,
final Service service,
final ServiceName name) {
SingletonServiceBuilderFactory factory = null;
for(ServiceName each : SINGLETON_FACTORY_NAMES) {
ServiceController factoryService = registry.getService(each);
if (factoryService != null) {
factory = (SingletonServiceBuilderFactory)factoryService.getValue();
}
}
if (factory == null) {
throw new RuntimeException("Failed to locate singleton builder");
}
final InjectedValue<ServerEnvironment> env = new InjectedValue<>();
factory.createSingletonServiceBuilder(name, service)
.electionPolicy((SingletonElectionPolicy)electionPolicy())
.requireQuorum(1)
.build(target)
.addDependency(ServerEnvironmentService.SERVICE_NAME, ServerEnvironment.class, env)
.setInitialMode(ServiceController.Mode.ACTIVE)
.install();
}
开发者ID:projectodd,项目名称:wunderboss,代码行数:26,代码来源:SingletonHelper.java
示例4: activate
import org.jboss.as.server.ServerEnvironmentService; //导入依赖的package包/类
@Override
public void activate(ServiceActivatorContext context) {
log.info("HATimerService will be installed!");
HATimerService service = new HATimerService();
SingletonService<String> singleton = new SingletonService<String>(service, HATimerService.SINGLETON_SERVICE_NAME);
/*
* We can pass a chain of election policies to the singleton, for example to tell JGroups to prefer running the singleton on a node with a
* particular name
*/
// singleton.setElectionPolicy(new PreferredSingletonElectionPolicy(new SimpleSingletonElectionPolicy(), new NamePreference("node2/cluster")));
// Workaround for JBoss AS 7.1.2
// In later releases, SingleService.build(...) accepts a service target
singleton.build(new DelegatingServiceContainer(context.getServiceTarget(), context.getServiceRegistry()))
// singleton.build(context.getServiceTarget())
.addDependency(ServerEnvironmentService.SERVICE_NAME, ServerEnvironment.class, service.env)
.setInitialMode(ServiceController.Mode.ACTIVE)
.install()
;
}
开发者ID:red-fox-mulder,项目名称:eap-6.1-quickstarts,代码行数:22,代码来源:HATimerServiceActivator.java
示例5: activate
import org.jboss.as.server.ServerEnvironmentService; //导入依赖的package包/类
@Override
public void activate(ServiceActivatorContext context) {
log.info("HATimerService will be installed!");
HATimerService service = new HATimerService();
SingletonService<String> singleton = new SingletonService<String>(service, HATimerService.SINGLETON_SERVICE_NAME);
/*
* We can pass a chain of election policies to the singleton, for example to tell JGroups to prefer running the singleton on a node with a
* particular name
*/
// singleton.setElectionPolicy(new PreferredSingletonElectionPolicy(new SimpleSingletonElectionPolicy(), new NamePreference("node2/cluster")));
singleton.build(new DelegatingServiceContainer(context.getServiceTarget(), context.getServiceRegistry()))
.addDependency(ServerEnvironmentService.SERVICE_NAME, ServerEnvironment.class, service.env)
.setInitialMode(ServiceController.Mode.ACTIVE)
.install()
;
}
开发者ID:wfink,项目名称:jboss-as-quickstart,代码行数:19,代码来源:HATimerServiceActivator.java
示例6: activate
import org.jboss.as.server.ServerEnvironmentService; //导入依赖的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
示例7: activate
import org.jboss.as.server.ServerEnvironmentService; //导入依赖的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
示例8: activate
import org.jboss.as.server.ServerEnvironmentService; //导入依赖的package包/类
@Override
public void activate(ServiceActivatorContext context) throws ServiceRegistryException {
Optional<String> securityRealm = Optional.empty();
if (!monitorFractionInstance.isUnsatisfied()) {
securityRealm = monitorFractionInstance.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
示例9: addService
import org.jboss.as.server.ServerEnvironmentService; //导入依赖的package包/类
static ServiceController<?> addService(final ServiceTarget serviceTarget, final ServiceName serviceName, final String managementName, final byte[] hash) {
final ManagedExplodedContentServitor service = new ManagedExplodedContentServitor(managementName, hash);
return addServerExecutorDependency(serviceTarget.addService(serviceName, service), service.executorInjectedValue)
.addDependency(ContentRepository.SERVICE_NAME, ContentRepository.class, service.contentRepositoryInjectedValue)
.addDependency(ServerEnvironmentService.SERVICE_NAME, ServerEnvironment.class, service.serverEnvironmentInjectedValue)
.install();
}
开发者ID:wildfly,项目名称:wildfly-core,代码行数:8,代码来源:ManagedExplodedContentServitor.java
示例10: start
import org.jboss.as.server.ServerEnvironmentService; //导入依赖的package包/类
@Override
public void start(StartContext context) throws StartException {
if (initializer != null) {
initializer.setRootResourceDefinitionDelegate();
}
super.start(context);
//todo super hack
if (type == TestModelType.STANDALONE){
ServerEnvironmentService.addService(((ServerInitializer)initializer).environment, context.getChildTarget());
}
}
开发者ID:wildfly,项目名称:wildfly-core,代码行数:13,代码来源:TestModelControllerService.java
示例11: install
import org.jboss.as.server.ServerEnvironmentService; //导入依赖的package包/类
public ServiceController<Runtime> install(ServiceTarget serviceTarget) {
ServiceBuilder<Runtime> builder = serviceTarget.addService(GraviaConstants.RUNTIME_SERVICE_NAME, this);
builder.addDependency(ServerEnvironmentService.SERVICE_NAME, ServerEnvironment.class, injectedServerEnvironment);
return builder.install();
}
开发者ID:tdiesler,项目名称:gravia,代码行数:6,代码来源:RuntimeService.java
注:本文中的org.jboss.as.server.ServerEnvironmentService类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论