java/com.sap.sailing.expeditionconnector/src/com/sap/sailing/expeditionconnector/UDPExpeditionReceiver.java
... ...
@@ -38,6 +38,23 @@ public class UDPExpeditionReceiver extends UDPReceiver<ExpeditionMessage, Expedi
38 38
* Otherwise, only wind data will be forwarded.
39 39
*/
40 40
private final DeviceRegistry deviceRegistry;
41
+
42
+ private final static Map<Integer, ExpeditionExtendedSensorDataMetadata> mapExpeditionMessageFieldIdToMetadata;
43
+
44
+ static {
45
+ mapExpeditionMessageFieldIdToMetadata = new HashMap<>();
46
+ mapExpeditionMessageFieldIdToMetadata.put(ExpeditionMessage.ID_ROLL, ExpeditionExtendedSensorDataMetadata.HEEL);
47
+ mapExpeditionMessageFieldIdToMetadata.put(ExpeditionMessage.ID_PITCH, ExpeditionExtendedSensorDataMetadata.TRIM);
48
+ mapExpeditionMessageFieldIdToMetadata.put(ExpeditionMessage.ID_RUDDER, ExpeditionExtendedSensorDataMetadata.RUDDER);
49
+ mapExpeditionMessageFieldIdToMetadata.put(ExpeditionMessage.ID_TACK_ANGLE, ExpeditionExtendedSensorDataMetadata.TACK_ANGLE);
50
+ mapExpeditionMessageFieldIdToMetadata.put(ExpeditionMessage.ID_RAKE_DEG, ExpeditionExtendedSensorDataMetadata.RAKE_DEG);
51
+ mapExpeditionMessageFieldIdToMetadata.put(ExpeditionMessage.ID_DFLCTR_PP, ExpeditionExtendedSensorDataMetadata.DEFLECTOR_PERCENTAGE);
52
+ mapExpeditionMessageFieldIdToMetadata.put(ExpeditionMessage.ID_TG_HEEL, ExpeditionExtendedSensorDataMetadata.TARGET_HEEL);
53
+ mapExpeditionMessageFieldIdToMetadata.put(ExpeditionMessage.ID_FORESTAY_LOAD, ExpeditionExtendedSensorDataMetadata.FORESTAY_LOAD);
54
+ mapExpeditionMessageFieldIdToMetadata.put(ExpeditionMessage.ID_FORESTAY_PRES, ExpeditionExtendedSensorDataMetadata.FORESTAY_PRESSURE);
55
+ mapExpeditionMessageFieldIdToMetadata.put(ExpeditionMessage.ID_DFLECTR_MM, ExpeditionExtendedSensorDataMetadata.DEFLECTOR_MILLIMETERS);
56
+ mapExpeditionMessageFieldIdToMetadata.put(ExpeditionMessage.ID_TARG_BSP_P, ExpeditionExtendedSensorDataMetadata.TARGET_BOATSPEED_P);
57
+ }
41 58
42 59
/**
43 60
* Launches a listener and dumps messages received to the console
... ...
@@ -100,19 +117,6 @@ public class UDPExpeditionReceiver extends UDPReceiver<ExpeditionMessage, Expedi
100 117
* store in the {@link DeviceRegistry#getSensorFixStore() sensor fix store}.
101 118
*/
102 119
private void tryToProduceAndStoreSensorFix(ExpeditionMessage msg, ExpeditionSensorDeviceIdentifier sensorDeviceIdentifier) {
103
- final Map<Integer, ExpeditionExtendedSensorDataMetadata> mapExpeditionMessageFieldIdToMetadata = new HashMap<>();
104
- mapExpeditionMessageFieldIdToMetadata.put(ExpeditionMessage.ID_ROLL, ExpeditionExtendedSensorDataMetadata.HEEL);
105
- mapExpeditionMessageFieldIdToMetadata.put(ExpeditionMessage.ID_PITCH, ExpeditionExtendedSensorDataMetadata.TRIM);
106
- mapExpeditionMessageFieldIdToMetadata.put(ExpeditionMessage.ID_RUDDER, ExpeditionExtendedSensorDataMetadata.RUDDER);
107
- mapExpeditionMessageFieldIdToMetadata.put(ExpeditionMessage.ID_TACK_ANGLE, ExpeditionExtendedSensorDataMetadata.TACK_ANGLE);
108
- mapExpeditionMessageFieldIdToMetadata.put(ExpeditionMessage.ID_RAKE_DEG, ExpeditionExtendedSensorDataMetadata.RAKE_DEG);
109
- mapExpeditionMessageFieldIdToMetadata.put(ExpeditionMessage.ID_DFLCTR_PP, ExpeditionExtendedSensorDataMetadata.DEFLECTOR_PERCENTAGE);
110
- mapExpeditionMessageFieldIdToMetadata.put(ExpeditionMessage.ID_TG_HEEL, ExpeditionExtendedSensorDataMetadata.TARGET_HEEL);
111
- mapExpeditionMessageFieldIdToMetadata.put(ExpeditionMessage.ID_FORESTAY_LOAD, ExpeditionExtendedSensorDataMetadata.FORESTAY_LOAD);
112
- mapExpeditionMessageFieldIdToMetadata.put(ExpeditionMessage.ID_FORESTAY_PRES, ExpeditionExtendedSensorDataMetadata.FORESTAY_PRESSURE);
113
- mapExpeditionMessageFieldIdToMetadata.put(ExpeditionMessage.ID_DFLECTR_MM, ExpeditionExtendedSensorDataMetadata.DEFLECTOR_MILLIMETERS);
114
- mapExpeditionMessageFieldIdToMetadata.put(ExpeditionMessage.ID_TARG_BSP_P, ExpeditionExtendedSensorDataMetadata.TARGET_BOATSPEED_P);
115
-
116 120
int maxColumnIndex = -1;
117 121
final Map<Integer, Double> valuesPerDoubleVectorFixColumnIndices = new HashMap<>();
118 122
for (final Entry<Integer, ExpeditionExtendedSensorDataMetadata> mapEntry : mapExpeditionMessageFieldIdToMetadata.entrySet()) {
... ...
@@ -126,7 +130,7 @@ public class UDPExpeditionReceiver extends UDPReceiver<ExpeditionMessage, Expedi
126 130
vector[valuesPerDoubleVectorFixColumnIndex.getKey()] = valuesPerDoubleVectorFixColumnIndex.getValue();
127 131
}
128 132
final DoubleVectorFix fix = new DoubleVectorFixImpl(msg.getTimePoint(), vector);
129
- if (fix != null && fix.hasValidData()) {
133
+ if (fix.hasValidData()) {
130 134
deviceRegistry.getSensorFixStore().storeFix(sensorDeviceIdentifier, fix);
131 135
}
132 136
}
wiki/info/landscape/amazon-ec2.md
... ...
@@ -20,7 +20,8 @@
20 20
You may need to select "All generations" instead of "Current generation" to see these instance configurations. Of course, you may choose variations of those as you feel is appropriate for your use case.
21 21
22 22
- Using a release, set the following in the instance's user data, replacing `myspecificevent` by a unique name of the event or series you'll be running on that instance, such as `kielerwoche2014` or similar.
23
- <pre>
23
+
24
+ ```
24 25
INSTALL_FROM_RELEASE=`name-of-release`
25 26
USE_ENVIRONMENT=live-server
26 27
MONGODB_URI="mongodb://mongo0.internal.sapsailing.com,mongo1.internal.sapsailing.com/myspecificevent?replicaSet=live&retryWrites=true"
... ...
@@ -29,7 +30,15 @@ You may need to select "All generations" instead of "Current generation" to see
29 30
BUILD_COMPLETE_NOTIFY=your@email.here
30 31
SERVER_STARTUP_NOTIFY=your@email.here
31 32
ADDITIONAL_JAVA_ARGS="$ADDITIONAL_JAVA_ARGS -Dcom.sap.sailing.domain.tracking.MailInvitationType=SailInsight2"
32
- </pre>
33
+ # Provide authentication credentials for a user on security-service.sapsailing.com permitted to replicate, either by username/password...
34
+ #REPLICATE_MASTER_USERNAME=(user for replicator login on security-service.sapsailing.com server having SERVER:REPLICATE:&lt;server-name&gt; permission)
35
+ #REPLICATE_MASTER_PASSWORD=(password of the user for replication login on security-service.sapsailing.com)
36
+ # Or by bearer token, obtained, e.g., through
37
+ # curl -d "username=myuser&password=mysecretpassword" "https://security-service.sapsailing.com/security/api/restsecurity/access_token" | jq .access_token
38
+ # or by logging in to the security-service.sapsailing.com server using your web browser and then navigating to
39
+ # https://security-service.sapsailing.com/security/api/restsecurity/access_token
40
+ #REPLICATE_MASTER_BEARER_TOKEN=
41
+```
33 42
34 43
The *MailInvitationType* property controls which version of the SAP Sail Insight app will be targeted by tracking invitations sent out by e-mail.
35 44
Two different Branch.io URL schemes exist for the Sail Insight app: sailinsight-app.sapsailing.com and sailinsight20-app.sapsailing.com.
... ...
@@ -40,7 +49,8 @@ iOS app has hit the store. If not provided, it will default to *SailInsight2*.
40 49
Note that when you select to install an environment using the `USE_ENVIRONMENT` variable, any other variable that you specify in the user data, such as the `MONGODB_URI` or `REPLICATION_CHANNEL` properties in the example above, these additional user data properties will override whatever comes from the environment specified by the `USE_ENVIRONMENT` parameter.
41 50
42 51
- To build from git, install and start, set the following in the instance's user data, adjusting the branch name (`BUILD_FROM`), the `myspecificevent` naming and memory settings according to your needs:
43
- <pre>
52
+
53
+```
44 54
BUILD_BEFORE_START=True
45 55
BUILD_FROM=master
46 56
RUN_TESTS=False
... ...
@@ -52,7 +62,15 @@ Note that when you select to install an environment using the `USE_ENVIRONMENT`
52 62
REPLICATION_HOST=rabbit.internal.sapsailing.com
53 63
REPLICATION_CHANNEL=myspecificevent
54 64
MONGODB_URI="mongodb://mongo0.internal.sapsailing.com,mongo1.internal.sapsailing.com/myspecificevent?replicaSet=live&retryWrites=true"
55
- </pre>
65
+ # Provide authentication credentials for a user on security-service.sapsailing.com permitted to replicate, either by username/password...
66
+ #REPLICATE_MASTER_USERNAME=(user for replicator login on security-service.sapsailing.com server having SERVER:REPLICATE:&lt;server-name&gt; permission)
67
+ #REPLICATE_MASTER_PASSWORD=(password of the user for replication login on security-service.sapsailing.com)
68
+ # Or by bearer token, obtained, e.g., through
69
+ # curl -d "username=myuser&password=mysecretpassword" "https://security-service.sapsailing.com/security/api/restsecurity/access_token" | jq .access_token
70
+ # or by logging in to the security-service.sapsailing.com server using your web browser and then navigating to
71
+ # https://security-service.sapsailing.com/security/api/restsecurity/access_token
72
+ #REPLICATE_MASTER_BEARER_TOKEN=
73
+```
56 74
57 75
#### Setting up a new image (AMI) from scratch (more or less)
58 76
... ...
@@ -66,20 +84,28 @@ See [here](/wiki/creating-ec2-image-from-scratch)
66 84
67 85
- Fire up a master with the following configuration. There is a preconfigured master environment at http://releases.sapsailing.com/environments/live-master-server that you should use.
68 86
69
-<pre>
87
+```
70 88
INSTALL_FROM_RELEASE=(name-of-release)
71 89
USE_ENVIRONMENT=live-master-server
72 90
SERVER_NAME=MYSPECIFICEVENT
73 91
REPLICATION_CHANNEL=myspecificevent
74 92
MONGODB_URI="mongodb://mongo0.internal.sapsailing.com,mongo1.internal.sapsailing.com/myspecificevent?replicaSet=live&retryWrites=true"
75 93
SERVER_STARTUP_NOTIFY=you@email.com
76
-</pre>
94
+# Provide authentication credentials for a user on security-service.sapsailing.com permitted to replicate, either by username/password...
95
+#REPLICATE_MASTER_USERNAME=(user for replicator login on security-service.sapsailing.com server having SERVER:REPLICATE:&lt;server-name&gt; permission)
96
+#REPLICATE_MASTER_PASSWORD=(password of the user for replication login on security-service.sapsailing.com)
97
+# Or by bearer token, obtained, e.g., through
98
+# curl -d "username=myuser&password=mysecretpassword" "https://security-service.sapsailing.com/security/api/restsecurity/access_token" | jq .access_token
99
+# or by logging in to the security-service.sapsailing.com server using your web browser and then navigating to
100
+# https://security-service.sapsailing.com/security/api/restsecurity/access_token
101
+#REPLICATE_MASTER_BEARER_TOKEN=
102
+```
77 103
78 104
- After your master server is ready, note the internal IP and configure your replica instances. Set up a user account there that has the following permission: ``SERVER:REPLICATE:{SERVERNAME}``. You will need this user's credentials to authenticate your replicas for replication.
79 105
80 106
- Make sure to use the preconfigured environment from http://releases.sapsailing.com/environments/live-replica-server. Then absolutely make sure to add the line "REPLICATE_MASTER_SERVLET_HOST" to the user-data and adjust the `myspecificevent` master exchange name to the `REPLICATION_CHANNEL` setting you used for the master configuration.
81 107
82
-<pre>
108
+```
83 109
INSTALL_FROM_RELEASE=(name-of-release)
84 110
USE_ENVIRONMENT=live-replica-server
85 111
REPLICATE_MASTER_SERVLET_HOST=(IP of your master server)
... ...
@@ -96,7 +122,7 @@ SERVER_NAME=MYSPECIFICEVENT
96 122
MONGODB_URI="mongodb://mongo0.internal.sapsailing.com,mongo1.internal.sapsailing.com/myspecificevent-replica?replicaSet=live&retryWrites=true"
97 123
EVENT_ID=&lt;some-uuid-of-an-event-you-want-to-feature&gt;
98 124
SERVER_STARTUP_NOTIFY=you@email.com
99
-</pre>
125
+```
100 126
101 127
#### Setting up a Multi Instance
102 128
To set up a multi instance for a server with name "SSV", subdomain "ssv.sapsailing.com" and description "Schwartauer Segler-Verein, [www.ssv-net.de](http://www.ssv-net.de), Alexander Probst, [webmaster@alexprobst.de](mailto:webmaster@alexprobst.de)" perform the following steps: