Example usage for java.lang String join

List of usage examples for java.lang String join

Introduction

In this page you can find the example usage for java.lang String join.

Prototype

public static String join(CharSequence delimiter, Iterable<? extends CharSequence> elements) 

Source Link

Document

Returns a new String composed of copies of the CharSequence elements joined together with a copy of the specified delimiter .

Usage

From source file:io.github.retz.cli.Launcher.java

private static int doRequest(Client c, String cmd, Configuration conf)
        throws IOException, InterruptedException {
    if (cmd.equals("list")) {
        ListJobResponse r = (ListJobResponse) c.list(64); // TODO: make this CLI argument
        List<Job> jobs = new LinkedList<>();
        jobs.addAll(r.queue());//from  w ww .  jav a  2s.  co  m
        jobs.addAll(r.running());
        jobs.addAll(r.finished());

        TableFormatter formatter = new TableFormatter("TaskId", "State", "Result", "Duration", "AppName",
                "Command", "Scheduled", "Started", "Finished", "Reason");

        jobs.sort((a, b) -> a.id() - b.id());

        for (Job job : jobs) {
            String state = "Queued";
            if (job.finished() != null) {
                state = "Finished";
            } else if (job.started() != null) {
                state = "Started";
            }
            String reason = "-";
            if (job.reason() != null) {
                reason = "'" + job.reason() + "'";
            }
            String duration = "-";
            if (job.started() != null && job.finished() != null) {
                try {
                    duration = Double
                            .toString(TimestampHelper.diffMillisec(job.finished(), job.started()) / 1000.0);
                } catch (java.text.ParseException e) {
                }
            }
            formatter.feed(Integer.toString(job.id()), state, Integer.toString(job.result()), duration,
                    job.appid(), job.cmd(), job.scheduled(), job.started(), job.finished(), reason);
        }
        LOG.info(formatter.titles());
        for (String line : formatter) {
            LOG.info(line);
        }
        return 0;

    } else if (cmd.equals("schedule")) {
        if (!conf.remoteCommand.isPresent()) { // || !conf.applicationTarball.isPresent()) {
            LOG.error("No command specified");
            return -1;
        }
        try {
            Job job = new Job(conf.getAppName().get(), conf.getRemoteCommand().get(), conf.getJobEnv(),
                    conf.getCpu(), conf.getMemMB(), conf.getGPU());
            job.setTrustPVFiles(conf.getTrustPVFiles());
            LOG.info("Sending job {} to App {}", job.cmd(), job.appid());
            Response res = c.schedule(job);
            if (res instanceof ScheduleResponse) {
                ScheduleResponse res1 = (ScheduleResponse) res;
                LOG.info("Job (id={}): {} registered at {}", res1.job().id(), res1.status(),
                        res1.job.scheduled());
                return 0;
            } else {
                LOG.error("Error: " + res.status());
                return -1;
            }
        } catch (IOException e) {
            LOG.error(e.getMessage());

        } catch (InterruptedException e) {
            LOG.error(e.getMessage());

        }

    } else if (cmd.equals("get-job")) {
        if (conf.getJobId().isPresent()) {
            Response res = c.getJob(conf.getJobId().get());
            if (res instanceof GetJobResponse) {
                GetJobResponse getJobResponse = (GetJobResponse) res;

                if (getJobResponse.job().isPresent()) {
                    Job job = getJobResponse.job().get();

                    LOG.info("Job: appid={}, id={}, scheduled={}, cmd='{}'", job.appid(), job.id(),
                            job.scheduled(), job.cmd());
                    LOG.info("\tstarted={}, finished={}, result={}", job.started(), job.finished(),
                            job.result());

                    if (conf.getJobResultDir().isPresent()) {
                        if (conf.getJobResultDir().get().equals("-")) {
                            LOG.info("==== Printing stdout of remote executor ====");
                            Client.catHTTPFile(job.url(), "stdout");
                            LOG.info("==== Printing stderr of remote executor ====");
                            Client.catHTTPFile(job.url(), "stderr");
                            LOG.info("==== Printing stdout-{} of remote executor ====", job.id());
                            Client.catHTTPFile(job.url(), "stdout-" + job.id());
                            LOG.info("==== Printing stderr-{} of remote executor ====", job.id());
                            Client.catHTTPFile(job.url(), "stderr-" + job.id());
                        } else {
                            Client.fetchHTTPFile(job.url(), "stdout", conf.getJobResultDir().get());
                            Client.fetchHTTPFile(job.url(), "stderr", conf.getJobResultDir().get());
                            Client.fetchHTTPFile(job.url(), "stdout-" + job.id(), conf.getJobResultDir().get());
                            Client.fetchHTTPFile(job.url(), "stderr-" + job.id(), conf.getJobResultDir().get());
                        }
                    }
                    return 0;

                } else {
                    LOG.error("No such job: id={}", conf.getJobId());
                }
            } else {
                ErrorResponse errorResponse = (ErrorResponse) res;
                LOG.error("Error: {}", errorResponse.status());
            }
        } else {
            LOG.error("get-job requires job id you want: {} specified", conf.getJobId());
        }

    } else if (cmd.equals("run")) {
        if (!conf.remoteCommand.isPresent()) { // || !conf.applicationTarball.isPresent()) {
            LOG.error("No command specified");
            return -1;
        }
        Job job = new Job(conf.getAppName().get(), conf.getRemoteCommand().get(), conf.getJobEnv(),
                conf.getCpu(), conf.getMemMB(), conf.getGPU());
        job.setTrustPVFiles(conf.getTrustPVFiles());
        LOG.info("Sending job {} to App {}", job.cmd(), job.appid());
        Job result = c.run(job);

        if (result != null) {
            LOG.info("Job result files URL: {}", result.url());

            if (conf.getJobResultDir().isPresent()) {
                if (conf.getJobResultDir().get().equals("-")) {
                    LOG.info("==== Printing stdout of remote executor ====");
                    Client.catHTTPFile(result.url(), "stdout");
                    LOG.info("==== Printing stderr of remote executor ====");
                    Client.catHTTPFile(result.url(), "stderr");
                    LOG.info("==== Printing stdout-{} of remote executor ====", result.id());
                    Client.catHTTPFile(result.url(), "stdout-" + result.id());
                    LOG.info("==== Printing stderr-{} of remote executor ====", result.id());
                    Client.catHTTPFile(result.url(), "stderr-" + result.id());
                } else {
                    Client.fetchHTTPFile(result.url(), "stdout", conf.getJobResultDir().get());
                    Client.fetchHTTPFile(result.url(), "stderr", conf.getJobResultDir().get());
                    Client.fetchHTTPFile(result.url(), "stdout-" + result.id(), conf.getJobResultDir().get());
                    Client.fetchHTTPFile(result.url(), "stderr-" + result.id(), conf.getJobResultDir().get());
                }
            }
            return result.result();
        }

    } else if (cmd.equals("watch")) {
        c.startWatch((watchResponse -> {
            StringBuilder b = new StringBuilder().append("event: ").append(watchResponse.event());

            if (watchResponse.job() != null) {
                b.append(" Job ").append(watchResponse.job().id()).append(" (app=")
                        .append(watchResponse.job().appid()).append(") has ").append(watchResponse.event())
                        .append(" at ");
                if (watchResponse.event().equals("started")) {
                    b.append(watchResponse.job().started());
                    b.append(" cmd=").append(watchResponse.job().cmd());

                } else if (watchResponse.event().equals("scheduled")) {
                    b.append(watchResponse.job().scheduled());
                    b.append(" cmd=").append(watchResponse.job().cmd());

                } else if (watchResponse.event().equals("finished")) {
                    b.append(watchResponse.job().finished());
                    b.append(" result=").append(watchResponse.job().result());
                    b.append(" url=").append(watchResponse.job().url());
                } else {
                    b.append("unknown event(error)");
                }
            }
            LOG.info(b.toString());
            return true;
        }));
        return 0;

    } else if (cmd.equals("load-app")) {
        if (conf.getAppName().isPresent()) {
            if (conf.getFileUris().isEmpty() || conf.getPersistentFileUris().isEmpty()) {
                LOG.warn("No files specified; mesos-execute would rather suite your use case.");
            }
            if (!conf.getPersistentFileUris().isEmpty() && !conf.getDiskMB().isPresent()) {
                LOG.error("Option '-disk' required when persistent files specified");
                return -1;
            }

            LoadAppResponse r = (LoadAppResponse) c.load(conf.getAppName().get(), conf.getPersistentFileUris(),
                    conf.getFileUris(), conf.getDiskMB());
            LOG.info(r.status());
            return 0;
        }
        LOG.error("AppName is required for load-app");

    } else if (cmd.equals("list-app")) {
        ListAppResponse r = (ListAppResponse) c.listApp();
        for (Application a : r.applicationList()) {
            LOG.info("Application {}: fetch: {} persistent ({} MB): {}", a.getAppid(),
                    String.join(" ", a.getFiles()), a.getDiskMB(), String.join(" ", a.getPersistentFiles()));
        }
        return 0;

    } else if (cmd.equals("unload-app")) {
        if (conf.getAppName().isPresent()) {
            UnloadAppResponse res = (UnloadAppResponse) c.unload(conf.getAppName().get());
            if (res.status().equals("ok")) {
                LOG.info("Unload: {}", res.status());
                return 0;
            }
        }
        LOG.error("unload-app requires AppName");

    }
    return -1;
}

