use of com.laytonsmith.core.Profiles in project CommandHelper by EngineHub.
the class ProfilesTest method testProfileSuccess.
@Test
public void testProfileSuccess() throws Exception {
String good = "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>" + "<profiles>" + " <profile id=\"profile1\">" + " <type>mysql</type>" + " <database>db_name1</database>" + " <username>username1</username>" + " <password>password1</password>" + " </profile>" + " <profile id=\"profile2\">" + " <type>mysql</type>" + " <database>db_name2</database>" + " <username>username2</username>" + " <password>password2</password>" + " </profile>" + "</profiles>";
Profiles profiles = new Profiles(good);
}
use of com.laytonsmith.core.Profiles in project CommandHelper by EngineHub.
the class Manager method start.
@SuppressWarnings("ResultOfObjectAllocationIgnored")
public static void start() throws IOException, DataSourceException, URISyntaxException, Profiles.InvalidProfileException {
Implementation.useAbstractEnumThread(false);
Implementation.forceServerType(Implementation.Type.BUKKIT);
ConnectionMixinFactory.ConnectionMixinOptions options = new ConnectionMixinFactory.ConnectionMixinOptions();
options.setWorkingDirectory(chDirectory);
persistenceNetwork = new PersistenceNetwork(CommandHelperFileLocations.getDefault().getPersistenceConfig(), CommandHelperFileLocations.getDefault().getDefaultPersistenceDBFile().toURI(), options);
Installer.Install(chDirectory);
CHLog.initialize(chDirectory);
profiler = new Profiler(CommandHelperFileLocations.getDefault().getProfilerConfigFile());
gEnv = new GlobalEnv(new MethodScriptExecutionQueue("Manager", "default"), profiler, persistenceNetwork, chDirectory, new Profiles(MethodScriptFileLocations.getDefault().getProfilesFile()), new TaskManager());
cls();
pl("\n" + Static.Logo() + "\n\n" + Static.DataManagerLogo());
pl("Starting the Data Manager...");
try {
Environment env = Environment.createEnvironment(gEnv, new CommandHelperEnvironment());
MethodScriptCompiler.execute(MethodScriptCompiler.compile(MethodScriptCompiler.lex("player()", null, true)), env, null, null);
} catch (ConfigCompileException | ConfigCompileGroupException ex) {
}
pl(GREEN + "Welcome to the CommandHelper " + CYAN + "Data Manager!");
pl(BLINKON + RED + "Warning!" + BLINKOFF + YELLOW + " Be sure your server is not running before using this tool to make changes to your database!");
pl("------------------------");
boolean finished = false;
do {
pl(YELLOW + "What function would you like to run? Type \"help\" for a full list of options.");
String input = prompt();
pl();
if (input.toLowerCase().startsWith("help")) {
help(input.replaceFirst("help ?", "").toLowerCase().split(" "));
} else if (input.equalsIgnoreCase("refactor")) {
refactor();
} else if (input.toLowerCase().startsWith("print")) {
print(input.replaceFirst("print ?", "").toLowerCase().split(" "));
} else if (input.equalsIgnoreCase("cleardb")) {
cleardb();
} else if (input.equalsIgnoreCase("edit")) {
edit();
} else if (input.equalsIgnoreCase("merge")) {
merge();
} else if (input.equalsIgnoreCase("interpreter")) {
new Interpreter(null, System.getProperty("user.dir"));
} else if (input.equalsIgnoreCase("hidden-keys")) {
hiddenKeys();
} else if (input.equalsIgnoreCase("exit")) {
pl("Thanks for using the " + CYAN + BOLD + "Data Manager!" + reset());
finished = true;
} else {
pl("I'm sorry, that's not a valid command. Here's the help:");
help(new String[] {});
}
} while (finished == false);
StreamUtils.GetSystemOut().println(TermColors.reset());
}
Aggregations