use of com.laytonsmith.core.taskmanager.TaskManager in project CommandHelper by EngineHub.
the class Static method GenerateStandaloneEnvironment.
/**
* Generates a new environment, assuming that the jar has a folder next to it named CommandHelper, and that folder
* is the root.
*
* @return
* @throws IOException
* @throws DataSourceException
* @throws URISyntaxException
*/
public static Environment GenerateStandaloneEnvironment(boolean install) throws IOException, DataSourceException, URISyntaxException, Profiles.InvalidProfileException {
File platformFolder = MethodScriptFileLocations.getDefault().getConfigDirectory();
if (install) {
Installer.Install(platformFolder);
}
ConnectionMixinFactory.ConnectionMixinOptions options = new ConnectionMixinFactory.ConnectionMixinOptions();
options.setWorkingDirectory(platformFolder);
PersistenceNetwork persistenceNetwork = new PersistenceNetwork(MethodScriptFileLocations.getDefault().getPersistenceConfig(), new URI(URLEncoder.encode("sqlite://" + new File(platformFolder, "persistence.db").getCanonicalPath().replace('\\', '/'), "UTF-8")), options);
GlobalEnv gEnv = new GlobalEnv(new MethodScriptExecutionQueue("MethodScriptExecutionQueue", "default"), new Profiler(MethodScriptFileLocations.getDefault().getProfilerConfigFile()), persistenceNetwork, platformFolder, new Profiles(MethodScriptFileLocations.getDefault().getProfilesFile()), new TaskManager());
gEnv.SetLabel(GLOBAL_PERMISSION);
return Environment.createEnvironment(gEnv, new CommandHelperEnvironment());
}
Aggregations