From source file:org.apache.sentry.binding.solr.authz.SentrySolrPluginImpl.java

private void audit(Name perm, AuthorizationContext ctx, AuthorizationResponse resp) {
    if (!auditLog.isPresent() || !auditLog.get().isLogEnabled()) {
        return;/*from ww w. j  a  va2 s  .  c om*/
    }

    String userName = getShortUserName(ctx.getUserPrincipal());
    String ipAddress = ctx.getRemoteAddr();
    long eventTime = System.currentTimeMillis();
    int allowed = (resp.statusCode == AuthorizationResponse.OK.statusCode) ? AuditLogger.ALLOWED
            : AuditLogger.UNAUTHORIZED;
    String operationParams = ctx.getParams().toString();

    switch (perm) {
    case COLL_EDIT_PERM:
    case COLL_READ_PERM: {
        String collectionName = "admin";
        String actionName = ctx.getParams().get(CoreAdminParams.ACTION);
        String operationName = (actionName != null)
                ? "CollectionAction." + ctx.getParams().get(CoreAdminParams.ACTION)
                : ctx.getHandler().getClass().getName();
        auditLog.get().log(userName, null, ipAddress, operationName, operationParams, eventTime, allowed,
                collectionName);
        break;
    }

    case CORE_EDIT_PERM:
    case CORE_READ_PERM: {
        String collectionName = "admin";
        String operationName = "CoreAdminAction.STATUS";
        if (ctx.getParams().get(CoreAdminParams.ACTION) != null) {
            operationName = "CoreAdminAction." + ctx.getParams().get(CoreAdminParams.ACTION);
        }

        auditLog.get().log(userName, null, ipAddress, operationName, operationParams, eventTime, allowed,
                collectionName);
        break;
    }

    case READ_PERM:
    case UPDATE_PERM: {
        List<String> names = new ArrayList<>();
        for (CollectionRequest r : ctx.getCollectionRequests()) {
            names.add(r.collectionName);
        }
        String collectionName = String.join(",", names);
        String operationName = (perm == Name.READ_PERM) ? SolrConstants.QUERY : SolrConstants.UPDATE;
        auditLog.get().log(userName, null, ipAddress, operationName, operationParams, eventTime, allowed,
                collectionName);
        break;
    }

    default: {
        // Do nothing.
        break;
    }
    }
}

