This method is only used to warm up JBoss Forge so we can create a sample project on startup in a temporary directory
492615
public Response doExecute(String name, ExecutionRequest executionRequest, CommandCompletePostProcessor postProcessor, UserDetails userDetails, RestUIContext uiContext) throws Exception {
        try (RestUIContext context = uiContext) {
            UICommand command = getCommandByName(context, name);
            if (command == null) {
                return Response.status(Status.NOT_FOUND).build();
            }
            List<Map<String, Object>> inputList = executionRequest.getInputList();

            // lets ensure a valid targetLocation for new projects
            if (Objects.equal(PROJECT_NEW_COMMAND, name)) {
                if (inputList.size() > 0) {
                    Map<String, Object> map = inputList.get(0);
                    map.put(TARGET_LOCATION_PROPERTY, projectFileSystem.getUserProjectFolderLocation(userDetails));
                }
            }
            CommandController controller = createController(context, command);
            configureAttributeMaps(userDetails, controller, executionRequest);
            ExecutionResult answer = null;
            if (controller instanceof WizardCommandController) {
                WizardCommandController wizardCommandController = (WizardCommandController) controller;
                List<WizardCommandController> controllers = new ArrayList<>();
                List<CommandInputDTO> stepPropertiesList = new ArrayList<>();
                List<ExecutionResult> stepResultList = new ArrayList<>();
                List<ValidationResult> stepValidationList = new ArrayList<>();
                controllers.add(wizardCommandController);
                WizardCommandController lastController = wizardCommandController;
                Result lastResult = null;
                int page = executionRequest.wizardStep();
                int nextPage = page + 1;
                boolean canMoveToNextStep = false;
                for (Map<String, Object> inputs : inputList) {
                    UICommands.populateController(inputs, lastController, getConverterFactory());
                    List<UIMessage> messages = lastController.validate();
                    ValidationResult stepValidation = UICommands.createValidationResult(context, lastController, messages);
                    stepValidationList.add(stepValidation);
                    if (!stepValidation.isValid()) {
                        break;
                    }
                    canMoveToNextStep = lastController.canMoveToNextStep();
                    boolean valid = lastController.isValid();
                    if (!canMoveToNextStep) {
                        if (lastController.canExecute()) {
                            // lets assume we can execute now
                            LOG.info("About to invoked command " + name + " stepValidation: " + stepValidation + " messages: " + messages + " with " + executionRequest);
                            lastResult = lastController.execute();
                            LOG.debug("Invoked command " + name + " with " + executionRequest + " result: " + lastResult);
                            ExecutionResult stepResults = UICommands.createExecutionResult(context, lastResult, false);
                            stepResultList.add(stepResults);
                            break;
                        } else {
                            stepValidation.addValidationError("Forge command failed with an internal error");
                            LOG.warn("Cannot move to next step as canExecute() returns false but the validation seems to be fine!");
                            break;
                        }
                    } else if (!valid) {
                        stepValidation.addValidationError("Forge command is not valid but didn't report any validation errors!");
                        LOG.warn("Cannot move to next step as invalid despite the validation saying otherwise");
                        break;
                    }
                    WizardCommandController nextController = lastController.next();
                    if (nextController != null) {
                        if (nextController == lastController) {
                            LOG.warn("No idea whats going on ;)");
                            break;
                        }
                        lastController = nextController;
                        lastController.initialize();
                        controllers.add(lastController);
                        CommandInputDTO stepDto = UICommands.createCommandInputDTO(context, command, lastController);
                        stepPropertiesList.add(stepDto);
                    } else {
                        int i = 0;
                        for (WizardCommandController stepController : controllers) {
                            Map<String, Object> stepControllerInputs = inputList.get(i++);
                            UICommands.populateController(stepControllerInputs, stepController, getConverterFactory());
                            lastResult = stepController.execute();
                            LOG.debug("Invoked command " + name + " with " + executionRequest + " result: " + lastResult);
                            ExecutionResult stepResults = UICommands.createExecutionResult(context, lastResult, false);
                            stepResultList.add(stepResults);
                        }
                        break;
                    }
                }
                answer = UICommands.createExecutionResult(context, lastResult, canMoveToNextStep);
                WizardResultsDTO wizardResultsDTO = new WizardResultsDTO(stepPropertiesList, stepValidationList, stepResultList);
                answer.setWizardResults(wizardResultsDTO);
            } else {
                Map<String, Object> inputs = inputList.get(0);
                UICommands.populateController(inputs, controller, getConverterFactory());
                Result result = controller.execute();
                LOG.debug("Invoked command " + name + " with " + executionRequest + " result: " + result);
                answer = UICommands.createExecutionResult(context, result, false);
            }
            if (answer.isCommandCompleted() && postProcessor != null) {
                postProcessor.firePostCompleteActions(name, executionRequest, context, controller, answer, request);
            }
            context.setCommitMessage(ExecutionRequest.createCommitMessage(name, executionRequest));
            return Response.ok(answer).build();
        }
    }
1040271
@Override
    protected void doStart() throws Exception
    {
        log.info("starting...");
        super.doStart();
        _client = newClient(_serverString);
        if (_client == null)
        {
            throw new IllegalStateException("newClient(" + _serverString + ") returns null.");
        }
        log.info("use " + _client.getClass().getSimpleName() + " as client factory.");
        _client.establish();
        log.info("started.");
    }
1373207
public File createTempDir(String prefix, String suffix) {
    try {
      // Create a tempfile, and delete it.
      File file = File.createTempFile(prefix, suffix, baseDir);
      file.delete();

      // Create it as a directory.
      File dir = new File(file.getAbsolutePath());
      if (!dir.mkdirs()) {
        throw new WebDriverException("Cannot create profile directory at " + dir.getAbsolutePath());
      }

      // Create the directory and mark it writable.
      FileHandler.createDir(dir);

      temporaryFiles.add(dir);
      return dir;
    } catch (IOException e) {
      throw new WebDriverException(
          "Unable to create temporary file at " + baseDir.getAbsolutePath());
    }
  }
1278518
function createProjectWithConfig(zipFile, configXml) {
	return createProject(zipFile)
	.then((project) => {
		return updateConfig(configXml, project)
		.then(() => {
			return project;
		})
		.catch((errorFromUpdate) => {
			deleteProject(project)
			.then(() => {
				console.error("The project with ID: " + project.id + " was not created because it wasn't possible to upload the custom XML.");
				throw errorFromUpdate;
			})
			.catch((errorFromDelete) => {
				console.error("The project with ID: " + project.id + " was created but it wasn't possible to upload the custom XML.");
				console.trace(errorFromDelete);
				throw errorFromDelete;
			});
		});
	})
	.catch((error) => {
		console.trace(error);
		throw error;
	});
}
257525
public static void createProjectSkeleton( File targetDirectory, CreationBean creationBean ) throws IOException {

		if( creationBean.isMavenProject())
			createMavenProject( targetDirectory, creationBean );
		else
			createSimpleProject( targetDirectory, creationBean );
	}
1018579
private static void runBuild(@Nonnull IProject myProject) {
        StructuredSelection selection = new StructuredSelection(myProject);
        FindBugsAction action = new FindBugsAction();
        action.selectionChanged(null, selection);
        action.run(null);
    }
1353818
@Override
    public void start() throws LifecycleException {

//        state = LifecycleState.STARTING_PREP;
//
//        WebResource classes = resources.getResource("/WEB-INF/classes");
//        if (classes.isDirectory() && classes.canRead()) {
//            localRepositories.add(classes.getURL());
//        }
//        WebResource[] jars = resources.listResources("/WEB-INF/lib");
//        for (WebResource jar : jars) {
//            if (jar.getName().endsWith(".jar") && jar.isFile() && jar.canRead()) {
//                localRepositories.add(jar.getURL());
//                jarModificationTimes.put(
//                        jar.getName(), Long.valueOf(jar.getLastModified()));
//            }
//        }
//
//        state = LifecycleState.STARTING;

        String encoding = null;
        try {
            encoding = System.getProperty("file.encoding");
        } catch (SecurityException e) {
            return;
        }
        if (encoding.indexOf("EBCDIC")!=-1) {
            needConvert = true;
        }

//        state = LifecycleState.STARTED;
    }
952821
def start_distribution(project_name, template_dir, dist, noadmin):
    

    directory = os.getcwd()

    # Check that the project_name cannot be imported.
    try:
        import_module(project_name)
    except ImportError:
        pass
    else:
        raise CommandError("%r conflicts with the name of an existing Python module and cannot be used as a project name. Please try another name." % project_name)
    #woven override
    copy_helper('project', project_name, directory, dist, template_dir, noadmin)
    
    #Create a random SECRET_KEY hash, and put it in the main settings.
    main_settings_file = os.path.join(directory, dist, project_name, 'settings.py')
    settings_contents = open(main_settings_file, 'r').read()
    fp = open(main_settings_file, 'w')
    secret_key = ''.join([choice('abcdefghijklmnopqrstuvwxyz0123456789!@#$%^&*(-_=+)') for i in range(50)])
    settings_contents = re.sub(r"(?<=SECRET_KEY = ')'", secret_key + "'", settings_contents)
    fp.write(settings_contents)
    fp.close()
    
    #import settings and create start directories
    sys.path.append(os.path.join(directory, dist))

    s = import_module('.'.join([project_name,'settings']))
    sys.path.pop()
    if s.DATABASES['default']['ENGINE']=='django.db.backends.sqlite3':
        if s.DATABASES['default']['NAME'] and not os.path.exists(s.DATABASES['default']['NAME']):
            os.mkdir(os.path.dirname(s.DATABASES['default']['NAME']))
    if s.STATIC_ROOT and os.path.isabs(s.STATIC_ROOT) and not os.path.exists(s.STATIC_ROOT):
        os.mkdir(s.STATIC_ROOT)
    if s.MEDIA_ROOT and os.path.isabs(s.MEDIA_ROOT) and not os.path.exists(s.MEDIA_ROOT):
        os.mkdir(s.MEDIA_ROOT)
    if s.TEMPLATE_DIRS:
        for t in s.TEMPLATE_DIRS:
            if not os.path.exists(t) and os.path.sep in t:
                os.mkdir(t)
867172
private void createStartupBeans() throws RuntimeWarning {
        boolean isTraceOn = TraceComponent.isAnyTracingEnabled();

        // d684950
        if (EJSPlatformHelper.isZOSCRA()) {
            if (isTraceOn && tc.isDebugEnabled())
                Tr.debug(tc, "createStartupBeans: skipped in adjunct process");
            return;
        }

        if (isTraceOn && tc.isEntryEnabled())
            Tr.entry(tc, "createStartupBeans");

        for (int i = 0, size = ivStartupSingletonList.size(); i < size; i++) {
            J2EEName startupName = ivStartupSingletonList.get(i);

            try { // F743-1753CodRev
                EJSHome home = (EJSHome) EJSContainer.homeOfHomes.getHome(startupName);

                if (home == null) {
                    // The home won't exist if singleton beans aren't enabled
                    // in the runtime.
                    if (isTraceOn && tc.isDebugEnabled())
                        Tr.debug(tc, "Ignoring Singleton Startup bean: " + startupName);
                } else {
                    if (isTraceOn && tc.isDebugEnabled())
                        Tr.debug(tc, "Creating instance for Singleton Startup bean: " + startupName.toString());

                    home.createSingletonBeanO();
                }
            } catch (Throwable t) {
                // A failure has occurred processing the Startup Singletons.
                // Post an FFDC, log the failure, and throw a RuntimWarning to
                // cause this application start to abort.
                FFDCFilter.processException(t, CLASS_NAME + ".createStartupBeans", "6921", this);

                Tr.error(tc, "STARTUP_SINGLETON_SESSION_BEAN_INITIALIZATION_FAILED_CNTR0190E", new Object[] { startupName.getComponent(),
                        startupName.getModule(), t });
                throw new RuntimeWarning("CNTR0201E: The " + startupName.getComponent() + " startup singleton session bean in the "
                        + startupName.getModule() + " module failed initialization.", t);
            }
        }

        if (isTraceOn && tc.isEntryEnabled())
            Tr.exit(tc, "createStartupBeans");
    }
