mirror of
https://github.com/eclipse-sailing-analytics/sailing-analytics.git
synced 2026-10-06 12:23:55 +00:00
RaceTracker objects now know the connectivity parmaeter objects from which they were originally created
Change-Id: Ifc3b20618b25f5a4a489108b283a44b9087a31c2
This commit is contained in:
1 parent
6ed29f7d12
commit
c20cf52f4d
21 files changed
+117
-66
No files matched your search
+1
-1
@@ -149,7 +149,7 @@ public interface DomainObjectFactory {
|
||||
* marked as to be restored} before the server got re-started. Callers that would like to use the result to re-connect to
|
||||
* those races should take care not to flood servers with requests. Instead, ideally, callers would monitor the
|
||||
* loading {@link TrackedRace#getStatus() status} or the resulting {@link TrackedRace}s (see
|
||||
* {@link RaceTracker#getRacesHandle()}, {@link RaceHandle#getRace(long)}, {@link RaceHandle#getTrackedRegatta()}
|
||||
* {@link RaceTracker#getRaceHandle()}, {@link RaceHandle#getRace(long)}, {@link RaceHandle#getTrackedRegatta()}
|
||||
* and {@link TrackedRegatta#getTrackedRace(RaceDefinition)}.
|
||||
*
|
||||
* @see MongoObjectFactory#addConnectivityParametersForRaceToRestore(RaceTrackingConnectivityParameters)
|
||||
|
||||
+7
@@ -170,4 +170,11 @@ public interface MongoObjectFactory {
|
||||
* @see #removeConnectivityParametersForRaceToRestore(RaceTrackingConnectivityParameters)
|
||||
*/
|
||||
void addConnectivityParametersForRaceToRestore(RaceTrackingConnectivityParameters params);
|
||||
|
||||
/**
|
||||
* Removes all {@link RaceTrackingConnectivityParameters} objects from those to restore; short for calling
|
||||
* {@link #removeConnectivityParametersForRaceToRestore(RaceTrackingConnectivityParameters)} for all parameter
|
||||
* objects obtained through {@link DomainObjectFactory#loadConnectivityParametersForRacesToRestore()}.
|
||||
*/
|
||||
void removeAllConnectivityParametersForRacesToRestore();
|
||||
}
|
||||
+5
-1
@@ -1551,7 +1551,11 @@ public class MongoObjectFactoryImpl implements MongoObjectFactory {
|
||||
logger.warning("Couldn't find a persistence service for connectivity parameters of type "+typeIdentifier+
|
||||
". Couldn't store race "+params.getTrackerID()+" for restoring.");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeAllConnectivityParametersForRacesToRestore() {
|
||||
database.getCollection(CollectionNames.CONNECTIVITY_PARAMS_FOR_RACES_TO_BE_RESTORED.name()).drop();
|
||||
}
|
||||
|
||||
}
|
||||
+1
-1
@@ -80,7 +80,7 @@ public class RaceLogConnectivityParams implements RaceTrackingConnectivityParame
|
||||
throw new RaceNotCreatedException("No regatta for race-log tracked race");
|
||||
}
|
||||
DynamicTrackedRegatta trackedRegatta = trackedRegattaRegistry.getOrCreateTrackedRegatta(regatta);
|
||||
return new RaceLogRaceTracker(trackedRegatta, this, windStore, raceLogResolver);
|
||||
return new RaceLogRaceTracker(trackedRegatta, this, windStore, raceLogResolver, this);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
+3
-2
@@ -98,7 +98,8 @@ public class RaceLogRaceTracker extends AbstractRaceTrackerBaseImpl {
|
||||
private EndOfTrackingController endOfTrackingController;
|
||||
|
||||
public RaceLogRaceTracker(DynamicTrackedRegatta regatta, RaceLogConnectivityParams params, WindStore windStore,
|
||||
RaceLogResolver raceLogResolver) {
|
||||
RaceLogResolver raceLogResolver, RaceLogConnectivityParams connectivityParams) {
|
||||
super(connectivityParams);
|
||||
this.params = params;
|
||||
this.windStore = windStore;
|
||||
this.trackedRegatta = regatta;
|
||||
@@ -204,7 +205,7 @@ public class RaceLogRaceTracker extends AbstractRaceTrackerBaseImpl {
|
||||
}
|
||||
|
||||
@Override
|
||||
public RaceHandle getRacesHandle() {
|
||||
public RaceHandle getRaceHandle() {
|
||||
return new RaceLogRacesHandle(this);
|
||||
}
|
||||
|
||||
|
||||
+3
-2
@@ -10,6 +10,7 @@ import com.sap.sailing.domain.base.Regatta;
|
||||
import com.sap.sailing.domain.racelog.RaceLogStore;
|
||||
import com.sap.sailing.domain.regattalog.RegattaLogStore;
|
||||
import com.sap.sailing.domain.swisstimingadapter.impl.SwissTimingFactoryImpl;
|
||||
import com.sap.sailing.domain.swisstimingadapter.impl.SwissTimingTrackingConnectivityParameters;
|
||||
import com.sap.sailing.domain.tracking.RaceTracker;
|
||||
import com.sap.sailing.domain.tracking.TrackedRegattaRegistry;
|
||||
import com.sap.sailing.domain.tracking.WindStore;
|
||||
@@ -54,14 +55,14 @@ public interface SwissTimingFactory {
|
||||
BoatClass boatClass, String hostname, int port, StartList startList, long delayToLiveInMillis,
|
||||
RaceLogStore raceLogStore, RegattaLogStore regattaLogStore, WindStore windStore,
|
||||
boolean useInternalMarkPassingAlgorithm, DomainFactory domainFactory,
|
||||
TrackedRegattaRegistry trackedRegattaRegistry, RaceLogResolver raceLogResolver) throws InterruptedException, UnknownHostException,
|
||||
TrackedRegattaRegistry trackedRegattaRegistry, RaceLogResolver raceLogResolver, SwissTimingTrackingConnectivityParameters connectivityParams) throws InterruptedException, UnknownHostException,
|
||||
IOException, ParseException;
|
||||
|
||||
RaceTracker createRaceTracker(Regatta regatta, String raceID, String raceName, String raceDescription,
|
||||
BoatClass boatClass, String hostname, int port, StartList startList, long delayToLiveInMillis,
|
||||
WindStore windStore, boolean useInternalMarkPassingAlgorithm, DomainFactory domainFactory,
|
||||
TrackedRegattaRegistry trackedRegattaRegistry, RaceLogResolver raceLogResolver, RaceLogStore raceLogStore,
|
||||
RegattaLogStore regattaLogStore)
|
||||
RegattaLogStore regattaLogStore, SwissTimingTrackingConnectivityParameters connectivityParams)
|
||||
throws UnknownHostException, InterruptedException, IOException, ParseException;
|
||||
|
||||
Race createRace(String raceId, String raceName, String description, BoatClass boatClass);
|
||||
|
||||
+4
-4
@@ -92,11 +92,11 @@ public class SwissTimingFactoryImpl implements SwissTimingFactory {
|
||||
BoatClass boatClass, String hostname, int port, StartList startList, long delayToLiveInMillis,
|
||||
RaceLogStore raceLogStore, RegattaLogStore regattaLogStore, WindStore windStore,
|
||||
boolean useInternalMarkPassingAlgorithm, DomainFactory domainFactory,
|
||||
TrackedRegattaRegistry trackedRegattaRegistry, RaceLogResolver raceLogResolver)
|
||||
TrackedRegattaRegistry trackedRegattaRegistry, RaceLogResolver raceLogResolver, SwissTimingTrackingConnectivityParameters connectivityParams)
|
||||
throws InterruptedException, UnknownHostException, IOException, ParseException {
|
||||
return new SwissTimingRaceTrackerImpl(raceID, raceName, raceDescription, boatClass, hostname, port, startList,
|
||||
raceLogStore, regattaLogStore, windStore, domainFactory, this,
|
||||
trackedRegattaRegistry, raceLogResolver, delayToLiveInMillis, useInternalMarkPassingAlgorithm);
|
||||
trackedRegattaRegistry, raceLogResolver, delayToLiveInMillis, useInternalMarkPassingAlgorithm, connectivityParams);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -104,11 +104,11 @@ public class SwissTimingFactoryImpl implements SwissTimingFactory {
|
||||
BoatClass boatClass, String hostname, int port, StartList startList, long delayToLiveInMillis,
|
||||
WindStore windStore, boolean useInternalMarkPassingAlgorithm, DomainFactory domainFactory,
|
||||
TrackedRegattaRegistry trackedRegattaRegistry, RaceLogResolver raceLogResolver, RaceLogStore raceLogStore,
|
||||
RegattaLogStore regattaLogStore)
|
||||
RegattaLogStore regattaLogStore, SwissTimingTrackingConnectivityParameters connectivityParams)
|
||||
throws UnknownHostException, InterruptedException, IOException, ParseException {
|
||||
return new SwissTimingRaceTrackerImpl(regatta, raceID, raceName, raceDescription, boatClass, hostname, port,
|
||||
startList, windStore, domainFactory, this, trackedRegattaRegistry, raceLogStore, regattaLogStore,
|
||||
raceLogResolver, delayToLiveInMillis, useInternalMarkPassingAlgorithm);
|
||||
raceLogResolver, delayToLiveInMillis, useInternalMarkPassingAlgorithm, connectivityParams);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
+8
-9
@@ -113,21 +113,20 @@ public class SwissTimingRaceTrackerImpl extends AbstractRaceTrackerImpl
|
||||
String hostname, int port, StartList startList, RaceLogStore raceLogStore, RegattaLogStore regattaLogStore,
|
||||
WindStore windStore, DomainFactory domainFactory, SwissTimingFactory factory,
|
||||
TrackedRegattaRegistry trackedRegattaRegistry, RaceLogResolver raceLogResolver, long delayToLiveInMillis,
|
||||
boolean useInternalMarkPassingAlgorithm) throws InterruptedException,
|
||||
boolean useInternalMarkPassingAlgorithm, SwissTimingTrackingConnectivityParameters connectivityParams) throws InterruptedException,
|
||||
UnknownHostException, IOException, ParseException {
|
||||
this(/* regatta */ null, raceID, raceName,
|
||||
raceDescription, boatClass, hostname, port, startList, windStore, domainFactory, factory,
|
||||
trackedRegattaRegistry,
|
||||
raceLogStore, regattaLogStore, raceLogResolver, delayToLiveInMillis, useInternalMarkPassingAlgorithm);
|
||||
this(/* regatta */ null, raceID, raceName, raceDescription, boatClass, hostname, port, startList, windStore,
|
||||
domainFactory, factory, trackedRegattaRegistry, raceLogStore, regattaLogStore, raceLogResolver,
|
||||
delayToLiveInMillis, useInternalMarkPassingAlgorithm, connectivityParams);
|
||||
}
|
||||
|
||||
protected SwissTimingRaceTrackerImpl(Regatta regatta, String raceID, String raceName, String raceDescription,
|
||||
BoatClass boatClass, String hostname, int port, StartList startList, WindStore windStore,
|
||||
DomainFactory domainFactory, SwissTimingFactory factory, TrackedRegattaRegistry trackedRegattaRegistry,
|
||||
RaceLogStore raceLogStore, RegattaLogStore regattaLogStore, RaceLogResolver raceLogResolver,
|
||||
long delayToLiveInMillis, boolean useInternalMarkPassingAlgorithm)
|
||||
long delayToLiveInMillis, boolean useInternalMarkPassingAlgorithm, SwissTimingTrackingConnectivityParameters connectivityParams)
|
||||
throws InterruptedException, UnknownHostException, IOException, ParseException {
|
||||
super();
|
||||
super(connectivityParams);
|
||||
this.raceLogResolver = raceLogResolver;
|
||||
this.tmdMessageQueue = new TMDMessageQueue(this);
|
||||
final Regatta effectiveRegatta;
|
||||
@@ -152,7 +151,7 @@ public class SwissTimingRaceTrackerImpl extends AbstractRaceTrackerImpl
|
||||
this.windStore = windStore;
|
||||
this.id = createID(raceID, hostname, port);
|
||||
connector.addSailMasterListener(this);
|
||||
trackedRegatta = trackedRegattaRegistry.getOrCreateTrackedRegatta(regatta);
|
||||
trackedRegatta = trackedRegattaRegistry.getOrCreateTrackedRegatta(this.regatta);
|
||||
this.delayToLiveInMillis = delayToLiveInMillis;
|
||||
this.competitorsByBoatId = new HashMap<String, Competitor>();
|
||||
this.useInternalMarkPassingAlgorithm = useInternalMarkPassingAlgorithm;
|
||||
@@ -183,7 +182,7 @@ public class SwissTimingRaceTrackerImpl extends AbstractRaceTrackerImpl
|
||||
}
|
||||
|
||||
@Override
|
||||
public RaceHandle getRacesHandle() {
|
||||
public RaceHandle getRaceHandle() {
|
||||
return new RaceHandle() {
|
||||
@Override
|
||||
public Regatta getRegatta() {
|
||||
|
||||
+2
-2
@@ -62,7 +62,7 @@ public class SwissTimingTrackingConnectivityParameters implements RaceTrackingCo
|
||||
return swissTimingFactory.createRaceTracker(raceID, raceName, raceDescription, boatClass, hostname, port,
|
||||
startList, delayToLiveInMillis, raceLogStore, regattaLogStore, windStore,
|
||||
useInternalMarkPassingAlgorithm,
|
||||
domainFactory, trackedRegattaRegistry, raceLogResolver);
|
||||
domainFactory, trackedRegattaRegistry, raceLogResolver, this);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -70,7 +70,7 @@ public class SwissTimingTrackingConnectivityParameters implements RaceTrackingCo
|
||||
WindStore windStore, RaceLogResolver raceLogResolver) throws Exception {
|
||||
return swissTimingFactory.createRaceTracker(regatta, raceID, raceName, raceDescription, boatClass, hostname,
|
||||
port, startList, delayToLiveInMillis, windStore, useInternalMarkPassingAlgorithm,
|
||||
domainFactory, trackedRegattaRegistry, raceLogResolver, raceLogStore, regattaLogStore);
|
||||
domainFactory, trackedRegattaRegistry, raceLogResolver, raceLogStore, regattaLogStore, this);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
+5
-4
@@ -36,7 +36,8 @@ public class SwissTimingReplayConnectivityParameters implements RaceTrackingConn
|
||||
private final WindStore windStore;
|
||||
private SwissTimingReplayToDomainAdapter listener;
|
||||
|
||||
private SwissTimingReplayRaceTracker(WindStore windStore, SwissTimingReplayToDomainAdapter listener) {
|
||||
private SwissTimingReplayRaceTracker(WindStore windStore, SwissTimingReplayToDomainAdapter listener, SwissTimingReplayConnectivityParameters connectivityParams) {
|
||||
super(connectivityParams);
|
||||
this.windStore = windStore;
|
||||
this.listener = listener;
|
||||
}
|
||||
@@ -69,7 +70,7 @@ public class SwissTimingReplayConnectivityParameters implements RaceTrackingConn
|
||||
}
|
||||
|
||||
@Override
|
||||
public RaceHandle getRacesHandle() {
|
||||
public RaceHandle getRaceHandle() {
|
||||
return new RaceHandle() {
|
||||
@Override
|
||||
public Regatta getRegatta() {
|
||||
@@ -139,7 +140,7 @@ public class SwissTimingReplayConnectivityParameters implements RaceTrackingConn
|
||||
trackedRegattaRegistry, useInternalMarkPassingAlgorithm, raceLogResolver, raceLogStore,
|
||||
regattaLogStore);
|
||||
replayService.loadRaceData(link, listener);
|
||||
return new SwissTimingReplayRaceTracker(windStore, listener);
|
||||
return new SwissTimingReplayRaceTracker(windStore, listener, this);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -150,7 +151,7 @@ public class SwissTimingReplayConnectivityParameters implements RaceTrackingConn
|
||||
domainFactory, trackedRegattaRegistry, useInternalMarkPassingAlgorithm, raceLogResolver,
|
||||
raceLogStore, regattaLogStore);
|
||||
replayService.loadRaceData(link, listener);
|
||||
return new SwissTimingReplayRaceTracker(windStore, listener);
|
||||
return new SwissTimingReplayRaceTracker(windStore, listener, this);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
+4
-4
@@ -62,7 +62,7 @@ public class MultipleClassesInRegattaTest {
|
||||
false, EmptyRaceLogStore.INSTANCE, EmptyRegattaLogStore.INSTANCE, EmptyWindStore.INSTANCE,
|
||||
tracTracUsername, tracTracPassword,
|
||||
TracTracConnectionConstants.ONLINE_STATUS, TracTracConnectionConstants.ONLINE_VISIBILITY,
|
||||
new DummyTrackedRegattaRegistry(), mock(RaceLogResolver.class));
|
||||
new DummyTrackedRegattaRegistry(), mock(RaceLogResolver.class), /* connectivityParams */ null);
|
||||
kiwotest2 = domainFactory
|
||||
.createRaceTracker(
|
||||
new URL(
|
||||
@@ -73,7 +73,7 @@ public class MultipleClassesInRegattaTest {
|
||||
false, EmptyRaceLogStore.INSTANCE, EmptyRegattaLogStore.INSTANCE, EmptyWindStore.INSTANCE,
|
||||
tracTracUsername, tracTracPassword,
|
||||
TracTracConnectionConstants.ONLINE_STATUS, TracTracConnectionConstants.ONLINE_VISIBILITY,
|
||||
new DummyTrackedRegattaRegistry(), mock(RaceLogResolver.class));
|
||||
new DummyTrackedRegattaRegistry(), mock(RaceLogResolver.class), /* connectivityParams */ null);
|
||||
kiwotest3 = domainFactory
|
||||
.createRaceTracker(
|
||||
new URL(
|
||||
@@ -84,7 +84,7 @@ public class MultipleClassesInRegattaTest {
|
||||
false, EmptyRaceLogStore.INSTANCE, EmptyRegattaLogStore.INSTANCE, EmptyWindStore.INSTANCE,
|
||||
tracTracUsername, tracTracPassword,
|
||||
TracTracConnectionConstants.ONLINE_STATUS, TracTracConnectionConstants.ONLINE_VISIBILITY,
|
||||
new DummyTrackedRegattaRegistry(), mock(RaceLogResolver.class));
|
||||
new DummyTrackedRegattaRegistry(), mock(RaceLogResolver.class), /* connectivityParams */ null);
|
||||
weym470may112014_2 = domainFactory
|
||||
.createRaceTracker(
|
||||
new URL(
|
||||
@@ -95,7 +95,7 @@ public class MultipleClassesInRegattaTest {
|
||||
false, EmptyRaceLogStore.INSTANCE, EmptyRegattaLogStore.INSTANCE, EmptyWindStore.INSTANCE,
|
||||
tracTracUsername, tracTracPassword,
|
||||
TracTracConnectionConstants.ONLINE_STATUS, TracTracConnectionConstants.ONLINE_VISIBILITY,
|
||||
new DummyTrackedRegattaRegistry(), mock(RaceLogResolver.class));
|
||||
new DummyTrackedRegattaRegistry(), mock(RaceLogResolver.class), /* connectivityParams */ null);
|
||||
|
||||
assertEquals("STG", kiwotest1.getRegatta().getBoatClass().getName());
|
||||
assertEquals("5O5", kiwotest2.getRegatta().getBoatClass().getName());
|
||||
|
||||
+2
-2
@@ -70,9 +70,9 @@ public class UnicodeCharactersInCompetitorNamesTest {
|
||||
/* offsetToStartTimeOfSimulatedRace */ null, /* ignoreTracTracMarkPassings*/
|
||||
false, EmptyRaceLogStore.INSTANCE, EmptyRegattaLogStore.INSTANCE,
|
||||
EmptyWindStore.INSTANCE, "tracTest", "tracTest", "", "",
|
||||
new DummyTrackedRegattaRegistry(), mock(RaceLogResolver.class));
|
||||
new DummyTrackedRegattaRegistry(), mock(RaceLogResolver.class), /* connectivityParams */ null);
|
||||
|
||||
Iterable<Competitor> competitors = fourtyninerYellow_2.getRacesHandle().getRace().getCompetitors();
|
||||
Iterable<Competitor> competitors = fourtyninerYellow_2.getRaceHandle().getRace().getCompetitors();
|
||||
for (Competitor competitor : competitors) {
|
||||
System.out.println(competitor.getName());
|
||||
}
|
||||
|
||||
+5
-3
@@ -42,6 +42,7 @@ import com.sap.sailing.domain.tracking.WindTrack;
|
||||
import com.sap.sailing.domain.tracking.impl.EmptyWindStore;
|
||||
import com.sap.sailing.domain.tractracadapter.impl.DomainFactoryImpl;
|
||||
import com.sap.sailing.domain.tractracadapter.impl.RaceCourseReceiver;
|
||||
import com.sap.sailing.domain.tractracadapter.impl.RaceTrackingConnectivityParametersImpl;
|
||||
import com.sap.sailing.domain.tractracadapter.impl.Simulator;
|
||||
import com.sap.sse.common.Duration;
|
||||
import com.sap.sse.common.TimePoint;
|
||||
@@ -137,26 +138,27 @@ public interface DomainFactory {
|
||||
* Provides the capability to obtain the {@link WindTrack}s for the different wind sources. A trivial
|
||||
* implementation is {@link EmptyWindStore} which simply provides new, empty tracks. This is always
|
||||
* available but loses track of the wind, e.g., during server restarts.
|
||||
* @param connectivityParams TODO
|
||||
*/
|
||||
TracTracRaceTracker createRaceTracker(URL paramURL, URI liveURI, URI storedURI, URI courseDesignUpdateURI,
|
||||
TimePoint startOfTracking, TimePoint endOfTracking, long delayToLiveInMillis,
|
||||
Duration offsetToStartTimeOfSimulatedRace, boolean useInternalMarkPassingAlgorithm, RaceLogStore raceLogStore, RegattaLogStore regattaLogStore,
|
||||
WindStore windStore, String tracTracUsername, String tracTracPassword,
|
||||
String raceStatus, String raceVisibility, TrackedRegattaRegistry trackedRegattaRegistry, RaceLogResolver raceLogResolver)
|
||||
String raceStatus, String raceVisibility, TrackedRegattaRegistry trackedRegattaRegistry, RaceLogResolver raceLogResolver, RaceTrackingConnectivityParametersImpl connectivityParams)
|
||||
throws MalformedURLException, FileNotFoundException, URISyntaxException, CreateModelException, SubscriberInitializationException;
|
||||
|
||||
/**
|
||||
* Same as {@link #createRaceTracker(URL, URI, URI, URI, TimePoint, TimePoint, WindStore, TrackedRegattaRegistry)},
|
||||
* only that a predefined {@link Regatta} is used to hold the resulting races.
|
||||
*
|
||||
* @param offsetToStartTimeOfSimulatedRace
|
||||
* if non-<code>null</code>, the {@link Simulator} will be used with this duration as start offset
|
||||
* @param connectivityParams TODO
|
||||
*/
|
||||
RaceTracker createRaceTracker(Regatta regatta, URL paramURL, URI liveURI, URI storedURI, URI courseDesignUpdateURI,
|
||||
TimePoint startOfTracking, TimePoint endOfTracking, long delayToLiveInMillis,
|
||||
Duration offsetToStartTimeOfSimulatedRace, boolean useInternalMarkPassingAlgorithm, RaceLogStore raceLogStore, RegattaLogStore regattaLogStore,
|
||||
WindStore windStore, String tracTracUsername, String tracTracPassword,
|
||||
String raceStatus, String raceVisibility, TrackedRegattaRegistry trackedRegattaRegistry, RaceLogResolver raceLogResolver)
|
||||
String raceStatus, String raceVisibility, TrackedRegattaRegistry trackedRegattaRegistry, RaceLogResolver raceLogResolver, RaceTrackingConnectivityParametersImpl connectivityParams)
|
||||
throws MalformedURLException, FileNotFoundException, URISyntaxException, CreateModelException,
|
||||
SubscriberInitializationException;
|
||||
|
||||
|
||||
+10
-9
@@ -654,15 +654,16 @@ public class DomainFactoryImpl implements DomainFactory {
|
||||
@Override
|
||||
public TracTracRaceTracker createRaceTracker(URL paramURL, URI liveURI, URI storedURI, URI courseDesignUpdateURI,
|
||||
TimePoint startOfTracking, TimePoint endOfTracking, long delayToLiveInMillis,
|
||||
Duration offsetToStartTimeOfSimulatedRace, boolean useInternalMarkPassingAlgorithm, RaceLogStore raceLogStore,
|
||||
RegattaLogStore regattaLogStore, WindStore windStore, String tracTracUsername,
|
||||
Duration offsetToStartTimeOfSimulatedRace, boolean useInternalMarkPassingAlgorithm,
|
||||
RaceLogStore raceLogStore, RegattaLogStore regattaLogStore, WindStore windStore, String tracTracUsername,
|
||||
String tracTracPassword, String raceStatus, String raceVisibility,
|
||||
TrackedRegattaRegistry trackedRegattaRegistry, RaceLogResolver raceLogResolver) throws MalformedURLException, FileNotFoundException,
|
||||
URISyntaxException, CreateModelException, SubscriberInitializationException {
|
||||
TrackedRegattaRegistry trackedRegattaRegistry, RaceLogResolver raceLogResolver,
|
||||
RaceTrackingConnectivityParametersImpl connectivityParams) throws MalformedURLException,
|
||||
FileNotFoundException, URISyntaxException, CreateModelException, SubscriberInitializationException {
|
||||
return new TracTracRaceTrackerImpl(this, paramURL, liveURI, storedURI, courseDesignUpdateURI, startOfTracking,
|
||||
endOfTracking, delayToLiveInMillis, offsetToStartTimeOfSimulatedRace, useInternalMarkPassingAlgorithm, raceLogStore, regattaLogStore, windStore,
|
||||
tracTracUsername, tracTracPassword, raceStatus, raceVisibility, trackedRegattaRegistry,
|
||||
raceLogResolver);
|
||||
endOfTracking, delayToLiveInMillis, offsetToStartTimeOfSimulatedRace, useInternalMarkPassingAlgorithm,
|
||||
raceLogStore, regattaLogStore, windStore, tracTracUsername, tracTracPassword, raceStatus,
|
||||
raceVisibility, trackedRegattaRegistry, raceLogResolver, connectivityParams);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -671,13 +672,13 @@ public class DomainFactoryImpl implements DomainFactory {
|
||||
Duration offsetToStartTimeOfSimulatedRace, boolean useInternalMarkPassingAlgorithm, RaceLogStore raceLogStore,
|
||||
RegattaLogStore regattaLogStore, WindStore windStore, String tracTracUsername,
|
||||
String tracTracPassword, String raceStatus, String raceVisibility,
|
||||
TrackedRegattaRegistry trackedRegattaRegistry, RaceLogResolver raceLogResolver)
|
||||
TrackedRegattaRegistry trackedRegattaRegistry, RaceLogResolver raceLogResolver, RaceTrackingConnectivityParametersImpl connectivityParams)
|
||||
throws MalformedURLException, FileNotFoundException, URISyntaxException, CreateModelException,
|
||||
SubscriberInitializationException {
|
||||
return new TracTracRaceTrackerImpl(regatta, this, paramURL, liveURI, storedURI, courseDesignUpdateURI,
|
||||
startOfTracking, endOfTracking, delayToLiveInMillis, offsetToStartTimeOfSimulatedRace, useInternalMarkPassingAlgorithm, raceLogStore,
|
||||
regattaLogStore, windStore, tracTracUsername, tracTracPassword, raceStatus,
|
||||
raceVisibility, trackedRegattaRegistry, raceLogResolver);
|
||||
raceVisibility, trackedRegattaRegistry, raceLogResolver, connectivityParams);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
+2
-2
@@ -76,7 +76,7 @@ public class RaceTrackingConnectivityParametersImpl implements RaceTrackingConne
|
||||
RaceTracker tracker = domainFactory.createRaceTracker(paramURL, liveURI, storedURI, courseDesignUpdateURI,
|
||||
startOfTracking, endOfTracking, delayToLiveInMillis, offsetToStartTimeOfSimulatedRace, useInternalMarkPassingAlgorithm, raceLogStore,
|
||||
regattaLogStore, windStore, tracTracUsername, tracTracPassword, raceStatus,
|
||||
raceVisibility, trackedRegattaRegistry, raceLogResolver);
|
||||
raceVisibility, trackedRegattaRegistry, raceLogResolver, this);
|
||||
return tracker;
|
||||
}
|
||||
|
||||
@@ -86,7 +86,7 @@ public class RaceTrackingConnectivityParametersImpl implements RaceTrackingConne
|
||||
RaceTracker tracker = domainFactory.createRaceTracker(regatta, paramURL, liveURI, storedURI,
|
||||
courseDesignUpdateURI, startOfTracking, endOfTracking, delayToLiveInMillis, offsetToStartTimeOfSimulatedRace, useInternalMarkPassingAlgorithm,
|
||||
raceLogStore, regattaLogStore, windStore, tracTracUsername, tracTracPassword, raceStatus,
|
||||
raceVisibility, trackedRegattaRegistry, raceLogResolver);
|
||||
raceVisibility, trackedRegattaRegistry, raceLogResolver, this);
|
||||
return tracker;
|
||||
}
|
||||
|
||||
|
||||
+9
-9
@@ -257,14 +257,14 @@ public class TracTracRaceTrackerImpl extends AbstractRaceTrackerImpl
|
||||
URI courseDesignUpdateURI, TimePoint startOfTracking, TimePoint endOfTracking, long delayToLiveInMillis,
|
||||
Duration offsetToStartTimeOfSimulatedRace, boolean useInternalMarkPassingAlgorithm, RaceLogStore raceLogStore, RegattaLogStore regattaLogStore,
|
||||
WindStore windStore, String tracTracUsername, String tracTracPassword,
|
||||
String raceStatus, String raceVisibility, TrackedRegattaRegistry trackedRegattaRegistry, RaceLogResolver raceLogResolver)
|
||||
String raceStatus, String raceVisibility, TrackedRegattaRegistry trackedRegattaRegistry, RaceLogResolver raceLogResolver, RaceTrackingConnectivityParametersImpl connectivityParams)
|
||||
throws URISyntaxException, MalformedURLException, FileNotFoundException, CreateModelException,
|
||||
SubscriberInitializationException {
|
||||
this(ModelLocator.getEventFactory().createRace(new URI(paramURL.toString())), domainFactory, paramURL, liveURI,
|
||||
storedURI, courseDesignUpdateURI, startOfTracking, endOfTracking, delayToLiveInMillis,
|
||||
offsetToStartTimeOfSimulatedRace, useInternalMarkPassingAlgorithm, raceLogStore, regattaLogStore,
|
||||
windStore, tracTracUsername,
|
||||
tracTracPassword, raceStatus, raceVisibility, trackedRegattaRegistry, raceLogResolver);
|
||||
tracTracPassword, raceStatus, raceVisibility, trackedRegattaRegistry, raceLogResolver, connectivityParams);
|
||||
}
|
||||
|
||||
private TracTracRaceTrackerImpl(IRace tractracRace, DomainFactory domainFactory, URL paramURL, URI liveURI,
|
||||
@@ -272,12 +272,12 @@ public class TracTracRaceTrackerImpl extends AbstractRaceTrackerImpl
|
||||
long delayToLiveInMillis, Duration offsetToStartTimeOfSimulatedRace, boolean useInternalMarkPassingAlgorithm, RaceLogStore raceLogStore,
|
||||
RegattaLogStore regattaLogStore, WindStore windStore, String tracTracUsername,
|
||||
String tracTracPassword, String raceStatus, String raceVisibility,
|
||||
TrackedRegattaRegistry trackedRegattaRegistry, RaceLogResolver raceLogResolver) throws URISyntaxException, MalformedURLException,
|
||||
TrackedRegattaRegistry trackedRegattaRegistry, RaceLogResolver raceLogResolver, RaceTrackingConnectivityParametersImpl connectivityParams) throws URISyntaxException, MalformedURLException,
|
||||
FileNotFoundException, SubscriberInitializationException {
|
||||
this(tractracRace, /* regatta */ null, domainFactory, paramURL, liveURI, storedURI, courseDesignUpdateURI, startOfTracking,
|
||||
endOfTracking, delayToLiveInMillis, offsetToStartTimeOfSimulatedRace, useInternalMarkPassingAlgorithm, raceLogStore, regattaLogStore, windStore,
|
||||
tracTracUsername, tracTracPassword, raceStatus, raceVisibility, trackedRegattaRegistry,
|
||||
raceLogResolver);
|
||||
raceLogResolver, connectivityParams);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -291,13 +291,13 @@ public class TracTracRaceTrackerImpl extends AbstractRaceTrackerImpl
|
||||
long delayToLiveInMillis, Duration offsetToStartTimeOfSimulatedRace, boolean ignoreTracTracMarkPassings, RaceLogStore raceLogStore,
|
||||
RegattaLogStore regattaLogStore, WindStore windStore, String tracTracUsername,
|
||||
String tracTracPassword, String raceStatus, String raceVisibility,
|
||||
TrackedRegattaRegistry trackedRegattaRegistry, RaceLogResolver raceLogResolver) throws URISyntaxException,
|
||||
TrackedRegattaRegistry trackedRegattaRegistry, RaceLogResolver raceLogResolver, RaceTrackingConnectivityParametersImpl connectivityParams) throws URISyntaxException,
|
||||
MalformedURLException, FileNotFoundException, CreateModelException, SubscriberInitializationException {
|
||||
this(ModelLocator.getEventFactory().createRace(new URI(paramURL.toString())), regatta, domainFactory, paramURL,
|
||||
liveURI, storedURI, courseDesignUpdateURI, startOfTracking, endOfTracking, delayToLiveInMillis,
|
||||
offsetToStartTimeOfSimulatedRace, ignoreTracTracMarkPassings, raceLogStore, regattaLogStore, windStore,
|
||||
tracTracUsername,
|
||||
tracTracPassword, raceStatus, raceVisibility, trackedRegattaRegistry, raceLogResolver);
|
||||
tracTracPassword, raceStatus, raceVisibility, trackedRegattaRegistry, raceLogResolver, connectivityParams);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -316,9 +316,9 @@ public class TracTracRaceTrackerImpl extends AbstractRaceTrackerImpl
|
||||
TimePoint endOfTracking, long delayToLiveInMillis, Duration offsetToStartTimeOfSimulatedRace, boolean useInternalMarkPassingAlgorithm,
|
||||
RaceLogStore raceLogStore, RegattaLogStore regattaLogStore, WindStore windStore,
|
||||
String tracTracUsername, String tracTracPassword, String raceStatus, String raceVisibility,
|
||||
TrackedRegattaRegistry trackedRegattaRegistry, RaceLogResolver raceLogResolver) throws URISyntaxException, MalformedURLException,
|
||||
TrackedRegattaRegistry trackedRegattaRegistry, RaceLogResolver raceLogResolver, RaceTrackingConnectivityParametersImpl connectivityParams) throws URISyntaxException, MalformedURLException,
|
||||
FileNotFoundException, SubscriberInitializationException {
|
||||
super();
|
||||
super(connectivityParams);
|
||||
this.trackedRegattaRegistry = trackedRegattaRegistry;
|
||||
this.tractracRace = tractracRace;
|
||||
this.tractracEvent = tractracRace.getEvent();
|
||||
@@ -519,7 +519,7 @@ public class TracTracRaceTrackerImpl extends AbstractRaceTrackerImpl
|
||||
}
|
||||
|
||||
@Override
|
||||
public RaceHandle getRacesHandle() {
|
||||
public RaceHandle getRaceHandle() {
|
||||
return new RaceHandleImpl(domainFactory, tractracRace, getTrackedRegatta(), this);
|
||||
}
|
||||
|
||||
|
||||
+11
@@ -8,6 +8,12 @@ import java.net.MalformedURLException;
|
||||
*/
|
||||
public abstract class AbstractRaceTrackerBaseImpl implements RaceTracker {
|
||||
private final RaceTrackerListeners listeners = new RaceTrackerListeners();
|
||||
private final RaceTrackingConnectivityParameters connectivityParams;
|
||||
|
||||
public AbstractRaceTrackerBaseImpl(RaceTrackingConnectivityParameters connectivityParams) {
|
||||
super();
|
||||
this.connectivityParams = connectivityParams;
|
||||
}
|
||||
|
||||
/**
|
||||
* Ensure stop method does notify all listeners after tracker stopped.
|
||||
@@ -41,4 +47,9 @@ public abstract class AbstractRaceTrackerBaseImpl implements RaceTracker {
|
||||
public void remove(Listener listener) {
|
||||
listeners.removeListener(listener);
|
||||
}
|
||||
|
||||
@Override
|
||||
public RaceTrackingConnectivityParameters getConnectivityParams() {
|
||||
return connectivityParams;
|
||||
}
|
||||
}
|
||||
+4
@@ -9,6 +9,10 @@ import com.sap.sailing.domain.common.RegattaAndRaceIdentifier;
|
||||
|
||||
public abstract class AbstractRaceTrackerImpl extends AbstractRaceTrackerBaseImpl {
|
||||
|
||||
public AbstractRaceTrackerImpl(RaceTrackingConnectivityParameters connectivityParams) {
|
||||
super(connectivityParams);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Set<RegattaAndRaceIdentifier> getRaceIdentifiers() {
|
||||
Set<RegattaAndRaceIdentifier> result = new HashSet<RegattaAndRaceIdentifier>();
|
||||
|
||||
@@ -14,7 +14,7 @@ import com.sap.sailing.domain.common.RegattaAndRaceIdentifier;
|
||||
* {@link RaceDefinition races} that are {@link Regatta#getAllRaces() part of} a common {@link #getRegatta() Event}. Some
|
||||
* tracker architectures may not be able to deliver all data for the {@link RaceDefinition} when created or started.
|
||||
* Therefore, {@link #getRaces()} may return <code>null</code> if the race information hasn't been received by the
|
||||
* tracker yet. Through the {@link RaceHandle} returned by {@link #getRacesHandle()} it is also possible to perform a
|
||||
* tracker yet. Through the {@link RaceHandle} returned by {@link #getRaceHandle()} it is also possible to perform a
|
||||
* {@link RaceHandle#getRace() blocking get} for the race tracked by this tracker.
|
||||
* <p>
|
||||
*
|
||||
@@ -66,7 +66,7 @@ public interface RaceTracker {
|
||||
|
||||
Set<RegattaAndRaceIdentifier> getRaceIdentifiers();
|
||||
|
||||
RaceHandle getRacesHandle();
|
||||
RaceHandle getRaceHandle();
|
||||
|
||||
DynamicTrackedRegatta getTrackedRegatta();
|
||||
|
||||
@@ -98,10 +98,18 @@ public interface RaceTracker {
|
||||
boolean add(RaceTracker.Listener newListener);
|
||||
|
||||
/**
|
||||
* Remove listener from racetracker
|
||||
* Remove listener from race tracker
|
||||
*
|
||||
* @param newListener
|
||||
* @return the listener registration for listener removal
|
||||
*/
|
||||
void remove(RaceTracker.Listener newListener);
|
||||
|
||||
/**
|
||||
* The connectivity parameters used to create this tracker. Can be used, e.g., to add or remove those parameters to
|
||||
* the set of trackers to restore after a server restart. May return {@code null}, e.g., in case the tracker was
|
||||
* created by a test case that did not use a {@link RaceTrackingConnectivityParameters} object to describe what to
|
||||
* track.
|
||||
*/
|
||||
RaceTrackingConnectivityParameters getConnectivityParams();
|
||||
}
|
||||
+4
-3
@@ -20,13 +20,13 @@ public class RaceTrackerMock extends AbstractRaceTrackerBaseImpl {
|
||||
private boolean isTracking;
|
||||
|
||||
public RaceTrackerMock() {
|
||||
// TODO check if necesary
|
||||
super(null);
|
||||
}
|
||||
|
||||
|
||||
|
||||
public RaceTrackerMock(Long id, Regatta regatta, Set<RaceDefinition> raceDefinitions, boolean isTracking) {
|
||||
super();
|
||||
super(null);
|
||||
this.id = id;
|
||||
this.regatta = regatta;
|
||||
this.raceDefinitions = raceDefinitions;
|
||||
@@ -42,6 +42,7 @@ public class RaceTrackerMock extends AbstractRaceTrackerBaseImpl {
|
||||
}
|
||||
|
||||
public RaceTrackerMock(Long id) {
|
||||
super(null);
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
@@ -61,7 +62,7 @@ public class RaceTrackerMock extends AbstractRaceTrackerBaseImpl {
|
||||
}
|
||||
|
||||
@Override
|
||||
public RaceHandle getRacesHandle() {
|
||||
public RaceHandle getRaceHandle() {
|
||||
throw new RuntimeException("No race Handle in RaceTrackerMock");
|
||||
}
|
||||
|
||||
|
||||
+16
-5
@@ -96,6 +96,7 @@ import com.sap.sailing.domain.common.Position;
|
||||
import com.sap.sailing.domain.common.RegattaAndRaceIdentifier;
|
||||
import com.sap.sailing.domain.common.RegattaIdentifier;
|
||||
import com.sap.sailing.domain.common.RegattaName;
|
||||
import com.sap.sailing.domain.common.RegattaNameAndRaceName;
|
||||
import com.sap.sailing.domain.common.Renamable;
|
||||
import com.sap.sailing.domain.common.ScoringSchemeType;
|
||||
import com.sap.sailing.domain.common.TrackedRaceStatusEnum;
|
||||
@@ -464,7 +465,7 @@ public class RacingEventServiceImpl implements RacingEventService, ClearStateTes
|
||||
* compatibility with prior releases that did not support a persistent competitor collection.
|
||||
*/
|
||||
public RacingEventServiceImpl() {
|
||||
this(true, null);
|
||||
this(true, /* serviceFinderFactory */ null);
|
||||
}
|
||||
|
||||
public RacingEventServiceImpl(WindStore windStore, SensorFixStore sensorFixStore,
|
||||
@@ -641,6 +642,7 @@ public class RacingEventServiceImpl implements RacingEventService, ClearStateTes
|
||||
mongoObjectFactory.storeEvent(eventAndRequireStoreFlag.getA());
|
||||
}
|
||||
}
|
||||
// TODO bug 2: decide whether to call getMongoObjectFactory().removeAllConnectivityParametersForRacesToRestore() or getDomainObjectFactory().loadConnectivityParametersForRacesToRestore() to restore last set of tracked races
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -1429,6 +1431,8 @@ public class RacingEventServiceImpl implements RacingEventService, ClearStateTes
|
||||
} else {
|
||||
cacheAndReplicateDefaultRegatta(tracker.getRegatta());
|
||||
}
|
||||
// TODO bug 2: we need to link the params to the TrackedRace / RaceDefinition such that when the RaceDefinition is removed using removeRace(Regatta, RaceDefinition) then we know which params to remove from the restore store again
|
||||
getMongoObjectFactory().addConnectivityParametersForRaceToRestore(params);
|
||||
} else {
|
||||
logger.warning("Race tracker with ID "+trackerID+" already found; not tracking twice to avoid race duplication");
|
||||
WindStore existingTrackersWindStore = tracker.getWindStore();
|
||||
@@ -1440,7 +1444,7 @@ public class RacingEventServiceImpl implements RacingEventService, ClearStateTes
|
||||
if (timeoutInMilliseconds != -1) {
|
||||
scheduleAbortTrackerAfterInitialTimeout(tracker, timeoutInMilliseconds);
|
||||
}
|
||||
return tracker.getRacesHandle();
|
||||
return tracker.getRaceHandle();
|
||||
} finally {
|
||||
unlockRaceTrackersById(trackerID, raceTrackersByIdLock);
|
||||
}
|
||||
@@ -2090,6 +2094,7 @@ public class RacingEventServiceImpl implements RacingEventService, ClearStateTes
|
||||
logger.warning("Didn't find any trackers for regatta " + regatta);
|
||||
}
|
||||
stopTrackingWind(regatta, race);
|
||||
// TODO bug 2: update the "restore" handle for race in DB such that when restoring, no wind tracker will be requested for race
|
||||
// if the last tracked race was removed, confirm that tracking for the entire regatta has stopped
|
||||
if (trackerSet == null || trackerSet.isEmpty()) {
|
||||
stopTracking(regatta);
|
||||
@@ -2189,6 +2194,8 @@ public class RacingEventServiceImpl implements RacingEventService, ClearStateTes
|
||||
public void removeRace(Regatta regatta, RaceDefinition race) throws MalformedURLException, IOException,
|
||||
InterruptedException {
|
||||
logger.info("Removing the race " + race + "...");
|
||||
getRaceTrackerByRegattaAndRaceIdentifier(new RegattaNameAndRaceName(regatta.getName(), race.getName()),
|
||||
tracker->getMongoObjectFactory().removeConnectivityParametersForRaceToRestore(tracker.getConnectivityParams()));
|
||||
stopAllTrackersForWhichRaceIsLastReachable(regatta, race);
|
||||
stopTrackingWind(regatta, race);
|
||||
TrackedRace trackedRace = getExistingTrackedRace(regatta, race);
|
||||
@@ -3562,14 +3569,18 @@ public class RacingEventServiceImpl implements RacingEventService, ClearStateTes
|
||||
@Override
|
||||
public void getRaceTrackerByRegattaAndRaceIdentifier(RegattaAndRaceIdentifier raceIdentifier,
|
||||
Consumer<RaceTracker> callback) {
|
||||
final Regatta regatta;
|
||||
LockUtil.lockForRead(regattasByNameLock);
|
||||
Regatta regatta = regattasByName.get(raceIdentifier.getRegattaName());
|
||||
LockUtil.unlockAfterRead(regattasByNameLock);
|
||||
try {
|
||||
regatta = regattasByName.get(raceIdentifier.getRegattaName());
|
||||
} finally {
|
||||
LockUtil.unlockAfterRead(regattasByNameLock);
|
||||
}
|
||||
if (regatta != null) {
|
||||
LockUtil.lockForRead(raceTrackersByRegattaLock);
|
||||
try {
|
||||
Set<RaceTracker> raceTrackersForRegatta = raceTrackersByRegatta.get(regatta);
|
||||
if(raceTrackersForRegatta != null) {
|
||||
if (raceTrackersForRegatta != null) {
|
||||
for (RaceTracker raceTracker : raceTrackersForRegatta) {
|
||||
if (raceTracker.getRaceIdentifiers().contains(raceIdentifier)) {
|
||||
callback.accept(raceTracker);
|
||||
|
||||
Reference in new issue
Block a user