From source file:com.rcv.ResultsWriter.java

private void addActionRowCandidates(List<String> candidates, CSVPrinter csvPrinter) throws IOException {
    List<String> candidateDisplayNames = new ArrayList<>();
    // build list of display names
    for (String candidate : candidates) {
        candidateDisplayNames.add(config.getNameForCandidateID(candidate));
    }/*  ww  w.  j  a v a2 s .  co  m*/
    // concatenate them using semi-colon for display in a single cell
    String candidateCellText = String.join("; ", candidateDisplayNames);
    // print the candidate name list
    csvPrinter.print(candidateCellText);
}

From source file:net.sf.jabref.model.entry.BibtexEntry.java

public void putKeywords(List<String> keywords) {
    Objects.requireNonNull(keywords);
    // Set Keyword Field
    String oldValue = this.getField("keywords");
    String newValue;/*  w w  w  . j  av a 2 s  . com*/
    if (!keywords.isEmpty()) {
        newValue = String.join(", ", keywords);
    } else {
        newValue = null;
    }
    if ((oldValue == null) && (newValue == null)) {
        return;
    }
    if ((oldValue == null) || !oldValue.equals(newValue)) {
        this.setField("keywords", newValue);
    }
}

From source file:com.cdd.bao.importer.KeywordMapping.java