959209
public synchronized void startup(AppContextWrapper context) {
		ContainerRegistryBuilder cb;
		try {
			cb = (ContainerRegistryBuilder) context.getAttribute(ContainerRegistryBuilder.APPLICATION_CONTEXT_ATTRIBUTE_NAME);
			if (cb == null) {
				Debug.logError("[JdonFramework] at first call prepare method");
				return;
			}
			if (cb.isKernelStartup())
				return;
			ContainerDirector cd = new ContainerDirector(cb);
			cd.startup();
		} catch (Exception ex) {
			Debug.logError(ex, module);
		}
	}
113624
def init(name, subnames, dest, skeleton, description, project_type, skip_core):
    """"""
    dest = dest or CUR_DIR
    skeleton = join(skeleton or SKEL_PATH, project_type)
    project = join(dest, name)
    script = join(project, name + '.py')
    core = join(project, name)
    if project_type == 'standalone':
        renames = [
            (join(project, 'project.py'), script),
            (join(project, 'project'), core)]
        copy_skeleton(
            name, skeleton, project, renames=renames, description=description,
            ignore=False)
    else:
        renames = [
            (join(project, 'project.py'), script),
            (join(project, 'project'), core)]
        exclude_dirs = ['submodule'] + (['project'] if skip_core else [])
        copy_skeleton(
            name, skeleton, project, renames=renames, description=description,
            exclude_dirs=exclude_dirs, ignore=True)
        for subname in subnames:
            renames = [
                (join(project, 'submodule'), join(project, subname))
            ]
            copy_skeleton(
                subname, skeleton, project, renames=renames,
                description=description, ignore=True,
                exclude_dirs=['project'], exclude_files=['project.py'])
    return 0, "\n{}\n".format(project)
173559
@Benchmark
  public void createCallLatency(OutputStreamWriter results) throws Exception {
    results.write(new MeanDevAccumulator().addResults(new TimedCallable() {
      private int i = 0;

      @Override
      public void callTimed() throws Exception {
        proxyTClientProxyProtocol.create(new CreateRequest(metaInfo, ROOT + "newfilea-" + i++,
            metaInfo.getOrigCaller().getUserName(), FsPermission.getDefault(), true, true,
            (short) 1, 1024));
      }
    }, WARMUP_SAMPLES, MEASURED_SAMPLES).report());
    results.write("  |  ");

    results.write(new MeanDevAccumulator().addResults(new TimedCallable() {
      private int i = 0;

      @Override
      public void callTimed() throws Exception {
        proxyClientProxyProtocol.create(new CreateRequest(metaInfo, ROOT + "newfileb-" + i++,
            metaInfo.getOrigCaller().getUserName(), FsPermission.getDefault(), true, true,
            (short) 1, 1024));
      }
    }, WARMUP_SAMPLES, MEASURED_SAMPLES).report());
    results.write("  |  ");

    results.write(new MeanDevAccumulator().addResults(new TimedCallable() {
      private int i = 0;

      @Override
      public void callTimed() throws Exception {
        directClientProxyProtocol.create(new CreateRequest(metaInfo, ROOT + "newfilec-" + i++,
            metaInfo.getOrigCaller().getUserName(), FsPermission.getDefault(), true, true,
            (short) 1, 1024));
      }
    }, WARMUP_SAMPLES, MEASURED_SAMPLES).report());
    results.write("  |  ");

    results.write(new MeanDevAccumulator().addResults(new TimedCallable() {
      private int i = 0;

      @Override
      public void callTimed() throws Exception {
        directClientProtocol.create(ROOT + "newfiled-" + i++, FsPermission.getDefault(),
            metaInfo.getOrigCaller().getUserName(), true, true, (short) 1, 1024);
      }
    }, WARMUP_SAMPLES, MEASURED_SAMPLES).report());
  }
615570
public static FreeMarkerOperation create(Furnace furnace, String templatePath, String outputFilename,
                String... varNames)
    {
        return new FreeMarkerOperation(furnace, templatePath, outputFilename, varNames);
    }
1118375
public void createInstance(
      final String my_instance_id, final String my_config_id, final String my_client_project) {
    // [START instance_admin_client_create_instance]
    final String instanceId = my_instance_id;
    final String configId = my_config_id;
    final String clientProject = my_client_project;

    OperationFuture<Instance, CreateInstanceMetadata> op =
        instanceAdminClient.createInstance(
            InstanceInfo.newBuilder(InstanceId.of(clientProject, instanceId))
                .setInstanceConfigId(InstanceConfigId.of(clientProject, configId))
                .setDisplayName(instanceId)
                .setNodeCount(1)
                .build());
    try {
      op.get();
    } catch (ExecutionException e) {
      throw (SpannerException) e.getCause();
    } catch (InterruptedException e) {
      throw SpannerExceptionFactory.propagateInterrupt(e);
    }
    // [END instance_admin_client_create_instance]
  }
