Package loci.common.services
Class ServiceFactory
java.lang.Object
loci.common.services.ServiceFactory
public class ServiceFactory
extends java.lang.Object
Runtime instantiation of services.
-
Constructor Summary
Constructors Constructor Description ServiceFactory()
Constructor loading service configuration from the default location.ServiceFactory(java.lang.String path)
Constructor loading service configuration from a given location. -
Method Summary
Modifier and Type Method Description <T extends Service>
TgetInstance(java.lang.Class<T> type)
Retrieves an instance of a given service.
-
Constructor Details
-
ServiceFactory
Constructor loading service configuration from the default location.- Throws:
DependencyException
- If there is an error locating or reading from the default configuration location.
-
ServiceFactory
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 Details
-
getInstance
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.
-