bug4811: place a new "port" field in version.json in the "start" script and use it for replica registration; added new port fields to replication status, for both, replicatedfrom and replicatedby

This commit is contained in:
Axel Uhl
2021-04-20 16:33:50 +02:00
parent 208d581735
commit ac765dca84
32 changed files with 388 additions and 270 deletions
@@ -3528,7 +3528,7 @@ public class SailingServiceImpl extends ResultCachingProxiedRemoteServiceServlet
@Override
public void startReplicatingFromMaster(String messagingHost, String masterHostName, String exchangeName,
int servletPort, int messagingPort, String usernameOrNull, String passwordOrNull)
throws IOException, ClassNotFoundException, InterruptedException {
throws Exception {
getSecurityService().checkCurrentUserServerPermission(ServerActions.START_REPLICATION);
// The queue name must always be the same for this server. In order to achieve
// this we're using the unique server identifier
@@ -47,7 +47,7 @@ import com.sap.sse.common.Util.Pair;
import com.sap.sse.common.impl.DegreeBearingImpl;
import com.sap.sse.datamining.data.ClusterGroup;
import com.sap.sse.datamining.shared.GroupKey;
import com.sap.sse.replication.impl.AbstractReplicableWithObjectInputStream;
import com.sap.sse.replication.interfaces.impl.AbstractReplicableWithObjectInputStream;
import com.sap.sse.util.ClearStateTestSupport;
/**
@@ -3,7 +3,6 @@ package com.sap.sailing.server.replication.test;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import java.io.IOException;
import java.util.UUID;
import org.junit.Assert;
@@ -59,7 +58,7 @@ public class RaceLogReplicationTest extends AbstractLogReplicationTest<RaceLog,
}
@Test
public void testRaceLogEmptyOnInitialLoad() throws ClassNotFoundException, IOException, InterruptedException {
public void testRaceLogEmptyOnInitialLoad() throws Exception {
final String regattaName = "Test";
final String seriesName = "Default";
final String fleetName = "Default";
@@ -72,7 +71,7 @@ public class RaceLogReplicationTest extends AbstractLogReplicationTest<RaceLog,
}
@Test
public void testRaceLogStateOnInitialLoad() throws InterruptedException, ClassNotFoundException, IOException {
public void testRaceLogStateOnInitialLoad() throws Exception {
final String regattaName = "Test";
final String seriesName = "Default";
final String fleetName = "Default";
@@ -86,7 +85,7 @@ public class RaceLogReplicationTest extends AbstractLogReplicationTest<RaceLog,
}
@Test
public void testRaceEventReplicationOnEmptyRegatta() throws ClassNotFoundException, IOException, InterruptedException {
public void testRaceEventReplicationOnEmptyRegatta() throws Exception {
final String regattaName = "Test";
final String seriesName = "Default";
final String fleetName = "Default";
@@ -99,7 +98,7 @@ public class RaceLogReplicationTest extends AbstractLogReplicationTest<RaceLog,
}
@Test
public void testRaceEventReplicationOnEmptyFlexibleLeaderboard() throws ClassNotFoundException, IOException, InterruptedException {
public void testRaceEventReplicationOnEmptyFlexibleLeaderboard() throws Exception {
final String leaderboardName = "Test";
final String fleetName = "Default";
final String raceColumnName = "R1";
@@ -111,7 +110,7 @@ public class RaceLogReplicationTest extends AbstractLogReplicationTest<RaceLog,
}
@Test
public void testRaceEventReplicationOnRegatta() throws ClassNotFoundException, IOException, InterruptedException {
public void testRaceEventReplicationOnRegatta() throws Exception {
final String regattaName = "Test";
final String seriesName = "Default";
final String fleetName = "Default";
@@ -125,7 +124,7 @@ public class RaceLogReplicationTest extends AbstractLogReplicationTest<RaceLog,
}
@Test
public void testRaceEventReplicationCourseDesignOnRegatta() throws ClassNotFoundException, IOException, InterruptedException {
public void testRaceEventReplicationCourseDesignOnRegatta() throws Exception {
final String regattaName = "Test";
final String seriesName = "Default";
final String fleetName = "Default";
@@ -142,7 +141,7 @@ public class RaceLogReplicationTest extends AbstractLogReplicationTest<RaceLog,
}
@Test
public void testRaceEventReplicationOnFlexibleLeaderboard() throws ClassNotFoundException, IOException, InterruptedException {
public void testRaceEventReplicationOnFlexibleLeaderboard() throws Exception {
final String leaderboardName = "Test";
final String fleetName = "Default";
final String raceColumnName = "R1";
@@ -155,7 +154,7 @@ public class RaceLogReplicationTest extends AbstractLogReplicationTest<RaceLog,
}
@Test
public void testRaceEventReplicationCourseDesignOnFlexibleLeaderboard() throws ClassNotFoundException, IOException, InterruptedException {
public void testRaceEventReplicationCourseDesignOnFlexibleLeaderboard() throws Exception {
final String leaderboardName = "Test";
final String fleetName = "Default";
final String raceColumnName = "R1";
@@ -1,7 +1,5 @@
package com.sap.sailing.server.replication.test;
import java.io.IOException;
import org.junit.Before;
import org.junit.Test;
@@ -39,7 +37,7 @@ public class RegattaLogReplicationTest extends
}
@Test
public void testRegattaLogEmptyOnInitialLoad() throws ClassNotFoundException, IOException, InterruptedException {
public void testRegattaLogEmptyOnInitialLoad() throws Exception {
final String regattaName = "Test";
final String seriesName = "Default";
final String fleetName = "Default";
@@ -51,7 +49,7 @@ public class RegattaLogReplicationTest extends
}
@Test
public void testRegattaLogStateOnInitialLoad() throws InterruptedException, ClassNotFoundException, IOException {
public void testRegattaLogStateOnInitialLoad() throws Exception {
final String regattaName = "Test";
final String seriesName = "Default";
final String fleetName = "Default";
@@ -64,7 +62,7 @@ public class RegattaLogReplicationTest extends
}
@Test
public void testRaceEventReplicationOnEmptyRegatta() throws ClassNotFoundException, IOException, InterruptedException {
public void testRaceEventReplicationOnEmptyRegatta() throws Exception {
final String regattaName = "Test";
final String seriesName = "Default";
final String fleetName = "Default";
@@ -77,7 +75,7 @@ public class RegattaLogReplicationTest extends
}
@Test
public void testRaceEventReplicationOnEmptyFlexibleLeaderboard() throws ClassNotFoundException, IOException, InterruptedException {
public void testRaceEventReplicationOnEmptyFlexibleLeaderboard() throws Exception {
final String leaderboardName = "Test";
FlexibleLeaderboard masterLeaderboard = setupFlexibleLeaderboard(leaderboardName);
RegattaLog masterLog = masterLeaderboard.getRegattaLog();
@@ -13,8 +13,8 @@ import org.junit.Test;
import com.sap.sailing.server.operationaltransformation.CreateLeaderboardGroup;
import com.sap.sse.replication.ReplicaDescriptor;
import com.sap.sse.replication.impl.ReplicaDescriptorImpl;
import com.sap.sse.replication.impl.ReplicationInstancesManager;
import com.sap.sse.replication.interfaces.impl.ReplicaDescriptorImpl;
public class ReplicationInstancesManagerLoggingPerformanceTest {
private ReplicationInstancesManager replicationInstanceManager;
@@ -24,7 +24,7 @@ public class ReplicationInstancesManagerLoggingPerformanceTest {
@Before
public void setUp() throws UnknownHostException {
replicationInstanceManager = new ReplicationInstancesManager();
replica = new ReplicaDescriptorImpl(InetAddress.getLocalHost(), UUID.randomUUID(), "", /* replicableIds */ new String[] { "Humba" });
replica = new ReplicaDescriptorImpl(InetAddress.getLocalHost(), 8888, UUID.randomUUID(), "", /* replicableIds */ new String[] { "Humba" });
replicationInstanceManager.registerReplica(replica);
UUID newGroupid = UUID.randomUUID();
operation = new CreateLeaderboardGroup(newGroupid, "Test Leaderboard Group",
@@ -26,223 +26,219 @@
<stringAttribute key="org.eclipse.jdt.launching.WORKING_DIRECTORY" value="${workspace_loc}"/>
<stringAttribute key="pde.version" value="3.3"/>
<setAttribute key="selected_target_bundles">
<setEntry value="routeconverter@default:default"/>
<setEntry value="org.apache.commons.codec@default:default"/>
<setEntry value="org.apache.poi@default:default"/>
<setEntry value="org.apache.poi.ooxml@default:default"/>
<setEntry value="org.apache.poi.ooxml.schemas@default:default"/>
<setEntry value="org.dom4j@default:default"/>
<setEntry value="org.apache.xmlbeans@default:default"/>
<setEntry value="org.apache.commons.math@default:default"/>
<setEntry value="org.apache.httpcomponents.httpclient@default:default"/>
<setEntry value="org.apache.httpcomponents.httpcore@default:default"/>
<setEntry value="org.objectweb.asm@default:default"/>
<setEntry value="org.hyperic.sigar@default:default"/>
<setEntry value="com.amazon.aws.aws-java-api@default:default"/>
<setEntry value="com.chargebee.chargebee-java@default:default"/>
<setEntry value="com.jcraft.jsch@default:default"/>
<setEntry value="com.rabbitmq.client@default:default"/>
<setEntry value="com.sun.activation.javax.activation@default:default"/>
<setEntry value="com.sun.istack.commons-runtime@default:default"/>
<setEntry value="com.sun.jersey.contribs.jersey-multipart@default:default"/>
<setEntry value="com.sun.jersey@default:default"/>
<setEntry value="com.sun.mail.javax.mail@default:default"/>
<setEntry value="com.sun.xml.bind.jaxb-impl@default:default"/>
<setEntry value="jackson-core-asl@default:default"/>
<setEntry value="jackson-jaxrs@default:default"/>
<setEntry value="jackson-mapper-asl@default:default"/>
<setEntry value="javax.annotation@default:default"/>
<setEntry value="javax.validation@default:default"/>
<setEntry value="org.apache.commons.fileupload@default:default"/>
<setEntry value="org.jdom@default:default"/>
<setEntry value="org.jvnet.mimepull@default:default"/>
<setEntry value="org.apache.commons.math3@default:default"/>
<setEntry value="org.mongodb.mongo-java-driver@default:default"/>
<setEntry value="org.mongodb.mongo-java-driver.source@default:default"/>
<setEntry value="org.eclipse.jetty.osgi.boot@3:true"/>
<setEntry value="org.eclipse.jetty.osgi.boot.warurl@default:default"/>
<setEntry value="org.hyperic.sigar@default:default"/>
<setEntry value="slf4j.jdk14@default:default"/>
<setEntry value="javax.ws.rs@default:default"/>
<setEntry value="javax.xml.stream@default:default"/>
<setEntry value="javax.xml.ws@default:default"/>
<setEntry value="javax.xml@default:default"/>
<setEntry value="jaxb-api@default:default"/>
<setEntry value="jcl.over.slf4j@default:default"/>
<setEntry value="lz4-java@default:default"/>
<setEntry value="org.apache.aries.spifly.dynamic.bundle@3:true"/>
<setEntry value="org.apache.commons.beanutils.source@default:default"/>
<setEntry value="org.apache.commons.beanutils@default:default"/>
<setEntry value="org.apache.commons.codec@default:default"/>
<setEntry value="org.apache.commons.collections@default:default"/>
<setEntry value="org.apache.commons.fileupload@default:default"/>
<setEntry value="org.apache.commons.io@default:default"/>
<setEntry value="org.apache.commons.lang@default:default"/>
<setEntry value="org.apache.commons.logging@default:default"/>
<setEntry value="org.apache.commons.math3@default:default"/>
<setEntry value="org.apache.commons.math@default:default"/>
<setEntry value="org.apache.felix.gogo.command@default:default"/>
<setEntry value="org.apache.felix.gogo.runtime@default:default"/>
<setEntry value="org.apache.felix.gogo.shell@default:default"/>
<setEntry value="org.apache.geronimo.specs.geronimo-jta_1.1_spec@default:default"/>
<setEntry value="org.apache.httpcomponents.httpclient@default:default"/>
<setEntry value="org.apache.httpcomponents.httpcore@default:default"/>
<setEntry value="org.apache.poi.ooxml.schemas@default:default"/>
<setEntry value="org.apache.poi.ooxml@default:default"/>
<setEntry value="org.apache.poi@default:default"/>
<setEntry value="org.apache.servicemix.bundles.ehcache@default:default"/>
<setEntry value="org.apache.servicemix.bundles.scribe@default:default"/>
<setEntry value="org.apache.servicemix.bundles.zxing@default:default"/>
<setEntry value="org.apache.shiro.core.source"/>
<setEntry value="org.apache.shiro.core@default:default"/>
<setEntry value="org.apache.shiro.ehcache.source"/>
<setEntry value="org.apache.shiro.ehcache@default:default"/>
<setEntry value="org.apache.shiro.web.source"/>
<setEntry value="org.apache.shiro.web@default:default"/>
<setEntry value="org.apache.taglibs.standard-impl@default:default"/>
<setEntry value="org.apache.taglibs.taglibs-standard-spec@default:default"/>
<setEntry value="org.apache.xalan@default:default"/>
<setEntry value="org.apache.xml.serializer@default:default"/>
<setEntry value="org.apache.xmlbeans@default:default"/>
<setEntry value="org.dom4j@default:default"/>
<setEntry value="org.eclipse.equinox.cm@default:default"/>
<setEntry value="org.eclipse.equinox.common@2:true"/>
<setEntry value="org.eclipse.equinox.console@default:default"/>
<setEntry value="org.eclipse.equinox.event@default:default"/>
<setEntry value="org.eclipse.equinox.launcher@default:default"/>
<setEntry value="org.eclipse.equinox.simpleconfigurator@2:true"/>
<setEntry value="org.eclipse.jdt.core.compiler.batch@default:default"/>
<setEntry value="org.eclipse.jetty.annotations@4:true"/>
<setEntry value="org.eclipse.jetty.apache-jsp@4:true"/>
<setEntry value="org.eclipse.jetty.client@default:default"/>
<setEntry value="org.eclipse.jetty.deploy@default:default"/>
<setEntry value="org.eclipse.jetty.http@3:true"/>
<setEntry value="org.eclipse.jetty.io@default:default"/>
<setEntry value="org.eclipse.jetty.jmx@default:default"/>
<setEntry value="org.eclipse.jetty.jndi@default:default"/>
<setEntry value="org.eclipse.jetty.osgi-servlet-api@default:default"/>
<setEntry value="org.eclipse.jetty.osgi.boot.jsp.source"/>
<setEntry value="org.eclipse.jetty.osgi.boot.jsp@default:false"/>
<setEntry value="org.eclipse.jetty.osgi.boot.warurl@default:default"/>
<setEntry value="org.eclipse.jetty.osgi.boot@3:true"/>
<setEntry value="org.eclipse.jetty.plus@default:default"/>
<setEntry value="org.eclipse.jetty.security@default:default"/>
<setEntry value="org.eclipse.jetty.server@default:default"/>
<setEntry value="org.eclipse.jetty.servlet@default:default"/>
<setEntry value="org.eclipse.jetty.util@default:default"/>
<setEntry value="org.eclipse.jetty.util.ajax@default:default"/>
<setEntry value="org.eclipse.jetty.util@default:default"/>
<setEntry value="org.eclipse.jetty.webapp@default:default"/>
<setEntry value="org.eclipse.jetty.websocket.api@default:default"/>
<setEntry value="org.eclipse.jetty.websocket.client@default:default"/>
<setEntry value="org.eclipse.jetty.websocket.common@default:default"/>
<setEntry value="org.eclipse.jetty.xml@default:default"/>
<setEntry value="slf4j.api@default:default"/>
<setEntry value="org.apache.servicemix.bundles.zxing@default:default"/>
<setEntry value="org.apache.commons.io@default:default"/>
<setEntry value="jcl.over.slf4j@default:default"/>
<setEntry value="com.sun.mail.javax.mail@default:default"/>
<setEntry value="com.rabbitmq.client@default:default"/>
<setEntry value="org.apache.commons.lang@default:default"/>
<setEntry value="org.apache.commons.logging@default:default"/>
<setEntry value="jackson-jaxrs@default:default"/>
<setEntry value="com.sun.jersey@default:default"/>
<setEntry value="javax.ws.rs@default:default"/>
<setEntry value="org.apache.commons.beanutils@default:default"/>
<setEntry value="org.apache.commons.beanutils.source@default:default"/>
<setEntry value="org.apache.servicemix.bundles.ehcache@default:default"/>
<setEntry value="org.apache.servicemix.bundles.scribe@default:default"/>
<setEntry value="org.owasp.encoder@default:default"/>
<setEntry value="org.owasp.encoder.source@default:default"/>
<setEntry value="org.apache.shiro.core@default:default"/>
<setEntry value="org.apache.shiro.core.source@default:default"/>
<setEntry value="org.apache.shiro.ehcache@default:default"/>
<setEntry value="org.apache.shiro.ehcache.source@default:default"/>
<setEntry value="org.apache.shiro.web@default:default"/>
<setEntry value="org.apache.shiro.web.source@default:default"/>
<setEntry value="jackson-core-asl@default:default"/>
<setEntry value="jackson-mapper-asl@default:default"/>
<setEntry value="org.apache.commons.collections@default:default"/>
<setEntry value="org.eclipse.jetty.client@default:default"/>
<setEntry value="javax.xml@default:default"/>
<setEntry value="com.sun.activation.javax.activation@default:default"/>
<setEntry value="org.eclipse.equinox.common@2:true"/>
<setEntry value="org.eclipse.equinox.console@default:default"/>
<setEntry value="org.eclipse.equinox.launcher@default:default"/>
<setEntry value="org.eclipse.equinox.simpleconfigurator@2:true"/>
<setEntry value="org.eclipse.osgi@-1:true"/>
<setEntry value="org.eclipse.osgi.services@default:default"/>
<setEntry value="org.eclipse.equinox.cm@default:default"/>
<setEntry value="com.sun.istack.commons-runtime@default:default"/>
<setEntry value="jaxb-api@default:default"/>
<setEntry value="com.sun.xml.bind.jaxb-impl@default:default"/>
<setEntry value="javax.xml.stream@default:default"/>
<setEntry value="javax.xml.ws@default:default"/>
<setEntry value="org.eclipse.osgi.util@default:default"/>
<setEntry value="com.chargebee.chargebee-java@default:default"/>
<setEntry value="com.jcraft.jsch@default:default"/>
<setEntry value="com.amazon.aws.aws-java-api@default:default"/>
<setEntry value="org.objectweb.asm@default:default"/>
<setEntry value="org.eclipse.osgi@-1:true"/>
<setEntry value="org.hyperic.sigar@default:default"/>
<setEntry value="org.jdom@default:default"/>
<setEntry value="org.jvnet.mimepull@default:default"/>
<setEntry value="org.mongodb.mongo-java-driver.source"/>
<setEntry value="org.mongodb.mongo-java-driver@default:default"/>
<setEntry value="org.mortbay.jasper.apache-el@default:default"/>
<setEntry value="org.mortbay.jasper.apache-jsp.source"/>
<setEntry value="org.mortbay.jasper.apache-jsp@default:default"/>
<setEntry value="org.objectweb.asm.commons@default:default"/>
<setEntry value="org.objectweb.asm.tree@default:default"/>
<setEntry value="org.eclipse.jetty.apache-jsp@4:true"/>
<setEntry value="org.eclipse.jetty.osgi.boot.jsp@default:default"/>
<setEntry value="org.eclipse.jetty.osgi.boot.jsp.source@default:default"/>
<setEntry value="org.apache.geronimo.specs.geronimo-jta_1.1_spec@default:default"/>
<setEntry value="org.apache.aries.spifly.dynamic.bundle@3:true"/>
<setEntry value="org.mortbay.jasper.apache-el@default:default"/>
<setEntry value="org.mortbay.jasper.apache-jsp@default:default"/>
<setEntry value="org.mortbay.jasper.apache-jsp.source@default:default"/>
<setEntry value="org.eclipse.jdt.core.compiler.batch@default:default"/>
<setEntry value="org.apache.taglibs.standard-impl@default:default"/>
<setEntry value="org.apache.taglibs.taglibs-standard-spec@default:default"/>
<setEntry value="javax.annotation@default:default"/>
<setEntry value="org.eclipse.jetty.osgi-servlet-api@default:default"/>
<setEntry value="org.apache.xalan@default:default"/>
<setEntry value="org.apache.xml.serializer@default:default"/>
<setEntry value="org.eclipse.equinox.event@default:default"/>
<setEntry value="org.eclipse.jetty.annotations@4:true"/>
<setEntry value="org.eclipse.jetty.jndi@default:default"/>
<setEntry value="org.eclipse.jetty.plus@default:default"/>
<setEntry value="org.objectweb.asm@default:default"/>
<setEntry value="org.owasp.encoder.source"/>
<setEntry value="org.owasp.encoder@default:default"/>
<setEntry value="routeconverter@default:default"/>
<setEntry value="slf4j.api@default:default"/>
<setEntry value="slf4j.jdk14@default:false"/>
</setAttribute>
<setAttribute key="selected_workspace_bundles">
<setEntry value="com.sap.sailing.geocoding@default:default"/>
<setEntry value="com.sap.sailing.domain.common@default:default"/>
<setEntry value="com.sap.sailing.domain@default:default"/>
<setEntry value="com.sap.sailing.news@4:true"/>
<setEntry value="com.sap.sailing.domain.tractracadapter@5:true"/>
<setEntry value="com.sap.sailing.expeditionconnector@default:default"/>
<setEntry value="com.sap.sailing.domain.windfinderadapter@4:true"/>
<setEntry value="com.sap.sailing.server@5:true"/>
<setEntry value="com.sap.sailing.server.gateway@5:true"/>
<setEntry value="com.tractrac.clientmodule@default:default"/>
<setEntry value="com.google.gwt.servlet@default:default"/>
<setEntry value="com.googlecode.java-diff-utils@default:default"/>
<setEntry value="com.sap.sailing.barbados.resultimport@4:true"/>
<setEntry value="com.sap.sailing.competitorimport@default:default"/>
<setEntry value="com.sap.sailing.dashboards.gwt@6:true"/>
<setEntry value="com.sap.sailing.datamining.provider@default:default"/>
<setEntry value="com.sap.sailing.datamining.shared@default:default"/>
<setEntry value="com.sap.sailing.datamining@5:true"/>
<setEntry value="com.sap.sailing.declination@default:default"/>
<setEntry value="com.sap.sailing.domain.bravoadapter@5:true"/>
<setEntry value="com.sap.sailing.domain.common@default:default"/>
<setEntry value="com.sap.sailing.domain.deckmanadapter@5:true"/>
<setEntry value="com.sap.sailing.domain.expeditionadapter@5:true"/>
<setEntry value="com.sap.sailing.domain.igtimiadapter.gateway@5:true"/>
<setEntry value="com.sap.sailing.domain.igtimiadapter.persistence@default:default"/>
<setEntry value="com.sap.sailing.domain.igtimiadapter@4:true"/>
<setEntry value="com.sap.sailing.domain.persistence@default:default"/>
<setEntry value="com.sap.sailing.domain.swisstimingadapter@5:true"/>
<setEntry value="com.sap.sailing.domain.racelogtrackingadapter@4:true"/>
<setEntry value="com.sap.sailing.domain.shared.android@default:default"/>
<setEntry value="com.sap.sailing.domain.swisstimingadapter.persistence@4:true"/>
<setEntry value="com.sap.sailing.domain.swisstimingadapter@5:true"/>
<setEntry value="com.sap.sailing.domain.swisstimingreplayadapter@4:true"/>
<setEntry value="com.sap.sailing.domain.tractracadapter.persistence@4:true"/>
<setEntry value="com.sap.sailing.gwt.ui@6:true"/>
<setEntry value="com.sap.sailing.udpconnector@default:default"/>
<setEntry value="com.sap.sailing.xmlexport@5:true"/>
<setEntry value="com.sap.sailing.simulator@default:default"/>
<setEntry value="com.sap.sailing.www@5:true"/>
<setEntry value="com.sap.sailing.resultimport@4:true"/>
<setEntry value="com.sap.sailing.kiworesultimport@4:true"/>
<setEntry value="com.sap.sailing.domain.tractracadapter@5:true"/>
<setEntry value="com.sap.sailing.domain.windfinderadapter@4:true"/>
<setEntry value="com.sap.sailing.domain@default:default"/>
<setEntry value="com.sap.sailing.ess40.resultimport@4:true"/>
<setEntry value="com.sap.sailing.freg.resultimport@4:true"/>
<setEntry value="com.sap.sailing.barbados.resultimport@4:true"/>
<setEntry value="com.sap.sailing.sailwave.resultimport@4:true"/>
<setEntry value="com.sap.sailing.manage2sail.resultimport@4:true"/>
<setEntry value="com.sap.sailing.yachtscoring.resultimport@4:true"/>
<setEntry value="com.sap.sailing.velum.resultimport@4:true"/>
<setEntry value="com.sap.sailing.monitoring@7:true"/>
<setEntry value="com.sap.sailing.xrr.resultimport@4:true"/>
<setEntry value="com.sap.sailing.domain.igtimiadapter@4:true"/>
<setEntry value="com.sap.sailing.domain.igtimiadapter.persistence@default:default"/>
<setEntry value="com.sap.sailing.domain.racelogtrackingadapter@4:true"/>
<setEntry value="com.sap.sailing.domain.deckmanadapter@5:true"/>
<setEntry value="com.sap.sailing.xrr.structureimport@default:default"/>
<setEntry value="com.sap.sailing.server.gateway.serialization.shared.android@default:default"/>
<setEntry value="com.sap.sailing.server.gateway.serialization@default:default"/>
<setEntry value="com.sap.sailing.dashboards.gwt@6:true"/>
<setEntry value="com.sap.sailing.dashboards.gwt@6:true"/>
<setEntry value="com.sap.sailing.datamining@5:true"/>
<setEntry value="com.sap.sailing.datamining.shared@default:default"/>
<setEntry value="com.sap.sailing.polars@5:true"/>
<setEntry value="com.sap.sailing.windestimation@5:true"/>
<setEntry value="com.sap.sailing.polars.datamining@5:true"/>
<setEntry value="com.sap.sailing.domain.shared.android@default:default"/>
<setEntry value="com.sap.sailing.manage2sail@default:default"/>
<setEntry value="com.sap.sailing.polars.datamining.shared@default:default"/>
<setEntry value="com.sap.sailing.xrr.schema@default:default"/>
<setEntry value="com.sap.sailing.server.trackfiles@default:default"/>
<setEntry value="com.sap.sailing.competitorimport@default:default"/>
<setEntry value="com.sap.sailing.datamining.provider@default:default"/>
<setEntry value="com.sap.sailing.grib@default:default"/>
<setEntry value="com.sap.sailing.nmeaconnector@default:default"/>
<setEntry value="com.sap.sailing.domain.expeditionadapter@5:true"/>
<setEntry value="com.sap.sailing.expeditionconnector.persistence@4:true"/>
<setEntry value="com.sap.sailing.expeditionconnector.common@default:default"/>
<setEntry value="com.sap.sailing.domain.bravoadapter@5:true"/>
<setEntry value="net.sf.marineapi@default:default"/>
<setEntry value="com.sap.sailing.routeconverterjava11extension@default:default"/>
<setEntry value="com.sap.sailing.server.interface@default:default"/>
<setEntry value="com.sap.sse.datamining.ui@default:default"/>
<setEntry value="com.sap.sailing.domain.igtimiadapter.gateway@5:true"/>
<setEntry value="com.sap.sailing.shared.server@5:true"/>
<setEntry value="com.sap.sailing.shared.server.gateway@5:true"/>
<setEntry value="com.sap.sailing.shared.persistence@default:default"/>
<setEntry value="com.sap.sailing.landscape@default:default"/>
<setEntry value="com.sap.sailing.expeditionconnector.persistence@4:true"/>
<setEntry value="com.sap.sailing.expeditionconnector@default:default"/>
<setEntry value="com.sap.sailing.freg.resultimport@4:true"/>
<setEntry value="com.sap.sailing.geocoding@default:default"/>
<setEntry value="com.sap.sailing.grib@default:default"/>
<setEntry value="com.sap.sailing.gwt.ui@6:true"/>
<setEntry value="com.sap.sailing.kiworesultimport@4:true"/>
<setEntry value="com.sap.sailing.landscape.common@default:default"/>
<setEntry value="com.sap.sailing.landscape.ui@default:default"/>
<setEntry value="com.tractrac.clientmodule@default:default"/>
<setEntry value="com.sap.sse.gwt@default:default"/>
<setEntry value="com.google.gwt.servlet@default:default"/>
<setEntry value="com.sap.sse.security@default:default"/>
<setEntry value="com.sap.sse.security.ui@6:true"/>
<setEntry value="com.sap.sse.security.userstore.mongodb@4:true"/>
<setEntry value="com.sap.sse@default:default"/>
<setEntry value="com.sap.sailing.landscape@default:default"/>
<setEntry value="com.sap.sailing.manage2sail.resultimport@4:true"/>
<setEntry value="com.sap.sailing.manage2sail@default:default"/>
<setEntry value="com.sap.sailing.monitoring@7:true"/>
<setEntry value="com.sap.sailing.news@4:true"/>
<setEntry value="com.sap.sailing.nmeaconnector@default:default"/>
<setEntry value="com.sap.sailing.polars.datamining.shared@default:default"/>
<setEntry value="com.sap.sailing.polars.datamining@5:true"/>
<setEntry value="com.sap.sailing.polars@5:true"/>
<setEntry value="com.sap.sailing.resultimport@4:true"/>
<setEntry value="com.sap.sailing.routeconverterjava11extension@default:false"/>
<setEntry value="com.sap.sailing.sailwave.resultimport@4:true"/>
<setEntry value="com.sap.sailing.server.gateway.serialization.shared.android@default:default"/>
<setEntry value="com.sap.sailing.server.gateway.serialization@default:default"/>
<setEntry value="com.sap.sailing.server.gateway@5:true"/>
<setEntry value="com.sap.sailing.server.interface@default:default"/>
<setEntry value="com.sap.sailing.server.trackfiles@default:default"/>
<setEntry value="com.sap.sailing.server@5:true"/>
<setEntry value="com.sap.sailing.shared.persistence@default:default"/>
<setEntry value="com.sap.sailing.shared.server.gateway@5:true"/>
<setEntry value="com.sap.sailing.shared.server@5:true"/>
<setEntry value="com.sap.sailing.simulator@default:default"/>
<setEntry value="com.sap.sailing.udpconnector@default:default"/>
<setEntry value="com.sap.sailing.velum.resultimport@4:true"/>
<setEntry value="com.sap.sailing.windestimation@5:true"/>
<setEntry value="com.sap.sailing.www@5:true"/>
<setEntry value="com.sap.sailing.xmlexport@5:true"/>
<setEntry value="com.sap.sailing.xrr.resultimport@4:true"/>
<setEntry value="com.sap.sailing.xrr.schema@default:default"/>
<setEntry value="com.sap.sailing.xrr.structureimport@default:default"/>
<setEntry value="com.sap.sailing.yachtscoring.resultimport@4:true"/>
<setEntry value="com.sap.sse.common@default:default"/>
<setEntry value="com.sap.sse.datamining@default:default"/>
<setEntry value="com.sap.sse.datamining.annotations@default:default"/>
<setEntry value="com.sap.sse.datamining.shared@default:default"/>
<setEntry value="com.sap.sse.gwt.adminconsole@default:default"/>
<setEntry value="com.sap.sse.mongodb@default:default"/>
<setEntry value="com.sap.sse.operationaltransformation@default:default"/>
<setEntry value="com.sap.sse.replication@6:true"/>
<setEntry value="com.sap.sse.datamining.ui@default:default"/>
<setEntry value="com.sap.sse.datamining@default:default"/>
<setEntry value="com.sap.sse.debranding@default:default"/>
<setEntry value="com.sap.sse.filestorage@4:true"/>
<setEntry value="com.sap.sse.shared.android@default:default"/>
<setEntry value="com.sap.sse.mail@5:true"/>
<setEntry value="com.sap.sse.threadmanager@default:default"/>
<setEntry value="com.sap.sse.security.common@default:default"/>
<setEntry value="org.json.simple@default:default"/>
<setEntry value="com.sap.sse.jersey.jaxbdependencyfragment@default:default"/>
<setEntry value="org.moxieapps.gwt.highcharts@default:default"/>
<setEntry value="com.googlecode.java-diff-utils@default:default"/>
<setEntry value="org.mp4parser.isoparser@default:default"/>
<setEntry value="com.sap.sse.replication.interfaces@default:default"/>
<setEntry value="com.sap.sse.security.persistence@default:default"/>
<setEntry value="com.sap.sse.security.interface@default:default"/>
<setEntry value="com.sap.sse.replication.persistence@default:default"/>
<setEntry value="com.sap.sse.landscape.common@default:default"/>
<setEntry value="com.sap.sse.landscape@default:default"/>
<setEntry value="com.sap.sse.landscape.aws@4:true"/>
<setEntry value="com.sap.sse.gwt.adminconsole@default:default"/>
<setEntry value="com.sap.sse.gwt@default:default"/>
<setEntry value="com.sap.sse.jersey.jaxbdependencyfragment@default:false"/>
<setEntry value="com.sap.sse.landscape.aws.common@default:default"/>
<setEntry value="com.sap.sse.landscape.aws.persistence@default:default"/>
<setEntry value="com.sap.sse.debranding@default:default"/>
<setEntry value="com.sap.sse.landscape.aws@4:true"/>
<setEntry value="com.sap.sse.landscape.common@default:default"/>
<setEntry value="com.sap.sse.landscape@default:default"/>
<setEntry value="com.sap.sse.mail@5:true"/>
<setEntry value="com.sap.sse.mongodb@default:default"/>
<setEntry value="com.sap.sse.operationaltransformation@default:default"/>
<setEntry value="com.sap.sse.replication.interfaces@default:default"/>
<setEntry value="com.sap.sse.replication.persistence@default:default"/>
<setEntry value="com.sap.sse.replication@6:true"/>
<setEntry value="com.sap.sse.security.common@default:default"/>
<setEntry value="com.sap.sse.security.interface@default:default"/>
<setEntry value="com.sap.sse.security.persistence@default:default"/>
<setEntry value="com.sap.sse.security.ui@6:true"/>
<setEntry value="com.sap.sse.security.userstore.mongodb@4:true"/>
<setEntry value="com.sap.sse.security@default:default"/>
<setEntry value="com.sap.sse.shared.android@default:default"/>
<setEntry value="com.sap.sse.threadmanager@default:default"/>
<setEntry value="com.sap.sse@default:default"/>
<setEntry value="com.tractrac.clientmodule@default:default"/>
<setEntry value="elemental2@default:default"/>
<setEntry value="net.sf.marineapi@default:default"/>
<setEntry value="org.json.simple@default:default"/>
<setEntry value="org.moxieapps.gwt.highcharts@default:default"/>
<setEntry value="org.mp4parser.isoparser@default:default"/>
</setAttribute>
<booleanAttribute key="show_selected_only" value="false"/>
<booleanAttribute key="tracing" value="false"/>
@@ -332,7 +332,7 @@ import com.sap.sse.pairinglist.PairingListTemplateFactory;
import com.sap.sse.replication.FullyInitializedReplicableTracker;
import com.sap.sse.replication.ReplicationMasterDescriptor;
import com.sap.sse.replication.ReplicationService;
import com.sap.sse.replication.impl.AbstractReplicableWithObjectInputStream;
import com.sap.sse.replication.interfaces.impl.AbstractReplicableWithObjectInputStream;
import com.sap.sse.security.SecurityService;
import com.sap.sse.security.shared.QualifiedObjectIdentifier;
import com.sap.sse.security.shared.TypeRelativeObjectIdentifier;
@@ -57,7 +57,7 @@ import com.sap.sse.common.Util;
import com.sap.sse.common.impl.MillisecondsTimePoint;
import com.sap.sse.replication.FullyInitializedReplicableTracker;
import com.sap.sse.replication.OperationWithResult;
import com.sap.sse.replication.impl.AbstractReplicableWithObjectInputStream;
import com.sap.sse.replication.interfaces.impl.AbstractReplicableWithObjectInputStream;
import com.sap.sse.security.SecurityService;
import com.sap.sse.security.shared.impl.UserGroup;
import com.sap.sse.util.ClearStateTestSupport;
@@ -22,7 +22,7 @@ import com.sap.sailing.windestimation.model.store.ModelDomainType;
import com.sap.sailing.windestimation.model.store.ModelStore;
import com.sap.sailing.windestimation.model.store.MongoDbModelStoreImpl;
import com.sap.sse.mongodb.MongoDBService;
import com.sap.sse.replication.impl.AbstractReplicableWithObjectInputStream;
import com.sap.sse.replication.interfaces.impl.AbstractReplicableWithObjectInputStream;
import com.sap.sse.util.ObjectInputStreamResolvingAgainstCache;
public class WindEstimationFactoryServiceImpl extends
@@ -22,7 +22,7 @@ import com.sap.sse.filestorage.FileStorageServiceResolver;
import com.sap.sse.filestorage.operations.FileStorageServiceOperation;
import com.sap.sse.filestorage.operations.SetActiveFileStorageServiceOperation;
import com.sap.sse.filestorage.operations.SetFileStorageServicePropertyOperation;
import com.sap.sse.replication.impl.AbstractReplicableWithObjectInputStream;
import com.sap.sse.replication.interfaces.impl.AbstractReplicableWithObjectInputStream;
/**
* Implements {@link ServiceTrackerCustomizer} so that all {@link FileStorageServices} announced in the registry can
@@ -25,7 +25,7 @@ import com.sap.sse.landscape.aws.persistence.MongoObjectFactory;
import com.sap.sse.landscape.aws.persistence.PersistenceFactory;
import com.sap.sse.landscape.ssh.SSHKeyPair;
import com.sap.sse.mongodb.MongoDBService;
import com.sap.sse.replication.impl.AbstractReplicableWithObjectInputStream;
import com.sap.sse.replication.interfaces.impl.AbstractReplicableWithObjectInputStream;
import com.sap.sse.util.ObjectInputStreamResolvingAgainstCache;
/**
@@ -26,7 +26,7 @@ import com.sap.sse.mail.SerializableMultipartSupplier;
import com.sap.sse.mail.operations.MailServiceOperation;
import com.sap.sse.mail.operations.SendMailOperation;
import com.sap.sse.mail.operations.SendMailWithMultipartSupplierOperation;
import com.sap.sse.replication.impl.AbstractReplicableWithObjectInputStream;
import com.sap.sse.replication.interfaces.impl.AbstractReplicableWithObjectInputStream;
import com.sap.sse.util.ObjectInputStreamResolvingAgainstCache;
public class MailServiceImpl extends AbstractReplicableWithObjectInputStream<ReplicableMailService, MailServiceOperation<?>> implements ReplicableMailService {
@@ -7,7 +7,7 @@ Bundle-Vendor: SAP
Automatic-Module-Name: com.sap.sse.replication.interfaces
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
Export-Package: com.sap.sse.replication,
com.sap.sse.replication.impl
com.sap.sse.replication.interfaces.impl
Import-Package: com.rabbitmq.client;version="2.8.4",
org.json.simple,
org.osgi.framework;version="1.8.0",
@@ -17,6 +17,8 @@ public interface ReplicaDescriptor extends Serializable {
UUID getUuid();
InetAddress getIpAddress();
Integer getPort();
TimePoint getRegistrationTime();
@@ -14,7 +14,7 @@ import org.osgi.framework.BundleContext;
import com.sap.sse.operationaltransformation.Operation;
import com.sap.sse.operationaltransformation.OperationWithTransformationSupport;
import com.sap.sse.replication.impl.AbstractReplicableWithObjectInputStream;
import com.sap.sse.replication.interfaces.impl.AbstractReplicableWithObjectInputStream;
import com.sap.sse.util.ObjectInputStreamResolvingAgainstCache;
import com.sap.sse.util.ThreadLocalTransporter;
@@ -1,7 +1,6 @@
package com.sap.sse.replication;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.UUID;
@@ -17,8 +16,8 @@ import com.rabbitmq.client.QueueingConsumer;
*/
public interface ReplicationMasterDescriptor {
URL getReplicationRegistrationRequestURL(UUID uuid, String additionalInformation) throws MalformedURLException, UnsupportedEncodingException;
URL getReplicationRegistrationRequestURL(UUID uuid, String additionalInformation) throws Exception;
URL getReplicationDeRegistrationRequestURL(UUID uuid) throws MalformedURLException;
/**
@@ -42,8 +42,7 @@ public interface ReplicationService {
* bundle that starts after this bundle because then that {@link Replicable} will not yet be registered and won't
* become part of replication.
*/
void startToReplicateFrom(ReplicationMasterDescriptor master) throws IOException,
ClassNotFoundException, InterruptedException;
void startToReplicateFrom(ReplicationMasterDescriptor master) throws Exception;
/**
* Registers a replica with this master instance. The <code>replica</code> will be considered in the result of
@@ -4,6 +4,7 @@ public interface ReplicationServletActions {
String REPLICATION_SERVLET_BASE_PATH = "/replication/replication";
String ACTION_PARAMETER_NAME = "action";
String SERVER_UUID_PARAMETER_NAME = "uuid";
String PORT_NAME = "port";
String ADDITIONAL_INFORMATION_PARAMETER_NAME = "additional";
String REPLICABLES_IDS_AS_STRINGS_COMMA_SEPARATED_PARAMETER_NAME = "replicaIdsAsStringsCommaSeparated";
String REPLICABLE_ID_AS_STRING_PARAMETER_NAME = "replicaIdAsString";
@@ -3,6 +3,31 @@ package com.sap.sse.replication;
import org.json.simple.JSONObject;
public interface ReplicationStatus {
static final String JSON_FIELD_NAME_ADDITIONALINFORMATION = "additionalinformation";
static final String JSON_FIELD_NAME_ADDRESS = "address";
static final String JSON_FIELD_NAME_REGISTRATIONTIMEMILLIS = "registrationtimemillis";
static final String JSON_FIELD_NAME_MESSAGINGPORT = "messagingport";
static final String JSON_FIELD_NAME_MESSAGINGHOSTNAME = "messaginghostname";
static final String JSON_FIELD_NAME_PORT = "port";
static final String JSON_FIELD_NAME_HOSTNAME = "hostname";
static final String JSON_FIELD_NAME_EXCHANGE = "exchange";
static final String JSON_FIELD_NAME_AVAILABLE = "available";
static final String JSON_FIELD_NAME_REPLICABLES = "replicables";
static final String JSON_FIELD_NAME_REPLICABLE_REPLICATEDBY = "replicatedby";
static final String JSON_FIELD_NAME_REPLICABLE_REPLICATEDFROM = "replicatedfrom";
static final String JSON_FIELD_NAME_REPLICABLE_OPERATIONQUEUELENGTH = "operationqueuelength";
static final String JSON_FIELD_NAME_REPLICABLE_INITIALLOADRUNNING = "initialloadrunning";
static final String JSON_FIELD_NAME_REPLICABLE_ID = "id";
static final String JSON_FIELD_NAME_OUTBOUNDMESSAGINGPORT = "outboundmessagingport";
static final String JSON_FIELD_NAME_OUTBOUNDMESSAGINGNAME = "outboundmessagingname";
static final String JSON_FIELD_NAME_TOTALOPERATIONQUEUELENGTH = "totaloperationqueuelength";
static final String JSON_FIELD_NAME_MESSAGEQUEUELENGTH = "messagequeuelength";
static final String JSON_FIELD_NAME_STOPPED = "stopped";
static final String JSON_FIELD_NAME_SUSPENDED = "suspended";
static final String JSON_FIELD_NAME_REPLICATIONSTARTING = "replicationstarting";
static final String JSON_FIELD_NAME_SERVERNAME = "servername";
static final String JSON_FIELD_NAME_REPLICA = "replica";
boolean isReplica();
boolean isReplicationStarting();
@@ -40,5 +65,8 @@ public interface ReplicationStatus {
*/
boolean isAvailable();
/**
* A JSON representation of this object.<p>
*/
JSONObject toJSONObject();
}
@@ -1,4 +1,4 @@
package com.sap.sse.replication.impl;
package com.sap.sse.replication.interfaces.impl;
import java.io.InputStream;
import java.io.Serializable;
@@ -1,4 +1,4 @@
package com.sap.sse.replication.impl;
package com.sap.sse.replication.interfaces.impl;
import java.net.InetAddress;
import java.util.UUID;
@@ -20,6 +20,7 @@ public class ReplicaDescriptorImpl implements ReplicaDescriptor {
private final UUID uuid;
private final InetAddress ipAddress;
private final Integer port;
private final TimePoint registrationTime;
private final String additionalInformation;
private final String[] replicableIdsAsStrings;
@@ -27,35 +28,45 @@ public class ReplicaDescriptorImpl implements ReplicaDescriptor {
/**
* Sets the registration time to now.
*/
public ReplicaDescriptorImpl(InetAddress ipAddress, UUID id, String additionalInformation, String[] replicableIdsAsStrings) {
this(ipAddress, id, MillisecondsTimePoint.now(), additionalInformation, replicableIdsAsStrings);
public ReplicaDescriptorImpl(InetAddress ipAddress, Integer port, UUID id, String additionalInformation, String[] replicableIdsAsStrings) {
this(ipAddress, port, id, MillisecondsTimePoint.now(), additionalInformation, replicableIdsAsStrings);
}
/**
* Sets the registration time to now.
*/
public ReplicaDescriptorImpl(InetAddress ipAddress, UUID id, TimePoint registrationTime,
String additionalInformation, String[] replicableIdsAsStrings) {
public ReplicaDescriptorImpl(InetAddress ipAddress, Integer port, UUID id,
TimePoint registrationTime, String additionalInformation, String[] replicableIdsAsStrings) {
assert replicableIdsAsStrings != null && replicableIdsAsStrings.length > 0;
this.uuid = id;
this.registrationTime = registrationTime;
this.ipAddress = ipAddress;
this.port = port;
this.additionalInformation = additionalInformation;
this.replicableIdsAsStrings = replicableIdsAsStrings;
}
@Override
public UUID getUuid() {
return uuid;
}
@Override
public InetAddress getIpAddress() {
return ipAddress;
}
@Override
public Integer getPort() {
return port;
}
@Override
public TimePoint getRegistrationTime() {
return registrationTime;
}
@Override
public String getAdditionalInformation() {
return additionalInformation;
}
@@ -67,6 +78,7 @@ public class ReplicaDescriptorImpl implements ReplicaDescriptor {
* replica must filter the operations received for those replicable IDs it has been requesting replication
* for.
*/
@Override
public String[] getReplicableIdsAsStrings() {
return replicableIdsAsStrings;
}
@@ -1,4 +1,4 @@
package com.sap.sse.replication.impl;
package com.sap.sse.replication.interfaces.impl;
import java.util.Arrays;
import java.util.Collections;
@@ -45,7 +45,7 @@ public class ReplicationStatusImpl implements ReplicationStatus {
this.outboundExchangeName = outboundExchangeName;
this.outboundMessagingPort = outboundMessagingPort;
}
@Override
public boolean isReplica() {
return isReplica;
@@ -115,30 +115,30 @@ public class ReplicationStatusImpl implements ReplicationStatus {
public JSONObject toJSONObject() {
final JSONObject result = new JSONObject();
final JSONArray replicablesJSON = new JSONArray();
result.put("replica", this.isReplica());
result.put("servername", serverName);
result.put("replicationstarting", this.isReplicationStarting());
result.put("suspended", this.isSuspended());
result.put("stopped", this.isStopped());
result.put("messagequeuelength", this.getMessageQueueLength());
result.put("totaloperationqueuelength", this.getTotalOperationQueueLength());
result.put("outboundmessagingname", this.outboundExchangeName);
result.put("outboundmessagingport", this.outboundMessagingPort);
result.put(JSON_FIELD_NAME_REPLICA, this.isReplica());
result.put(JSON_FIELD_NAME_SERVERNAME, serverName);
result.put(JSON_FIELD_NAME_REPLICATIONSTARTING, this.isReplicationStarting());
result.put(JSON_FIELD_NAME_SUSPENDED, this.isSuspended());
result.put(JSON_FIELD_NAME_STOPPED, this.isStopped());
result.put(JSON_FIELD_NAME_MESSAGEQUEUELENGTH, this.getMessageQueueLength());
result.put(JSON_FIELD_NAME_TOTALOPERATIONQUEUELENGTH, this.getTotalOperationQueueLength());
result.put(JSON_FIELD_NAME_OUTBOUNDMESSAGINGNAME, this.outboundExchangeName);
result.put(JSON_FIELD_NAME_OUTBOUNDMESSAGINGPORT, this.outboundMessagingPort);
for (final String replicableIdAsString : this.getReplicableIdsAsStrings()) {
Boolean initialLoadRunning = this.isInitialLoadRunning(replicableIdAsString);
if (initialLoadRunning != null) {
final JSONObject replicableJSON = new JSONObject();
replicableJSON.put("id", replicableIdAsString);
replicableJSON.put("initialloadrunning", initialLoadRunning);
replicableJSON.put(JSON_FIELD_NAME_REPLICABLE_ID, replicableIdAsString);
replicableJSON.put(JSON_FIELD_NAME_REPLICABLE_INITIALLOADRUNNING, initialLoadRunning);
final Integer operationQueueLength = this.getOperationQueueLength(replicableIdAsString);
replicableJSON.put("operationqueuelength", operationQueueLength==null?0:operationQueueLength);
replicableJSON.put("replicatedfrom", getReplicatedFromAsJSON(replicableIdAsString));
replicableJSON.put("replicatedby", getReplicatedByAsJSON(replicableIdAsString));
replicableJSON.put(JSON_FIELD_NAME_REPLICABLE_OPERATIONQUEUELENGTH, operationQueueLength==null?0:operationQueueLength);
replicableJSON.put(JSON_FIELD_NAME_REPLICABLE_REPLICATEDFROM, getReplicatedFromAsJSON(replicableIdAsString));
replicableJSON.put(JSON_FIELD_NAME_REPLICABLE_REPLICATEDBY, getReplicatedByAsJSON(replicableIdAsString));
replicablesJSON.add(replicableJSON);
}
}
result.put("replicables", replicablesJSON);
result.put("available", this.isAvailable());
result.put(JSON_FIELD_NAME_REPLICABLES, replicablesJSON);
result.put(JSON_FIELD_NAME_AVAILABLE, this.isAvailable());
return result;
}
@@ -154,11 +154,11 @@ public class ReplicationStatusImpl implements ReplicationStatus {
private JSONObject serializeMasterDescriptorAsJSON() {
final JSONObject result = new JSONObject();
result.put("exchange", masterDescriptor.getExchangeName());
result.put("hostname", masterDescriptor.getHostname());
result.put("port", masterDescriptor.getServletPort());
result.put("messaginghostname", masterDescriptor.getMessagingHostname());
result.put("messagingport", masterDescriptor.getMessagingPort());
result.put(JSON_FIELD_NAME_EXCHANGE, masterDescriptor.getExchangeName());
result.put(JSON_FIELD_NAME_HOSTNAME, masterDescriptor.getHostname());
result.put(JSON_FIELD_NAME_PORT, masterDescriptor.getServletPort());
result.put(JSON_FIELD_NAME_MESSAGINGHOSTNAME, masterDescriptor.getMessagingHostname());
result.put(JSON_FIELD_NAME_MESSAGINGPORT, masterDescriptor.getMessagingPort());
return result;
}
@@ -172,12 +172,13 @@ public class ReplicationStatusImpl implements ReplicationStatus {
return result;
}
private Object serializeReplicaDescriptorAsJSON(ReplicaDescriptor replicaDescriptor) {
private JSONObject serializeReplicaDescriptorAsJSON(ReplicaDescriptor replicaDescriptor) {
final JSONObject result = new JSONObject();
result.put("id", replicaDescriptor.getUuid().toString());
result.put("registrationtimemillis", replicaDescriptor.getRegistrationTime().asMillis());
result.put("address", replicaDescriptor.getIpAddress().getCanonicalHostName());
result.put("additionalinformation", replicaDescriptor.getAdditionalInformation());
result.put(JSON_FIELD_NAME_REPLICABLE_ID, replicaDescriptor.getUuid().toString());
result.put(JSON_FIELD_NAME_REGISTRATIONTIMEMILLIS, replicaDescriptor.getRegistrationTime().asMillis());
result.put(JSON_FIELD_NAME_PORT, replicaDescriptor.getPort());
result.put(JSON_FIELD_NAME_ADDRESS, replicaDescriptor.getIpAddress().getCanonicalHostName());
result.put(JSON_FIELD_NAME_ADDITIONALINFORMATION, replicaDescriptor.getAdditionalInformation());
return result;
}
}
@@ -16,7 +16,7 @@ import com.mongodb.client.MongoDatabase;
import com.sap.sse.common.TimePoint;
import com.sap.sse.common.impl.MillisecondsTimePoint;
import com.sap.sse.replication.ReplicaDescriptor;
import com.sap.sse.replication.impl.ReplicaDescriptorImpl;
import com.sap.sse.replication.interfaces.impl.ReplicaDescriptorImpl;
import com.sap.sse.replication.persistence.DomainObjectFactory;
public class DomainObjectFactoryImpl implements DomainObjectFactory {
@@ -60,6 +60,7 @@ public class DomainObjectFactoryImpl implements DomainObjectFactory {
final TimePoint registrationTime = new MillisecondsTimePoint(o.getLong(FieldNames.REPLICA_REGISTRATION_TIME_MILLIS.name()));
final String additionalInformation = o.getString(FieldNames.REPLICA_ADDITIONAL_INFORMATION.name());
final String[] replicableIdsAsStrings = o.get(FieldNames.REPLICA_REPLICABLE_IDS_AS_STRINGS.name(), new ArrayList<String>()).toArray(new String[0]);
return new ReplicaDescriptorImpl(ipAddress, uuid, registrationTime, additionalInformation, replicableIdsAsStrings);
final Integer port = o.getInteger(FieldNames.REPLICA_PORT.name()); // default for backward compatibility, assuming
return new ReplicaDescriptorImpl(ipAddress, port, uuid, registrationTime, additionalInformation, replicableIdsAsStrings);
}
}
@@ -2,5 +2,5 @@ package com.sap.sse.replication.persistence.impl;
public enum FieldNames {
REPLICA_ID_AS_STRING, REPLICA_IP_ADDRESS, REPLICA_REGISTRATION_TIME_MILLIS,
REPLICA_ADDITIONAL_INFORMATION, REPLICA_REPLICABLE_IDS_AS_STRINGS;
REPLICA_ADDITIONAL_INFORMATION, REPLICA_REPLICABLE_IDS_AS_STRINGS, REPLICA_PORT;
}
@@ -34,6 +34,7 @@ public class MongoObjectFactoryImpl implements MongoObjectFactory {
replicaDescriptorDoc.put(FieldNames.REPLICA_ADDITIONAL_INFORMATION.name(), replicaDescriptor.getAdditionalInformation());
replicaDescriptorDoc.put(FieldNames.REPLICA_REPLICABLE_IDS_AS_STRINGS.name(),
Arrays.asList(replicaDescriptor.getReplicableIdsAsStrings()));
replicaDescriptorDoc.put(FieldNames.REPLICA_PORT.name(), replicaDescriptor.getPort());
getReplicaDescriptorCollection().withWriteConcern(WriteConcern.ACKNOWLEDGED).replaceOne(replicaDescriptorDoc,
replicaDescriptorDoc, new UpdateOptions().upsert(true));
}
@@ -50,13 +50,13 @@ import com.sap.sse.replication.ReplicationReceiver;
import com.sap.sse.replication.ReplicationService;
import com.sap.sse.replication.impl.Activator;
import com.sap.sse.replication.impl.RabbitOutputStream;
import com.sap.sse.replication.impl.ReplicaDescriptorImpl;
import com.sap.sse.replication.impl.ReplicationInstancesManager;
import com.sap.sse.replication.impl.ReplicationMasterDescriptorImpl;
import com.sap.sse.replication.impl.ReplicationReceiverImpl;
import com.sap.sse.replication.impl.ReplicationServiceImpl;
import com.sap.sse.replication.impl.ReplicationServlet;
import com.sap.sse.replication.impl.SingletonReplicablesProvider;
import com.sap.sse.replication.interfaces.impl.ReplicaDescriptorImpl;
import net.jpountz.lz4.LZ4BlockOutputStream;
@@ -176,7 +176,7 @@ public abstract class AbstractServerReplicationTestSetUp<ReplicableInterface ext
}
ReplicationInstancesManager rim = new ReplicationInstancesManager();
masterReplicator = new ReplicationServiceImpl(exchangeName, exchangeHost, 0, rim, new SingletonReplicablesProvider(this.master));
replicaDescriptor = new ReplicaDescriptorImpl(InetAddress.getLocalHost(), serverUuid, "", new String[] { this.master.getId().toString() });
replicaDescriptor = new ReplicaDescriptorImpl(InetAddress.getLocalHost(), 8888, serverUuid, "", new String[] { this.master.getId().toString() });
// connect to exchange host and local server running as master
// master server and exchange host can be two different hosts
ReplicationServiceTestImpl<ReplicableInterface> replicaReplicator = new ReplicationServiceTestImpl<ReplicableInterface>(exchangeName, exchangeHost, rim, replicaDescriptor,
@@ -1,7 +1,6 @@
package com.sap.sse.replication.impl;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.HashMap;
@@ -90,16 +89,14 @@ public class ReplicationMasterDescriptorImpl implements ReplicationMasterDescrip
}
@Override
public URL getReplicationRegistrationRequestURL(UUID uuid, String additional) throws MalformedURLException,
UnsupportedEncodingException {
public URL getReplicationRegistrationRequestURL(UUID uuid, String additional) throws Exception {
final String[] replicableIdsAsString = StreamSupport.stream(replicables.spliterator(), /* parallel */ false).map(r->r.getId()).toArray(i->new String[i]);
return new URL(getHttpRequestProtocol(), getHostname(), servletPort, ReplicationServletActions.REPLICATION_SERVLET_BASE_PATH + "?" + ReplicationServletActions.ACTION_PARAMETER_NAME + "="
+ Action.REGISTER.name() + "&" + ReplicationServletActions.SERVER_UUID_PARAMETER_NAME + "="
+ java.net.URLEncoder.encode(uuid.toString(), "UTF-8") + "&"
+ ReplicationServletActions.ADDITIONAL_INFORMATION_PARAMETER_NAME + "="
+ java.net.URLEncoder.encode(ServerInfo.getBuildVersion(), "UTF-8") + "&"
+ ReplicationServletActions.REPLICABLES_IDS_AS_STRINGS_COMMA_SEPARATED_PARAMETER_NAME + "="
+ java.net.URLEncoder.encode(String.join(",", replicableIdsAsString), "UTF-8"));
return new URL(getHttpRequestProtocol(), getHostname(), servletPort, ReplicationServletActions.REPLICATION_SERVLET_BASE_PATH + "?"
+ ReplicationServletActions.ACTION_PARAMETER_NAME + "=" + Action.REGISTER.name() + "&"
+ ReplicationServletActions.PORT_NAME + "=" + ServerInfo.getServerInfo().getPort() + "&" // FIXME how to figure out the port here? Consider automatic replication...
+ ReplicationServletActions.SERVER_UUID_PARAMETER_NAME + "=" + java.net.URLEncoder.encode(uuid.toString(), "UTF-8") + "&"
+ ReplicationServletActions.ADDITIONAL_INFORMATION_PARAMETER_NAME + "=" + java.net.URLEncoder.encode(ServerInfo.getBuildVersion(), "UTF-8") + "&"
+ ReplicationServletActions.REPLICABLES_IDS_AS_STRINGS_COMMA_SEPARATED_PARAMETER_NAME + "=" + java.net.URLEncoder.encode(String.join(",", replicableIdsAsString), "UTF-8"));
}
private String getHttpRequestProtocol() {
@@ -45,6 +45,7 @@ import com.sap.sse.replication.ReplicaDescriptor;
import com.sap.sse.replication.Replicable;
import com.sap.sse.replication.ReplicablesProvider;
import com.sap.sse.replication.ReplicablesProvider.ReplicableLifeCycleListener;
import com.sap.sse.replication.interfaces.impl.ReplicationStatusImpl;
import com.sap.sse.replication.ReplicationMasterDescriptor;
import com.sap.sse.replication.ReplicationReceiver;
import com.sap.sse.replication.ReplicationService;
@@ -643,8 +644,7 @@ public class ReplicationServiceImpl implements ReplicationService, OperationsToM
* replicas described in the {@code master} descriptor has completed.
*/
@Override
public void startToReplicateFrom(final ReplicationMasterDescriptor master)
throws IOException, ClassNotFoundException, InterruptedException {
public void startToReplicateFrom(final ReplicationMasterDescriptor master) throws Exception {
if (initialLoadChannels.containsKey(master)) {
logger.warning("An initial load from "+master+" is already running, replicating the following replicables: "+
initialLoadChannels.get(master).getReplicables()+". Not starting a second time.");
@@ -740,10 +740,8 @@ public class ReplicationServiceImpl implements ReplicationService, OperationsToM
/**
* @return the UUID that the master generated for this client which is also entered into {@link #replicaUUIDs}
*/
private String registerReplicaWithMaster(ReplicationMasterDescriptor master) throws IOException,
ClassNotFoundException {
URL replicationRegistrationRequestURL = master.getReplicationRegistrationRequestURL(getServerIdentifier(),
ServerInfo.getBuildVersion());
private String registerReplicaWithMaster(ReplicationMasterDescriptor master) throws Exception {
URL replicationRegistrationRequestURL = master.getReplicationRegistrationRequestURL(getServerIdentifier(), ServerInfo.getBuildVersion());
logger.info("Replication registration request URL: "+replicationRegistrationRequestURL);
final URLConnection registrationRequestConnection = HttpUrlConnectionHelper
.redirectConnectionWithBearerToken(replicationRegistrationRequestURL, /* HTTP method */ "POST", master.getBearerToken());
@@ -34,6 +34,7 @@ import com.sap.sse.replication.ReplicablesProvider;
import com.sap.sse.replication.ReplicationService;
import com.sap.sse.replication.ReplicationServletActions;
import com.sap.sse.replication.ReplicationServletActions.Action;
import com.sap.sse.replication.interfaces.impl.ReplicaDescriptorImpl;
import com.sap.sse.replication.ReplicationStatus;
import com.sap.sse.security.shared.TypeRelativeObjectIdentifier;
import com.sap.sse.security.shared.impl.SecuredSecurityTypes;
@@ -159,7 +160,7 @@ public class ReplicationServlet extends AbstractHttpServlet {
case STATUS:
// no permission check to read status; the same is available, e.g., through /gwt/status
try {
reportStatus(resp);
reportStatus(req, resp);
} catch (IllegalAccessException e) {
logger.info("Error obtaining replication status: " + e.getMessage());
logger.log(Level.SEVERE, "doGet", e);
@@ -195,7 +196,7 @@ public class ReplicationServlet extends AbstractHttpServlet {
* whether the replicable is still fetching its initial load, as well as the length of the queue of
* inbound operations not yet processed. The JSON document is printed to the response object's writer.
*/
private void reportStatus(HttpServletResponse resp) throws IllegalAccessException, IOException {
private void reportStatus(HttpServletRequest req, HttpServletResponse resp) throws IllegalAccessException, IOException {
final ReplicationStatus status = getReplicationService().getStatus();
final JSONObject result = status.toJSONObject();
resp.setContentType("application/json;charset=UTF-8");
@@ -322,6 +323,7 @@ public class ReplicationServlet extends AbstractHttpServlet {
final UUID uuid = UUID.fromString(req.getParameter(ReplicationServletActions.SERVER_UUID_PARAMETER_NAME));
final String additional = req.getParameter(ReplicationServletActions.ADDITIONAL_INFORMATION_PARAMETER_NAME);
final String[] replicableIdsAsStrings = req.getParameter(ReplicationServletActions.REPLICABLES_IDS_AS_STRINGS_COMMA_SEPARATED_PARAMETER_NAME).split(",");
return new ReplicaDescriptorImpl(ipAddress, uuid, additional, replicableIdsAsStrings);
final Integer port = req.getParameter(ReplicationServletActions.PORT_NAME) == null ? null : Integer.valueOf(req.getParameter(ReplicationServletActions.PORT_NAME));
return new ReplicaDescriptorImpl(ipAddress, port, uuid, additional, replicableIdsAsStrings);
}
}
@@ -86,7 +86,7 @@ import com.sap.sse.common.Util.Pair;
import com.sap.sse.common.mail.MailException;
import com.sap.sse.i18n.impl.ResourceBundleStringMessagesImpl;
import com.sap.sse.mail.MailService;
import com.sap.sse.replication.impl.AbstractReplicableWithObjectInputStream;
import com.sap.sse.replication.interfaces.impl.AbstractReplicableWithObjectInputStream;
import com.sap.sse.security.Action;
import com.sap.sse.security.ClientUtils;
import com.sap.sse.security.GithubApi;
@@ -5,6 +5,7 @@ import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.text.SimpleDateFormat;
import java.util.logging.Level;
import java.util.logging.Logger;
@@ -12,15 +13,43 @@ import org.json.simple.JSONObject;
import org.json.simple.parser.JSONParser;
import org.json.simple.parser.ParseException;
import com.sap.sse.common.TimePoint;
/**
* A class providing static information about the running server.
* @author Frank
* A class providing static information about the running server. Some information is taken from system
* properties that are assigned to constants in {@link ServerStartupConstants}, others are taken
* from the {@code version.json} file located under {@code configuration/jetty}.
*
* @author Frank Mittag, Axel Uhl
*
*/
public class ServerInfo {
private static final Logger logger = Logger.getLogger(ServerInfo.class.getName());
public static final String COMMIT_ID_FIELD_NAME = "commit_id";
public static final String ACTIVE_BRANCH_FIELD_NAME = "active_branch";
public static final String BUILD_DATE_FIELD_NAME = "build_date";
public static final String RELEASE_FIELD_NAME = "release";
public static final String START_TIME_MILLIS_FIELD_NAME = "start_time_millis";
public static final String PORT_FIELD_NAME = "port";
public static final String SERVER_GROUP_NAME_SUFFIX = "-server";
private final String commitId;
private final String activeBranch;
private final TimePoint buildDate;
private final String release;
private final TimePoint startTime;
private final int port;
private ServerInfo(String commitId, String activeBranch, TimePoint buildDate, String release, TimePoint startTime, int port) {
super();
this.commitId = commitId;
this.activeBranch = activeBranch;
this.buildDate = buildDate;
this.release = release;
this.startTime = startTime;
this.port = port;
}
public static String getBuildVersion() {
String version = "Unknown or Development (" + getName() + ")";
File versionfile = new File(ServerStartupConstants.JETTY_HOME + File.separator + "version.txt");
@@ -34,6 +63,37 @@ public class ServerInfo {
return version;
}
public static ServerInfo getServerInfo() throws FileNotFoundException, IOException, ParseException, NumberFormatException, java.text.ParseException {
final SimpleDateFormat format = new SimpleDateFormat("yyyyMMddhhmmX");
final JSONObject buildVersionJson = getBuildVersionJson();
return new ServerInfo((String) buildVersionJson.get(COMMIT_ID_FIELD_NAME),
(String) buildVersionJson.get(ACTIVE_BRANCH_FIELD_NAME),
buildVersionJson.get(BUILD_DATE_FIELD_NAME) == null ? null : TimePoint.of(format.parse(((String) buildVersionJson.get(BUILD_DATE_FIELD_NAME))+"Z")),
(String) buildVersionJson.get(RELEASE_FIELD_NAME),
buildVersionJson.get(START_TIME_MILLIS_FIELD_NAME) == null ? null : TimePoint.of(((Number) buildVersionJson.get(START_TIME_MILLIS_FIELD_NAME)).longValue()),
buildVersionJson.get(PORT_FIELD_NAME) == null ? null : ((Number) buildVersionJson.get(PORT_FIELD_NAME)).intValue());
}
/**
* Example output:
* <pre>
* {
* "commit_id": "418b55c1dda167e2446c17a22a1fd1686da4188b",
* "active_branch": "build",
* "build_date": "202104182222",
* "release": "build-202104182222",
* "start_time_millis": 1618912876000,
* "port": 8888
* }
* </pre>
*
* @see #ACTIVE_BRANCH_FIELD_NAME
* @see #COMMIT_ID_FIELD_NAME
* @see #BUILD_DATE_FIELD_NAME
* @see #RELEASE_FIELD_NAME
* @see #START_TIME_MILLIS_FIELD_NAME
* @see #PORT_FIELD_NAME
*/
public static JSONObject getBuildVersionJson() throws FileNotFoundException, IOException, ParseException {
JSONObject result;
final File versionJsonFile = new File(ServerStartupConstants.JETTY_HOME + File.separator + "version.json");
@@ -58,6 +118,30 @@ public class ServerInfo {
return getName()+SERVER_GROUP_NAME_SUFFIX;
}
public String getCommitId() {
return commitId;
}
public String getActiveBranch() {
return activeBranch;
}
public TimePoint getBuildDate() {
return buildDate;
}
public String getRelease() {
return release;
}
public TimePoint getStartTime() {
return startTime;
}
public int getPort() {
return port;
}
/**
* Retrieve event management base URL from server startup configuration. This is the default
* URL for a self-service server in case the user doesn't have the {@code CREATE_OBJECT} permission
+1 -1
View File
@@ -76,7 +76,7 @@ else
fi
sed $SED_ARGS "s/System:.*$/System: $MONGODB_URI_FOR_SED-$EXPEDITION_PORT-$REPLICATION_HOST:$REPLICATION_PORT\/$REPLICATION_CHANNEL Started: $HEAD_DATE/g" ./configuration/jetty/version.txt
VERSION_JSON_CONTENTS=$( cat ./configuration/jetty/version.json )
echo "${VERSION_JSON_CONTENTS}" | jq --argjson start_time_millis $( date +%s )000 '. + {start_time_millis: $start_time_millis}' >./configuration/jetty/version.json
echo "${VERSION_JSON_CONTENTS}" | jq --argjson start_time_millis $( date +%s )000 '. + {start_time_millis: $start_time_millis} + {port: '${SERVER_PORT}'}' >./configuration/jetty/version.json
# Apply app parameters from env.sh
if [ "$MONGODB_URI" = "" ]; then