49773
def setup(api=None):
    
    global tmp_dir_object

    tmp_dir_object = tempfile.TemporaryDirectory()

    dir_name = tmp_dir_object.name

    dir_a = os.path.join(dir_name, "a")
    os.mkdir(dir_a)
    dir_b = os.path.join(dir_name, "b")
    os.mkdir(dir_b)

    # populate directory a with text files
    file_list = [
            ["hi.txt", """Hi World!"""],
            ["hi.html", """<strong>Hi World!</strong>"""],
            ["hello.html", """
                <img src='/static/b/smile.png'</img>
                pop-up
                <script src='/static/a/hi.js'></script>"""],
            ["hi.js", """alert('Hi World')""" ]
    ]

    for f in file_list:
        with open(os.path.join(dir_a, f[0]), mode="wt") as fo:
            fo.write(f[1])

    # populate directory b with binary file
    image = b'\x89PNG\r\n\x1a\n\x00\x00\x00\rIHDR\x00\x00\x00\n\x00\x00\x00\n\x08\x02\x00\x00\x00\x02PX\xea\x00\x00\x006IDAT\x18\xd3c\xfc\xff\xff?\x03n\xc0\xc4\x80\x170100022222\xc2\x85\x90\xb9\x04t3\x92`7\xb2\x15D\xeb\xc6\xe34\xa8n4c\xe1F\x120\x1c\x00\xc6z\x12\x1c\x8cT\xf2\x1e\x00\x00\x00\x00IEND\xaeB`\x82'

    with open(os.path.join(dir_b, "smile.png"), mode="wb") as fo:
            fo.write(image)
909356
def init(ctx, client, directory, name, force, use_external_storage):
    """"""
    if not client.use_external_storage:
        use_external_storage = False

    ctx.obj = client = attr.evolve(
        client,
        path=directory,
        use_external_storage=use_external_storage,
    )

    msg = 'Initialized empty project in {path}'
    branch_name = None

    stack = contextlib.ExitStack()

    if force and client.repo:
        msg = 'Initialized project in {path} (branch {branch_name})'
        merge_args = ['--no-ff', '-s', 'recursive', '-X', 'ours']

        try:
            commit = client.find_previous_commit(
                str(client.renku_metadata_path),
            )
            branch_name = 'renku/init/' + str(commit)
        except KeyError:
            from git import NULL_TREE
            commit = NULL_TREE
            branch_name = 'renku/init/root'
            merge_args.append('--allow-unrelated-histories')

        ctx.obj = client = stack.enter_context(
            client.worktree(
                branch_name=branch_name,
                commit=commit,
                merge_args=merge_args,
            )
        )

    try:
        with client.lock:
            path = client.init_repository(name=name, force=force)
    except FileExistsError:
        raise click.UsageError(
            'Renku repository is not empty. '
            'Please use --force flag to use the directory as Renku '
            'repository.'
        )

    stack.enter_context(client.commit())

    with stack:
        # Install Git hooks.
        from .githooks import install
        ctx.invoke(install, force=force)

        # Create all necessary template files.
        from .runner import template
        ctx.invoke(template, force=force)

    click.echo(msg.format(path=path, branch_name=branch_name))
59550
def CreateSessionStart(self):
    
    session_start = SessionStart()
    session_start.artifact_filters = self.artifact_filters
    session_start.command_line_arguments = self.command_line_arguments
    session_start.debug_mode = self.debug_mode
    session_start.enabled_parser_names = self.enabled_parser_names
    session_start.filter_file = self.filter_file
    session_start.identifier = self.identifier
    session_start.parser_filter_expression = self.parser_filter_expression
    session_start.preferred_encoding = self.preferred_encoding
    session_start.preferred_time_zone = self.preferred_time_zone
    session_start.product_name = self.product_name
    session_start.product_version = self.product_version
    session_start.timestamp = self.start_time
    return session_start