Tabnine Logo
SimpleProgramOptions
Code IndexAdd Tabnine to your IDE (free)

How to use
SimpleProgramOptions
in
co.cask.cdap.internal.app.runtime

Best Java code snippets using co.cask.cdap.internal.app.runtime.SimpleProgramOptions (Showing top 20 results out of 315)

origin: co.cask.cdap/cdap-app-fabric

@Override
public ProgramOptions deserialize(JsonElement json, Type typeOfT,
                 JsonDeserializationContext context) throws JsonParseException {
 JsonObject jsonObj = json.getAsJsonObject();
 ProgramId programId = context.deserialize(jsonObj.get("programId"), ProgramId.class);
 Arguments arguments = context.deserialize(jsonObj.get("arguments"), Arguments.class);
 Arguments userArguments = context.deserialize(jsonObj.get("userArguments"), Arguments.class);
 boolean debug = jsonObj.get("debug").getAsBoolean();
 return new SimpleProgramOptions(programId, arguments, userArguments, debug);
}
origin: cdapio/cdap

@Override
public ProgramOptions deserialize(JsonElement json, Type typeOfT,
                 JsonDeserializationContext context) throws JsonParseException {
 JsonObject jsonObj = json.getAsJsonObject();
 ProgramId programId = context.deserialize(jsonObj.get("programId"), ProgramId.class);
 Arguments arguments = context.deserialize(jsonObj.get("arguments"), Arguments.class);
 Arguments userArguments = context.deserialize(jsonObj.get("userArguments"), Arguments.class);
 boolean debug = jsonObj.get("debug").getAsBoolean();
 return new SimpleProgramOptions(programId, arguments, userArguments, debug);
}
origin: co.cask.cdap/cdap-app-fabric

private ProgramOptions createProgramOptions(ProgramId programId, Map<String, String> properties) {
 String userArgumentsString = properties.get(ProgramOptionConstants.USER_OVERRIDES);
 String systemArgumentsString = properties.get(ProgramOptionConstants.SYSTEM_OVERRIDES);
 String debugString = properties.get(ProgramOptionConstants.DEBUG_ENABLED);
 Boolean debug = Boolean.valueOf(debugString);
 Map<String, String> userArguments = userArgumentsString == null ?
  Collections.emptyMap() : GSON.fromJson(userArgumentsString, STRING_STRING_MAP);
 Map<String, String> systemArguments = systemArgumentsString == null ?
  Collections.emptyMap() : GSON.fromJson(systemArgumentsString, STRING_STRING_MAP);
 return new SimpleProgramOptions(programId, new BasicArguments(systemArguments),
                 new BasicArguments(userArguments), debug);
}
origin: cdapio/cdap

private ProgramOptions createProgramOptions(ProgramId programId, Map<String, String> properties) {
 String userArgumentsString = properties.get(ProgramOptionConstants.USER_OVERRIDES);
 String systemArgumentsString = properties.get(ProgramOptionConstants.SYSTEM_OVERRIDES);
 String debugString = properties.get(ProgramOptionConstants.DEBUG_ENABLED);
 Boolean debug = Boolean.valueOf(debugString);
 Map<String, String> userArguments = userArgumentsString == null ?
  Collections.emptyMap() : GSON.fromJson(userArgumentsString, STRING_STRING_MAP);
 Map<String, String> systemArguments = systemArgumentsString == null ?
  Collections.emptyMap() : GSON.fromJson(systemArgumentsString, STRING_STRING_MAP);
 return new SimpleProgramOptions(programId, new BasicArguments(systemArguments),
                 new BasicArguments(userArguments), debug);
}
origin: cdapio/cdap

private ProgramOptions createComponentOptions(int instanceId, int instances, RunId runId,
                       ProgramOptions options) {
 Map<String, String> systemOptions = Maps.newHashMap();
 systemOptions.putAll(options.getArguments().asMap());
 systemOptions.put(ProgramOptionConstants.INSTANCE_ID, Integer.toString(instanceId));
 systemOptions.put(ProgramOptionConstants.INSTANCES, Integer.toString(instances));
 systemOptions.put(ProgramOptionConstants.RUN_ID, runId.getId());
 systemOptions.put(ProgramOptionConstants.HOST, host);
 return new SimpleProgramOptions(options.getProgramId(), new BasicArguments(systemOptions),
                 options.getUserArguments());
}
origin: co.cask.cdap/cdap-app-fabric

private ProgramOptions createComponentOptions(int instanceId, int instances, RunId runId,
                       ProgramOptions options) {
 Map<String, String> systemOptions = Maps.newHashMap();
 systemOptions.putAll(options.getArguments().asMap());
 systemOptions.put(ProgramOptionConstants.INSTANCE_ID, Integer.toString(instanceId));
 systemOptions.put(ProgramOptionConstants.INSTANCES, Integer.toString(instances));
 systemOptions.put(ProgramOptionConstants.RUN_ID, runId.getId());
 systemOptions.put(ProgramOptionConstants.HOST, host);
 return new SimpleProgramOptions(options.getProgramId(), new BasicArguments(systemOptions),
                 options.getUserArguments());
}
origin: co.cask.cdap/cdap-app-fabric