public JSONObject createAssay(JSONObject keydata, Schema schema, Map<Schema.Assignment, SchemaTree> treeCache)
        throws JSONException, IOException {
    String uniqueID = null;/*from  w  w w . ja  va2 s.c  o m*/
    List<String> linesTitle = new ArrayList<>(), linesBlock = new ArrayList<>();
    List<String> linesSkipped = new ArrayList<>(), linesProcessed = new ArrayList<>();
    Set<String> gotAnnot = new HashSet<>(), gotLiteral = new HashSet<>();
    JSONArray jsonAnnot = new JSONArray();
    final String SEP = "::";

    // assertions: these always supply a term
    for (Assertion asrt : assertions) {
        JSONObject obj = new JSONObject();
        obj.put("propURI", ModelSchema.expandPrefix(asrt.propURI));
        obj.put("groupNest", new JSONArray(expandPrefixes(asrt.groupNest)));
        obj.put("valueURI", ModelSchema.expandPrefix(asrt.valueURI));
        jsonAnnot.put(obj);

        String hash = asrt.propURI + SEP + asrt.valueURI + SEP
                + (asrt.groupNest == null ? "" : String.join(SEP, asrt.groupNest));
        gotAnnot.add(hash);
    }

    // go through the columns one at a time
    for (String key : keydata.keySet()) {
        String data = keydata.getString(key);

        Identifier id = findIdentifier(key);
        if (id != null) {
            if (uniqueID == null)
                uniqueID = id.prefix + data;
            continue;
        }

        TextBlock tblk = findTextBlock(key);
        if (tblk != null) {
            if (Util.isBlank(tblk.title))
                linesTitle.add(data);
            else
                linesBlock.add(tblk.title + ": " + data);
        }

        Value val = findValue(key, data);
        if (val != null) {
            if (Util.isBlank(val.valueURI)) {
                linesSkipped.add(key + ": " + data);
            } else {
                String hash = val.propURI + SEP + val.valueURI + SEP
                        + (val.groupNest == null ? "" : String.join(SEP, val.groupNest));
                if (gotAnnot.contains(hash))
                    continue;

                JSONObject obj = new JSONObject();
                obj.put("propURI", ModelSchema.expandPrefix(val.propURI));
                obj.put("groupNest", new JSONArray(expandPrefixes(val.groupNest)));
                obj.put("valueURI", ModelSchema.expandPrefix(val.valueURI));
                jsonAnnot.put(obj);
                gotAnnot.add(hash);
                linesProcessed.add(key + ": " + data);
            }
            continue;
        }

        Literal lit = findLiteral(key, data);
        if (lit != null) {
            String hash = lit.propURI + SEP + (lit.groupNest == null ? "" : String.join(SEP, lit.groupNest))
                    + SEP + data;
            if (gotLiteral.contains(hash))
                continue;

            JSONObject obj = new JSONObject();
            obj.put("propURI", ModelSchema.expandPrefix(lit.propURI));
            obj.put("groupNest", new JSONArray(expandPrefixes(lit.groupNest)));
            obj.put("valueLabel", data);
            jsonAnnot.put(obj);
            gotLiteral.add(hash);
            linesProcessed.add(key + ": " + data);

            continue;
        }

        Reference ref = findReference(key, data);
        if (ref != null) {
            Pattern ptn = Pattern.compile(ref.valueRegex);
            Matcher m = ptn.matcher(data);
            if (!m.matches() || m.groupCount() < 1)
                throw new IOException(
                        "Pattern /" + ref.valueRegex + "/ did not match '" + data + "' to produce a group.");

            JSONObject obj = new JSONObject();
            obj.put("propURI", ModelSchema.expandPrefix(ref.propURI));
            obj.put("groupNest", new JSONArray(expandPrefixes(ref.groupNest)));
            obj.put("valueLabel", ref.prefix + m.group(1));
            jsonAnnot.put(obj);
            linesProcessed.add(key + ": " + data);

            continue;
        }

        // probably shouldn't get this far, but just in case
        linesSkipped.add(key + ": " + data);
    }

    // annotation collapsing: sometimes there's a branch sequence that should exclude parent nodes
    for (int n = 0; n < jsonAnnot.length(); n++) {
        JSONObject obj = jsonAnnot.getJSONObject(n);
        String propURI = obj.getString("propURI"), valueURI = obj.optString("valueURI");
        if (valueURI == null)
            continue;
        String[] groupNest = obj.getJSONArray("groupNest").toStringArray();
        Schema.Assignment[] assnList = schema.findAssignmentByProperty(ModelSchema.expandPrefix(propURI),
                groupNest);
        if (assnList.length == 0)
            continue;
        SchemaTree tree = treeCache.get(assnList[0]);
        if (tree == null)
            continue;

        Set<String> exclusion = new HashSet<>();
        for (SchemaTree.Node node = tree.getNode(valueURI); node != null; node = node.parent)
            exclusion.add(node.uri);
        if (exclusion.size() == 0)
            continue;

        for (int i = jsonAnnot.length() - 1; i >= 0; i--)
            if (i != n) {
                obj = jsonAnnot.getJSONObject(i);
                if (!obj.has("valueURI"))
                    continue;
                if (!propURI.equals(obj.getString("propURI")))
                    continue;
                if (!Objects.deepEquals(groupNest, obj.getJSONArray("groupNest").toStringArray()))
                    continue;
                if (!exclusion.contains(obj.getString("valueURI")))
                    continue;
                jsonAnnot.remove(i);
            }
    }

    /*String text = "";
    if (linesBlock.size() > 0) text += String.join("\n", linesBlock) + "\n\n";
    if (linesSkipped.size() > 0) text += "SKIPPED:\n" + String.join("\n", linesSkipped) + "\n\n";
    text += "PROCESSED:\n" + String.join("\n", linesProcessed);*/

    List<String> sections = new ArrayList<>();
    if (linesTitle.size() > 0)
        sections.add(String.join(" / ", linesTitle));
    if (linesBlock.size() > 0)
        sections.add(String.join("\n", linesBlock));
    sections.add("#### IMPORTED ####");
    if (linesSkipped.size() > 0)
        sections.add("SKIPPED:\n" + String.join("\n", linesSkipped));
    if (linesProcessed.size() > 0)
        sections.add("PROCESSED:\n" + String.join("\n", linesProcessed));
    String text = String.join("\n\n", sections);

    JSONObject assay = new JSONObject();
    assay.put("uniqueID", uniqueID);
    assay.put("text", text);
    assay.put("schemaURI", schema.getSchemaPrefix());
    assay.put("annotations", jsonAnnot);
    return assay;
}

