branch feature/7017 updated (82fd5ba -> 87de065)
This is an automated email from the git hooks/post-receive script. New change to branch feature/7017 in repository observe. See http://git.codelutin.com/observe.git from 82fd5ba add missing files + fix API new 87de065 add missing files + fix API The 1 revisions listed above as "new" are entirely new to this repository and will be described in separate emails. The revisions listed as "adds" were already present in the repository and have only been added to this reference. Detailed log of new commits: commit 87de06591a00e8f906eccd856c2f1e2e2b5096e9 Author: Tony CHEMIT <chemit@codelutin.com> Date: Mon May 4 09:38:28 2015 +0200 add missing files + fix API Summary of changes: .../README.txt => observe-services-api/LICENSE.txt | 0 .../README.txt | 0 .../observe/services/ObserveServiceFactory.java | 166 --------------------- .../ref/ReferentialContentUIInitializer.java | 22 ++- 4 files changed, 9 insertions(+), 179 deletions(-) copy observe-entities/README.txt => observe-services-api/LICENSE.txt (100%) copy {observe-entities => observe-services-api}/README.txt (100%) -- To stop receiving notification emails like this one, please contact codelutin.com SCM administrator <admin+scm@list.forge.codelutin.com>.
This is an automated email from the git hooks/post-receive script. New commit to branch feature/7017 in repository observe. See http://git.codelutin.com/observe.git commit 87de06591a00e8f906eccd856c2f1e2e2b5096e9 Author: Tony CHEMIT <chemit@codelutin.com> Date: Mon May 4 09:38:28 2015 +0200 add missing files + fix API --- observe-services-api/LICENSE.txt | 0 observe-services-api/README.txt | 0 .../observe/services/ObserveServiceFactory.java | 166 --------------------- .../ref/ReferentialContentUIInitializer.java | 22 ++- 4 files changed, 9 insertions(+), 179 deletions(-) diff --git a/observe-services-api/LICENSE.txt b/observe-services-api/LICENSE.txt new file mode 100644 index 0000000..e69de29 diff --git a/observe-services-api/README.txt b/observe-services-api/README.txt new file mode 100644 index 0000000..e69de29 diff --git a/observe-services-api/src/main/java/fr/ird/observe/services/ObserveServiceFactory.java b/observe-services-api/src/main/java/fr/ird/observe/services/ObserveServiceFactory.java index 951d040..345052d 100644 --- a/observe-services-api/src/main/java/fr/ird/observe/services/ObserveServiceFactory.java +++ b/observe-services-api/src/main/java/fr/ird/observe/services/ObserveServiceFactory.java @@ -152,19 +152,6 @@ public class ObserveServiceFactory implements Closeable { } } -// public <S extends ObserveService> S getService(Class<S> serviceType) { -// -// Preconditions.checkNotNull(serviceType, "serviceType can't be null."); -// Preconditions.checkNotNull(dataSource, "dataSource can't be null."); -// -// try { -// S s = (S) services.get(serviceType); -// return s; -// } catch (ExecutionException e) { -// throw new ObserveTechnicalException("Could not get service: " + serviceType, e); -// } -// } - public void unregisterDataSource(DataSource dataSource) { //FIXME Remove all service using this dataSource } @@ -186,157 +173,4 @@ public class ObserveServiceFactory implements Closeable { } -// public <S extends ObserveService> S newProxyService(Class<S> serviceType, ObserveApplicationContext applicationContext, DataSource dataSource) { -// -// Preconditions.checkNotNull(serviceType, "serviceType can't be null"); -// Preconditions.checkArgument(serviceType.isInterface(), "serviceType must be an interface"); -// Preconditions.checkNotNull(applicationContext, "applicationContext can't be null"); -// -// ObserveServiceContext serviceContext = new ObserveServiceContext(applicationContext, dataSource); -// -// S service = newProxyService(serviceType, serviceContext); -// return service; -// -// } -// -// public <S extends ObserveService> S newProxyService(Class<S> serviceType, ObserveServiceContext serviceContext) { -// -// Preconditions.checkNotNull(serviceType, "serviceType can't be null"); -// Preconditions.checkArgument(serviceType.isInterface(), "serviceType must be an interface"); -// Preconditions.checkNotNull(serviceContext, "serviceContext can't be null"); -// -// S service = newService(serviceType, serviceContext); -// S proxyService = addProxyService(serviceType, service, serviceContext); -// return proxyService; -// -// } -// -// public static <S extends ObserveService> S newService(Class<S> serviceType, ObserveServiceContext serviceContext) { -// -// Class<S> serviceImpl; -// try { -// //FIXME Cela devrait dépendre de la datasource ? -// serviceImpl = (Class<S>) Class.forName(serviceType.getName() + "Impl"); -// } catch (ClassNotFoundException e) { -// throw new IllegalStateException("Could not find implementation class for " + serviceType); -// } -// -// try { -// -// // Instanciate concrete service -// S service = ConstructorUtils.invokeConstructor(serviceImpl); -// service.setServiceContext(serviceContext); -// -// return service; -// -// } catch (Exception e) { -// throw new ObserveTechnicalException("Could not create service: " + serviceType, e); -// } -// -// } -// -// protected <S extends ObserveService> S addProxyService(Class<S> serviceType, S service, ObserveServiceContext serviceContext) { -// -// // Instanciate transactional proxied service -// ServiceInvocationHandler invocationHandler = new ServiceInvocationHandler(serviceContext, service); -// S proxyService = (S) Proxy.newProxyInstance(ObserveServiceFactory.class.getClassLoader(), new Class[]{serviceType}, invocationHandler); -// -// return proxyService; -// -// } -// -// protected static class ServiceInvocationHandler implements InvocationHandler { -// -// private final ObserveServiceContext serviceContext; -// -// private final ObserveService target; -// -// private final Set<String> methodNamesToByPass; -// -// protected ServiceInvocationHandler(ObserveServiceContext serviceContext, ObserveService target) { -// this.serviceContext = serviceContext; -// this.target = target; -// this.methodNamesToByPass = Sets.newHashSet( -// "equals", -// "hashCode", -// "finalize", -// "toString", -// "clone", -// "getClass" -// ); -// } -// -// @Override -// public Object invoke(Object proxy, Method method, Object[] args) throws Throwable { -// -// Object result; -// -// if (methodNamesToByPass.contains(method.getName()) || method.isAnnotationPresent(NoTransaction.class)) { -// -// result = invokeMethod(method, args); -// -// } else { -// -// result = invokeMethodWithTransaction(method, args); -// -// } -// -// return result; -// -// } -// -// protected Object invokeMethod(Method method, Object... args) throws Throwable { -// try { -// Object result = method.invoke(target, args); -// return result; -// } catch (InvocationTargetException e) { -// throw e.getCause(); -// } -// } -// -// -// protected Object invokeMethodWithTransaction(Method method, Object... args) throws Throwable { -// -// String methodName = method.getName(); -// -// DataSource source = serviceContext.getDataSource(); -// -// TopiaContext tx = source.beginTransaction(methodName); -// -// try { -// -// serviceContext.setTransaction(tx); -// -// Object invoke = invokeMethod(method, args); -// -// if (method.isAnnotationPresent(Commit.class)) { -// -// // do commit -// source.commitTransaction(tx, methodName); -// -// } -// -// return invoke; -// -// } finally { -// -// try { -// -// // always rollback transaction to avoid dirty transactions -// source.rollbackTransaction(tx, methodName); -// -// -// } finally { -// -// serviceContext.setTransaction(null); -// source.closeTransaction(tx, methodName); -// -// } -// -// } -// -// } -// -// } - } diff --git a/observe-swing/src/main/java/fr/ird/observe/ui/content/ref/ReferentialContentUIInitializer.java b/observe-swing/src/main/java/fr/ird/observe/ui/content/ref/ReferentialContentUIInitializer.java index 3ac17f4..bd4aea1 100644 --- a/observe-swing/src/main/java/fr/ird/observe/ui/content/ref/ReferentialContentUIInitializer.java +++ b/observe-swing/src/main/java/fr/ird/observe/ui/content/ref/ReferentialContentUIInitializer.java @@ -24,9 +24,8 @@ package fr.ird.observe.ui.content.ref; import fr.ird.observe.DecoratorService; import fr.ird.observe.ObserveContext; -import fr.ird.observe.db.DataSourceException; +import fr.ird.observe.db.DataSource; import fr.ird.observe.entities.referentiel.ReferenceEntity; -import fr.ird.observe.services.ObserveServiceFactory; import fr.ird.observe.services.referential.ReferentialService; import fr.ird.observe.ui.content.ContentUIInitializer; import jaxx.runtime.swing.editor.bean.BeanListHeader; @@ -60,15 +59,12 @@ public class ReferentialContentUIInitializer<E extends ReferenceEntity, UI exten * Remplit le modèle d'une liste graphique avec la liste des entités d'un * type donné sur un service de persistance donné. * - * @param serviceFactory le service de persistance à utiliser pour - * récupérer les entités - * @param entityClass le type de l'entité - * @param list le component graphique à initialiser - * @throws DataSourceException si un problème lors de la récupération - * des entités + * @param dataSource la data source + * @param entityClass le type de l'entité + * @param list le component graphique à initialiser * @since 1.5 */ - public static <E extends ReferenceEntity> void prepareMainEntityList(ObserveServiceFactory serviceFactory, + public static <E extends ReferenceEntity> void prepareMainEntityList(DataSource dataSource, Class<E> entityClass, BeanListHeader<E> list) { @@ -81,7 +77,7 @@ public class ReferentialContentUIInitializer<E extends ReferenceEntity, UI exten } list.putClientProperty("decorator", decorator); - ReferentialService service = serviceFactory.getService(ReferentialService.class); + ReferentialService service = ObserveContext.getService(dataSource, ReferentialService.class); List<E> data = service.loadListForEdit(entityClass); @@ -107,7 +103,7 @@ public class ReferentialContentUIInitializer<E extends ReferenceEntity, UI exten } @SuppressWarnings("unchecked") - protected void init(ObserveServiceFactory serviceFactory, DecoratorService decoratorService, BeanListHeader beanList) { + protected void init(DataSource dataSource, DecoratorService decoratorService, BeanListHeader beanList) { beanList.setI18nPrefix("observe.common."); @@ -118,11 +114,11 @@ public class ReferentialContentUIInitializer<E extends ReferenceEntity, UI exten if ("listHeader".equals(beanList.getName())) { // use the binder for loading - prepareMainEntityList(serviceFactory, beanList.getBeanType(), beanList); + prepareMainEntityList(dataSource, beanList.getBeanType(), beanList); } else { - super.init(serviceFactory, decoratorService, beanList); + super.init(dataSource, decoratorService, beanList); } -- To stop receiving notification emails like this one, please contact codelutin.com SCM administrator <admin+scm@list.forge.codelutin.com>.
participants (1)
-
codelutin.com scm