Tabnine Logo
ServiceProfile.getPrefix
Code IndexAdd Tabnine to your IDE (free)

How to use
getPrefix
method
in
com.asakusafw.yaess.core.ServiceProfile

Best Java code snippets using com.asakusafw.yaess.core.ServiceProfile.getPrefix (Showing top 20 results out of 315)

origin: asakusafw/asakusafw

@Override
public final void configure(ServiceProfile<?> profile) throws InterruptedException, IOException {
  try {
    doConfigure(profile);
  } catch (IllegalArgumentException e) {
    throw new IOException(MessageFormat.format(
        "Failed to configure \"{0}\" ({1})",
        profile.getPrefix(),
        profile.getPrefix()), e);
  }
}
origin: asakusafw/asakusafw

@Override
public final void configure(ServiceProfile<?> profile) throws InterruptedException, IOException {
  try {
    doConfigure(profile);
  } catch (IllegalArgumentException e) {
    throw new IOException(MessageFormat.format(
        "Failed to configure \"{0}\" ({1})",
        profile.getPrefix(),
        profile.getPrefix()), e);
  }
}
origin: asakusafw/asakusafw

private void configureResourceId(ServiceProfile<?> profile) {
  assert profile != null;
  String override = profile.getConfiguration(ExecutionScriptHandler.KEY_RESOURCE, false, true);
  if (override == null) {
    LOG.debug("resourceId is not override in {}",
        profile.getPrefix());
    resourceId = ExecutionScriptHandler.DEFAULT_RESOURCE_ID;
  } else {
    LOG.debug("resourceId is overriden in {}: {}",
        profile.getPrefix(),
        override);
    resourceId = override;
  }
}
origin: asakusafw/asakusafw

private void checkPrefix(ServiceProfile<?> profile, String prefix) {
  assert profile != null;
  assert prefix != null;
  if (profile.getPrefix().equals(prefix) == false) {
    throw new IllegalArgumentException(MessageFormat.format(
        "Profile \"{1}\" is invalid, this must be \"{0}\" ({2})",
        prefix,
        profile.getPrefix(),
        profile.getServiceClass().getName()));
  }
}
origin: asakusafw/asakusafw

@Override
public final void configure(ServiceProfile<?> profile) throws InterruptedException, IOException {
  try {
    configureScope(profile);
    doConfigure(profile);
  } catch (IllegalArgumentException e) {
    throw new IOException(MessageFormat.format(
        "Failed to configure \"{0}\" ({1})",
        profile.getPrefix(),
        profile.getPrefix()), e);
  }
}
origin: asakusafw/asakusafw

@Override
public void doConfigure(ServiceProfile<?> profile) throws InterruptedException, IOException {
  LOG.debug("Configuring file sessions: {}",
      profile.getPrefix());
  directory = prepareDirectory(profile);
  LOG.debug("Configured file sessions: {}",
      directory);
}
origin: asakusafw/asakusafw

private void configureStepUnit(ServiceProfile<?> profile) throws IOException {
  assert profile != null;
  String stepUnitString = profile.getConfiguration(KEY_STEP_UNIT, false, true);
  if (stepUnitString == null) {
    LOG.debug("{} is not defined in {}", KEY_STEP_UNIT, profile.getPrefix());
  } else {
    try {
      stepUnit = Double.parseDouble(stepUnitString);
    } catch (NumberFormatException e) {
      throw new IOException(MessageFormat.format(
          "{0}.{1} must be a number: {2}",
          profile.getPrefix(),
          KEY_STEP_UNIT,
          stepUnitString));
    }
  }
}
origin: asakusafw/asakusafw

private boolean extractBoolean(ServiceProfile<?> profile, String key, boolean defaultValue) throws IOException {
  assert profile != null;
  assert key != null;
  String string = profile.getConfiguration(key, false, true);
  if (string == null) {
    return defaultValue;
  }
  string = string.trim();
  if (string.isEmpty()) {
    return defaultValue;
  }
  try {
    return Boolean.parseBoolean(string);
  } catch (RuntimeException e) {
    throw new IOException(MessageFormat.format(
        "Failed to resolve boolean value ({0}={1})",
        profile.getPrefix() + '.' + key,
        string), e);
  }
}
origin: asakusafw/asakusafw

private File getConfDirectory(ServiceProfile<?> profile) {
  assert profile != null;
  String value = profile.getConfiguration(KEY_DIRECTORY, true, true);
  File dir = new File(value);
  if (dir.exists() == false) {
    YSLOG.info("I00001",
        profile.getPrefix(),
        KEY_DIRECTORY,
        value);
  }
  return dir;
}
origin: asakusafw/asakusafw

@Override
public final void configure(ServiceProfile<?> profile) throws InterruptedException, IOException {
  this.prefix = profile.getPrefix();
  try {
    configureResourceId(profile);
    Map<String, String> desiredProperties = getDesiredProperties(profile);
    Map<String, String> desiredEnvironmentVariables = getDesiredEnvironmentVariables(profile);
    this.properties = Collections.unmodifiableMap(desiredProperties);
    this.environmentVariables = Collections.unmodifiableMap(desiredEnvironmentVariables);
    doConfigure(profile, desiredProperties, desiredEnvironmentVariables);
  } catch (IllegalArgumentException e) {
    throw new IOException(MessageFormat.format(
        "Failed to configure \"{0}\" ({1})",
        profile.getPrefix(),
        profile.getPrefix()), e);
  }
}
origin: asakusafw/asakusafw

@Override
protected void configureExtension(ServiceProfile<?> profile) throws InterruptedException, IOException {
  try {
    this.executor = JschProcessExecutor.extract(
        profile.getPrefix(),
        profile.getConfiguration(),
        profile.getContext().getContextParameters());
  } catch (IllegalArgumentException e) {
    throw new IOException(MessageFormat.format(
        "Failed to configure SSH: {0}",
        profile.getPrefix()), e);
  } catch (JSchException e) {
    throw new IOException(MessageFormat.format(
        "Failed to configure SSH: {0}",
        profile.getPrefix()), e);
  }
}
origin: asakusafw/asakusafw

@Override
protected void configureExtension(ServiceProfile<?> profile) throws InterruptedException, IOException {
  try {
    this.executor = JschProcessExecutor.extract(
        profile.getPrefix(),
        profile.getConfiguration(),
        profile.getContext().getContextParameters());
  } catch (IllegalArgumentException e) {
    throw new IOException(MessageFormat.format(
        "Failed to configure SSH: {0}",
        profile.getPrefix()), e);
  } catch (JSchException e) {
    throw new IOException(MessageFormat.format(
        "Failed to configure SSH: {0}",
        profile.getPrefix()), e);
  }
}
origin: asakusafw/asakusafw

private static long extractLong(
    ServiceProfile<?> profile,
    Map<String, String> conf,
    String key,
    long defaultValue) {
  assert profile != null;
  assert conf != null;
  assert key != null;
  String value = profile.normalize(key, conf.remove(key), false, true);
  if (value == null) {
    return defaultValue;
  }
  try {
    return Long.parseLong(value);
  } catch (RuntimeException e) {
    throw new IllegalArgumentException(MessageFormat.format(
        "{0}.{1} must be an integer ({2})",
        profile.getPrefix(),
        key,
        value));
  }
}
origin: asakusafw/asakusafw

private void checkCleanupConfigurations(ServiceProfile<?> profile) throws IOException {
  assert profile != null;
  String workingDirectory = profile.getConfiguration().get(KEY_WORKING_DIRECTORY);
  if (workingDirectory != null) {
    YSLOG.warn("W10001", profile.getPrefix(), KEY_WORKING_DIRECTORY, KEY_CLEANUP);
  }
  List<String> cleanupPrefix = extractCommand(profile, ProcessUtil.PREFIX_CLEANUP);
  if (cleanupPrefix.isEmpty() == false) {
    YSLOG.warn("W10001", profile.getPrefix(), ProcessUtil.PREFIX_CLEANUP + "*", KEY_CLEANUP);
  }
}
origin: asakusafw/asakusafw

@Override
protected void doConfigure(ServiceProfile<?> profile) throws InterruptedException, IOException {
  try {
    this.executor = ParallelJobExecutor.extract(
        profile.getPrefix(),
        profile.getConfiguration(),
        profile.getContext().getContextParameters());
  } catch (IllegalArgumentException e) {
    throw new IOException(MessageFormat.format(
        "Failed to configure job scheduler: {0}",
        profile.getPrefix()), e);
  }
}
origin: asakusafw/asakusafw

@Override
public final void configure(ServiceProfile<?> profile) throws InterruptedException, IOException {
  try {
    configureVersion(profile);
    doConfigure(profile);
  } catch (IllegalArgumentException e) {
    throw new IOException(MessageFormat.format(
        "Failed to configure \"{0}\" ({1})",
        profile.getPrefix(),
        profile.getServiceClass().getName()), e);
  }
}
origin: asakusafw/asakusafw

private List<String> extractCommand(ServiceProfile<?> profile, String prefix) throws IOException {
  try {
    return ProcessUtil.extractCommandLineTokens(
        prefix,
        profile.getConfiguration(),
        profile.getContext().getContextParameters());
  } catch (IllegalArgumentException e) {
    throw new IOException(MessageFormat.format(
        "Failed to resolve command line tokens ({0})",
        profile.getPrefix() + '.' + prefix + '*'), e);
  }
}
origin: asakusafw/asakusafw

private List<String> extractCommand(
    ServiceProfile<?> profile,
    String prefix) throws IOException {
  try {
    return ProcessUtil.extractCommandLineTokens(
        prefix,
        profile.getConfiguration(),
        profile.getContext().getContextParameters());
  } catch (IllegalArgumentException e) {
    throw new IOException(MessageFormat.format(
        "Failed to resolve command line tokens ({0})",
        profile.getPrefix() + '.' + prefix + '*'), e);
  }
}
origin: asakusafw/asakusafw

private void configureScope(ServiceProfile<?> profile) throws IOException {
  assert profile != null;
  String scopeSymbol = profile.getConfiguration(KEY_SCOPE, false, true);
  if (scopeSymbol == null) {
    scope = ExecutionLock.Scope.getDefault();
    LOG.debug("Lock scope is not defined, use default: {}",
        scope.getSymbol());
  } else {
    scope = ExecutionLock.Scope.findFromSymbol(scopeSymbol);
    if (scope == null) {
      throw new IOException(MessageFormat.format(
          "Unknown lock scope in \"{0}.{1}\": {2}",
          profile.getPrefix(),
          KEY_SCOPE,
          scopeSymbol));
    }
  }
}
origin: asakusafw/asakusafw

private String getCommand(
    ExecutionContext context,
    String command,
    HadoopScript script) throws IOException, InterruptedException {
  assert command != null;
  Map<String, String> variables;
  if (script != null) {
    variables = buildEnvironmentVariables(context, script);
  } else {
    variables = getEnvironmentVariables(context, null);
  }
  String home = variables.get(ExecutionScript.ENV_ASAKUSA_HOME);
  if (home == null) {
    throw new IOException(MessageFormat.format(
        "Asakusa installation path is not known: {0}",
        currentProfile.getPrefix() + '.' + KEY_ENV_PREFIX + ExecutionScript.ENV_ASAKUSA_HOME));
  }
  if (home.endsWith(getPathSegmentSeparator())) {
    return home + command;
  } else {
    return home + getPathSegmentSeparator() + command;
  }
}
com.asakusafw.yaess.coreServiceProfilegetPrefix

Javadoc

Returns the key prefix of this profile.

Popular methods of ServiceProfile

  • getConfiguration
    Returns the target configuration.
  • getContext
    Returns the current profile context.
  • getServiceClass
    Returns the service class.
  • load
    Loads a service profile with the specified key prefix.
  • newInstance
    Creates a new instance. The created service will automatically Service#configure(ServiceProfile)by u
  • normalize
    Normalizes the configuration value.
  • <init>
    Creates a new instance.

Popular in Java

  • Finding current android device location
  • scheduleAtFixedRate (Timer)
  • putExtra (Intent)
  • getOriginalFilename (MultipartFile)
    Return the original filename in the client's filesystem.This may contain path information depending
  • FileNotFoundException (java.io)
    Thrown when a file specified by a program cannot be found.
  • Proxy (java.net)
    This class represents proxy server settings. A created instance of Proxy stores a type and an addres
  • Executors (java.util.concurrent)
    Factory and utility methods for Executor, ExecutorService, ScheduledExecutorService, ThreadFactory,
  • ImageIO (javax.imageio)
  • JList (javax.swing)
  • Get (org.apache.hadoop.hbase.client)
    Used to perform Get operations on a single row. To get everything for a row, instantiate a Get objec
  • Github Copilot alternatives
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