diff --git a/java/core/src/core/connector/mv/async/ConnectorMvStore.java b/java/core/src/core/connector/mv/async/ConnectorMvStore.java index dffba30..8d89786 100644 --- a/java/core/src/core/connector/mv/async/ConnectorMvStore.java +++ b/java/core/src/core/connector/mv/async/ConnectorMvStore.java @@ -21,13 +21,13 @@ import core.util.HttpDelegate; import core.util.JSON_; import core.util.LogNull; import core.util.Strings; -import core.util.XML; public class ConnectorMvStore extends AsyncStoreConnectorHelper { static LogNull log = new LogNull(S3Connector.class); final int LOCK_INTERVAL = 10 * 1000; - + + String endpointOverride = null; ClientInfoMvStore info; HttpDelegate httpDelegate; @@ -36,6 +36,9 @@ public class ConnectorMvStore extends AsyncStoreConnectorHelper protected String createUrlPrefix () { + if (endpointOverride != null) + return endpointOverride; + return "https://" + info.getBucketEndpoint() + "/"; } @@ -112,6 +115,11 @@ public class ConnectorMvStore extends AsyncStoreConnectorHelper setKey (info.getSecretKey()); } + public void setEndpointOverride(String endpoint) + { + this.endpointOverride = endpoint; + } + long toVersionFromString (String s) throws Exception { HashSha256 hash = new HashSha256(); diff --git a/java/core/src/core/connector/mv/sync/ConnectorMvStore.java b/java/core/src/core/connector/mv/sync/ConnectorMvStore.java index ddb70df..46601eb 100644 --- a/java/core/src/core/connector/mv/sync/ConnectorMvStore.java +++ b/java/core/src/core/connector/mv/sync/ConnectorMvStore.java @@ -134,4 +134,9 @@ public class ConnectorMvStore implements StoreConnector CallbackSync sync = new CallbackSync(connector.ensureDirectories_(folders)).invoke(); return sync.exportNoException(); } + + public void setEndpointOverride(String endpoint) + { + connector.setEndpointOverride(endpoint); + } } diff --git a/java/core/src/core/constants/ConstantsClient.java b/java/core/src/core/constants/ConstantsClient.java index 1fa738e..8258ebf 100644 --- a/java/core/src/core/constants/ConstantsClient.java +++ b/java/core/src/core/constants/ConstantsClient.java @@ -11,7 +11,8 @@ public class ConstantsClient public static final String ATHOST = "@" + HOST; public static final String WEB_SERVER_URL = "https://" + WEB_HOST; - public static final String SERVER_TOMCAT = TOMCAT_HOST + "/Mailiverse/"; + public static final String TOMCAT_URL_PORTION = "/Mailiverse/"; + public static final String SERVER_TOMCAT = TOMCAT_HOST + TOMCAT_URL_PORTION; public static final String WEB_SERVER_TOMCAT = "https://" + SERVER_TOMCAT; public static final String KEY_AUTH_HOST = AUTH_HOST; diff --git a/java/core/src/mail/server/handler/MailetHandlerMvStore.java b/java/core/src/mail/server/handler/MailetHandlerMvStore.java index 4a5c076..6dc104b 100644 --- a/java/core/src/mail/server/handler/MailetHandlerMvStore.java +++ b/java/core/src/mail/server/handler/MailetHandlerMvStore.java @@ -9,6 +9,7 @@ import core.connector.mv.ClientInfoMvStore; import core.connector.mv.sync.ConnectorMvStore; import core.connector.sync.EncryptedStoreConnector; import core.connector.sync.StoreConnector; +import core.constants.ConstantsClient; import core.constants.ConstantsStorage; import core.crypt.CryptorRSAAES; import core.crypt.CryptorRSAFactoryEnvironment; @@ -23,10 +24,17 @@ public class MailetHandlerMvStore extends MailetHandlerDefault public StoreConnector createConnector (Environment e) throws Exception { log.debug("createConnector"); + + ConnectorMvStore connector = + new ConnectorMvStore(new ClientInfoMvStore(e.childEnvironment(ConstantsStorage.HANDLER_MV))); + // this is a really dirty hack getting around that when you install + // using a fake key set (your first install, + connector.setEndpointOverride("http://127.0.0.1" + ConstantsClient.TOMCAT_URL_PORTION); + return new EncryptedStoreConnector( new CryptorRSAAES(CryptorRSAFactoryEnvironment.create(e)), - new ConnectorMvStore(new ClientInfoMvStore(e.childEnvironment(ConstantsStorage.HANDLER_MV))) + connector ); } }