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

How to use
ProfileContext
in
com.asakusafw.yaess.core

Best Java code snippets using com.asakusafw.yaess.core.ProfileContext (Showing top 15 results out of 315)

origin: asakusafw/asakusafw

private static String resolve(ServiceProfile<?> profile, String key, String value) {
  assert profile != null;
  assert key != null;
  assert value != null;
  try {
    return profile.getContext().getContextParameters().replace(value, true);
  } catch (IllegalArgumentException e) {
    throw new IllegalArgumentException(MessageFormat.format(
        "Failed to resolve {0} ({1})",
        key,
        value), e);
  }
}
origin: asakusafw/asakusafw

/**
 * Creates a new context with system variables as context parameters.
 * @param classLoader current class loader
 * @return the created context object
 * @throws IllegalArgumentException if some parameters were {@code null}
 */
public static ProfileContext system(ClassLoader classLoader) {
  return new ProfileContext(classLoader, new VariableResolver(System.getenv()));
}
origin: asakusafw/asakusafw

/**
 * Returns the class loader which loaded this service class.
 * @return the class loader
 * @deprecated use {@link #getContext()} instead
 */
@Deprecated
public ClassLoader getClassLoader() {
  return getContext().getClassLoader();
}
origin: asakusafw/asakusafw

/**
 * Loads a YAESS profile from the specified properties.
 * @param properties source properties
 * @param classLoader the class loader to load the service class
 * @return the loaded profile
 * @throws IllegalArgumentException if the target profile is invalid, or parameters contain {@code null}
 * @deprecated use {@link #load(Properties, ProfileContext)} instead
 */
@Deprecated
public static YaessProfile load(Properties properties, ClassLoader classLoader) {
  if (properties == null) {
    throw new IllegalArgumentException("properties must not be null"); //$NON-NLS-1$
  }
  if (classLoader == null) {
    throw new IllegalArgumentException("classLoader must not be null"); //$NON-NLS-1$
  }
  return load(properties, ProfileContext.system(classLoader));
}
origin: asakusafw/asakusafw

  throw new IllegalArgumentException("classLoader must not be null"); //$NON-NLS-1$
return load(properties, prefix, serviceBaseClass, ProfileContext.system(classLoader));
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

env.putAll(System.getenv());
env.putAll(toMap(variables));
result.context = new ProfileContext(loader, new VariableResolver(env));
Properties properties = CommandLineUtil.loadProperties(file);
result.profile = YaessProfile.load(properties, result.context);
origin: asakusafw/asakusafw

  loaded = context.getClassLoader().loadClass(targetClassName);
} catch (ClassNotFoundException e) {
  throw new IllegalArgumentException(MessageFormat.format(
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

@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
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

if (resolve) {
  try {
    string = getContext().getContextParameters().replace(string, true);
  } catch (IllegalArgumentException e) {
    throw new IllegalArgumentException(MessageFormat.format(
origin: asakusafw/asakusafw

String unresolved = entry.getValue();
try {
  String value = profile.getContext().getContextParameters().replace(unresolved, true);
  resolved.put(key, value);
} catch (IllegalArgumentException e) {
origin: asakusafw/asakusafw

String unresolved = entry.getValue();
try {
  String value = profile.getContext().getContextParameters().replace(unresolved, true);
  resolved.put(key, value);
} catch (IllegalArgumentException e) {
com.asakusafw.yaess.coreProfileContext

Javadoc

The profile context for YAESS.

Most used methods

  • getContextParameters
    Returns context parameters (may be environment variables).
  • <init>
    Creates a new instance.
  • getClassLoader
    Returns a class loader to load services.
  • system
    Creates a new context with system variables as context parameters.

Popular in Java

  • Reading from database using SQL prepared statement
  • requestLocationUpdates (LocationManager)
  • notifyDataSetChanged (ArrayAdapter)
  • getContentResolver (Context)
  • Iterator (java.util)
    An iterator over a sequence of objects, such as a collection.If a collection has been changed since
  • ResourceBundle (java.util)
    ResourceBundle is an abstract class which is the superclass of classes which provide Locale-specifi
  • Vector (java.util)
    Vector is an implementation of List, backed by an array and synchronized. All optional operations in
  • BlockingQueue (java.util.concurrent)
    A java.util.Queue that additionally supports operations that wait for the queue to become non-empty
  • IsNull (org.hamcrest.core)
    Is the value null?
  • Runner (org.openjdk.jmh.runner)
  • Top Sublime Text plugins
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