From source file:com.formkiq.core.service.workflow.WorkflowEditorServiceImplTest.java

/**
 * testEventIdremoveprintstep02()//from   w w  w  .j  ava 2s  .co  m
 * remove -1 print step.
 */
@Test
public void testEventIdremoveprintstep02() {
    // given
    String[] fieldids = new String[] { "" };
    this.workflow.setPrintsteps(new ArrayList<>(Arrays.asList("1", "2", "3")));

    // when
    expect(this.flow.getData()).andReturn(this.mockarchive);
    expect(this.mockarchive.getWorkflow()).andReturn(this.workflow);

    replayAll();
    this.ws.eventIdremoveprintstep(this.flow, fieldids);

    // then
    verifyAll();

    assertEquals("1,2,3", String.join(",", this.workflow.getPrintsteps()));
}

From source file:org.fcrepo.importexport.exporter.ExportVersionsTest.java

private String joinJsonArray(final List<String> array) {
    return "[" + String.join(",", array) + "]";
}

From source file:net.sf.jabref.exporter.BibDatabaseWriter.java

private void writeTypeDefinitions(Writer writer, Map<String, EntryType> types) throws IOException {
    for (EntryType type : types.values()) {
        if (type instanceof CustomEntryType) {
            CustomEntryType customType = (CustomEntryType) type;
            writer.write(Globals.NEWLINE);
            writer.write(COMMENT_PREFIX + "{");
            writer.write(CustomEntryType.ENTRYTYPE_FLAG);
            writer.write(customType.getName());
            writer.write(": req[");
            writer.write(customType.getRequiredFieldsString());
            writer.write("] opt[");
            writer.write(String.join(";", customType.getOptionalFields()));
            writer.write("]}");
            writer.write(Globals.NEWLINE);
        }//  w  w w .j  a  v a 2s.  c  o  m
    }
}

