mirror of
https://github.com/eclipse-sailing-analytics/sailing-analytics.git
synced 2026-10-22 20:13:52 +00:00
restructured race log tracking: moved to racelogtrackingadapter bundles, renamed packages, moved some interfaces
This commit is contained in:
1 parent
713c6200df
commit
5c714e5a31
140 files changed
+807
-642
No files matched your search
@@ -0,0 +1,7 @@
|
||||
<?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.7"/>
|
||||
<classpathentry kind="output" path="bin"/>
|
||||
</classpath>
|
||||
@@ -0,0 +1 @@
|
||||
bin
|
||||
@@ -0,0 +1,28 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<projectDescription>
|
||||
<name>com.sap.sailing.domain.racelogtrackingadapter</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>
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
#Thu Jan 19 09:51:40 CET 2012
|
||||
eclipse.preferences.version=1
|
||||
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
|
||||
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7
|
||||
org.eclipse.jdt.core.compiler.compliance=1.7
|
||||
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
|
||||
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
|
||||
org.eclipse.jdt.core.compiler.source=1.7
|
||||
+4
@@ -0,0 +1,4 @@
|
||||
#Thu Aug 25 16:46:04 CEST 2011
|
||||
eclipse.preferences.version=1
|
||||
pluginProject.extensions=false
|
||||
resolve.requirebundle=false
|
||||
@@ -0,0 +1,24 @@
|
||||
Manifest-Version: 1.0
|
||||
Bundle-ManifestVersion: 2
|
||||
Bundle-Name: RaceLog Tracking Adapter
|
||||
Bundle-SymbolicName: com.sap.sailing.domain.racelogtrackingadapter
|
||||
Bundle-Version: 1.0.0.qualifier
|
||||
Bundle-Vendor: SAP
|
||||
Bundle-RequiredExecutionEnvironment: JavaSE-1.7
|
||||
Bundle-ActivationPolicy: lazy
|
||||
Require-Bundle: com.sap.sailing.domain,
|
||||
com.sap.sailing.domain.common,
|
||||
com.sap.sailing.domain.shared.android,
|
||||
com.sap.sailing.server.gateway.serialization;bundle-version="1.0.0",
|
||||
com.sap.sailing.domain.persistence;bundle-version="1.0.0",
|
||||
com.sap.sailing.server.gateway;bundle-version="1.0.0",
|
||||
com.sap.sailing.server;bundle-version="1.0.0",
|
||||
com.googlecode.java-diff-utils;bundle-version="1.3.0"
|
||||
Import-Package: javax.servlet;version="2.6.0",
|
||||
org.json.simple,
|
||||
org.json.simple.parser,
|
||||
org.osgi.framework;version="1.6.0"
|
||||
Export-Package: com.sap.sailing.domain.racelog.tracking.impl;x-friends:="com.sap.sailing.domain.racelogtrackingadapter.testsupport",
|
||||
com.sap.sailing.domain.racelog.tracking.servlet;x-friends:="com.sap.sailing.domain.racelogtrackingadapter.test"
|
||||
Web-ContextPath: /tracking
|
||||
Bundle-Activator: com.sap.sailing.domain.racelog.tracking.impl.Activator
|
||||
@@ -0,0 +1,17 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns="http://java.sun.com/xml/ns/javaee"
|
||||
xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
|
||||
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
|
||||
http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" version="2.5">
|
||||
|
||||
<servlet>
|
||||
<servlet-name>RecordFixesPostServlet</servlet-name>
|
||||
<servlet-class>com.sap.sailing.domain.racelog.tracking.servlet.RecordFixesPostServlet</servlet-class>
|
||||
</servlet>
|
||||
<servlet-mapping>
|
||||
<servlet-name>RecordFixesPostServlet</servlet-name>
|
||||
<url-pattern>/recordFixes</url-pattern>
|
||||
</servlet-mapping>
|
||||
|
||||
</web-app>
|
||||
@@ -0,0 +1,4 @@
|
||||
source.. = src/
|
||||
output.. = bin/
|
||||
bin.includes = META-INF/,\
|
||||
.
|
||||
@@ -0,0 +1,12 @@
|
||||
<?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.domain.racelogtrackingadapter</artifactId>
|
||||
<packaging>eclipse-plugin</packaging>
|
||||
</project>
|
||||
+63
@@ -0,0 +1,63 @@
|
||||
package com.sap.sailing.domain.racelog.tracking.impl;
|
||||
|
||||
import java.util.Dictionary;
|
||||
import java.util.HashSet;
|
||||
import java.util.Hashtable;
|
||||
import java.util.Set;
|
||||
|
||||
import org.osgi.framework.BundleActivator;
|
||||
import org.osgi.framework.BundleContext;
|
||||
import org.osgi.framework.ServiceRegistration;
|
||||
|
||||
import com.sap.sailing.domain.common.racelog.tracking.TypeBasedServiceFinder;
|
||||
import com.sap.sailing.domain.persistence.racelog.tracking.DeviceIdentifierMongoHandler;
|
||||
import com.sap.sailing.domain.racelog.tracking.SmartphoneImeiIdentifier;
|
||||
import com.sap.sailing.domain.tracking.GPSFix;
|
||||
import com.sap.sailing.server.gateway.deserialization.JsonDeserializer;
|
||||
import com.sap.sailing.server.gateway.deserialization.impl.GPSFixJsonDeserializer;
|
||||
import com.sap.sailing.server.gateway.deserialization.impl.GPSFixMovingJsonDeserializer;
|
||||
import com.sap.sailing.server.gateway.deserialization.impl.GPSFixMovingNmeaDTOJsonDeserializer;
|
||||
import com.sap.sailing.server.gateway.deserialization.impl.GPSFixNmeaDTOJsonDeserializer;
|
||||
import com.sap.sailing.server.gateway.serialization.JsonSerializer;
|
||||
import com.sap.sailing.server.gateway.serialization.impl.GPSFixJsonSerializer;
|
||||
import com.sap.sailing.server.gateway.serialization.impl.GPSFixMovingJsonSerializer;
|
||||
import com.sap.sailing.server.gateway.serialization.impl.GPSFixMovingNmeaDTOJsonSerializer;
|
||||
import com.sap.sailing.server.gateway.serialization.impl.GPSFixNmeaDTOJsonSerializer;
|
||||
import com.sap.sailing.server.gateway.serialization.racelog.tracking.DeviceIdentifierJsonHandler;
|
||||
import com.sap.sailing.server.gateway.serialization.racelog.tracking.GPSFixJsonHandler;
|
||||
import com.sap.sailing.server.gateway.serialization.racelog.tracking.impl.SmartphoneImeiJsonHandlerImpl;
|
||||
|
||||
public class Activator implements BundleActivator {
|
||||
private Set<ServiceRegistration<?>> registrations = new HashSet<>();
|
||||
|
||||
private Dictionary<String, String> getDict(String type) {
|
||||
Dictionary<String, String> properties = new Hashtable<String, String>();
|
||||
properties.put(TypeBasedServiceFinder.TYPE, type);
|
||||
return properties;
|
||||
}
|
||||
|
||||
private <T extends GPSFix> void registerGPSFixJsonService(BundleContext context, JsonDeserializer<T> deserializer,
|
||||
JsonSerializer<T> serializer, String type) {
|
||||
registrations.add(context.registerService(GPSFixJsonHandler.class,
|
||||
new GPSFixJsonHandlerImpl<T>(deserializer, serializer), getDict(type)));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void start(BundleContext context) throws Exception {
|
||||
registrations.add(context.registerService(DeviceIdentifierMongoHandler.class, new SmartphoneImeiMongoHandlerImpl(), getDict(SmartphoneImeiIdentifier.TYPE)));
|
||||
registrations.add(context.registerService(DeviceIdentifierJsonHandler.class, new SmartphoneImeiJsonHandlerImpl(), getDict(SmartphoneImeiIdentifier.TYPE)));
|
||||
|
||||
registerGPSFixJsonService(context, new GPSFixJsonDeserializer(), new GPSFixJsonSerializer(), GPSFixJsonDeserializer.TYPE);
|
||||
registerGPSFixJsonService(context, new GPSFixMovingJsonDeserializer(), new GPSFixMovingJsonSerializer(), GPSFixMovingJsonDeserializer.TYPE);
|
||||
registerGPSFixJsonService(context, new GPSFixNmeaDTOJsonDeserializer(), new GPSFixNmeaDTOJsonSerializer(), GPSFixNmeaDTOJsonDeserializer.TYPE);
|
||||
registerGPSFixJsonService(context, new GPSFixMovingNmeaDTOJsonDeserializer(), new GPSFixMovingNmeaDTOJsonSerializer(), GPSFixMovingNmeaDTOJsonDeserializer.TYPE);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void stop(BundleContext context) throws Exception {
|
||||
for (ServiceRegistration<?> reg : registrations) {
|
||||
reg.unregister();
|
||||
}
|
||||
registrations.clear();
|
||||
}
|
||||
}
|
||||
+31
@@ -0,0 +1,31 @@
|
||||
package com.sap.sailing.domain.racelog.tracking.impl;
|
||||
|
||||
import org.json.simple.JSONObject;
|
||||
|
||||
import com.sap.sailing.domain.tracking.GPSFix;
|
||||
import com.sap.sailing.server.gateway.deserialization.JsonDeserializationException;
|
||||
import com.sap.sailing.server.gateway.deserialization.JsonDeserializer;
|
||||
import com.sap.sailing.server.gateway.serialization.JsonSerializer;
|
||||
import com.sap.sailing.server.gateway.serialization.racelog.tracking.GPSFixJsonHandler;
|
||||
|
||||
public class GPSFixJsonHandlerImpl<T extends GPSFix> implements GPSFixJsonHandler {
|
||||
private final JsonDeserializer<T> deserializer;
|
||||
private final JsonSerializer<T> serializer;
|
||||
|
||||
public GPSFixJsonHandlerImpl(JsonDeserializer<T> deserializer,
|
||||
JsonSerializer<T> serializer) {
|
||||
this.deserializer = deserializer;
|
||||
this.serializer = serializer;
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
public JSONObject transformForth(GPSFix fix) throws IllegalArgumentException {
|
||||
return serializer.serialize((T) fix);
|
||||
}
|
||||
|
||||
@Override
|
||||
public GPSFix transformBack(JSONObject json) throws JsonDeserializationException {
|
||||
return deserializer.deserialize(json);
|
||||
}
|
||||
}
|
||||
+24
@@ -0,0 +1,24 @@
|
||||
package com.sap.sailing.domain.racelog.tracking.impl;
|
||||
|
||||
import com.sap.sailing.domain.common.racelog.tracking.TransformationException;
|
||||
import com.sap.sailing.domain.persistence.racelog.tracking.DeviceIdentifierMongoHandler;
|
||||
import com.sap.sailing.domain.racelog.tracking.DeviceIdentifier;
|
||||
import com.sap.sailing.domain.racelog.tracking.SmartphoneImeiIdentifier;
|
||||
|
||||
public class SmartphoneImeiMongoHandlerImpl implements DeviceIdentifierMongoHandler {
|
||||
private SmartphoneImeiIdentifier castIdentifier(DeviceIdentifier identifier) throws TransformationException {
|
||||
if (! (identifier instanceof SmartphoneImeiIdentifier))
|
||||
throw new TransformationException("Expected a SmartphoneImeiIdentifier, got instead: " + identifier);
|
||||
return (SmartphoneImeiIdentifier) identifier;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object transformForth(DeviceIdentifier deviceIdentifier) throws TransformationException {
|
||||
return castIdentifier(deviceIdentifier).getImei();
|
||||
}
|
||||
|
||||
@Override
|
||||
public DeviceIdentifier transformBack(Object input) {
|
||||
return new SmartphoneImeiIdentifier((String) input);
|
||||
}
|
||||
}
|
||||
+60
@@ -0,0 +1,60 @@
|
||||
package com.sap.sailing.domain.racelog.tracking.servlet;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.servlet.ServletConfig;
|
||||
import javax.servlet.ServletException;
|
||||
|
||||
import com.sap.sailing.domain.common.impl.Util.Triple;
|
||||
import com.sap.sailing.domain.common.racelog.tracking.TypeBasedServiceFinder;
|
||||
import com.sap.sailing.domain.racelog.tracking.DeviceIdentifier;
|
||||
import com.sap.sailing.domain.tracking.GPSFix;
|
||||
import com.sap.sailing.server.gateway.AbstractJsonPostServlet;
|
||||
import com.sap.sailing.server.gateway.HttpExceptionWithMessage;
|
||||
import com.sap.sailing.server.gateway.deserialization.JsonDeserializer;
|
||||
import com.sap.sailing.server.gateway.deserialization.impl.DeviceAndSessionIdentifierWithGPSFixesDeserializer;
|
||||
import com.sap.sailing.server.gateway.serialization.JsonSerializer;
|
||||
import com.sap.sailing.server.gateway.serialization.racelog.tracking.DeviceIdentifierJsonHandler;
|
||||
import com.sap.sailing.server.gateway.serialization.racelog.tracking.GPSFixJsonHandler;
|
||||
|
||||
public class RecordFixesPostServlet extends AbstractJsonPostServlet<Triple<DeviceIdentifier, Serializable, List<GPSFix>>, Void> {
|
||||
private static final long serialVersionUID = 2778739335260621119L;
|
||||
private DeviceAndSessionIdentifierWithGPSFixesDeserializer deserializer;
|
||||
|
||||
@Override
|
||||
public void init(ServletConfig config) throws ServletException {
|
||||
super.init(config);
|
||||
TypeBasedServiceFinder<GPSFixJsonHandler> fixServiceFinder =
|
||||
getServiceFinderFactory().createServiceFinder(GPSFixJsonHandler.class);
|
||||
TypeBasedServiceFinder<DeviceIdentifierJsonHandler> deviceServiceFinder =
|
||||
getServiceFinderFactory().createServiceFinder(DeviceIdentifierJsonHandler.class);
|
||||
deserializer = new DeviceAndSessionIdentifierWithGPSFixesDeserializer(fixServiceFinder, deviceServiceFinder);
|
||||
}
|
||||
|
||||
@Override
|
||||
public JsonDeserializer<Triple<DeviceIdentifier, Serializable, List<GPSFix>>> getRequestDeserializer() {
|
||||
return deserializer;
|
||||
}
|
||||
|
||||
@Override
|
||||
public JsonSerializer<Void> getResponseSerializer() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Void process(Map<String, String> parameterValues,
|
||||
Triple<DeviceIdentifier, Serializable, List<GPSFix>> domainObject) throws HttpExceptionWithMessage {
|
||||
DeviceIdentifier device = domainObject.getA();
|
||||
//might use the session id in the future
|
||||
// Serializable sessionId = domainObject.getB();
|
||||
List<GPSFix> fixes = domainObject.getC();
|
||||
|
||||
for (GPSFix fix : fixes) {
|
||||
getService().storeGPSFix(device, fix);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user