diff --git a/src/main/java/com/orientechnologies/teleporter/main/OTeleporter.java b/src/main/java/com/orientechnologies/teleporter/main/OTeleporter.java index 653d847c..ba23944c 100644 --- a/src/main/java/com/orientechnologies/teleporter/main/OTeleporter.java +++ b/src/main/java/com/orientechnologies/teleporter/main/OTeleporter.java @@ -244,6 +244,8 @@ public static void execute(String driver, String jurl, String username, String p String chosenMapper, String xmlPath, String nameResolver, String outputLevel, List includedTables, List excludedTables, String configurationPath, OPluginMessageHandler messageHandler) throws OTeleporterIOException { + SetScriptOTeleporterContext(outDbUrl); + // trying to load the configuration starting from the input configurationPath ODocument migrationConfigDoc = null; String jsonMigrationConfig = null; @@ -481,6 +483,32 @@ public static ODocument execute(String driver, String jurl, String username, Str includedTables, excludedTables, null, messageHandler, null); } + public static void SetScriptOTeleporterContext(String outDbUrl) { + /** + * Urls handling + */ + + String serverInitUrl; + + if(outDbUrl.contains("embedded") || outDbUrl.contains("plocal")) { + outDbUrl = outDbUrl.replace("plocal","embedded"); + serverInitUrl = outDbUrl.substring(0, outDbUrl.lastIndexOf('/') + 1); + } + + else if(outDbUrl.contains("remote")) { + serverInitUrl = outDbUrl.substring(0, outDbUrl.lastIndexOf('/') + 1); + } + else { + // memory protocol + serverInitUrl = outDbUrl; + } + + OTeleporterContext.newInstance(serverInitUrl); + + OTeleporterContext.getInstance().setMessageHandler(messageHandler); + + } + @Override public String getName() { return "teleporter";