Package org.eclipse.aether.impl
Class DefaultServiceLocator
java.lang.Object
org.eclipse.aether.impl.DefaultServiceLocator
- All Implemented Interfaces:
ServiceLocator
Deprecated.
A simple service locator that is already setup with all components from this library. To acquire a complete
repository system, clients need to add an artifact descriptor reader, a version resolver, a version range resolver
and optionally some repository connector and transporter factories to access remote repositories. Once the locator is
fully populated, the repository system can be created like this:
RepositorySystem repoSystem = serviceLocator.getService( RepositorySystem.class );Note: This class is not thread-safe. Clients are expected to create the service locator and the repository system on a single thread.
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
Deprecated.A hook to customize the handling of errors encountered while locating a service implementation. -
Constructor Summary
ConstructorDescriptionDeprecated.Creates a new service locator that already knows about all service implementations included this library. -
Method Summary
Modifier and TypeMethodDescriptionaddService
(Class<T> type, Class<? extends T> impl) Deprecated.Adds an implementation class for a service.<T> T
getService
(Class<T> type) Deprecated.Gets an instance of the specified service.<T> List
<T> getServices
(Class<T> type) Deprecated.Gets all available instances of the specified service.void
setErrorHandler
(DefaultServiceLocator.ErrorHandler errorHandler) Deprecated.Sets the error handler to use.setService
(Class<T> type, Class<? extends T> impl) Deprecated.Sets the implementation class for a service.setServices
(Class<T> type, T... services) Deprecated.Sets the instances for a service.
-
Constructor Details
-
DefaultServiceLocator
public DefaultServiceLocator()Deprecated.Creates a new service locator that already knows about all service implementations included this library.
-
-
Method Details
-
setService
Deprecated.Sets the implementation class for a service. The specified class must have a no-arg constructor (of any visibility). If the service implementation itself requires other services for its operation, it should implementService
to gain access to this service locator.- Type Parameters:
T
- The service type.- Parameters:
type
- The interface describing the service, must not benull
.impl
- The implementation class of the service, must not benull
.- Returns:
- This locator for chaining, never
null
.
-
addService
Deprecated.Adds an implementation class for a service. The specified class must have a no-arg constructor (of any visibility). If the service implementation itself requires other services for its operation, it should implementService
to gain access to this service locator.- Type Parameters:
T
- The service type.- Parameters:
type
- The interface describing the service, must not benull
.impl
- The implementation class of the service, must not benull
.- Returns:
- This locator for chaining, never
null
.
-
setServices
Deprecated.Sets the instances for a service.- Type Parameters:
T
- The service type.- Parameters:
type
- The interface describing the service, must not benull
.services
- The instances of the service, may benull
but must not containnull
elements.- Returns:
- This locator for chaining, never
null
.
-
getService
Deprecated.Description copied from interface:ServiceLocator
Gets an instance of the specified service.- Specified by:
getService
in interfaceServiceLocator
- Type Parameters:
T
- The service type.- Parameters:
type
- The interface describing the service, must not benull
.- Returns:
- The service instance or
null
if the service could not be located/initialized.
-
getServices
Deprecated.Description copied from interface:ServiceLocator
Gets all available instances of the specified service.- Specified by:
getServices
in interfaceServiceLocator
- Type Parameters:
T
- The service type.- Parameters:
type
- The interface describing the service, must not benull
.- Returns:
- The (read-only) list of available service instances, never
null
.
-
setErrorHandler
Deprecated.Sets the error handler to use.- Parameters:
errorHandler
- The error handler to use, may benull
to ignore/swallow errors.
-
maven-resolver-supplier
.