From source file:com.ottogroup.bi.streaming.operator.json.filter.JsonContentFilter.java

/**
 * Adds a {@link Matcher} to an existing/newly created {@link MatchJSONContent} instance according to the give {@link FieldConditionConfiguration} 
 * @param matchJsonContent//  w w w  . j  a v  a  2  s  .  c om
 *          The {@link MatchJSONContent} instance to add a new {@link Matcher} to. If null is provided a new {@link MatchJSONContent} is created
 * @param cfg
 *          The configuration to use for matcher instantiation
 * @return
 *          The {@link MatchJSONContent} instance holding the newly created {@link Matcher}
 * @throws NoSuchMethodException
 * @throws IllegalArgumentException
 * @throws ParseException
 */
protected MatchJSONContent addMatcher(MatchJSONContent matchJsonContent, final FieldConditionConfiguration cfg)
        throws NoSuchMethodException, IllegalArgumentException, ParseException {

    ///////////////////////////////////////////////////////////////////////
    // validate provided input
    if (cfg == null)
        throw new IllegalArgumentException("Missing required configuration");
    if (cfg.getOperator() == null)
        throw new IllegalArgumentException("Missing required matcher type");
    if (cfg.getContentRef() == null)
        throw new IllegalArgumentException("Missing required content reference");
    if (cfg.getContentRef().getContentType() == null)
        throw new IllegalArgumentException("Missing required content type");
    if (cfg.getContentRef().getPath() == null || cfg.getContentRef().getPath().length < 1)
        throw new IllegalArgumentException("Missing required content path");
    if (cfg.getContentRef().getContentType() == JsonContentType.TIMESTAMP
            && StringUtils.isBlank(cfg.getContentRef().getConversionPattern()))
        throw new IllegalArgumentException(
                "Missing required conversion pattern for content type '" + JsonContentType.TIMESTAMP + "'");
    ///////////////////////////////////////////////////////////////////////

    if (matchJsonContent == null)
        matchJsonContent = new MatchJSONContent();

    switch (cfg.getContentRef().getContentType()) {
    case BOOLEAN: {
        return matchJsonContent.assertBoolean(String.join(".", cfg.getContentRef().getPath()),
                matcher(cfg.getOperator(),
                        (StringUtils.isNotBlank(cfg.getValue()) ? Boolean.parseBoolean(cfg.getValue()) : null),
                        cfg.getContentRef().getContentType()));
    }
    case DOUBLE: {
        return matchJsonContent.assertDouble(String.join(".", cfg.getContentRef().getPath()),
                matcher(cfg.getOperator(),
                        (StringUtils.isNotBlank(cfg.getValue()) ? Double.parseDouble(cfg.getValue()) : null),
                        cfg.getContentRef().getContentType()));
    }
    case INTEGER: {
        return matchJsonContent.assertInteger(String.join(".", cfg.getContentRef().getPath()),
                matcher(cfg.getOperator(),
                        (StringUtils.isNotBlank(cfg.getValue()) ? Integer.parseInt(cfg.getValue()) : null),
                        cfg.getContentRef().getContentType()));
    }
    case STRING: {
        return matchJsonContent.assertString(String.join(".", cfg.getContentRef().getPath()),
                matcher(cfg.getOperator(), cfg.getValue(), cfg.getContentRef().getContentType()));
    }
    case TIMESTAMP: {
        if (StringUtils.isNotBlank(cfg.getValue())) {
            final SimpleDateFormat sdf = new SimpleDateFormat(cfg.getContentRef().getConversionPattern());
            return matchJsonContent.assertTimestamp(String.join(".", cfg.getContentRef().getPath()),
                    cfg.getContentRef().getConversionPattern(), matcher(cfg.getOperator(),
                            sdf.parse(cfg.getValue()), cfg.getContentRef().getContentType()));
        }
        return matchJsonContent.assertTimestamp(String.join(".", cfg.getContentRef().getPath()),
                cfg.getContentRef().getConversionPattern(),
                matcher(cfg.getOperator(), null, cfg.getContentRef().getContentType()));
    }
    default:
        return matchJsonContent;

    }

}

