@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);
   }
 }
 private CommandScriptHandler handler(String... keyValuePairs) {
   Map<String, String> conf = map(keyValuePairs);
   ServiceProfile<CommandScriptHandler> profile =
       new ServiceProfile<CommandScriptHandler>(
           "command.testing",
           MockCommandScriptHandler.class,
           conf,
           ProfileContext.system(getClass().getClassLoader()));
   try {
     return profile.newInstance();
   } catch (Exception e) {
     throw new AssertionError(e);
   }
 }
 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));
     }
   }
 }