mirror of
https://github.com/eclipse-sailing-analytics/sailing-analytics.git
synced 2026-09-25 06:58:39 +00:00
Merge branch 'master' into prod
This commit is contained in:
@@ -4,18 +4,16 @@ Axel
|
||||
|
||||
- Implement and test course update with corresponding TrackedLeg[OfCompetitor] updates
|
||||
|
||||
- Clarify Equinox server upgrade process from the maven-repository
|
||||
|
||||
- Open test server firewall ports for UDP / Expedition wind integration
|
||||
|
||||
- test UDP ports
|
||||
|
||||
- Set up two Expedition machines with RF and UMTS transmission, test killing one
|
||||
|
||||
- enable switching between our and TracTrac-provided leaderboard information
|
||||
|
||||
- Test fail-over in case one of the two Java VM fails
|
||||
|
||||
- enable switching between our and TracTrac-provided leaderboard information
|
||||
|
||||
- Pass final production instance URL information to BeTomorrow for wind integration
|
||||
|
||||
- Display gain/loss for next-best competitor (green/red arrow up/down) based on VMG comparison
|
||||
|
||||
@@ -11,7 +11,7 @@ package com.sap.sailing.domain.base;
|
||||
* @author Axel Uhl (d043530)
|
||||
*
|
||||
*/
|
||||
public interface Waypoint extends Named {
|
||||
public interface Waypoint extends Named, WithID {
|
||||
ControlPoint getControlPoint();
|
||||
|
||||
Iterable<Buoy> getBuoys();
|
||||
|
||||
@@ -6,7 +6,14 @@ import com.sap.sailing.domain.base.Waypoint;
|
||||
|
||||
public class WaypointImpl implements Waypoint {
|
||||
private final ControlPoint controlPoint;
|
||||
private static int idCounter = 1;
|
||||
private final int id;
|
||||
|
||||
public WaypointImpl(ControlPoint controlPoint) {
|
||||
this.controlPoint = controlPoint;
|
||||
id = idCounter++;
|
||||
}
|
||||
|
||||
public boolean equals(Object o) {
|
||||
return getControlPoint() == ((Waypoint) o).getControlPoint();
|
||||
}
|
||||
@@ -15,10 +22,6 @@ public class WaypointImpl implements Waypoint {
|
||||
return 984637 ^ getControlPoint().hashCode();
|
||||
}
|
||||
|
||||
public WaypointImpl(ControlPoint controlPoint) {
|
||||
this.controlPoint = controlPoint;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ControlPoint getControlPoint() {
|
||||
return controlPoint;
|
||||
@@ -38,4 +41,12 @@ public class WaypointImpl implements Waypoint {
|
||||
public Iterable<Buoy> getBuoys() {
|
||||
return getControlPoint().getBuoys();
|
||||
}
|
||||
|
||||
/**
|
||||
* Note that a waypoint is not compared by its identity but by the control point it represents.
|
||||
*/
|
||||
@Override
|
||||
public Integer getId() {
|
||||
return id;
|
||||
}
|
||||
}
|
||||
|
||||
+32
-9
@@ -9,6 +9,7 @@ import java.util.concurrent.ConcurrentSkipListSet;
|
||||
|
||||
import com.sap.sailing.domain.base.Buoy;
|
||||
import com.sap.sailing.domain.base.Competitor;
|
||||
import com.sap.sailing.domain.base.CourseListener;
|
||||
import com.sap.sailing.domain.base.Distance;
|
||||
import com.sap.sailing.domain.base.Leg;
|
||||
import com.sap.sailing.domain.base.Position;
|
||||
@@ -32,7 +33,7 @@ import com.sap.sailing.domain.tracking.WindStore;
|
||||
import com.sap.sailing.domain.tracking.WindTrack;
|
||||
import com.sap.sailing.util.Util;
|
||||
|
||||
public abstract class TrackedRaceImpl implements TrackedRace {
|
||||
public abstract class TrackedRaceImpl implements TrackedRace, CourseListener {
|
||||
// TODO observe the race course; if it changes, update leg structures; consider fine-grained update events that tell what changed
|
||||
private final RaceDefinition race;
|
||||
|
||||
@@ -94,11 +95,10 @@ public abstract class TrackedRaceImpl implements TrackedRace {
|
||||
}
|
||||
}
|
||||
}
|
||||
LinkedHashMap<Leg, TrackedLeg> trackedLegsMap = new LinkedHashMap<Leg, TrackedLeg>();
|
||||
trackedLegs = new LinkedHashMap<Leg, TrackedLeg>();
|
||||
for (Leg leg : race.getCourse().getLegs()) {
|
||||
trackedLegsMap.put(leg, createTrackedLeg(race, leg));
|
||||
trackedLegs.put(leg, createTrackedLeg(race, leg));
|
||||
}
|
||||
trackedLegs = trackedLegsMap;
|
||||
markPassingsForCompetitor = new HashMap<Competitor, NavigableSet<MarkPassing>>();
|
||||
tracks = new HashMap<Competitor, GPSFixTrack<Competitor, GPSFixMoving>>();
|
||||
for (Competitor competitor : race.getCompetitors()) {
|
||||
@@ -349,14 +349,19 @@ public abstract class TrackedRaceImpl implements TrackedRace {
|
||||
return timePointOfNewestEvent;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param timeOfEvent may be <code>null</code> meaning to only unblock waiters but not update any time points
|
||||
*/
|
||||
protected synchronized void updated(TimePoint timeOfEvent) {
|
||||
updateCount++;
|
||||
clearAllCaches();
|
||||
if (timePointOfNewestEvent == null || timePointOfNewestEvent.compareTo(timeOfEvent) < 0) {
|
||||
timePointOfNewestEvent = timeOfEvent;
|
||||
}
|
||||
if (startOfTracking == null || startOfTracking.compareTo(timeOfEvent) > 0) {
|
||||
startOfTracking = timeOfEvent;
|
||||
if (timeOfEvent != null) {
|
||||
if (timePointOfNewestEvent == null || timePointOfNewestEvent.compareTo(timeOfEvent) < 0) {
|
||||
timePointOfNewestEvent = timeOfEvent;
|
||||
}
|
||||
if (startOfTracking == null || startOfTracking.compareTo(timeOfEvent) > 0) {
|
||||
startOfTracking = timeOfEvent;
|
||||
}
|
||||
}
|
||||
notifyAll();
|
||||
}
|
||||
@@ -374,4 +379,22 @@ public abstract class TrackedRaceImpl implements TrackedRace {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public synchronized void waypointAdded(int zeroBasedIndex, Waypoint waypointThatGotAdded) {
|
||||
markPassingsForWaypoint.put(waypointThatGotAdded, new ConcurrentSkipListSet<MarkPassing>(TimedComparator.INSTANCE));
|
||||
for (Buoy buoy : waypointThatGotAdded.getBuoys()) {
|
||||
if (!buoyTracks.containsKey(buoy)) {
|
||||
buoyTracks.put(buoy, new DynamicTrackImpl<Buoy, GPSFix>(buoy, millisecondsOverWhichToAverageSpeed));
|
||||
}
|
||||
}
|
||||
// TODO update trackedLegs
|
||||
updated(/* time point*/ null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public synchronized void waypointRemoved(int zeroBasedIndex, Waypoint waypointThatGotRemoved) {
|
||||
// TODO update trackedLegs
|
||||
updated(/* time point*/ null);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,4 +11,5 @@ Require-Bundle: org.junit4;bundle-version="4.8.1",
|
||||
com.sap.sailing.mongodb,
|
||||
com.sap.sailing.domain.test,
|
||||
com.tractrac.clientmodule,
|
||||
com.sap.sailing.domain.tractracadapter
|
||||
com.sap.sailing.domain.tractracadapter,
|
||||
org.eclipse.osgi
|
||||
|
||||
+8
-3
@@ -23,15 +23,20 @@ import com.sap.sailing.domain.tracking.Wind;
|
||||
import com.sap.sailing.domain.tracking.impl.WindImpl;
|
||||
import com.sap.sailing.mongodb.DomainObjectFactory;
|
||||
import com.sap.sailing.mongodb.MongoObjectFactory;
|
||||
import com.sap.sailing.mongodb.impl.MongoWindStoreFactoryImpl;
|
||||
|
||||
public class TestStoringAndRetrievingWindData implements MongoDBTest {
|
||||
private static final String WIND_TEST_COLLECTION = "wind_test_collection";
|
||||
private Mongo mongo;
|
||||
private DB db;
|
||||
|
||||
private Mongo newMongo() throws UnknownHostException, MongoException {
|
||||
return new Mongo("127.0.0.1", ((MongoWindStoreFactoryImpl) MongoWindStoreFactoryImpl.getDefaultInstance()).getDefaultPort());
|
||||
}
|
||||
|
||||
@Before
|
||||
public void dropTestDB() throws UnknownHostException, MongoException {
|
||||
mongo = new Mongo();
|
||||
mongo = newMongo();
|
||||
assertNotNull(mongo);
|
||||
mongo.dropDatabase(WIND_TEST_DB);
|
||||
db = mongo.getDB(WIND_TEST_DB);
|
||||
@@ -61,7 +66,7 @@ public class TestStoringAndRetrievingWindData implements MongoDBTest {
|
||||
|
||||
{
|
||||
Thread.sleep(1000); // wait until MongoDB has recorded the change and made it visible
|
||||
Mongo mongo = new Mongo();
|
||||
Mongo mongo = newMongo();
|
||||
assertNotNull(mongo);
|
||||
DB db = mongo.getDB(WIND_TEST_DB);
|
||||
assertNotNull(db);
|
||||
@@ -86,7 +91,7 @@ public class TestStoringAndRetrievingWindData implements MongoDBTest {
|
||||
|
||||
{
|
||||
Thread.sleep(1000); // wait until MongoDB has recorded the change and made it visible
|
||||
Mongo mongo = new Mongo();
|
||||
Mongo mongo = newMongo();
|
||||
assertNotNull(mongo);
|
||||
DB db = mongo.getDB(WIND_TEST_DB);
|
||||
assertNotNull(db);
|
||||
|
||||
+7
-2
@@ -34,6 +34,7 @@ import com.sap.sailing.domain.tractracadapter.Receiver;
|
||||
import com.sap.sailing.domain.tractracadapter.ReceiverType;
|
||||
import com.sap.sailing.mongodb.DomainObjectFactory;
|
||||
import com.sap.sailing.mongodb.MongoObjectFactory;
|
||||
import com.sap.sailing.mongodb.impl.MongoWindStoreFactoryImpl;
|
||||
|
||||
public class TestStoringAndRetrievingWindTracks extends AbstractTracTracLiveTest implements MongoDBTest {
|
||||
|
||||
@@ -44,9 +45,13 @@ public class TestStoringAndRetrievingWindTracks extends AbstractTracTracLiveTest
|
||||
super();
|
||||
}
|
||||
|
||||
private Mongo newMongo() throws UnknownHostException, MongoException {
|
||||
return new Mongo("127.0.0.1", ((MongoWindStoreFactoryImpl) MongoWindStoreFactoryImpl.getDefaultInstance()).getDefaultPort());
|
||||
}
|
||||
|
||||
@Before
|
||||
public void dropTestDB() throws UnknownHostException, MongoException {
|
||||
mongo = new Mongo();
|
||||
mongo = newMongo();
|
||||
assertNotNull(mongo);
|
||||
mongo.dropDatabase(WIND_TEST_DB);
|
||||
db = mongo.getDB(WIND_TEST_DB);
|
||||
@@ -75,7 +80,7 @@ public class TestStoringAndRetrievingWindTracks extends AbstractTracTracLiveTest
|
||||
}
|
||||
Thread.sleep(1000); // give MongoDB some time to make written data available to other connections
|
||||
|
||||
Mongo myMongo = new Mongo();
|
||||
Mongo myMongo = newMongo();
|
||||
DB database = myMongo.getDB(WIND_TEST_DB);
|
||||
WindTrack result = DomainObjectFactory.INSTANCE.loadWindTrack(domainEvent, race, windSource, /* millisecondsOverWhichToAverage */
|
||||
30000, database);
|
||||
|
||||
@@ -8,6 +8,7 @@ Bundle-RequiredExecutionEnvironment: JavaSE-1.6
|
||||
Require-Bundle: com.mongodb.driver;bundle-version="2.6.2",
|
||||
com.sap.sailing.domain,
|
||||
org.eclipse.osgi
|
||||
Export-Package: com.sap.sailing.mongodb
|
||||
Export-Package: com.sap.sailing.mongodb,
|
||||
com.sap.sailing.mongodb.impl;x-friends:="com.sap.sailing.mongodb.test"
|
||||
Bundle-ActivationPolicy: lazy
|
||||
Bundle-Activator: com.sap.sailing.mongodb.impl.MongoWindStoreFactoryImpl
|
||||
|
||||
+23
-4
@@ -13,14 +13,26 @@ import com.sap.sailing.mongodb.MongoWindStore;
|
||||
import com.sap.sailing.mongodb.MongoWindStoreFactory;
|
||||
|
||||
public class MongoWindStoreFactoryImpl implements MongoWindStoreFactory, BundleActivator {
|
||||
private static final String MONGO_PORT = "mongo.port";
|
||||
|
||||
private static final String MONGO_HOSTNAME = "mongo.hostname";
|
||||
|
||||
private static final String MONGO_DB_NAME = "mongo.dbName";
|
||||
|
||||
private static final Logger logger = Logger.getLogger(MongoWindStoreFactoryImpl.class.getName());
|
||||
|
||||
private static MongoWindStoreFactory defaultInstance;
|
||||
|
||||
private String defaultHostName;
|
||||
private Integer defaultPort;
|
||||
private int defaultPort;
|
||||
private String defaultDatabaseName;
|
||||
|
||||
public MongoWindStoreFactoryImpl() {
|
||||
defaultHostName = System.getProperty(MONGO_HOSTNAME, "127.0.0.1");
|
||||
defaultPort = Integer.valueOf(System.getProperty(MONGO_PORT, "27017"));
|
||||
defaultDatabaseName = System.getProperty(MONGO_DB_NAME, DEFAULT_DB_NAME);
|
||||
}
|
||||
|
||||
@Override
|
||||
public MongoWindStore getMongoWindStore(MongoObjectFactory mongoObjectFactory) throws UnknownHostException, MongoException {
|
||||
return getMongoWindStore(defaultHostName, defaultPort, defaultDatabaseName, mongoObjectFactory);
|
||||
@@ -45,26 +57,33 @@ public class MongoWindStoreFactoryImpl implements MongoWindStoreFactory, BundleA
|
||||
@Override
|
||||
public void start(BundleContext context) throws Exception {
|
||||
defaultInstance = this;
|
||||
defaultDatabaseName = context.getProperty("mongo.dbName");
|
||||
defaultDatabaseName = context.getProperty(MONGO_DB_NAME);
|
||||
if (defaultDatabaseName == null) {
|
||||
defaultDatabaseName = DEFAULT_DB_NAME;
|
||||
} else {
|
||||
logger.log(Level.INFO, "found mongo.dbName="+defaultDatabaseName);
|
||||
}
|
||||
defaultHostName = context.getProperty("mongo.hostname");
|
||||
defaultHostName = context.getProperty(MONGO_HOSTNAME);
|
||||
if (defaultHostName == null) {
|
||||
defaultHostName = "localhost";
|
||||
} else {
|
||||
logger.log(Level.INFO, "found mongo.hostname="+defaultHostName);
|
||||
}
|
||||
defaultPort = context.getProperty("mongo.port") != null ? Integer.valueOf(context.getProperty("mongo.port")) : 27017;
|
||||
defaultPort = context.getProperty(MONGO_PORT) != null ? Integer.valueOf(context.getProperty(MONGO_PORT)) : 27017;
|
||||
logger.log(Level.INFO, "Using port "+defaultPort+" as default for Mongo wind stores");
|
||||
}
|
||||
|
||||
public static MongoWindStoreFactory getDefaultInstance() {
|
||||
if (defaultInstance == null) {
|
||||
defaultInstance = new MongoWindStoreFactoryImpl();
|
||||
}
|
||||
return defaultInstance;
|
||||
}
|
||||
|
||||
public Integer getDefaultPort() {
|
||||
return defaultPort;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void stop(BundleContext context) throws Exception {
|
||||
}
|
||||
|
||||
+2
-3
@@ -29,13 +29,12 @@ public class MongoWindStoreImpl implements MongoWindStore {
|
||||
|
||||
public MongoWindStoreImpl(int port, String dbName, MongoObjectFactory mongoObjectFactory)
|
||||
throws UnknownHostException, MongoException {
|
||||
this("localhost", port, dbName, mongoObjectFactory);
|
||||
this("127.0.0.1", port, dbName, mongoObjectFactory);
|
||||
}
|
||||
|
||||
public MongoWindStoreImpl(String hostname, int port, String dbName, MongoObjectFactory mongoObjectFactory)
|
||||
throws UnknownHostException, MongoException {
|
||||
// mongo = new Mongo(hostname, port); // TODO clarify why this doesn't work with "localhost"/27017
|
||||
mongo = new Mongo();
|
||||
mongo = new Mongo(hostname, port);
|
||||
db = mongo.getDB(dbName);
|
||||
this.mongoObjectFactory = mongoObjectFactory;
|
||||
}
|
||||
|
||||
+1
-1
@@ -105,7 +105,7 @@
|
||||
<argLine>-Dhttp.proxyHost=proxy -Dhttp.proxyPort=8080 -Xmx1024m -XX:PermSize=256m -XX:-UseGCOverheadLimit -XX:+UseParallelGC</argLine>
|
||||
-->
|
||||
<!-- no proxy -->
|
||||
<argLine>-Xmx1024m -XX:PermSize=256m -XX:-UseGCOverheadLimit -XX:+UseParallelGC</argLine>
|
||||
<argLine>-Dmongo.port=10200 -Xmx1024m -XX:PermSize=256m -XX:-UseGCOverheadLimit -XX:+UseParallelGC</argLine>
|
||||
<!-- -->
|
||||
<!-- -->
|
||||
<!-- debug
|
||||
|
||||
Reference in New Issue
Block a user