mirror of
https://github.com/eclipse-sailing-analytics/sailing-analytics.git
synced 2026-09-20 12:45:35 +00:00
removed com.sap.sailing.autoload bundle; it is obsoleted by the solution for bug 2
Change-Id: I4b0d7c7472a65605f676e97e5626f767d5bef7ee
This commit is contained in:
@@ -1,7 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<classpath>
|
||||
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
|
||||
<classpathentry kind="src" path="src"/>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
|
||||
<classpathentry kind="output" path="bin"/>
|
||||
</classpath>
|
||||
@@ -1 +0,0 @@
|
||||
bin
|
||||
@@ -1,28 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<projectDescription>
|
||||
<name>com.sap.sailing.autoload</name>
|
||||
<comment></comment>
|
||||
<projects>
|
||||
</projects>
|
||||
<buildSpec>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.jdt.core.javabuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.pde.ManifestBuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.pde.SchemaBuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
</buildSpec>
|
||||
<natures>
|
||||
<nature>org.eclipse.pde.PluginNature</nature>
|
||||
<nature>org.eclipse.jdt.core.javanature</nature>
|
||||
</natures>
|
||||
</projectDescription>
|
||||
@@ -1,12 +0,0 @@
|
||||
eclipse.preferences.version=1
|
||||
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
|
||||
org.eclipse.jdt.core.compiler.codegen.methodParameters=do not generate
|
||||
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
|
||||
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
|
||||
org.eclipse.jdt.core.compiler.compliance=1.8
|
||||
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
|
||||
org.eclipse.jdt.core.compiler.debug.localVariable=generate
|
||||
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
|
||||
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
|
||||
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
|
||||
org.eclipse.jdt.core.compiler.source=1.8
|
||||
@@ -1,4 +0,0 @@
|
||||
#Mon Aug 29 13:20:38 CEST 2011
|
||||
eclipse.preferences.version=1
|
||||
pluginProject.extensions=false
|
||||
resolve.requirebundle=false
|
||||
@@ -1,23 +0,0 @@
|
||||
Manifest-Version: 1.0
|
||||
Bundle-ManifestVersion: 2
|
||||
Bundle-Name: AutoLoad Races
|
||||
Bundle-SymbolicName: com.sap.sailing.autoload
|
||||
Bundle-Version: 1.0.0.qualifier
|
||||
Bundle-Vendor: SAP
|
||||
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
|
||||
Bundle-ActivationPolicy: lazy
|
||||
Export-Package: com.sap.sailing.autoload
|
||||
Import-Package: org.json.simple,
|
||||
org.json.simple.parser,
|
||||
org.osgi.framework;version="1.7.0",
|
||||
org.osgi.util.tracker;version="1.5.1"
|
||||
Require-Bundle: com.sap.sailing.gwt.ui,
|
||||
com.sap.sse.common,
|
||||
com.sap.sailing.domain.shared.android,
|
||||
com.sap.sailing.domain.tractracadapter,
|
||||
com.sap.sailing.server,
|
||||
com.sap.sailing.domain,
|
||||
com.sap.sailing.domain.common,
|
||||
com.sap.sailing.domain.persistence,
|
||||
com.sap.sse.replication
|
||||
Bundle-Activator: com.sap.sailing.autoload.Activator
|
||||
@@ -1,4 +0,0 @@
|
||||
source.. = src/
|
||||
output.. = bin/
|
||||
bin.includes = META-INF/,\
|
||||
.
|
||||
@@ -1,12 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<artifactId>root</artifactId>
|
||||
<groupId>com.sap.sailing</groupId>
|
||||
<version>1.0.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
<artifactId>com.sap.sailing.autoload</artifactId>
|
||||
<packaging>eclipse-plugin</packaging>
|
||||
</project>
|
||||
@@ -1,32 +0,0 @@
|
||||
package com.sap.sailing.autoload;
|
||||
|
||||
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.server.RacingEventService;
|
||||
|
||||
|
||||
public class Activator implements BundleActivator {
|
||||
Logger logger = Logger.getLogger(Activator.class.getName());
|
||||
|
||||
@Override
|
||||
public void start(BundleContext context) throws Exception {
|
||||
RacingEventService racingEventService = createAndOpenRacingEventServiceTracker(context).getService();
|
||||
new TracTrac(context, racingEventService);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void stop(BundleContext context) throws Exception {
|
||||
}
|
||||
|
||||
protected ServiceTracker<RacingEventService, RacingEventService> createAndOpenRacingEventServiceTracker(
|
||||
BundleContext context) {
|
||||
ServiceTracker<RacingEventService, RacingEventService> result = new ServiceTracker<RacingEventService, RacingEventService>(
|
||||
context, RacingEventService.class.getName(), null);
|
||||
result.open();
|
||||
return result;
|
||||
}
|
||||
}
|
||||
@@ -1,141 +0,0 @@
|
||||
package com.sap.sailing.autoload;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.Serializable;
|
||||
import java.net.MalformedURLException;
|
||||
import java.net.URI;
|
||||
import java.net.URISyntaxException;
|
||||
import java.net.URL;
|
||||
import java.text.ParseException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import org.osgi.framework.BundleContext;
|
||||
import org.osgi.util.tracker.ServiceTracker;
|
||||
|
||||
import com.sap.sailing.domain.base.Regatta;
|
||||
import com.sap.sailing.domain.common.RegattaIdentifier;
|
||||
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.RaceTracker;
|
||||
import com.sap.sailing.domain.tracking.TrackerManager;
|
||||
import com.sap.sailing.domain.tractracadapter.RaceRecord;
|
||||
import com.sap.sailing.domain.tractracadapter.TracTracAdapter;
|
||||
import com.sap.sailing.domain.tractracadapter.TracTracAdapterFactory;
|
||||
import com.sap.sailing.domain.tractracadapter.TracTracConnectionConstants;
|
||||
import com.sap.sailing.gwt.ui.shared.TracTracRaceRecordDTO;
|
||||
import com.sap.sailing.server.RacingEventService;
|
||||
import com.sap.sse.common.Util.Pair;
|
||||
import com.sap.sse.common.impl.MillisecondsTimePoint;
|
||||
|
||||
/**
|
||||
* Auto load TracTrac races from a parameter called <code>tractrac.autoload.json_urls</code>. This
|
||||
* parameter contains a list of all event json urls from which you want to load races from. Only
|
||||
* races in state <code>REPLAY</code> will be loaded.
|
||||
*
|
||||
* @author Simon Marcel Pamies
|
||||
*/
|
||||
public class TracTrac {
|
||||
Logger logger = Logger.getLogger(TracTrac.class.getName());
|
||||
|
||||
private final TracTracAdapter tracTracAdapter;
|
||||
private final RacingEventService racingEventService;
|
||||
|
||||
public TracTrac(BundleContext context, RacingEventService racingEventService) {
|
||||
this.racingEventService = racingEventService;
|
||||
this.tracTracAdapter = createAndOpenTracTracAdapterTracker(context).getService().getOrCreateTracTracAdapter(this.racingEventService.getBaseDomainFactory());
|
||||
try {
|
||||
autoLoadTrackTrackRaces();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
private TracTracAdapter getTracTracAdapter() {
|
||||
return this.tracTracAdapter;
|
||||
}
|
||||
|
||||
private RacingEventService getService() {
|
||||
return this.racingEventService;
|
||||
}
|
||||
|
||||
private void autoLoadTrackTrackRaces() throws Exception {
|
||||
String jsonUrls = System.getProperty("tractrac.autoload.json_urls");
|
||||
if (jsonUrls != null) {
|
||||
String[] splitJsonUrls = jsonUrls.split(",");
|
||||
for (String jsonUrl : splitJsonUrls) {
|
||||
logger.info("Loading races from " + jsonUrl);
|
||||
Pair<String, List<TracTracRaceRecordDTO>> racesThatCanBeTracked = listTracTracRacesInEvent(jsonUrl, /*listHiddenRaces*/false);
|
||||
|
||||
for (TracTracRaceRecordDTO raceRecord : racesThatCanBeTracked.getB()) {
|
||||
RaceRecord record = getTracTracAdapter().getSingleTracTracRaceRecord(new URL(raceRecord.jsonURL), raceRecord.id, /*loadClientParams*/true);
|
||||
if (record.getRaceStatus().equals(TracTracConnectionConstants.REPLAY_STATUS) || record.getRaceVisibility().equals(TracTracConnectionConstants.REPLAY_VISIBILITY)) {
|
||||
RegattaIdentifier regattaForRaceRecord = null;
|
||||
if (raceRecord.hasRememberedRegatta()) {
|
||||
Regatta regatta = getService().getRememberedRegattaForRace(raceRecord.id);
|
||||
if (regatta != null) {
|
||||
regattaForRaceRecord = regatta.getRegattaIdentifier();
|
||||
}
|
||||
}
|
||||
RaceLogStore raceLogStore = MongoRaceLogStoreFactory.INSTANCE.getMongoRaceLogStore(getService()
|
||||
.getMongoObjectFactory(), getService().getDomainObjectFactory());
|
||||
RegattaLogStore regattaLogStore = MongoRegattaLogStoreFactory.INSTANCE.getMongoRegattaLogStore(
|
||||
getService().getMongoObjectFactory(), getService().getDomainObjectFactory());
|
||||
getTracTracAdapter().addTracTracRace(
|
||||
(TrackerManager) getService(),
|
||||
regattaForRaceRecord,
|
||||
record.getParamURL(), /* effectiveLiveURI */
|
||||
null,
|
||||
record.getStoredURI(),
|
||||
new URI(""),
|
||||
new MillisecondsTimePoint(record.getTrackingStartTime().asMillis()),
|
||||
new MillisecondsTimePoint(record.getTrackingEndTime().asMillis()),
|
||||
raceLogStore, regattaLogStore,
|
||||
RaceTracker.TIMEOUT_FOR_RECEIVING_RACE_DEFINITION_IN_MILLISECONDS, /* offsetToStartTimeOfSimulatedRace */
|
||||
null, /*useTracTracMarkPassings*/ false,
|
||||
/* tracTracUsername */"", /* tracTracPassword */"", record.getRaceStatus(),
|
||||
record.getRaceVisibility());
|
||||
} else {
|
||||
logger.info("Ignoring race " + record.getName() + " because it is in status "
|
||||
+ record.getRaceStatus() + " and visibility " + record.getRaceVisibility());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public com.sap.sse.common.Util.Pair<String, List<TracTracRaceRecordDTO>> listTracTracRacesInEvent(String eventJsonURL, boolean listHiddenRaces) throws MalformedURLException, IOException, ParseException, org.json.simple.parser.ParseException, URISyntaxException {
|
||||
com.sap.sse.common.Util.Pair<String,List<RaceRecord>> raceRecords;
|
||||
raceRecords = getTracTracAdapter().getTracTracRaceRecords(new URL(eventJsonURL), /*loadClientParam*/ false);
|
||||
List<TracTracRaceRecordDTO> result = new ArrayList<TracTracRaceRecordDTO>();
|
||||
for (RaceRecord raceRecord : raceRecords.getB()) {
|
||||
if (listHiddenRaces == false && raceRecord.getRaceVisibility().equals(TracTracConnectionConstants.HIDDEN_VISIBILITY)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
result.add(new TracTracRaceRecordDTO(raceRecord.getID(), raceRecord.getEventName(), raceRecord.getName(),
|
||||
raceRecord.getTrackingStartTime().asDate(),
|
||||
raceRecord
|
||||
.getTrackingEndTime().asDate(), raceRecord.getRaceStartTime().asDate(),
|
||||
raceRecord.getBoatClassNames(), raceRecord.getRaceStatus(), raceRecord.getRaceVisibility(), raceRecord.getJsonURL().toString(),
|
||||
hasRememberedRegatta(raceRecord.getID())));
|
||||
}
|
||||
return new com.sap.sse.common.Util.Pair<String, List<TracTracRaceRecordDTO>>(raceRecords.getA(), result);
|
||||
}
|
||||
|
||||
private boolean hasRememberedRegatta(Serializable raceID) {
|
||||
return racingEventService.getRememberedRegattaForRace(raceID) != null;
|
||||
}
|
||||
|
||||
private ServiceTracker<TracTracAdapterFactory, TracTracAdapterFactory> createAndOpenTracTracAdapterTracker(BundleContext context) {
|
||||
ServiceTracker<TracTracAdapterFactory, TracTracAdapterFactory> result = new ServiceTracker<TracTracAdapterFactory, TracTracAdapterFactory>(
|
||||
context, TracTracAdapterFactory.class.getName(), null);
|
||||
result.open();
|
||||
result.getService().getOrCreateTracTracAdapter(racingEventService.getBaseDomainFactory());
|
||||
return result;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -303,13 +303,6 @@ Computes leaderboard information for sailing races and offers RESTful APIs to al
|
||||
version="0.0.0"
|
||||
unpack="false"/>
|
||||
|
||||
<plugin
|
||||
id="com.sap.sailing.autoload"
|
||||
download-size="0"
|
||||
install-size="0"
|
||||
version="0.0.0"
|
||||
unpack="false"/>
|
||||
|
||||
<plugin
|
||||
id="com.sap.sse"
|
||||
download-size="0"
|
||||
|
||||
@@ -189,7 +189,6 @@
|
||||
<module>com.sap.sailing.simulator.test</module>
|
||||
<module>com.sap.sailing.server.trackfiles.test</module>
|
||||
<module>com.sap.sailing.selenium.test</module>
|
||||
<module>com.sap.sailing.autoload</module>
|
||||
<module>com.sap.sailing.feature.p2build</module>
|
||||
<module>com.sap.sailing.polars</module>
|
||||
<module>com.sap.sailing.polars.datamining</module>
|
||||
|
||||
Reference in New Issue
Block a user