private ProgramOptions createFlowletOptions(int instanceId, int instances,
                      ProgramOptions options) {
 Map<String, String> systemArgs = new HashMap<>();
 systemArgs.putAll(options.getArguments().asMap());
 systemArgs.put(ProgramOptionConstants.INSTANCE_ID, Integer.toString(instanceId));
 systemArgs.put(ProgramOptionConstants.INSTANCES, Integer.toString(instances));
 return new SimpleProgramOptions(options.getProgramId(), new BasicArguments(systemArgs), options.getUserArguments());
}
origin: cdapio/cdap

return new SimpleProgramOptions(options.getProgramId(), new BasicArguments(builder.build()),
                options.getUserArguments(), options.isDebug());
origin: co.cask.cdap/cdap-app-fabric

return new SimpleProgramOptions(options.getProgramId(), new BasicArguments(builder.build()),
                options.getUserArguments(), options.isDebug());
origin: co.cask.cdap/cdap-app-fabric

/**
 * Creates a new instance of {@link ProgramOptions} with artifact localization information and with
 * extra system arguments, while maintaining other fields of the given {@link ProgramOptions}.
 *
 * @param options the original {@link ProgramOptions}.
 * @param localizeResources a {@link Map} of {@link LocalizeResource} to be localized to the remote container
 * @param tempDir a local temporary directory for creating files for artifact localization.
 * @param extraSystemArgs a set of extra system arguments to be added/updated
 * @return a new instance of {@link ProgramOptions}
 * @throws IOException if failed to create local copy of artifact files
 */
private ProgramOptions updateProgramOptions(ProgramOptions options,
                      Map<String, LocalizeResource> localizeResources,
                      File tempDir, Map<String, String> extraSystemArgs) throws IOException {
 Arguments systemArgs = options.getArguments();
 Map<String, String> newSystemArgs = new HashMap<>(systemArgs.asMap());
 newSystemArgs.putAll(extraSystemArgs);
 if (systemArgs.hasOption(ProgramOptionConstants.PLUGIN_DIR)) {
  File localDir = new File(systemArgs.getOption(ProgramOptionConstants.PLUGIN_DIR));
  File archiveFile = new File(tempDir, "artifacts.jar");
  BundleJarUtil.createJar(localDir, archiveFile);
  // Localize plugins to two files, one expanded into a directory, one not.
  localizeResources.put("artifacts", new LocalizeResource(archiveFile, true));
  localizeResources.put("artifacts_archive.jar", new LocalizeResource(archiveFile, false));
  newSystemArgs.put(ProgramOptionConstants.PLUGIN_DIR, "artifacts");
  newSystemArgs.put(ProgramOptionConstants.PLUGIN_ARCHIVE, "artifacts_archive.jar");
 }
 return new SimpleProgramOptions(options.getProgramId(), new BasicArguments(newSystemArgs),
                 options.getUserArguments(), options.isDebug());
}
origin: cdapio/cdap

/**
 * Creates a new instance of {@link ProgramOptions} with artifact localization information and with
 * extra system arguments, while maintaining other fields of the given {@link ProgramOptions}.
 *
 * @param options the original {@link ProgramOptions}.
 * @param localizeResources a {@link Map} of {@link LocalizeResource} to be localized to the remote container
 * @param tempDir a local temporary directory for creating files for artifact localization.
 * @param extraSystemArgs a set of extra system arguments to be added/updated
 * @return a new instance of {@link ProgramOptions}
 * @throws IOException if failed to create local copy of artifact files
 */
private ProgramOptions updateProgramOptions(ProgramOptions options,
                      Map<String, LocalizeResource> localizeResources,
                      File tempDir, Map<String, String> extraSystemArgs) throws IOException {
 Arguments systemArgs = options.getArguments();
 Map<String, String> newSystemArgs = new HashMap<>(systemArgs.asMap());
 newSystemArgs.putAll(extraSystemArgs);
 if (systemArgs.hasOption(ProgramOptionConstants.PLUGIN_DIR)) {
  File localDir = new File(systemArgs.getOption(ProgramOptionConstants.PLUGIN_DIR));
  File archiveFile = new File(tempDir, "artifacts.jar");
  BundleJarUtil.createJar(localDir, archiveFile);
  // Localize plugins to two files, one expanded into a directory, one not.
  localizeResources.put("artifacts", new LocalizeResource(archiveFile, true));
  localizeResources.put("artifacts_archive.jar", new LocalizeResource(archiveFile, false));
  newSystemArgs.put(ProgramOptionConstants.PLUGIN_DIR, "artifacts");
  newSystemArgs.put(ProgramOptionConstants.PLUGIN_ARCHIVE, "artifacts_archive.jar");
 }
 return new SimpleProgramOptions(options.getProgramId(), new BasicArguments(newSystemArgs),
                 options.getUserArguments(), options.isDebug());
}
origin: cdapio/cdap

