Tony CHEMIT pushed to branch develop at ultreiaio / ird-observe
Commits:
-
85d9ecc9
by Tony CHEMIT at 2017-09-10T10:15:43+02:00
1 changed file:
Changes:
| ... | ... | @@ -38,6 +38,7 @@ import fr.ird.observe.services.service.ObserveService; |
| 38 | 38 |
import io.ultreia.java4all.http.HResponseBuilder;
|
| 39 | 39 |
import java.io.IOException;
|
| 40 | 40 |
import java.util.Objects;
|
| 41 |
+import org.apache.commons.lang3.StringUtils;
|
|
| 41 | 42 |
|
| 42 | 43 |
/**
|
| 43 | 44 |
* Created on 16/08/15.
|
| ... | ... | @@ -61,6 +62,8 @@ public class ObserveServiceFactoryClient extends ObserveServiceFactorySupport im |
| 61 | 62 |
});
|
| 62 | 63 |
private final static ClassMappingClient CLASS_MAPPING = ClassMappingClient.get();
|
| 63 | 64 |
|
| 65 |
+ private final static int LOCATE_PREFIX_LENGTH = ObserveServiceClientSupport.class.getPackage().getName().length();
|
|
| 66 |
+ |
|
| 64 | 67 |
@Override
|
| 65 | 68 |
public <S extends ObserveService> boolean accept(ObserveDataSourceConfiguration dataSourceConfiguration, Class<S> serviceType) {
|
| 66 | 69 |
|
| ... | ... | @@ -110,8 +113,8 @@ public class ObserveServiceFactoryClient extends ObserveServiceFactorySupport im |
| 110 | 113 |
throw new IllegalStateException("Can't get service " + implementationType, e);
|
| 111 | 114 |
}
|
| 112 | 115 |
|
| 113 |
- String serviceLocation = implementationType.getCanonicalName().replace(serviceType.getName(), "");
|
|
| 114 |
- serviceLocation = serviceLocation.substring(0, serviceLocation.length() - "Client".length());
|
|
| 116 |
+ String serviceLocation = implementationType.getCanonicalName().substring(LOCATE_PREFIX_LENGTH).replaceAll("\\.", "/");
|
|
| 117 |
+ serviceLocation = StringUtils.removeEnd(serviceLocation, "Client");
|
|
| 115 | 118 |
|
| 116 | 119 |
ObserveServiceClientContext serviceRestApiContext = new ObserveServiceClientContext(
|
| 117 | 120 |
observeServiceInitializer,
|