Package org.jboss.msc.service
Class DelegatingServiceBuilder<T>
- java.lang.Object
-
- org.jboss.msc.service.DelegatingServiceBuilder<T>
-
- Type Parameters:
T
- the service type
- All Implemented Interfaces:
ServiceBuilder<T>
public final class DelegatingServiceBuilder<T> extends java.lang.Object implements ServiceBuilder<T>
A service builder which delegates to another service builder.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.jboss.msc.service.ServiceBuilder
ServiceBuilder.DependencyType
-
-
Field Summary
Fields Modifier and Type Field Description private ServiceBuilder<T>
delegate
-
Constructor Summary
Constructors Constructor Description DelegatingServiceBuilder(ServiceBuilder<T> delegate)
Construct a new instance.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ServiceBuilder<T>
addAliases(ServiceName... aliases)
Add aliases for this service.ServiceBuilder<T>
addDependencies(java.lang.Iterable<ServiceName> dependencies)
Add multiple, non-injected dependencies.ServiceBuilder<T>
addDependencies(ServiceBuilder.DependencyType dependencyType, java.lang.Iterable<ServiceName> dependencies)
Add multiple, non-injected dependencies.ServiceBuilder<T>
addDependencies(ServiceBuilder.DependencyType dependencyType, ServiceName... dependencies)
Add multiple, non-injected dependencies.ServiceBuilder<T>
addDependencies(ServiceName... dependencies)
Add multiple, non-injected dependencies.ServiceBuilder<T>
addDependency(ServiceBuilder.DependencyType dependencyType, ServiceName dependency)
Add a dependency.<I> ServiceBuilder<T>
addDependency(ServiceBuilder.DependencyType dependencyType, ServiceName dependency, java.lang.Class<I> type, Injector<I> target)
Add a service dependency.ServiceBuilder<T>
addDependency(ServiceBuilder.DependencyType dependencyType, ServiceName dependency, Injector<java.lang.Object> target)
Add a service dependency.ServiceBuilder<T>
addDependency(ServiceName dependency)
Add a dependency.<I> ServiceBuilder<T>
addDependency(ServiceName dependency, java.lang.Class<I> type, Injector<I> target)
Add a service dependency.ServiceBuilder<T>
addDependency(ServiceName dependency, Injector<java.lang.Object> target)
Add a service dependency.<I> ServiceBuilder<T>
addInjection(Injector<? super I> target, I value)
Add an injection.ServiceBuilder<T>
addInjection(Injector<? super T> target)
Add an injection of this service into another target.<I> ServiceBuilder<T>
addInjectionValue(Injector<? super I> target, Value<I> value)
Add an injection value.ServiceBuilder<T>
addListener(java.util.Collection<? extends ServiceListener<? super T>> listeners)
Add service listeners that will be added to this service.ServiceBuilder<T>
addListener(ServiceListener<? super T> listener)
Add a service listener that will be added to this service.ServiceBuilder<T>
addListener(ServiceListener<? super T>... listeners)
Add service listeners that will be added to this service.ServiceBuilder<T>
addMonitor(StabilityMonitor monitor)
Add a service stability monitor that will be added to this service.ServiceBuilder<T>
addMonitors(StabilityMonitor... monitors)
Add service stability monitors that will be added to this service.ServiceController<T>
install()
Install the defined service into the container.ServiceBuilder<T>
setInitialMode(ServiceController.Mode mode)
Set the initial mode.
-
-
-
Field Detail
-
delegate
private final ServiceBuilder<T> delegate
-
-
Constructor Detail
-
DelegatingServiceBuilder
public DelegatingServiceBuilder(ServiceBuilder<T> delegate)
Construct a new instance.- Parameters:
delegate
- the builder to delegate to
-
-
Method Detail
-
addAliases
public ServiceBuilder<T> addAliases(ServiceName... aliases)
Add aliases for this service.- Specified by:
addAliases
in interfaceServiceBuilder<T>
- Parameters:
aliases
- the service names to use as aliases- Returns:
- the builder
-
setInitialMode
public ServiceBuilder<T> setInitialMode(ServiceController.Mode mode)
Set the initial mode.- Specified by:
setInitialMode
in interfaceServiceBuilder<T>
- Parameters:
mode
- the initial mode- Returns:
- this builder
-
addDependencies
public ServiceBuilder<T> addDependencies(ServiceName... dependencies)
Add multiple, non-injected dependencies.- Specified by:
addDependencies
in interfaceServiceBuilder<T>
- Parameters:
dependencies
- the service names to depend on- Returns:
- this builder
-
addDependencies
public ServiceBuilder<T> addDependencies(ServiceBuilder.DependencyType dependencyType, ServiceName... dependencies)
Add multiple, non-injected dependencies.- Specified by:
addDependencies
in interfaceServiceBuilder<T>
- Parameters:
dependencyType
- the dependency type; must not benull
dependencies
- the service names to depend on- Returns:
- this builder
-
addDependencies
public ServiceBuilder<T> addDependencies(java.lang.Iterable<ServiceName> dependencies)
Add multiple, non-injected dependencies.- Specified by:
addDependencies
in interfaceServiceBuilder<T>
- Parameters:
dependencies
- the service names to depend on- Returns:
- this builder
-
addDependencies
public ServiceBuilder<T> addDependencies(ServiceBuilder.DependencyType dependencyType, java.lang.Iterable<ServiceName> dependencies)
Add multiple, non-injected dependencies.- Specified by:
addDependencies
in interfaceServiceBuilder<T>
- Parameters:
dependencyType
- the dependency type; must not benull
dependencies
- the service names to depend on- Returns:
- this builder
-
addDependency
public ServiceBuilder<T> addDependency(ServiceName dependency)
Add a dependency. Calling this method multiple times for the same service name will only add it as a dependency one time; however this may be useful to specify multiple injections for one dependency.- Specified by:
addDependency
in interfaceServiceBuilder<T>
- Parameters:
dependency
- the name of the dependency- Returns:
- an injection builder for optionally injecting the dependency
-
addDependency
public ServiceBuilder<T> addDependency(ServiceBuilder.DependencyType dependencyType, ServiceName dependency)
Add a dependency. Calling this method multiple times for the same service name will only add it as a dependency one time; however this may be useful to specify multiple injections for one dependency.- Specified by:
addDependency
in interfaceServiceBuilder<T>
- Parameters:
dependencyType
- the dependency type; must not benull
dependency
- the name of the dependency- Returns:
- an injection builder for optionally injecting the dependency
-
addDependency
public ServiceBuilder<T> addDependency(ServiceName dependency, Injector<java.lang.Object> target)
Add a service dependency. Calling this method multiple times for the same service name will only add it as a dependency one time; however this may be useful to specify multiple injections for one dependency.- Specified by:
addDependency
in interfaceServiceBuilder<T>
- Parameters:
dependency
- the name of the dependencytarget
- the injector into which the dependency should be stored- Returns:
- this builder
-
addDependency
public ServiceBuilder<T> addDependency(ServiceBuilder.DependencyType dependencyType, ServiceName dependency, Injector<java.lang.Object> target)
Add a service dependency. Calling this method multiple times for the same service name will only add it as a dependency one time; however this may be useful to specify multiple injections for one dependency.- Specified by:
addDependency
in interfaceServiceBuilder<T>
- Parameters:
dependencyType
- the dependency type; must not benull
dependency
- the name of the dependencytarget
- the injector into which the dependency should be stored- Returns:
- this builder
-
addDependency
public <I> ServiceBuilder<T> addDependency(ServiceName dependency, java.lang.Class<I> type, Injector<I> target)
Add a service dependency. The type of the dependency is checked before it is passed into the (type-safe) injector instance. Calling this method multiple times for the same service name will only add it as a dependency one time; however this may be useful to specify multiple injections for one dependency.- Specified by:
addDependency
in interfaceServiceBuilder<T>
- Type Parameters:
I
- the type of the value of the dependency- Parameters:
dependency
- the name of the dependencytype
- the class of the value of the dependencytarget
- the injector into which the dependency should be stored- Returns:
- this builder
-
addDependency
public <I> ServiceBuilder<T> addDependency(ServiceBuilder.DependencyType dependencyType, ServiceName dependency, java.lang.Class<I> type, Injector<I> target)
Add a service dependency. The type of the dependency is checked before it is passed into the (type-safe) injector instance. Calling this method multiple times for the same service name will only add it as a dependency one time; however this may be useful to specify multiple injections for one dependency.- Specified by:
addDependency
in interfaceServiceBuilder<T>
- Type Parameters:
I
- the type of the value of the dependency- Parameters:
dependencyType
- the dependency type; must not benull
dependency
- the name of the dependencytype
- the class of the value of the dependencytarget
- the injector into which the dependency should be stored- Returns:
- this builder
-
addInjection
public <I> ServiceBuilder<T> addInjection(Injector<? super I> target, I value)
Add an injection. The given value will be injected into the given injector before service start, and uninjected after service stop.- Specified by:
addInjection
in interfaceServiceBuilder<T>
- Type Parameters:
I
- the injection type- Parameters:
target
- the injection targetvalue
- the injection value- Returns:
- this builder
-
addInjectionValue
public <I> ServiceBuilder<T> addInjectionValue(Injector<? super I> target, Value<I> value)
Add an injection value. The given value will be injected into the given injector before service start, and uninjected after service stop.- Specified by:
addInjectionValue
in interfaceServiceBuilder<T>
- Type Parameters:
I
- the injection type- Parameters:
target
- the injection targetvalue
- the injection value- Returns:
- this builder
-
addInjection
public ServiceBuilder<T> addInjection(Injector<? super T> target)
Add an injection of this service into another target. The given injector will be given this service after start, and uninjected when this service stops.Differently from other injection types, failures to perform an outward injection will not result in a failure to start the service.
- Specified by:
addInjection
in interfaceServiceBuilder<T>
- Parameters:
target
- the injector target- Returns:
- this builder
-
addMonitor
public ServiceBuilder<T> addMonitor(StabilityMonitor monitor)
Description copied from interface:ServiceBuilder
Add a service stability monitor that will be added to this service.- Specified by:
addMonitor
in interfaceServiceBuilder<T>
- Parameters:
monitor
- the stability monitor to add to the service- Returns:
- this builder
-
addMonitors
public ServiceBuilder<T> addMonitors(StabilityMonitor... monitors)
Description copied from interface:ServiceBuilder
Add service stability monitors that will be added to this service.- Specified by:
addMonitors
in interfaceServiceBuilder<T>
- Parameters:
monitors
- a list of stability monitors to add to the service- Returns:
- this builder
-
addListener
public ServiceBuilder<T> addListener(ServiceListener<? super T> listener)
Add a service listener that will be added to this service.- Specified by:
addListener
in interfaceServiceBuilder<T>
- Parameters:
listener
- the listener to add to the service- Returns:
- this builder
-
addListener
public ServiceBuilder<T> addListener(ServiceListener<? super T>... listeners)
Add service listeners that will be added to this service.- Specified by:
addListener
in interfaceServiceBuilder<T>
- Parameters:
listeners
- a list of listeners to add to the service- Returns:
- this builder
-
addListener
public ServiceBuilder<T> addListener(java.util.Collection<? extends ServiceListener<? super T>> listeners)
Add service listeners that will be added to this service.- Specified by:
addListener
in interfaceServiceBuilder<T>
- Parameters:
listeners
- a collection of listeners to add to the service- Returns:
- this builder
-
install
public ServiceController<T> install() throws ServiceRegistryException
Install the defined service into the container. All service listeners defined for this built service will be invoked from the same thread that calls this method.- Specified by:
install
in interfaceServiceBuilder<T>
- Returns:
- the installed service controller
- Throws:
ServiceRegistryException
- if installation fails
-
-