/**
 * Creates a {@link ProgramOptions} by deserializing the given json file.
 */
private ProgramOptions createProgramOptions(File programOptionsFile) throws IOException {
 ProgramOptions original = readJsonFile(programOptionsFile, ProgramOptions.class);
 // Overwrite them with environmental information
 Map<String, String> arguments = new HashMap<>(original.getArguments().asMap());
 arguments.putAll(getExtraSystemArguments());
 // Use the name passed in by the constructor as the program name to construct the ProgramId
 return new SimpleProgramOptions(original.getProgramId(), new BasicArguments(arguments),
                 resolveScope(original.getUserArguments()), original.isDebug());
}
origin: co.cask.cdap/cdap-app-fabric

/**
 * Creates a {@link ProgramOptions} by deserializing the given json file.
 */
private ProgramOptions createProgramOptions(File programOptionsFile) throws IOException {
 ProgramOptions original = readJsonFile(programOptionsFile, ProgramOptions.class);
 // Overwrite them with environmental information
 Map<String, String> arguments = new HashMap<>(original.getArguments().asMap());
 arguments.putAll(getExtraSystemArguments());
 // Use the name passed in by the constructor as the program name to construct the ProgramId
 return new SimpleProgramOptions(original.getProgramId(), new BasicArguments(arguments),
                 resolveScope(original.getUserArguments()), original.isDebug());
}
origin: co.cask.cdap/cdap-app-fabric

private ProgramOptions resolveFlowletOptions(ProgramOptions options, String flowlet) {
 Map<String, String> systemArgs = new HashMap<>(options.getArguments().asMap());
 systemArgs.put(ProgramOptionConstants.FLOWLET_NAME, flowlet);
 return new SimpleProgramOptions(options.getProgramId(),
                 new BasicArguments(systemArgs),
                 new BasicArguments(RuntimeArguments.extractScope(
                  FlowUtils.FLOWLET_SCOPE, flowlet, options.getUserArguments().asMap())));
}
origin: cdapio/cdap

systemArgumentsMap.put(ProgramOptionConstants.WORKFLOW_TOKEN, GSON.toJson(token));
final ProgramOptions options = new SimpleProgramOptions(
 program.getId(),
 new BasicArguments(Collections.unmodifiableMap(systemArgumentsMap)),
origin: co.cask.cdap/cdap-app-fabric

systemArgumentsMap.put(ProgramOptionConstants.WORKFLOW_TOKEN, GSON.toJson(token));
final ProgramOptions options = new SimpleProgramOptions(
 program.getId(),
 new BasicArguments(Collections.unmodifiableMap(systemArgumentsMap)),
origin: cdapio/cdap

                       userArguments);
return new SimpleProgramOptions(options.getProgramId(), new BasicArguments(systemArguments),
                new BasicArguments(userArguments), options.isDebug());
origin: co.cask.cdap/cdap-app-fabric

                       userArguments);
return new SimpleProgramOptions(options.getProgramId(), new BasicArguments(systemArguments),
                new BasicArguments(userArguments), options.isDebug());
origin: co.cask.cdap/cdap-app-fabric

systemArgs.put(ProgramOptionConstants.SECURE_KEYS_DIR, properties.get(ProgramOptionConstants.SECURE_KEYS_DIR));
ProgramOptions newProgramOptions = new SimpleProgramOptions(programOptions.getProgramId(),
                              new BasicArguments(systemArgs),
                              programOptions.getUserArguments());
origin: cdapio/cdap

systemArgs.put(ProgramOptionConstants.SECURE_KEYS_DIR, properties.get(ProgramOptionConstants.SECURE_KEYS_DIR));
ProgramOptions newProgramOptions = new SimpleProgramOptions(programOptions.getProgramId(),
                              new BasicArguments(systemArgs),
                              programOptions.getUserArguments());
co.cask.cdap.internal.app.runtimeSimpleProgramOptions

Most used methods

  • <init>

Popular in Java

  • Making http post requests using okhttp
  • findViewById (Activity)
  • getSupportFragmentManager (FragmentActivity)
  • getContentResolver (Context)
  • Properties (java.util)
    A Properties object is a Hashtable where the keys and values must be Strings. Each property can have
  • TimerTask (java.util)
    The TimerTask class represents a task to run at a specified time. The task may be run once or repeat
  • Executor (java.util.concurrent)
    An object that executes submitted Runnable tasks. This interface provides a way of decoupling task s
  • HttpServletRequest (javax.servlet.http)
    Extends the javax.servlet.ServletRequest interface to provide request information for HTTP servlets.
  • Response (javax.ws.rs.core)
    Defines the contract between a returned instance and the runtime when an application needs to provid
  • Scheduler (org.quartz)
    This is the main interface of a Quartz Scheduler. A Scheduler maintains a registry of org.quartz.Job
  • Top plugins for WebStorm
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now