From source file:eu.itesla_project.dymola.DymolaImpactAnalysis.java

private Command createCommand(String inputScenarioZipPrefixFileName, String matFilePrefix,
        DymolaSimulationConfig simConfig) {
    String modelFileName = DymolaUtil.DYMOLA_SIM_MODEL_INPUT_PREFIX + ".mo";
    String modelNamePrefix = "M_" + matFilePrefix + "_events_";

    double startSimulationTime = 0.0;
    double endSimulationTime = parameters.getPostFaultSimulationStopInstant();

    return new GroupCommandBuilder().id("dym_imp").inputFiles(
            new InputFile(inputScenarioZipPrefixFileName + "_" + Command.EXECUTION_NUMBER_PATTERN + ".zip"),
            new InputFile(inputScenarioZipPrefixFileName + "_" + Command.EXECUTION_NUMBER_PATTERN + "_pars.zip",
                    ARCHIVE_UNZIP))/*from  w  w  w.  j  ava2s.co  m*/
            .subCommand().program(REMOTE_DYMOLA_SCRIPT)
            .args(modelFileName, modelNamePrefix + Command.EXECUTION_NUMBER_PATTERN, "./",
                    Command.EXECUTION_NUMBER_PATTERN, config.getDymolaSeviceWSDL(), "" + startSimulationTime,
                    "" + endSimulationTime, "" + simConfig.getNumberOfIntervals(),
                    "" + simConfig.getOutputInterval(), "" + simConfig.getMethod(),
                    "" + simConfig.getTolerance(), "" + simConfig.getOutputFixedstepSize(),
                    "" + DymolaUtil.DYMOLAINPUTZIPFILENAMEPREFIX + "_" + Command.EXECUTION_NUMBER_PATTERN
                            + ".zip",
                    "" + DymolaUtil.DYMOLAOUTPUTZIPFILENAMEPREFIX + "_" + Command.EXECUTION_NUMBER_PATTERN
                            + ".zip",
                    "" + DymolaUtil.DYMOLA_SIM_MAT_OUTPUT_PREFIX + "_" + Command.EXECUTION_NUMBER_PATTERN,
                    "" + DymolaUtil.DYMOLAOUTPUTZIPFILENAMEPREFIX + "_" + Command.EXECUTION_NUMBER_PATTERN
                            + ".txt",
                    "" + config.isFakeDymolaExecution())
            .timeout(config.getSimTimeout()).add().subCommand().program(WP43_SCRIPT)
            .args("./", DymolaUtil.DYMOLA_SIM_MAT_OUTPUT_PREFIX + "_" + Command.EXECUTION_NUMBER_PATTERN,
                    String.join(",", config.getIndexesNames()))
            .timeout(config.getIdxTimeout()).add()
            .outputFiles(
                    new OutputFile(DymolaUtil.DYMOLAOUTPUTZIPFILENAMEPREFIX + "_"
                            + Command.EXECUTION_NUMBER_PATTERN + ".zip"),
                    new OutputFile(DymolaUtil.DYMOLAOUTPUTZIPFILENAMEPREFIX + "_"
                            + Command.EXECUTION_NUMBER_PATTERN + ".txt"),
                    new OutputFile(DymolaUtil.DYMOLA_SIM_MAT_OUTPUT_PREFIX + "_"
                            + Command.EXECUTION_NUMBER_PATTERN + WP43_SMALLSIGNAL_SECURITY_INDEX_FILE_NAME),
                    new OutputFile(DymolaUtil.DYMOLA_SIM_MAT_OUTPUT_PREFIX + "_"
                            + Command.EXECUTION_NUMBER_PATTERN + WP43_TRANSIENT_SECURITY_INDEX_FILE_NAME),
                    new OutputFile(DymolaUtil.DYMOLA_SIM_MAT_OUTPUT_PREFIX + "_"
                            + Command.EXECUTION_NUMBER_PATTERN + WP43_OVERLOAD_SECURITY_INDEX_FILE_NAME),
                    new OutputFile(
                            DymolaUtil.DYMOLA_SIM_MAT_OUTPUT_PREFIX + "_" + Command.EXECUTION_NUMBER_PATTERN
                                    + WP43_UNDEROVERVOLTAGE_SECURITY_INDEX_FILE_NAME),
                    new OutputFile(DymolaUtil.DYMOLA_SIM_MAT_OUTPUT_PREFIX + "_"
                            + Command.EXECUTION_NUMBER_PATTERN + WP43_SMALLSIGNAL_SECURITY_INPUT_FILE_NAME),
                    new OutputFile(DymolaUtil.DYMOLA_SIM_MAT_OUTPUT_PREFIX + "_"
                            + Command.EXECUTION_NUMBER_PATTERN + WP43_TRANSIENT_SECURITY_INPUT_FILE_NAME),
                    new OutputFile(DymolaUtil.DYMOLA_SIM_MAT_OUTPUT_PREFIX + "_"
                            + Command.EXECUTION_NUMBER_PATTERN + WP43_OVERLOAD_SECURITY_INPUT_FILE_NAME),
                    new OutputFile(
                            DymolaUtil.DYMOLA_SIM_MAT_OUTPUT_PREFIX + "_" + Command.EXECUTION_NUMBER_PATTERN
                                    + WP43_UNDEROVERVOLTAGE_SECURITY_INPUT_FILE_NAME))
            .build();
}