Merge branch 'racecommittee_integrated' of ssh://sapsailing.com/home/trac/git into racecommittee_integrated

Conflicts:
	java/com.sap.sailing.server.gateway/src/com/sap/sailing/server/gateway/impl/rc/AddToRaceLogJsonExportServlet.java
This commit is contained in:
Lukas Niemeier committed 2013-02-18 02:27:48 +01:00
commit a744ad6c86
92 files changed
+888 -792

No files matched your search

@@ -38,10 +38,7 @@ import com.sap.sailing.domain.common.impl.DegreePosition;
import com.sap.sailing.domain.common.impl.Util.Triple;
import com.sap.sailing.domain.common.impl.WindSourceImpl;
import com.sap.sailing.domain.persistence.MongoFactory;
import com.sap.sailing.domain.persistence.MongoRaceLogStoreFactory;
import com.sap.sailing.domain.persistence.MongoWindStoreFactory;
import com.sap.sailing.domain.racelog.RaceLogStore;
import com.sap.sailing.domain.racelog.impl.EmptyRaceLogStore;
import com.sap.sailing.domain.tracking.DynamicTrackedRace;
import com.sap.sailing.domain.tracking.TrackedRace;
import com.sap.sailing.domain.tracking.Wind;
@@ -118,8 +115,6 @@ public class AdminApp extends SailingServerHttpServlet {
private static final String PARAM_NAME_WINDSTORE = "windstore";
private static final String PARAM_NAME_RACELOGSTORE = "racelogstore";
private static final String STORE_EMPTY = "empty";
private static final String STORE_MONGO = "mongo";
@@ -471,7 +466,7 @@ public class AdminApp extends SailingServerHttpServlet {
URL jsonURL = new URL(req.getParameter(PARAM_NAME_EVENT_JSON_URL));
URI liveURI = new URI(req.getParameter(PARAM_NAME_LIVE_URI));
URI storedURI = new URI(req.getParameter(PARAM_NAME_STORED_URI));
getService().addRegatta(jsonURL, liveURI, storedURI, getWindStore(req), /* timeoutInMilliseconds */ 60000, getRaceLogStore(req));
getService().addRegatta(jsonURL, liveURI, storedURI, getWindStore(req), /* timeoutInMilliseconds */ 60000);
}
private WindStore getWindStore(HttpServletRequest req) throws UnknownHostException, MongoException {
@@ -490,29 +485,12 @@ public class AdminApp extends SailingServerHttpServlet {
}
return EmptyWindStore.INSTANCE;
}
private RaceLogStore getRaceLogStore(HttpServletRequest req) throws UnknownHostException, MongoException {
String raceLogStore = req.getParameter(PARAM_NAME_RACELOGSTORE);
if (raceLogStore != null) {
if (raceLogStore.equals(STORE_EMPTY)) {
return EmptyRaceLogStore.INSTANCE;
} else if (raceLogStore.equals(STORE_MONGO)) {
return MongoRaceLogStoreFactory.INSTANCE.getMongoRaceLogStore(
MongoFactory.INSTANCE.getDefaultMongoObjectFactory(),
MongoFactory.INSTANCE.getDefaultDomainObjectFactory());
} else {
log("Couldn't find wind store "+raceLogStore+". Using EmptyWindStore instead.");
return EmptyRaceLogStore.INSTANCE;
}
}
return EmptyRaceLogStore.INSTANCE;
}
private void addRace(HttpServletRequest req, HttpServletResponse resp) throws MongoException, Exception {
URL paramURL = new URL(req.getParameter(PARAM_NAME_PARAM_URL));
URI liveURI = new URI(req.getParameter(PARAM_NAME_LIVE_URI));
URI storedURI = new URI(req.getParameter(PARAM_NAME_STORED_URI));
getService().addTracTracRace(paramURL, liveURI, storedURI, getWindStore(req), /* timeoutInMilliseconds */ 60000, getRaceLogStore(req));
getService().addTracTracRace(paramURL, liveURI, storedURI, getWindStore(req), /* timeoutInMilliseconds */ 60000);
}
private void stopRace(HttpServletRequest req, HttpServletResponse resp) throws MalformedURLException, IOException, InterruptedException {
@@ -14,6 +14,8 @@ import com.sap.sailing.domain.base.Fleet;
import com.sap.sailing.domain.base.RaceColumn;
import com.sap.sailing.domain.leaderboard.Leaderboard;
import com.sap.sailing.domain.racelog.RaceLogEvent;
import com.sap.sailing.domain.racelog.RaceLogIdentifier;
import com.sap.sailing.domain.racelog.impl.RaceLogIdentifierImpl;
import com.sap.sailing.server.RacingEventService;
import com.sap.sailing.server.gateway.deserialization.JsonDeserializer;
import com.sap.sailing.server.gateway.deserialization.impl.Helpers;
@@ -72,9 +74,8 @@ public class AddToRaceLogJsonExportServlet extends JsonExportServlet {
response.sendError(HttpServletResponse.SC_NOT_FOUND, "No such fleet found.");
return;
}
/// TODO: get RaceLog of RaceColumn by Fleet
//service.apply(new RecordRaceLogEvent(leaderboardName, raceColumnName, fleetName, event));
RaceLogIdentifier identifier = new RaceLogIdentifierImpl(leaderboard, raceColumn, fleet);
JsonDeserializer<RaceLogEvent> deserializer =
new RaceLogEventDeserializer(
new RaceLogFlagEventDeserializer(),
@@ -89,7 +90,7 @@ public class AddToRaceLogJsonExportServlet extends JsonExportServlet {
RaceLogEvent logEvent = deserializer.deserialize(requestObject);
service.recordRaceLogEvent(leaderboardName, raceColumnName, fleetName, logEvent);
service.recordRaceLogEvent(identifier, logEvent);
} catch (ParseException pe) {
response.sendError(HttpServletResponse.SC_BAD_REQUEST, String.format("Invalid JSON in request body:\n%s", pe));