JBoss Modular Service Kernel API 1.0.0.Beta6

org.jboss.msc.service
Class DelegatingServiceBuilder<T>

java.lang.Object
  extended by org.jboss.msc.service.DelegatingServiceBuilder<T>
Type Parameters:
T - the service type
All Implemented Interfaces:
ServiceBuilder<T>

public final class DelegatingServiceBuilder<T>
extends Object
implements ServiceBuilder<T>

A service builder which delegates to another service builder.

Author:
David M. Lloyd

Nested Class Summary
 
Nested classes/interfaces inherited from interface org.jboss.msc.service.ServiceBuilder
ServiceBuilder.DependencyType
 
Constructor Summary
DelegatingServiceBuilder(ServiceBuilder<T> delegate)
          Construct a new instance.
 
Method Summary
 ServiceBuilder<T> addAliases(ServiceName... aliases)
          Add aliases for this service.
 ServiceBuilder<T> addDependencies(Iterable<ServiceName> dependencies)
          Add multiple, non-injected dependencies.
 ServiceBuilder<T> addDependencies(ServiceBuilder.DependencyType dependencyType, 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, Class<I> type, Injector<I> target)
          Add a service dependency.
 ServiceBuilder<T> addDependency(ServiceBuilder.DependencyType dependencyType, ServiceName dependency, Injector<Object> target)
          Add a service dependency.
 ServiceBuilder<T> addDependency(ServiceName dependency)
          Add a dependency.
