Package org.jboss.as.server
Class ServerEnvironmentService
- java.lang.Object
-
- org.jboss.as.server.ServerEnvironmentService
-
- All Implemented Interfaces:
org.jboss.msc.Service,org.jboss.msc.service.Service<ServerEnvironment>,org.jboss.msc.value.Value<ServerEnvironment>
public class ServerEnvironmentService extends Object implements org.jboss.msc.service.Service<ServerEnvironment>
Exposes theServerEnvironmentvia aService.Services that need access to the
ServerEnvironmentcan use this service to have it injected. For example, suppose we have a serviceMyServicethat has a fieldinjectedEnvironmentinto which it wants the ServerEnvironment injected. And supposeMyServiceexposes a utility method to facilitate installing it via aServiceTarget. TheServerEnvironmentinjection could be done as follows:public static void addService(BatchBuilder batchBuilder) { MyService myService = new MyService(); InjectedValueinjectedEnvironment = myService.injectedEnvironment; batchBuilder.addService(MyService.SERVICE_NAME, myService) .addSystemDependency(ServerEnvironmentService.SERVICE_NAME, ServerEnvironment.class, injectedEnvironment); } - Author:
- Brian Stansberry
-
-
Field Summary
Fields Modifier and Type Field Description static org.jboss.msc.service.ServiceNameSERVICE_NAMEStandard ServiceName under which a ServerEnvironmentService would be registered
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static voidaddService(ServerEnvironment serverEnvironment, org.jboss.msc.service.ServiceTarget target)Adds a ServerEnvironmentService based on the givenserverEnvironmentto the given batch under nameSERVICE_NAME.ServerEnvironmentgetValue()voidstart(org.jboss.msc.service.StartContext context)voidstop(org.jboss.msc.service.StopContext context)
-
-
-
Method Detail
-
addService
public static void addService(ServerEnvironment serverEnvironment, org.jboss.msc.service.ServiceTarget target)
Adds a ServerEnvironmentService based on the givenserverEnvironmentto the given batch under nameSERVICE_NAME.- Parameters:
serverEnvironment- theServerEnvironment. Cannot benulltarget- the batch builder. Cannot benull
-
start
public void start(org.jboss.msc.service.StartContext context) throws org.jboss.msc.service.StartException- Specified by:
startin interfaceorg.jboss.msc.Service- Specified by:
startin interfaceorg.jboss.msc.service.Service<ServerEnvironment>- Throws:
org.jboss.msc.service.StartException
-
stop
public void stop(org.jboss.msc.service.StopContext context)
- Specified by:
stopin interfaceorg.jboss.msc.Service- Specified by:
stopin interfaceorg.jboss.msc.service.Service<ServerEnvironment>
-
getValue
public ServerEnvironment getValue() throws IllegalStateException
- Specified by:
getValuein interfaceorg.jboss.msc.value.Value<ServerEnvironment>- Throws:
IllegalStateException
-
-