public class ServerEnvironmentService extends Object implements org.jboss.msc.service.Service<ServerEnvironment>
ServerEnvironment via a Service.
Services that need access to the ServerEnvironment can use this service to
have it injected. For example, suppose we have a service MyService
that has a field injectedEnvironment into which it wants the
ServerEnvironment injected. And suppose MyService exposes a utility method
to facilitate installing it via a ServiceTarget. The ServerEnvironment
injection could be done as follows:
public static void addService(BatchBuilder batchBuilder) {
MyService myService = new MyService();
InjectedValue injectedEnvironment = myService.injectedEnvironment;
batchBuilder.addService(MyService.SERVICE_NAME, myService)
.addSystemDependency(ServerEnvironmentService.SERVICE_NAME, ServerEnvironment.class, injectedEnvironment);
}
| Modifier and Type | Field and Description |
|---|---|
static org.jboss.msc.service.ServiceName |
SERVICE_NAME
Standard ServiceName under which a ServerEnvironmentService would be registered
|
| Modifier and Type | Method and Description |
|---|---|
static void |
addService(ServerEnvironment serverEnvironment,
org.jboss.msc.service.ServiceTarget target)
Adds a ServerEnvironmentService based on the given
serverEnvironment
to the given batch under name SERVICE_NAME. |
ServerEnvironment |
getValue() |
void |
start(org.jboss.msc.service.StartContext context) |
void |
stop(org.jboss.msc.service.StopContext context) |
public static final org.jboss.msc.service.ServiceName SERVICE_NAME
public static void addService(ServerEnvironment serverEnvironment, org.jboss.msc.service.ServiceTarget target)
serverEnvironment
to the given batch under name SERVICE_NAME.serverEnvironment - the ServerEnvironment. Cannot be nulltarget - the batch builder. Cannot be nullpublic void start(org.jboss.msc.service.StartContext context)
throws org.jboss.msc.service.StartException
start in interface org.jboss.msc.service.Service<ServerEnvironment>org.jboss.msc.service.StartExceptionpublic void stop(org.jboss.msc.service.StopContext context)
stop in interface org.jboss.msc.service.Service<ServerEnvironment>public ServerEnvironment getValue() throws IllegalStateException
getValue in interface org.jboss.msc.value.Value<ServerEnvironment>IllegalStateExceptionCopyright © 2015 JBoss by Red Hat. All rights reserved.