Search in sources :

Example 6 with TaskManager

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());
}
Also used : TaskManager(com.laytonsmith.core.taskmanager.TaskManager) Profiler(com.laytonsmith.core.profiler.Profiler) ConnectionMixinFactory(com.laytonsmith.persistence.io.ConnectionMixinFactory) CommandHelperEnvironment(com.laytonsmith.core.environments.CommandHelperEnvironment) PersistenceNetwork(com.laytonsmith.persistence.PersistenceNetwork) GlobalEnv(com.laytonsmith.core.environments.GlobalEnv) File(java.io.File) URI(java.net.URI)

Aggregations

CommandHelperEnvironment (com.laytonsmith.core.environments.CommandHelperEnvironment)6 GlobalEnv (com.laytonsmith.core.environments.GlobalEnv)6 TaskManager (com.laytonsmith.core.taskmanager.TaskManager)6 Environment (com.laytonsmith.core.environments.Environment)5 ConfigCompileException (com.laytonsmith.core.exceptions.ConfigCompileException)5 ConfigCompileGroupException (com.laytonsmith.core.exceptions.ConfigCompileGroupException)4 ConfigRuntimeException (com.laytonsmith.core.exceptions.ConfigRuntimeException)4 CancelCommandException (com.laytonsmith.core.exceptions.CancelCommandException)3 Profiler (com.laytonsmith.core.profiler.Profiler)3 PersistenceNetwork (com.laytonsmith.persistence.PersistenceNetwork)3 ConnectionMixinFactory (com.laytonsmith.persistence.io.ConnectionMixinFactory)3 File (java.io.File)3 IOException (java.io.IOException)3 ProgramFlowManipulationException (com.laytonsmith.core.exceptions.ProgramFlowManipulationException)2 ProfilePoint (com.laytonsmith.core.profiler.ProfilePoint)2 URI (java.net.URI)2 ZipException (java.util.zip.ZipException)2 MCPlayer (com.laytonsmith.abstraction.MCPlayer)1 com.laytonsmith.annotations.nolinking (com.laytonsmith.annotations.nolinking)1 CommandHelperPlugin (com.laytonsmith.commandhelper.CommandHelperPlugin)1