public class ServiceRepositoryJpaImpl<C,E,S> extends Object implements ServiceRepositoryJpa<S>
| Constructor and Description |
|---|
ServiceRepositoryJpaImpl(javax.persistence.EntityManagerFactory emf,
Class<C> configClass,
Class<E> executionContextClass,
ServiceLauncher<C,E,S> serviceLauncher) |
| Modifier and Type | Method and Description |
|---|---|
static <C,E,S> ServiceRepositoryJpaImpl<C,E,S> |
create(javax.persistence.EntityManagerFactory emf,
Class<C> configClass,
Class<E> executionContextClass,
ServiceLauncher<C,E,S> serviceLauncher) |
static void |
deleteAll(javax.persistence.EntityManager em,
Class<?> clazz) |
static <T> List<T> |
deleteAll(javax.persistence.EntityManagerFactory emf,
Class<T> clazz) |
void |
deleteByConfigId(Object configId)
Stops a service and removes its execution record
|
void |
deleteExecutionContexts() |
List<C> |
getConfigs() |
static <T> T |
getEntity(javax.persistence.EntityManagerFactory emf,
Class<T> clazz,
Object id) |
javax.persistence.EntityManagerFactory |
getEntityManagerFactory() |
List<E> |
getExecutionContexts() |
Map<Integer,E> |
getExecutions(javax.persistence.EntityManager em,
List<Integer> ids) |
static List<Integer> |
getIds(List<ConfigToExecution> mappings)
Note: There should always be only at most one execution context,
but for dealing with abnormalities we allow a list to be returned.
|
List<ConfigToExecution> |
getMappings(javax.persistence.EntityManager em,
Object configId) |
List<ServiceEventListener<C,E,S>> |
getServiceEventListeners() |
ServiceProvider<S> |
getServiceProviderByConfigId(Object configId) |
ServiceState |
getStateByConfigId(Object configId) |
ServiceState |
getStateByExecutionContextId(Object executionContextId) |
ServiceState |
getStateByExecutionId(Object executionId) |
static <T> List<T> |
listAll(javax.persistence.EntityManager em,
Class<T> clazz) |
static <T> List<T> |
listAll(javax.persistence.EntityManagerFactory emf,
Class<T> clazz) |
ConfigToExecution |
newCte(javax.persistence.EntityManager em,
Object configId,
E executionContext) |
static <T> T |
newEntity(javax.persistence.EntityManager em,
Class<T> clazz) |
void |
setStatus(ConfigToExecution cte,
String status) |
void |
startAll() |
void |
startAllServices()
TODO This could be done in parallel
|
ServiceControl<S> |
startByConfig(C config) |
ServiceControl<S> |
startByConfigId(Object id) |
void |
stopByConfigId(Object configId) |
public List<ServiceEventListener<C,E,S>> getServiceEventListeners()
public static <C,E,S> ServiceRepositoryJpaImpl<C,E,S> create(javax.persistence.EntityManagerFactory emf, Class<C> configClass, Class<E> executionContextClass, ServiceLauncher<C,E,S> serviceLauncher)
public javax.persistence.EntityManagerFactory getEntityManagerFactory()
getEntityManagerFactory in interface ServiceRepositoryJpa<S>public void startAll()
startAll in interface ServiceRepository<S>public static <T> T getEntity(javax.persistence.EntityManagerFactory emf,
Class<T> clazz,
Object id)
public static <T> List<T> listAll(javax.persistence.EntityManagerFactory emf, Class<T> clazz)
public static <T> List<T> deleteAll(javax.persistence.EntityManagerFactory emf, Class<T> clazz)
public static void deleteAll(javax.persistence.EntityManager em,
Class<?> clazz)
public void deleteExecutionContexts()
public void deleteByConfigId(Object configId)
configId - public List<ConfigToExecution> getMappings(javax.persistence.EntityManager em, Object configId)
public static List<Integer> getIds(List<ConfigToExecution> mappings)
configId - public Map<Integer,E> getExecutions(javax.persistence.EntityManager em, List<Integer> ids)
public static <T> T newEntity(javax.persistence.EntityManager em,
Class<T> clazz)
public ConfigToExecution newCte(javax.persistence.EntityManager em, Object configId, E executionContext)
public void startAllServices()
public ServiceControl<S> startByConfigId(Object id)
startByConfigId in interface ServiceRepository<S>public ServiceControl<S> startByConfig(C config)
public void stopByConfigId(Object configId)
stopByConfigId in interface ServiceRepository<S>public void setStatus(ConfigToExecution cte, String status)
public ServiceProvider<S> getServiceProviderByConfigId(Object configId)
public ServiceState getStateByConfigId(Object configId)
public ServiceState getStateByExecutionId(Object executionId)
public ServiceState getStateByExecutionContextId(Object executionContextId)
Copyright © 2015. All rights reserved.