Package loci.common.services
Class ServiceFactory
- java.lang.Object
-
- loci.common.services.ServiceFactory
-
public class ServiceFactory extends Object
Runtime instantiation of services.
-
-
Constructor Summary
Constructors Constructor Description ServiceFactory()
Constructor loading service configuration from the default location.ServiceFactory(String path)
Constructor loading service configuration from a given location.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description <T extends Service>
TgetInstance(Class<T> type)
Retrieves an instance of a given service.
-
-
-
Constructor Detail
-
ServiceFactory
public ServiceFactory() throws DependencyException
Constructor loading service configuration from the default location.- Throws:
DependencyException
- If there is an error locating or reading from the default configuration location.
-
ServiceFactory
public ServiceFactory(String path) throws DependencyException
Constructor loading service configuration from a given location.- Parameters:
path
- Location to load service configuration from.- Throws:
DependencyException
- If there is an error locating or reading frompath
.
-
-
Method Detail
-
getInstance
public <T extends Service> T getInstance(Class<T> type) throws DependencyException
Retrieves an instance of a given service.- Type Parameters:
T
- generic service type- Parameters:
type
- Interface type of the service.- Returns:
- A newly instantiated service.
- Throws:
DependencyException
- If there is an error instantiating the service instance requested.
-
-