44 lines
1.3 KiB
Java
44 lines
1.3 KiB
Java
package cz.trask.migration;
|
|
|
|
import org.apache.logging.log4j.LogManager;
|
|
import org.apache.logging.log4j.Logger;
|
|
|
|
import cz.trask.migration.impl.ExportToWso2;
|
|
import cz.trask.migration.impl.v32.ImportToApicurio;
|
|
import cz.trask.migration.model.StartParameters;
|
|
|
|
public class ApiSync {
|
|
|
|
private static Logger log = LogManager.getLogger(ApiSync.class);
|
|
|
|
public static void main(String[] args) throws Exception {
|
|
log.info("API Operator started.");
|
|
if (args == null) {
|
|
log.error("No parameters found.");
|
|
printHelp();
|
|
} else {
|
|
String commandLine = String.join("", args).trim();
|
|
StartParameters sp = StartParameters.parse(commandLine);
|
|
log.info("Parsed parameters: " + sp);
|
|
|
|
if (sp.getCommand().equals("import")) {
|
|
log.info("Import command selected.");
|
|
ImportToApicurio imp = new ImportToApicurio();
|
|
imp.process();
|
|
} else if (sp.getCommand().equals("export")) {
|
|
log.info("Export command selected.");
|
|
ExportToWso2 exp = new ExportToWso2();
|
|
exp.process();
|
|
log.error("Export command not implemented yet.");
|
|
} else {
|
|
log.error("Unknown command: " + sp.getCommand());
|
|
printHelp();
|
|
}
|
|
}
|
|
}
|
|
|
|
private static void printHelp() {
|
|
System.out.println("Not enough parameters.\nRun command in this format:\njava -jar shaded.jar [import/export]");
|
|
}
|
|
}
|