mirror of
https://github.com/eclipse-sailing-analytics/sailing-analytics.git
synced 2026-11-07 19:42:17 +00:00
first attempt to load and store a TracTrac connectivity params object with service finder approach
Change-Id: I8a42e772a31ab074b561154ec42fa1ac28e79bb9
This commit is contained in:
1 parent
48ffb76e11
commit
c949c21450
13 files changed
+238
-39
No files matched your search
+3
-1
@@ -1,5 +1,7 @@
|
||||
package com.sap.sailing.domain.persistence;
|
||||
|
||||
import java.net.MalformedURLException;
|
||||
import java.net.URISyntaxException;
|
||||
import java.net.URL;
|
||||
import java.util.Collection;
|
||||
import java.util.Map;
|
||||
@@ -153,5 +155,5 @@ public interface DomainObjectFactory {
|
||||
* @see MongoObjectFactory#addConnectivityParametersForRaceToRestore(RaceTrackingConnectivityParameters)
|
||||
* @see MongoObjectFactory#removeConnectivityParametersForRaceToRestore(RaceTrackingConnectivityParameters)
|
||||
*/
|
||||
Iterable<RaceTrackingConnectivityParameters> loadConnectivityParametersForRacesToRestore();
|
||||
Iterable<RaceTrackingConnectivityParameters> loadConnectivityParametersForRacesToRestore() throws MalformedURLException, URISyntaxException;
|
||||
}
|
||||
+3
-2
@@ -2,6 +2,7 @@ package com.sap.sailing.domain.persistence.impl;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.net.MalformedURLException;
|
||||
import java.net.URISyntaxException;
|
||||
import java.net.URL;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
@@ -2283,7 +2284,7 @@ public class DomainObjectFactoryImpl implements DomainObjectFactory {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Iterable<RaceTrackingConnectivityParameters> loadConnectivityParametersForRacesToRestore() {
|
||||
public Iterable<RaceTrackingConnectivityParameters> loadConnectivityParametersForRacesToRestore() throws MalformedURLException, URISyntaxException {
|
||||
Set<RaceTrackingConnectivityParameters> result = new HashSet<>();
|
||||
final DBCollection collection = database.getCollection(CollectionNames.CONNECTIVITY_PARAMS_FOR_RACES_TO_BE_RESTORED.name());
|
||||
for (final DBObject o : collection.find()) {
|
||||
@@ -2296,7 +2297,7 @@ public class DomainObjectFactoryImpl implements DomainObjectFactory {
|
||||
map.put(key, o.get(key));
|
||||
}
|
||||
}
|
||||
connectivityParamsPersistenceService.mapTo(map);
|
||||
result.add(connectivityParamsPersistenceService.mapTo(map));
|
||||
}
|
||||
}
|
||||
return result;
|
||||
|
||||
@@ -11,8 +11,12 @@ Require-Bundle: org.mongodb.mongo-java-driver;bundle-version="2.13.0",
|
||||
com.sap.sailing.domain.tractracadapter,
|
||||
com.sap.sailing.domain,
|
||||
com.sap.sailing.domain.common,
|
||||
com.sap.sse.common
|
||||
Export-Package: com.sap.sailing.domain.tractracadapter.persistence,
|
||||
com.sap.sailing.domain.tractracadapter.persistence.impl
|
||||
com.sap.sse.common,
|
||||
com.sap.sailing.domain.persistence,
|
||||
com.sap.sse,
|
||||
org.eclipse.osgi
|
||||
Export-Package: com.sap.sailing.domain.tractracadapter.impl,
|
||||
com.sap.sailing.domain.tractracadapter.persistence,
|
||||
com.sap.sailing.domain.tractracadapter.persistence.impl;x-friends:="com.sap.sailing.mongodb.test"
|
||||
Import-Package: org.osgi.framework
|
||||
Bundle-Activator: com.sap.sailing.domain.tractracadapter.persistence.impl.Activator
|
||||
+103
@@ -0,0 +1,103 @@
|
||||
package com.sap.sailing.domain.tractracadapter.impl;
|
||||
|
||||
import java.net.MalformedURLException;
|
||||
import java.net.URI;
|
||||
import java.net.URISyntaxException;
|
||||
import java.net.URL;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import com.sap.sailing.domain.racelog.RaceLogStore;
|
||||
import com.sap.sailing.domain.regattalog.RegattaLogStore;
|
||||
import com.sap.sailing.domain.tracking.RaceTrackingConnectivityParameters;
|
||||
import com.sap.sailing.domain.tracking.RaceTrackingConnectivityParametersHandler;
|
||||
import com.sap.sailing.domain.tractracadapter.DomainFactory;
|
||||
import com.sap.sse.common.TypeBasedServiceFinder;
|
||||
import com.sap.sse.common.impl.MillisecondsDurationImpl;
|
||||
import com.sap.sse.common.impl.MillisecondsTimePoint;
|
||||
|
||||
/**
|
||||
* Handles mapping TracTrac connectivity parameters from and to a map with {@link String} keys. The
|
||||
* "param URL" is considered the {@link #getKey(RaceTrackingConnectivityParameters) key} for these objects.<p>
|
||||
*
|
||||
* Lives in the same package as {@link RaceTrackingConnectivityParameters} for package-private access to
|
||||
* its members.
|
||||
*
|
||||
* @author Axel Uhl (d043530)
|
||||
*
|
||||
*/
|
||||
public class ConnectivityParamsHandler implements RaceTrackingConnectivityParametersHandler {
|
||||
private static final String USE_INTERNAL_MARK_PASSING_ALGORITHM = "useInternalMarkPassingAlgorithm";
|
||||
private static final String TRAC_TRAC_USERNAME = "tracTracUsername";
|
||||
private static final String TRAC_TRAC_PASSWORD = "tracTracPassword";
|
||||
private static final String STORED_URI = "storedURI";
|
||||
private static final String START_OF_TRACKING_MILLIS = "startOfTrackingMillis";
|
||||
private static final String RACE_VISIBILITY = "raceVisibility";
|
||||
private static final String RACE_STATUS = "raceStatus";
|
||||
private static final String PARAM_URL = "paramURL";
|
||||
private static final String OFFSET_TO_START_TIME_OF_SIMULATED_RACE_MILLIS = "offsetToStartTimeOfSimulatedRaceMillis";
|
||||
private static final String LIVE_URI = "liveURI";
|
||||
private static final String END_OF_TRACKING_MILLIS = "endOfTrackingMillis";
|
||||
private static final String DELAY_TO_LIVE_IN_MILLIS = "delayToLiveInMillis";
|
||||
private static final String COURSE_DESIGN_UPDATE_URI = "courseDesignUpdateURI";
|
||||
private final RaceLogStore raceLogStore;
|
||||
private final RegattaLogStore regattaLogStore;
|
||||
private final DomainFactory domainFactory;
|
||||
|
||||
public ConnectivityParamsHandler(RaceLogStore raceLogStore, RegattaLogStore regattaLogStore, DomainFactory domainFactory) {
|
||||
super();
|
||||
this.raceLogStore = raceLogStore;
|
||||
this.regattaLogStore = regattaLogStore;
|
||||
this.domainFactory = domainFactory;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> mapFrom(RaceTrackingConnectivityParameters params) {
|
||||
assert params instanceof RaceTrackingConnectivityParametersImpl;
|
||||
final RaceTrackingConnectivityParametersImpl ttParams = (RaceTrackingConnectivityParametersImpl) params;
|
||||
final Map<String, Object> result = getKey(params);
|
||||
result.put(PARAM_URL, ttParams.getParamURL().toString());
|
||||
result.put(COURSE_DESIGN_UPDATE_URI, ttParams.getCourseDesignUpdateURI()==null?null:ttParams.getCourseDesignUpdateURI().toString());
|
||||
result.put(DELAY_TO_LIVE_IN_MILLIS, ttParams.getDelayToLiveInMillis());
|
||||
result.put(END_OF_TRACKING_MILLIS, ttParams.getEndOfTracking()==null?null:ttParams.getEndOfTracking().asMillis());
|
||||
result.put(LIVE_URI, ttParams.getLiveURI()==null?null:ttParams.getLiveURI().toString());
|
||||
result.put(OFFSET_TO_START_TIME_OF_SIMULATED_RACE_MILLIS, ttParams.getOffsetToStartTimeOfSimulatedRace()==null?null:ttParams.getOffsetToStartTimeOfSimulatedRace().asMillis());
|
||||
result.put(RACE_STATUS, ttParams.getRaceStatus());
|
||||
result.put(RACE_VISIBILITY, ttParams.getRaceVisibility());
|
||||
result.put(START_OF_TRACKING_MILLIS, ttParams.getStartOfTracking()==null?null:ttParams.getStartOfTracking().asMillis());
|
||||
result.put(STORED_URI, ttParams.getStoredURI()==null?null:ttParams.getStoredURI().toString());
|
||||
result.put(TRAC_TRAC_PASSWORD, ttParams.getTracTracPassword());
|
||||
result.put(TRAC_TRAC_USERNAME, ttParams.getTracTracUsername().toString());
|
||||
result.put(USE_INTERNAL_MARK_PASSING_ALGORITHM, ttParams.isUseInternalMarkPassingAlgorithm());
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public RaceTrackingConnectivityParameters mapTo(Map<String, Object> map) throws MalformedURLException, URISyntaxException {
|
||||
return new RaceTrackingConnectivityParametersImpl(
|
||||
new URL(map.get(PARAM_URL).toString()),
|
||||
map.get(LIVE_URI) == null ? null : new URI(map.get(LIVE_URI).toString()),
|
||||
map.get(STORED_URI) == null ? null : new URI(map.get(STORED_URI).toString()),
|
||||
map.get(COURSE_DESIGN_UPDATE_URI) == null ? null : new URI(map.get(COURSE_DESIGN_UPDATE_URI).toString()),
|
||||
map.get(START_OF_TRACKING_MILLIS) == null ? null : new MillisecondsTimePoint(((Number) map.get(START_OF_TRACKING_MILLIS)).longValue()),
|
||||
map.get(END_OF_TRACKING_MILLIS) == null ? null : new MillisecondsTimePoint(((Number) map.get(END_OF_TRACKING_MILLIS)).longValue()),
|
||||
((Number) map.get(DELAY_TO_LIVE_IN_MILLIS)).longValue(),
|
||||
map.get(OFFSET_TO_START_TIME_OF_SIMULATED_RACE_MILLIS) == null ? null : new MillisecondsDurationImpl(((Number) map.get(OFFSET_TO_START_TIME_OF_SIMULATED_RACE_MILLIS)).longValue()),
|
||||
(Boolean) map.get(USE_INTERNAL_MARK_PASSING_ALGORITHM),
|
||||
raceLogStore, regattaLogStore, domainFactory,
|
||||
map.get(TRAC_TRAC_USERNAME)==null?null:map.get(TRAC_TRAC_USERNAME).toString(),
|
||||
map.get(TRAC_TRAC_PASSWORD)==null?null:map.get(TRAC_TRAC_PASSWORD).toString(),
|
||||
map.get(RACE_STATUS)==null?null:map.get(RACE_STATUS).toString(),
|
||||
map.get(RACE_VISIBILITY)==null?null:map.get(RACE_VISIBILITY).toString());
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> getKey(RaceTrackingConnectivityParameters params) {
|
||||
assert params instanceof RaceTrackingConnectivityParametersImpl;
|
||||
final RaceTrackingConnectivityParametersImpl ttParams = (RaceTrackingConnectivityParametersImpl) params;
|
||||
final Map<String, Object> result = new HashMap<>();
|
||||
result.put(TypeBasedServiceFinder.TYPE, params.getTypeIdentifier());
|
||||
result.put(PARAM_URL, ttParams.getParamURL().toString());
|
||||
return result;
|
||||
}
|
||||
}
|
||||
+46
@@ -1,16 +1,62 @@
|
||||
package com.sap.sailing.domain.tractracadapter.persistence.impl;
|
||||
|
||||
import java.util.Dictionary;
|
||||
import java.util.Hashtable;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import org.osgi.framework.BundleActivator;
|
||||
import org.osgi.framework.BundleContext;
|
||||
import org.osgi.util.tracker.ServiceTracker;
|
||||
|
||||
import com.sap.sailing.domain.base.DomainFactory;
|
||||
import com.sap.sailing.domain.persistence.DomainObjectFactory;
|
||||
import com.sap.sailing.domain.persistence.MongoObjectFactory;
|
||||
import com.sap.sailing.domain.persistence.MongoRaceLogStoreFactory;
|
||||
import com.sap.sailing.domain.persistence.MongoRegattaLogStoreFactory;
|
||||
import com.sap.sailing.domain.racelog.RaceLogStore;
|
||||
import com.sap.sailing.domain.regattalog.RegattaLogStore;
|
||||
import com.sap.sailing.domain.tracking.RaceTrackingConnectivityParametersHandler;
|
||||
import com.sap.sailing.domain.tractracadapter.TracTracAdapterFactory;
|
||||
import com.sap.sailing.domain.tractracadapter.impl.ConnectivityParamsHandler;
|
||||
import com.sap.sailing.domain.tractracadapter.impl.RaceTrackingConnectivityParametersImpl;
|
||||
import com.sap.sse.common.TypeBasedServiceFinder;
|
||||
import com.sap.sse.mongodb.MongoDBService;
|
||||
import com.sap.sse.util.ServiceTrackerFactory;
|
||||
|
||||
public class Activator implements BundleActivator {
|
||||
private static final Logger logger = Logger.getLogger(Activator.class.getName());
|
||||
|
||||
/**
|
||||
* Requires a base {@link DomainFactory} as well as a {@link RaceLogStore} and a {@link RegattaLogStore}. In order
|
||||
* to instantiate those two stores, the method requires a {@link MongoObjectFactory} and a {@link DomainObjectFactory}
|
||||
* which are waited for as services from the OSGi registry. This happens in a separate thread that the {@link #start(BundleContext)}
|
||||
* method launches.
|
||||
*/
|
||||
@Override
|
||||
public void start(BundleContext context) throws Exception {
|
||||
for (CollectionNames name : CollectionNames.values()) {
|
||||
MongoDBService.INSTANCE.registerExclusively(CollectionNames.class, name.name());
|
||||
}
|
||||
new Thread(() -> {
|
||||
final ServiceTracker<MongoObjectFactory, MongoObjectFactory> mongoObjectFactoryServiceTracker = ServiceTrackerFactory.createAndOpen(context, MongoObjectFactory.class);
|
||||
final ServiceTracker<DomainObjectFactory, DomainObjectFactory> domainObjectFactoryServiceTracker = ServiceTrackerFactory.createAndOpen(context, DomainObjectFactory.class);
|
||||
try {
|
||||
final MongoObjectFactory mongoObjectFactory = mongoObjectFactoryServiceTracker.waitForService(0);
|
||||
final DomainObjectFactory domainObjectFactory = domainObjectFactoryServiceTracker.waitForService(0);
|
||||
final Dictionary<String, Object> properties = new Hashtable<String, Object>();
|
||||
final com.sap.sailing.domain.tractracadapter.DomainFactory domainFactory = TracTracAdapterFactory.INSTANCE.getOrCreateTracTracAdapter(
|
||||
domainObjectFactory.getBaseDomainFactory()).getTracTracDomainFactory();
|
||||
final ConnectivityParamsHandler paramsHandler = new ConnectivityParamsHandler(
|
||||
MongoRaceLogStoreFactory.INSTANCE.getMongoRaceLogStore(mongoObjectFactory, domainObjectFactory),
|
||||
MongoRegattaLogStoreFactory.INSTANCE.getMongoRegattaLogStore(mongoObjectFactory, domainObjectFactory),
|
||||
domainFactory);
|
||||
properties.put(TypeBasedServiceFinder.TYPE, RaceTrackingConnectivityParametersImpl.TYPE);
|
||||
context.registerService(RaceTrackingConnectivityParametersHandler.class, paramsHandler, properties);
|
||||
} catch (Exception e) {
|
||||
logger.log(Level.SEVERE, "Exception trying to register TracTrac RaceTrackingConnectivityParametersHandler implementation", e);
|
||||
}
|
||||
}, getClass().getName() + " registering connectivity handler").start();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
-26
@@ -1,26 +0,0 @@
|
||||
package com.sap.sailing.domain.tractracadapter.persistence.impl;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import com.sap.sailing.domain.tracking.RaceTrackingConnectivityParameters;
|
||||
import com.sap.sailing.domain.tracking.RaceTrackingConnectivityParametersHandler;
|
||||
|
||||
public class ConnectivityParamsHandler implements RaceTrackingConnectivityParametersHandler {
|
||||
@Override
|
||||
public Map<String, Object> mapFrom(RaceTrackingConnectivityParameters params) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public RaceTrackingConnectivityParameters mapTo(Map<String, Object> map) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> getKey(RaceTrackingConnectivityParameters params) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -19,7 +19,8 @@ Export-Package: com.sap.sailing.domain.tractracadapter,
|
||||
x-friends:="com.sap.sailing.domain.test,
|
||||
com.sap.sailing.domain.swisstimingadapter.test,
|
||||
com.sap.sailing.server.test,
|
||||
com.sap.sailing.mongodb.test"
|
||||
com.sap.sailing.mongodb.test,
|
||||
com.sap.sailing.domain.tractracadapter.persistence"
|
||||
Bundle-ActivationPolicy: lazy
|
||||
Import-Package: org.apache.http,
|
||||
org.apache.http.client,
|
||||
|
||||
+48
@@ -100,4 +100,52 @@ public class RaceTrackingConnectivityParametersImpl implements RaceTrackingConne
|
||||
return delayToLiveInMillis;
|
||||
}
|
||||
|
||||
URL getParamURL() {
|
||||
return paramURL;
|
||||
}
|
||||
|
||||
URI getLiveURI() {
|
||||
return liveURI;
|
||||
}
|
||||
|
||||
URI getStoredURI() {
|
||||
return storedURI;
|
||||
}
|
||||
|
||||
URI getCourseDesignUpdateURI() {
|
||||
return courseDesignUpdateURI;
|
||||
}
|
||||
|
||||
TimePoint getStartOfTracking() {
|
||||
return startOfTracking;
|
||||
}
|
||||
|
||||
TimePoint getEndOfTracking() {
|
||||
return endOfTracking;
|
||||
}
|
||||
|
||||
Duration getOffsetToStartTimeOfSimulatedRace() {
|
||||
return offsetToStartTimeOfSimulatedRace;
|
||||
}
|
||||
|
||||
String getTracTracUsername() {
|
||||
return tracTracUsername;
|
||||
}
|
||||
|
||||
String getTracTracPassword() {
|
||||
return tracTracPassword;
|
||||
}
|
||||
|
||||
String getRaceStatus() {
|
||||
return raceStatus;
|
||||
}
|
||||
|
||||
String getRaceVisibility() {
|
||||
return raceVisibility;
|
||||
}
|
||||
|
||||
boolean isUseInternalMarkPassingAlgorithm() {
|
||||
return useInternalMarkPassingAlgorithm;
|
||||
}
|
||||
|
||||
}
|
||||
+3
-1
@@ -1,5 +1,7 @@
|
||||
package com.sap.sailing.domain.tracking;
|
||||
|
||||
import java.net.MalformedURLException;
|
||||
import java.net.URISyntaxException;
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
|
||||
@@ -35,7 +37,7 @@ public interface RaceTrackingConnectivityParametersHandler {
|
||||
* produced {@code map} by passing it to this service's {@link #mapFrom(RaceTrackingConnectivityParameters)}
|
||||
* method.
|
||||
*/
|
||||
RaceTrackingConnectivityParameters mapTo(Map<String, Object> map);
|
||||
RaceTrackingConnectivityParameters mapTo(Map<String, Object> map) throws MalformedURLException, URISyntaxException;
|
||||
|
||||
/**
|
||||
* @return a map that contains the {@link TypeBasedServiceFinder#TYPE} identifier as taken from
|
||||
|
||||
@@ -28,7 +28,8 @@ Require-Bundle: com.sap.sailing.domain,
|
||||
com.sap.sse.replication,
|
||||
com.sap.sse,
|
||||
com.sap.sse.filestorage,
|
||||
com.sap.sse.shared.android
|
||||
com.sap.sse.shared.android,
|
||||
com.sap.sailing.domain.tractracadapter.persistence
|
||||
Import-Package: com.sap.sailing.domain.common,
|
||||
com.sap.sailing.domain.common.impl,
|
||||
com.sap.sailing.domain.common.racelog,
|
||||
|
||||
+15
-2
@@ -4,15 +4,23 @@ import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import com.sap.sailing.domain.base.DomainFactory;
|
||||
import com.sap.sailing.domain.persistence.DomainObjectFactory;
|
||||
import com.sap.sailing.domain.persistence.MongoObjectFactory;
|
||||
import com.sap.sailing.domain.persistence.MongoRaceLogStoreFactory;
|
||||
import com.sap.sailing.domain.persistence.MongoRegattaLogStoreFactory;
|
||||
import com.sap.sailing.domain.persistence.PersistenceFactory;
|
||||
import com.sap.sailing.domain.persistence.racelog.tracking.DeviceIdentifierMongoHandler;
|
||||
import com.sap.sailing.domain.persistence.racelog.tracking.impl.PlaceHolderDeviceIdentifierMongoHandler;
|
||||
import com.sap.sailing.domain.racelog.tracking.test.mock.SmartphoneImeiIdentifier;
|
||||
import com.sap.sailing.domain.tracking.RaceTrackingConnectivityParametersHandler;
|
||||
import com.sap.sailing.domain.tractracadapter.TracTracAdapterFactory;
|
||||
import com.sap.sailing.domain.tractracadapter.impl.ConnectivityParamsHandler;
|
||||
import com.sap.sailing.domain.tractracadapter.impl.RaceTrackingConnectivityParametersImpl;
|
||||
import com.sap.sailing.domain.tractracadapter.persistence.impl.ConnectivityParamsHandler;
|
||||
import com.sap.sse.common.NoCorrespondingServiceRegisteredException;
|
||||
import com.sap.sse.common.TypeBasedServiceFinder;
|
||||
import com.sap.sse.common.TypeBasedServiceFinderFactory;
|
||||
import com.sap.sse.mongodb.MongoDBService;
|
||||
|
||||
/**
|
||||
* A simplified implementation of the {@link TypeBasedServiceFinder} interface that, when the device type
|
||||
@@ -32,7 +40,12 @@ public class MockConnectivityParamsServiceFinderFactory implements TypeBasedServ
|
||||
throws NoCorrespondingServiceRegisteredException {
|
||||
switch (type) {
|
||||
case RaceTrackingConnectivityParametersImpl.TYPE:
|
||||
return new ConnectivityParamsHandler();
|
||||
final MongoObjectFactory mongoObjectFactory = PersistenceFactory.INSTANCE.getDefaultMongoObjectFactory(MockConnectivityParamsServiceFinderFactory.this);
|
||||
final DomainObjectFactory domainObjectFactory = PersistenceFactory.INSTANCE.getDomainObjectFactory(MongoDBService.INSTANCE, DomainFactory.INSTANCE, MockConnectivityParamsServiceFinderFactory.this);
|
||||
return new ConnectivityParamsHandler(
|
||||
MongoRaceLogStoreFactory.INSTANCE.getMongoRaceLogStore(mongoObjectFactory, domainObjectFactory),
|
||||
MongoRegattaLogStoreFactory.INSTANCE.getMongoRegattaLogStore(mongoObjectFactory, domainObjectFactory),
|
||||
TracTracAdapterFactory.INSTANCE.getOrCreateTracTracAdapter(domainObjectFactory.getBaseDomainFactory()).getTracTracDomainFactory());
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -24,6 +24,8 @@ import com.sap.sailing.domain.base.Regatta;
|
||||
import com.sap.sailing.domain.common.tracking.impl.DoubleVectorFixImpl;
|
||||
import com.sap.sailing.domain.common.tracking.impl.GPSFixImpl;
|
||||
import com.sap.sailing.domain.common.tracking.impl.GPSFixMovingImpl;
|
||||
import com.sap.sailing.domain.persistence.DomainObjectFactory;
|
||||
import com.sap.sailing.domain.persistence.MongoObjectFactory;
|
||||
import com.sap.sailing.domain.persistence.racelog.tracking.FixMongoHandler;
|
||||
import com.sap.sailing.domain.persistence.racelog.tracking.impl.DoubleVectorFixMongoHandlerImpl;
|
||||
import com.sap.sailing.domain.persistence.racelog.tracking.impl.GPSFixMongoHandlerImpl;
|
||||
@@ -114,6 +116,8 @@ public class Activator implements BundleActivator {
|
||||
|
||||
// register the racing service in the OSGi registry
|
||||
racingEventService.setBundleContext(context);
|
||||
context.registerService(MongoObjectFactory.class, racingEventService.getMongoObjectFactory(), /* properties */ null);
|
||||
context.registerService(DomainObjectFactory.class, racingEventService.getDomainObjectFactory(), /* properties */ null);
|
||||
final Dictionary<String, String> replicableServiceProperties = new Hashtable<>();
|
||||
replicableServiceProperties.put(Replicable.OSGi_Service_Registry_ID_Property_Name,
|
||||
racingEventService.getId().toString());
|
||||
|
||||
+2
-2
@@ -24,9 +24,9 @@ public class OSGiBasedTrackedRegattaListener implements TrackedRegattaListener {
|
||||
}
|
||||
|
||||
private void forEachListener(Consumer<TrackedRegattaListener> consumer) {
|
||||
for(ServiceReference<TrackedRegattaListener> serviceReference : serviceTracker.getServiceReferences()) {
|
||||
for (ServiceReference<TrackedRegattaListener> serviceReference : serviceTracker.getServiceReferences()) {
|
||||
TrackedRegattaListener listener = serviceTracker.getService(serviceReference);
|
||||
if(listener != null) {
|
||||
if (listener != null) {
|
||||
consumer.accept(listener);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user