<I> ServiceBuilder<T>
addDependency(ServiceName dependency, Class<I> type, Injector<I> target)
          Add a service dependency.
 ServiceBuilder<T> addDependency(ServiceName dependency, Injector<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(Collection<? extends ServiceListener<? super T>> listeners)
          Add service listeners 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> addListener(ServiceListener<? super T> listener)
          Add a service listener that will be added to this service.
 ServiceBuilder<T> addOptionalDependencies(Iterable<ServiceName> dependencies)
          Deprecated. 
 ServiceBuilder<T> addOptionalDependencies(ServiceName... dependencies)
          Deprecated. 
 ServiceBuilder<T> addOptionalDependency(ServiceName dependency)
          Deprecated. 
<I> ServiceBuilder<T>
addOptionalDependency(ServiceName dependency, Class<I> type, Injector<I> target)
          Deprecated. 
 ServiceBuilder<T> addOptionalDependency(ServiceName dependency, Injector<Object> target)
          Deprecated. 
 ServiceController<T> install()
          Install the defined service into the container.
 ServiceBuilder<T> setInitialMode(ServiceController.Mode mode)
          Set the initial mode.
 ServiceBuilder<T> setLocation()
          Set the service definition location to be the caller's location.
 ServiceBuilder<T> setLocation(Location location)
          Set the service definition location, if any.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

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 interface ServiceBuilder<T>
Parameters:
aliases - the service names to use as aliases
Returns:
the builder

setLocation

public ServiceBuilder<T> setLocation()
Set the service definition location to be the caller's location.

Specified by:
setLocation in interface ServiceBuilder<T>
Returns:
this builder

setLocation

public ServiceBuilder<T> setLocation(Location location)
Set the service definition location, if any.

Specified by:
setLocation in interface ServiceBuilder<T>
Parameters:
location - the location
Returns:
this builder

setInitialMode

public ServiceBuilder<T> setInitialMode(ServiceController.Mode mode)
Set the initial mode.

Specified by:
setInitialMode in interface ServiceBuilder<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 interface ServiceBuilder<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 interface ServiceBuilder<T>
Parameters:
dependencyType - the dependency type; must not be null
dependencies - the service names to depend on
Returns:
this builder

addOptionalDependencies

@Deprecated
public ServiceBuilder<T> addOptionalDependencies(ServiceName... dependencies)
Deprecated. 

Add multiple, optional, non-injected dependencies. If the dependencies do not exist, it will not stop the service from starting.

Specified by:
addOptionalDependencies in interface ServiceBuilder<T>
Parameters:
dependencies - the service names to depend on
Returns:
this builder

addDependencies

public ServiceBuilder<T> addDependencies(Iterable<ServiceName> dependencies)
Add multiple, non-injected dependencies.

Specified by:
addDependencies in interface ServiceBuilder<T>
Parameters:
dependencies - the service names to depend on
Returns:
this builder

addDependencies

public ServiceBuilder<T> addDependencies(ServiceBuilder.DependencyType dependencyType,
                                         Iterable<ServiceName> dependencies)
Add multiple, non-injected dependencies.

Specified by:
addDependencies in interface ServiceBuilder<T>
Parameters:
dependencyType - the dependency type; must not be null
dependencies - the service names to depend on
Returns:
this builder

addOptionalDependencies

@Deprecated
public ServiceBuilder<T> addOptionalDependencies(Iterable<ServiceName> dependencies)
Deprecated. 

Add multiple, optional, non-injected dependencies. If the dependencies do not exist, it will not stop the service from starting.

Specified by:
addOptionalDependencies in interface ServiceBuilder<T>
Parameters:
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 interface ServiceBuilder<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 interface ServiceBuilder<T>
Parameters:
dependencyType - the dependency type; must not be null
dependency - the name of the dependency
Returns:
an injection builder for optionally injecting the dependency

addOptionalDependency

@Deprecated
public ServiceBuilder<T> addOptionalDependency(ServiceName dependency)
Deprecated. 

Add an optional 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. If the dependencies do not exist, it will not stop the service from starting.

Specified by:
addOptionalDependency in interface ServiceBuilder<T>
Parameters:
dependency - the name of the dependency
Returns:
an injection builder for optionally injecting the dependency

addDependency

public ServiceBuilder<T> addDependency(ServiceName dependency,
                                       Injector<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 interface ServiceBuilder<T>
Parameters:
dependency - the name of the dependency
target - the injector into which the dependency should be stored
Returns:
this builder

addDependency

public ServiceBuilder<T> addDependency(ServiceBuilder.DependencyType dependencyType,
                                       ServiceName dependency,
                                       Injector<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 interface ServiceBuilder<T>
Parameters:
dependencyType - the dependency type; must not be null
dependency - the name of the dependency
target - the injector into which the dependency should be stored
Returns:
this builder

addOptionalDependency

@Deprecated
public ServiceBuilder<T> addOptionalDependency(ServiceName dependency,
                                                          Injector<Object> target)
Deprecated. 

Add an optional service dependency. This will 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. If the dependencies do not exist, it will not stop the service from starting.

Specified by:
addOptionalDependency in interface ServiceBuilder<T>
Parameters:
dependency - the name of the dependency
target - the injector into which the dependency should be stored
Returns:
this builder

addDependency

public <I> ServiceBuilder<T> addDependency(ServiceName dependency,
                                           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 interface ServiceBuilder<T>
Type Parameters:
I - the type of the value of the dependency
Parameters:
dependency - the name of the dependency
type - the class of the value of the dependency
target - the injector into which the dependency should be stored
Returns:
this builder

addDependency

public <I> ServiceBuilder<T> addDependency(ServiceBuilder.DependencyType dependencyType,
                                           ServiceName dependency,
                                           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 interface ServiceBuilder<T>
Type Parameters:
I - the type of the value of the dependency
Parameters:
dependencyType - the dependency type; must not be null
dependency - the name of the dependency
type - the class of the value of the dependency
target - the injector into which the dependency should be stored
Returns:
this builder

addOptionalDependency

@Deprecated
public <I> ServiceBuilder<T> addOptionalDependency(ServiceName dependency,
                                                              Class<I> type,
                                                              Injector<I> target)
Deprecated. 

Add an optional 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. If the dependencies do not exist, it will not stop the service from starting.

Specified by:
addOptionalDependency in interface ServiceBuilder<T>
Type Parameters:
I - the type of the value of the dependency
Parameters:
dependency - the name of the dependency
type - the class of the value of the dependency
target - 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 interface ServiceBuilder<T>
Type Parameters:
I - the injection type
Parameters:
target - the injection target
value - 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 interface ServiceBuilder<T>
Type Parameters:
I - the injection type
Parameters:
target - the injection target
value - 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 upon start, and uninjected when this service stops.

Specified by:
addInjection in interface ServiceBuilder<T>
Parameters:
target - the injector target
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 interface ServiceBuilder<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 interface ServiceBuilder<T>
Parameters:
listeners - a list of listeners to add to the service
Returns:
this builder

addListener

public ServiceBuilder<T> addListener(Collection<? extends ServiceListener<? super T>> listeners)
Add service listeners that will be added to this service.

Specified by:
addListener in interface ServiceBuilder<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.

Specified by:
install in interface ServiceBuilder<T>
Returns:
the installed service controller
Throws:
ServiceRegistryException - if installation fails

JBoss Modular Service Kernel API 1.0.0.Beta6

Copyright © 2011 JBoss, a division of Red Hat, Inc.