Package com.ocs.dynamo.service.impl
Class BaseSpringServiceLocator
- java.lang.Object
-
- com.ocs.dynamo.service.impl.BaseSpringServiceLocator
-
- All Implemented Interfaces:
ServiceLocator
public abstract class BaseSpringServiceLocator extends Object implements ServiceLocator
Static class for accessing the Spring container- Author:
- bas.rutten
-
-
Field Summary
Fields Modifier and Type Field Description protected org.springframework.context.ApplicationContextctx
-
Constructor Summary
Constructors Constructor Description BaseSpringServiceLocator()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description EntityModelFactorygetEntityModelFactory()Retrieves the entity model factory from the contextMessageServicegetMessageService()Retrieves the message service from the context<T> TgetService(Class<T> clazz)Retrieves a service of a certain type<T> TgetServiceByName(String name, Class<T> clazz)BaseService<?,?>getServiceForEntity(Class<?> entityClass)Returns a service that is used to manage a certain type of entity<T> Collection<T>getServices(Class<T> clazz)protected abstract org.springframework.context.ApplicationContextloadCtx()
-
-
-
Method Detail
-
loadCtx
protected abstract org.springframework.context.ApplicationContext loadCtx()
-
getService
public <T> T getService(Class<T> clazz)
Retrieves a service of a certain type- Specified by:
getServicein interfaceServiceLocator- Parameters:
clazz- the class of the service- Returns:
-
getServiceByName
public <T> T getServiceByName(String name, Class<T> clazz)
- Specified by:
getServiceByNamein interfaceServiceLocator
-
getMessageService
public MessageService getMessageService()
Retrieves the message service from the context- Specified by:
getMessageServicein interfaceServiceLocator- Returns:
-
getEntityModelFactory
public EntityModelFactory getEntityModelFactory()
Retrieves the entity model factory from the context- Specified by:
getEntityModelFactoryin interfaceServiceLocator- Returns:
-
getServiceForEntity
public BaseService<?,?> getServiceForEntity(Class<?> entityClass)
Returns a service that is used to manage a certain type of entity- Specified by:
getServiceForEntityin interfaceServiceLocator- Parameters:
entityClass- the entity class- Returns:
-
getServices
public <T> Collection<T> getServices(Class<T> clazz)
- Specified by:
getServicesin interfaceServiceLocator
-
-